Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter Modal #6642

Merged
merged 196 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
4aa2278
Added basic UI filter modal functionality
khushiagl Jun 22, 2023
990287c
filter by annotation UI
khushiagl Jun 22, 2023
b78772f
filter by annotation UI
khushiagl Jun 23, 2023
8b9cfd9
translations for single filter view
khushiagl Jun 23, 2023
eb0ffab
styled filter modal
khushiagl Jun 23, 2023
1e22235
styling changes
khushiagl Jun 26, 2023
9ef4117
pushed state up from filter modal to result.jsx
khushiagl Jun 26, 2023
8aec2fd
students cannot view the filter modal and button
khushiagl Jun 26, 2023
4fc9d22
Finished filter annotations backend
DanielDervishi Jun 28, 2023
5d10c3d
testing UI through react-testing library
khushiagl Jun 28, 2023
38890cb
Added tests
DanielDervishi Jun 28, 2023
75bb76e
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jun 29, 2023
4456153
testing UI through react-testing library
khushiagl Jun 29, 2023
9cbe9ff
bug fix
khushiagl Jun 29, 2023
8e10c5f
Rough draft of section and Marking State filters finished
DanielDervishi Jun 29, 2023
f27429d
multiselect dropdown
khushiagl Jun 29, 2023
415a500
added tags to dropdown
khushiagl Jul 4, 2023
cc94fce
styling
khushiagl Jul 4, 2023
4cb4200
resolving conflicts
khushiagl Jul 4, 2023
82235d8
filtering by TAs
khushiagl Jul 4, 2023
42ca7d2
Changed single select dropdown styling
DanielDervishi Jul 5, 2023
8790955
filter by tags
khushiagl Jul 5, 2023
96c8386
resolving conflicts
khushiagl Jul 5, 2023
1d8ba82
Added 2 orderBy options allowing to traverse in ascending and descend…
DanielDervishi Jul 5, 2023
877fb02
Resolved merge conflicts
DanielDervishi Jul 5, 2023
44043d6
clear all tags
khushiagl Jul 5, 2023
0918269
resolving conflict
khushiagl Jul 5, 2023
a06f32b
styling
khushiagl Jul 5, 2023
285f142
Added Range Compnent UI
khushiagl Jul 6, 2023
3aaf98a
Range components and filter by total mark and total extra mark
khushiagl Jul 6, 2023
efcafe5
Styling
khushiagl Jul 6, 2023
0f48da8
resolved conflicts
khushiagl Jul 6, 2023
18723eb
Refactored stylesheets extracting common styles
DanielDervishi Jul 7, 2023
2c6eae4
Resolved Conflicts
DanielDervishi Jul 10, 2023
bd2b3f4
bug fix
khushiagl Jul 10, 2023
0fdf6e9
Front-end testing Filter modal - annotations, tas, tags
khushiagl Jul 11, 2023
7f89a23
Front-end tests for Total mark and Total Extra mark range
khushiagl Jul 13, 2023
75ea1bc
Front-end tests for Total mark and Total Extra mark range
khushiagl Jul 13, 2023
b0035ad
Added some tests and refactored filter logic in the backend
DanielDervishi Jul 13, 2023
05b30e6
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 13, 2023
15aee69
Revised automatic merge conflict resolution
DanielDervishi Jul 13, 2023
022c8f6
Front end tests for MultiSelectDropdown
khushiagl Jul 13, 2023
ef9b8a0
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 13, 2023
7d55f13
Front-end tests for multiselectdropdown
khushiagl Jul 13, 2023
98ad429
Backend tests for filter by tags
khushiagl Jul 13, 2023
3e276c3
Finished most frontend tests
DanielDervishi Jul 13, 2023
533ec8e
Resolved Conficts
DanielDervishi Jul 13, 2023
294debf
Backend tests for filtering by tas
khushiagl Jul 13, 2023
aba563d
Finished frontend tests
DanielDervishi Jul 13, 2023
fd6f827
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 13, 2023
39939d8
Frontend tests for multiselect dropdown
khushiagl Jul 13, 2023
f9695ee
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 13, 2023
e5782e6
Fixed some tests
DanielDervishi Jul 13, 2023
41a6ace
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 13, 2023
3dfe652
Removed a test and fixed others
DanielDervishi Jul 14, 2023
fb387f5
Added tests for filtering by marking state
DanielDervishi Jul 14, 2023
b609d00
Added additional test for marking state
DanielDervishi Jul 14, 2023
518a74f
Finished ordering tests
DanielDervishi Jul 14, 2023
ab42fcf
Fixed gramatical error
DanielDervishi Jul 17, 2023
ddc69c8
updated tests
DanielDervishi Jul 17, 2023
ca44c7b
Renamed method
DanielDervishi Jul 17, 2023
c81fb78
Fixed ordering bug
DanielDervishi Jul 17, 2023
7692a54
Front-end testing clean-up
khushiagl Jul 17, 2023
0bfed12
Updated Changelog
DanielDervishi Jul 17, 2023
97801d0
fixed test
DanielDervishi Jul 17, 2023
1f23f53
Quick fix
DanielDervishi Jul 17, 2023
d5325d8
Back-end tests: range filters
khushiagl Jul 17, 2023
d0dc1d5
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 17, 2023
60f8419
Back-end tests: range filters
khushiagl Jul 17, 2023
ca664c0
Front-end tests- small fix
khushiagl Jul 17, 2023
a6ea9a7
fix bug
khushiagl Jul 17, 2023
73cffe8
Merge branch 'master' into filter_modal
DanielDervishi Jul 17, 2023
58bb0e9
error message for invalid range using state instead of css
khushiagl Jul 18, 2023
2723077
Separated Range filters into a separate component
khushiagl Jul 18, 2023
61b7785
Ref to close dropdown on click outside to prevent buggy behaviour
khushiagl Jul 18, 2023
2747d92
More backend tests for range filters
khushiagl Jul 18, 2023
d7c147c
Frontend tests for multiselect dropdowns
khushiagl Jul 18, 2023
86daa3a
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 18, 2023
26a133e
Normalized remaining strings
DanielDervishi Jul 18, 2023
ebb00fa
Remove error message on Clear all (Range)
khushiagl Jul 18, 2023
4a7a3b6
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 18, 2023
16dda81
Removed test
DanielDervishi Jul 18, 2023
fafb053
Range: changed step to any
khushiagl Jul 18, 2023
a376f9f
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 18, 2023
89fc7ec
Added spacing for tests in backend
DanielDervishi Jul 18, 2023
f0a1d42
Adding appropriate scpace front-end tests
khushiagl Jul 18, 2023
700d01a
Adding appropriate spacing front-end tests
khushiagl Jul 18, 2023
55b3acd
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 18, 2023
c5280c8
Fixed grouping tests
DanielDervishi Jul 18, 2023
c066fac
Resolving https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 20, 2023
88b92ad
Range: changed class component to functional component
khushiagl Jul 20, 2023
0c10192
Updated front-end tests (range)
khushiagl Jul 20, 2023
fd2615d
Resolved https://github.com/MarkUsProject/Markus/pull/6642#discussion…
DanielDervishi Jul 20, 2023
9b3aa58
Resolved https://github.com/MarkUsProject/Markus/pull/6642#discussion…
DanielDervishi Jul 20, 2023
7385ba7
Resolved https://github.com/MarkUsProject/Markus/pull/6642#discussion…
DanielDervishi Jul 20, 2023
91ecc49
https://github.com/MarkUsProject/Markus/pull/6642#discussion_r1268809252
DanielDervishi Jul 20, 2023
25e44a8
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 20, 2023
b2d19ad
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 20, 2023
f837337
Lifted state up from filter modal to result.jsx
khushiagl Jul 20, 2023
af5946d
Updated front-end tests for filter modal change to purely controller …
khushiagl Jul 20, 2023
1b1b9c8
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 20, 2023
9aece8a
Partially addressed https://github.com/MarkUsProject/Markus/pull/6642…
DanielDervishi Jul 21, 2023
f010bc8
Resolved merge conflicts
DanielDervishi Jul 21, 2023
f50985c
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
DanielDervishi Jul 21, 2023
79d7114
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
DanielDervishi Jul 21, 2023
2d23567
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
DanielDervishi Jul 21, 2023
2e2d05b
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
DanielDervishi Jul 21, 2023
d732fe6
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
c2a7f27
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
DanielDervishi Jul 21, 2023
02478b0
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
4aa25f8
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
0735eaf
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
87c8281
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
44c057a
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
DanielDervishi Jul 21, 2023
d0c5f57
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
a1116ac
Made annotation text search independent of character case and Address…
DanielDervishi Jul 21, 2023
4947068
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
5052504
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 21, 2023
7f484d7
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
khushiagl Jul 23, 2023
cbf6a7d
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
khushiagl Jul 23, 2023
a77401f
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files/c52…
khushiagl Jul 23, 2023
37b0064
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files#r12…
khushiagl Jul 24, 2023
f108ab7
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files#r12…
khushiagl Jul 24, 2023
7173ada
Allowing tas who can manage assessments to filter by tas
khushiagl Jul 24, 2023
046c879
Fixed failing tests
DanielDervishi Jul 24, 2023
7095fbe
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 24, 2023
6d73a82
Styling dropdowns and addressed https://github.com/MarkUsProject/Mark…
khushiagl Jul 24, 2023
0a569ac
Changed permissions to filter by tas back to only Instructors
khushiagl Jul 24, 2023
e53e043
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 24, 2023
78ac965
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files#r12…
khushiagl Jul 24, 2023
f4c0707
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files#r12…
khushiagl Jul 24, 2023
10db712
Fixed failing tests
DanielDervishi Jul 24, 2023
44aaadd
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 24, 2023
4690030
re-added tabIndex
DanielDervishi Jul 24, 2023
2eccdaf
Addressing https://github.com/MarkUsProject/Markus/pull/6642#discussi…
DanielDervishi Jul 24, 2023
7e87c5b
Fixed front-end tests
khushiagl Jul 24, 2023
9157549
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 24, 2023
5c15b99
Adding id to inputs with labels
khushiagl Jul 24, 2023
a48f44d
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 24, 2023
aac7885
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 24, 2023
16207ba
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
DanielDervishi Jul 25, 2023
a879f3c
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files#r12…
khushiagl Jul 25, 2023
3716e38
Added more documentation
DanielDervishi Jul 25, 2023
19095a5
Changed global event listener to onBlur
khushiagl Jul 25, 2023
3db0e25
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 25, 2023
54285f2
Further addressing https://github.com/MarkUsProject/Markus/pull/6642#…
DanielDervishi Jul 25, 2023
3aa2553
Addressed https://github.com/MarkUsProject/Markus/pull/6642/files#r12…
khushiagl Jul 25, 2023
8ce78fa
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 25, 2023
6ae8d01
Fixed frontend tests
khushiagl Jul 25, 2023
b40cd3d
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 25, 2023
6597e04
Fixed frontend tests
khushiagl Jul 25, 2023
415db14
Adjusting syling in favour of uniformity
DanielDervishi Jul 25, 2023
689c026
Adjusted styling slightly
DanielDervishi Jul 25, 2023
594bd90
More styling changes
DanielDervishi Jul 25, 2023
9ba8e62
removed _dropdown.scss
DanielDervishi Jul 25, 2023
5b29fa5
Styling and changed checkboxes from inputs to icons
khushiagl Jul 25, 2023
c9b7c77
Spacing
khushiagl Jul 25, 2023
711dc2b
Fixed failing tests
khushiagl Jul 26, 2023
0cd092f
styling updates
DanielDervishi Jul 26, 2023
4e7cff0
resoved conflicts
DanielDervishi Jul 26, 2023
3e681c5
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 26, 2023
a82ced0
quick styling fixes
DanielDervishi Jul 26, 2023
e266043
Styling complete
DanielDervishi Jul 26, 2023
064e84b
Small correction
DanielDervishi Jul 26, 2023
6113d0e
small change
DanielDervishi Jul 26, 2023
4f821b4
Styling
khushiagl Jul 26, 2023
19cf1c9
small change
khushiagl Jul 26, 2023
ff07865
Merge branch 'master' of github.com:MarkUsProject/Markus into filter_…
khushiagl Jul 26, 2023
f6e4929
Addressed some comments
DanielDervishi Jul 27, 2023
b3dc928
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 27, 2023
7724812
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
khushiagl Jul 27, 2023
b2f4079
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
khushiagl Jul 27, 2023
4be38e7
Updated documentation for filter_results to avoid repetition
DanielDervishi Jul 27, 2023
c757b24
Small styling fix
DanielDervishi Jul 27, 2023
a337cb6
Adressed https://github.com/MarkUsProject/Markus/pull/6642#discussion…
khushiagl Jul 27, 2023
3b8e072
Addressed https://github.com/MarkUsProject/Markus/pull/6642#issuecomm…
khushiagl Jul 27, 2023
d1e0b41
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 27, 2023
d70dcb8
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
khushiagl Jul 27, 2023
1e42496
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
khushiagl Jul 27, 2023
4acff2a
Removed redunant sorting
DanielDervishi Jul 27, 2023
f4e8ef3
Addressed https://github.com/MarkUsProject/Markus/pull/6642#discussio…
khushiagl Jul 27, 2023
5ecf6e9
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 27, 2023
e30c3ff
small fix
DanielDervishi Jul 27, 2023
51b35d4
Small change
DanielDervishi Jul 27, 2023
48a92b8
Small Change
khushiagl Jul 27, 2023
a5a18dd
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 27, 2023
da2bec2
documentation update
DanielDervishi Jul 27, 2023
ba0ebef
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 27, 2023
ad4df10
small fix
DanielDervishi Jul 27, 2023
ebe7002
Internationalized aria-labels
DanielDervishi Jul 27, 2023
0d4a6ad
Small change (documentation of filter_results)
khushiagl Jul 27, 2023
51707ec
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 27, 2023
940b70b
Rename mutateFilterData to updateFilterData
DanielDervishi Jul 27, 2023
7287416
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
DanielDervishi Jul 27, 2023
8f49fa3
Fixed failing tests
khushiagl Jul 27, 2023
ec6a7a7
Merge branch 'filter_modal' of github.com:khushiagl/Markus into filte…
khushiagl Jul 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Ensure Jupyter notebook HTML rendering does not require external CDNs (#6656)
- Prevent Jupyter notebook from reloading when an annotation is added (#6656)
- Added a button allowing graders to view a random incomplete submission (#6641)
- Added a filter modal allowing graders to specify filters and order when navigating submissions (#6642)
- Add icons to submission and result grading action buttons (#6666)
- Remove group name maximum length constraint (#6668)
- Fix bug where in some cases flash messages were not being rendered correctly (#6670)
Expand Down
307 changes: 307 additions & 0 deletions app/assets/javascripts/Components/Modals/filter_modal.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
import React from "react";
import Modal from "react-modal";
import {MultiSelectDropdown} from "../../DropDownMenu/MultiSelectDropDown";
import {SingleSelectDropDown} from "../../DropDownMenu/SingleSelectDropDown";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";

export class FilterModal extends React.Component {
onToggleOptionTas = user_name => {
const newArray = [...this.props.filterData.tas];
if (newArray.includes(user_name)) {
this.props.updateFilterData({
tas: newArray.filter(item => item !== user_name),
});
} else {
newArray.push(user_name);
this.props.updateFilterData({
tas: newArray,
});
}
};

onClearSelectionTAs = () => {
this.props.updateFilterData({
tas: [],
});
};

onClearSelectionTags = () => {
this.props.updateFilterData({
tags: [],
});
};

onToggleOptionTags = tag => {
const newArray = [...this.props.filterData.tags];
if (newArray.includes(tag)) {
this.props.updateFilterData({
tags: newArray.filter(item => item !== tag),
});
} else {
newArray.push(tag);
this.props.updateFilterData({
tags: newArray,
});
}
};

renderTasDropdown = () => {
if (this.props.role === "Instructor") {
let tas = this.props.tas.map(option => {
return {key: option[0], display: option[0] + " - " + option[1]};
});
return (
<div className={"filter"}>
<p>{I18n.t("activerecord.models.ta.other")}</p>
<MultiSelectDropdown
title={"Tas"}
options={tas}
selected={this.props.filterData.tas}
onToggleOption={this.onToggleOptionTas}
onClearSelection={this.onClearSelectionTAs}
/>
</div>
);
}
};

renderTagsDropdown = () => {
let options = [];
if (this.props.available_tags.length !== 0) {
options = options.concat(
this.props.available_tags.map(item => {
return {key: item.name, display: item.name};
})
);
}
if (this.props.current_tags.length !== 0) {
options = options.concat(
this.props.current_tags.map(item => {
return {key: item.name, display: item.name};
})
);
}
return (
<MultiSelectDropdown
title={"Tags"}
options={options}
selected={this.props.filterData.tags}
onToggleOption={this.onToggleOptionTags}
onClearSelection={this.onClearSelectionTags}
/>
);
};

rangeFilter = (min, max, title, onMinChange, onMaxChange) => {
return (
<div className={"filter"}>
<p>{title}</p>
<div className={"range"} data-testid={title}>
<input
DanielDervishi marked this conversation as resolved.
Show resolved Hide resolved
className={"input-min"}
aria-label={title + " - " + I18n.t("min")}
type="number"
step="any"
placeholder={I18n.t("min")}
value={min}
max={max}
onChange={e => onMinChange(e)}
/>
<span>{I18n.t("to")}</span>
<input
className={"input-max"}
aria-label={title + " - " + I18n.t("max")}
type="number"
step="any"
placeholder={I18n.t("max")}
value={max}
min={min}
onChange={e => onMaxChange(e)}
/>
<div className={"hidden"}>
<FontAwesomeIcon icon={"fa-solid fa-circle-exclamation"} />
<span className={"validity"}>{I18n.t("results.filters.invalid_range")}</span>
</div>
</div>
</div>
);
};

onTotalMarkMinChange = e => {
this.props.updateFilterData({
totalMarkRange: {...this.props.filterData.totalMarkRange, min: e.target.value},
});
};

onTotalMarkMaxChange = e => {
this.props.updateFilterData({
totalMarkRange: {...this.props.filterData.totalMarkRange, max: e.target.value},
});
};

onTotalExtraMarkMinChange = e => {
this.props.updateFilterData({
totalExtraMarkRange: {...this.props.filterData.totalExtraMarkRange, min: e.target.value},
});
};

onTotalExtraMarkMaxChange = e => {
this.props.updateFilterData({
totalExtraMarkRange: {...this.props.filterData.totalExtraMarkRange, max: e.target.value},
});
};

componentDidMount() {
Modal.setAppElement("body");
}

onClearFilters = event => {
event.preventDefault();
this.props.clearAllFilters();
};

render() {
if (this.props.loading) {
return "";
}
return (
<Modal
className="react-modal dialog filter-modal"
isOpen={this.props.isOpen}
onRequestClose={() => {
this.props.onRequestClose();
}}
>
<h3 className={"filter-modal-title"}>
<FontAwesomeIcon icon="fa-solid fa-filter" className={"filter-icon-title"} />
{I18n.t("results.filter_submissions")}
</h3>
<form>
<div className={"modal-container-scrollable"}>
<div className={"modal-container-vertical"}>
<div className={"modal-container"}>
<div className={"filter"} data-testid={"order-by"}>
<p>{I18n.t("results.filters.order_by")} </p>
<SingleSelectDropDown
valueToDisplayName={{
group_name: I18n.t("activerecord.attributes.group.group_name"),
submission_date: I18n.t("submissions.commit_date"),
}}
options={["group_name", "submission_date"]}
selected={this.props.filterData.orderBy}
onSelect={selection => {
this.props.updateFilterData({
orderBy: selection,
});
}}
defaultValue={I18n.t("activerecord.attributes.group.group_name")}
/>
<div className={"order"} data-testid={"radio-group"}>
<input
type="radio"
checked={this.props.filterData.ascending}
name="order"
onChange={() => {
this.props.updateFilterData({ascending: true});
}}
id={"Asc"}
data-testid={"ascending"}
/>
<label htmlFor="Asc">{I18n.t("results.filters.ordering.ascending")}</label>
<input
type="radio"
checked={!this.props.filterData.ascending}
name="order"
onChange={() => {
this.props.updateFilterData({ascending: false});
}}
id={"Desc"}
data-testid={"descending"}
/>
<label htmlFor="Desc">{I18n.t("results.filters.ordering.descending")}</label>
</div>
</div>
<div className={"filter"} data-testid={"marking-state"}>
<p>{I18n.t("activerecord.attributes.result.marking_state")}</p>
<SingleSelectDropDown
valueToDisplayName={{
in_progress: I18n.t("submissions.state.in_progress"),
complete: I18n.t("submissions.state.complete"),
released: I18n.t("submissions.state.released"),
remark_requested: I18n.t("submissions.state.remark_requested"),
}}
options={["in_progress", "complete", "released", "remark_requested"]}
selected={this.props.filterData.markingState}
onSelect={selection => {
this.props.updateFilterData({
markingState: selection,
});
}}
/>
</div>
</div>
<div className={"modal-container"}>
<div className={"filter"}>
<p>{I18n.t("activerecord.models.tag.other")}</p>
{this.renderTagsDropdown()}
</div>
<div className={"filter"} data-testid={"section"}>
<p>{I18n.t("activerecord.models.section.one")}</p>
<SingleSelectDropDown
options={this.props.sections.sort()}
selected={this.props.filterData.section}
onSelect={selection => {
this.props.updateFilterData({
section: selection,
});
}}
defaultValue={""}
/>
</div>
</div>
<div className={"modal-container"}>
{this.renderTasDropdown()}
<div className={"annotation-input"}>
<p>{I18n.t("activerecord.models.annotation.one")}</p>
<input
type={"text"}
value={this.props.filterData.annotationText}
onChange={e =>
this.props.updateFilterData({
annotationText: e.target.value,
})
}
placeholder={I18n.t("results.filters.text_box_placeholder")}
/>
</div>
</div>

<div className={"modal-container"}>
{this.rangeFilter(
this.props.filterData.totalMarkRange.min,
this.props.filterData.totalMarkRange.max,
I18n.t("results.total_mark"),
this.onTotalMarkMinChange,
this.onTotalMarkMaxChange
)}
{this.rangeFilter(
this.props.filterData.totalExtraMarkRange.min,
this.props.filterData.totalExtraMarkRange.max,
I18n.t("results.total_extra_marks"),
this.onTotalExtraMarkMinChange,
this.onTotalExtraMarkMaxChange
)}
</div>
</div>
</div>
<div className={"modal-footer"}>
<section className={"modal-container dialog-actions"}>
<button onClick={this.onClearFilters}>{I18n.t("clear_all")}</button>
<button onClick={this.props.onRequestClose}>{I18n.t("close")}</button>
</section>
</div>
</form>
</Modal>
);
}
}
Loading