Skip to content

Commit 59e19ba

Browse files
authored
Merge pull request #4846 from nulib/deploy/staging
Deploy v9.10.2 to production
2 parents a7ab40b + 8260e24 commit 59e19ba

File tree

17 files changed

+10638
-8199
lines changed

17 files changed

+10638
-8199
lines changed

app/assets/js/components/Dashboards/LocalAuthorities/List.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default function DashboardsLocalAuthoritiesList() {
4747
variables: {
4848
authority: "nul-authority",
4949
query: searchValue,
50+
limit: limit,
5051
},
5152
});
5253
} else {
@@ -113,7 +114,7 @@ export default function DashboardsLocalAuthoritiesList() {
113114
React.useEffect(() => {
114115
if (!data) return;
115116
filterValues();
116-
}, [data, searchValue]);
117+
}, [data, searchValue, limit]);
117118

118119
if (loading || deleteAuthorityLoading || updateLoading) return null;
119120
if (error) return <Notification isDanger>{error.toString()}</Notification>;

app/assets/js/components/Work/Tabs/Preservation/Preservation.jsx

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const WorkTabsPreservation = ({ work }) => {
4747
orderBy: "created",
4848
fileSets: sortFileSets({ fileSets: work.fileSets }),
4949
});
50+
const [selectedFilesets, setSelectedFilesets] = useState([]);
5051

5152
// Keep track of whether these modals are open,
5253
// and also additional data which the dependent modals rely upon
@@ -215,9 +216,33 @@ const WorkTabsPreservation = ({ work }) => {
215216
};
216217

217218
const handleTransferFileSetsClick = () => {
219+
if (selectedFilesets.length === 0) {
220+
return;
221+
}
218222
setTransferFilesetsModal({ fromWorkId: work.id, isVisible: true });
219223
};
220224

225+
const handleSelectAllFilesets = (e) => {
226+
if (e.target.checked) {
227+
setSelectedFilesets(orderedFileSets.fileSets.map((fs) => fs.id));
228+
} else {
229+
setSelectedFilesets([]);
230+
}
231+
};
232+
233+
const handleSelectFileset = (filesetId) => {
234+
setSelectedFilesets((prev) => {
235+
if (prev.includes(filesetId)) {
236+
return prev.filter((id) => id !== filesetId);
237+
} else {
238+
return [...prev, filesetId];
239+
}
240+
});
241+
};
242+
243+
const isAllSelected = selectedFilesets.length === orderedFileSets.fileSets.length && orderedFileSets.fileSets.length > 0;
244+
const isSomeSelected = selectedFilesets.length > 0 && !isAllSelected;
245+
221246
return (
222247
<div data-testid="preservation-tab">
223248
<UITabsStickyHeader title="Preservation and Access">
@@ -248,6 +273,19 @@ const WorkTabsPreservation = ({ work }) => {
248273
>
249274
<thead>
250275
<tr>
276+
<th style={{ width: "40px" }}>
277+
<input
278+
type="checkbox"
279+
checked={isAllSelected}
280+
ref={(input) => {
281+
if (input) {
282+
input.indeterminate = isSomeSelected;
283+
}
284+
}}
285+
onChange={handleSelectAllFilesets}
286+
aria-label="Select all filesets"
287+
/>
288+
</th>
251289
<th>
252290
<UIOrderBy
253291
label="ID"
@@ -305,6 +343,14 @@ const WorkTabsPreservation = ({ work }) => {
305343
const metadata = fileset.coreMetadata;
306344
return (
307345
<tr key={fileset.id} data-testid="preservation-row">
346+
<td>
347+
<input
348+
type="checkbox"
349+
checked={selectedFilesets.includes(fileset.id)}
350+
onChange={() => handleSelectFileset(fileset.id)}
351+
aria-label={`Select fileset ${fileset.id}`}
352+
/>
353+
</td>
308354
<td>{fileset.id}</td>
309355
<td>{fileset.role?.id}</td>
310356
<td>{fileset.accessionNumber}</td>
@@ -383,21 +429,36 @@ const WorkTabsPreservation = ({ work }) => {
383429
</Dialog.Root>
384430
<Button
385431
as="span"
432+
className={selectedFilesets.length === 0 ? "has-tooltip-multiline" : ""}
386433
data-testid="button-transfer-file-sets"
387434
onClick={handleTransferFileSetsClick}
435+
disabled={selectedFilesets.length === 0}
436+
data-tooltip={
437+
selectedFilesets.length === 0
438+
? "Select one or more filesets from the table above to transfer"
439+
: undefined
440+
}
388441
>
389442
<span className="icon">
390443
<IconReplace />
391444
</span>
392-
<span>Transfer File Sets to Existing Work</span>
445+
<span>
446+
Transfer File Sets
447+
{selectedFilesets.length > 0 && ` (${selectedFilesets.length})`}
448+
</span>
393449
</Button>
394450
</AuthDisplayAuthorized>
395451
</div>
396452

397453
<WorkTabsPreservationTransferFileSetsModal
398-
closeModal={() => setTransferFilesetsModal({ isVisible: false })}
454+
closeModal={() => {
455+
setTransferFilesetsModal({ isVisible: false });
456+
setSelectedFilesets([]);
457+
}}
399458
isVisible={transferFilesetsModal.isVisible}
400459
fromWorkId={work.id}
460+
selectedFilesets={selectedFilesets}
461+
work={work}
401462
/>
402463

403464
<WorkTabsPreservationFileSetModal

0 commit comments

Comments
 (0)