-
Notifications
You must be signed in to change notification settings - Fork 29
/
datasets.actions.ts
334 lines (301 loc) · 10.1 KB
/
datasets.actions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
import { createAction, props } from "@ngrx/store";
import {
Dataset,
Attachment,
DerivedDataset,
OrigDatablock,
Datablock,
} from "shared/sdk";
import { FacetCounts } from "state-management/state/datasets.store";
import {
ArchViewMode,
DatasetFilters,
ScientificCondition,
} from "state-management/models";
// === Effects ===
export const fetchDatasetsAction = createAction("[Dataset] Fetch Datasets");
export const fetchDatasetsCompleteAction = createAction(
"[Dataset] Fetch Datasets Complete",
props<{ datasets: Dataset[] }>(),
);
export const fetchDatasetsFailedAction = createAction(
"[Dataset] Fetch Datasets Failed",
);
export const fetchFacetCountsAction = createAction(
"[Dataset] Fetch Facet Counts",
);
export const fetchFacetCountsCompleteAction = createAction(
"[Dataset] Fetch Facet Counts Complete",
props<{ facetCounts: FacetCounts; allCounts: number }>(),
);
export const fetchFacetCountsFailedAction = createAction(
"[Dataset] Fetch Facet Counts Failed",
);
export const fetchMetadataKeysAction = createAction(
"[Dataset] Fetch Metadata Keys",
);
export const fetchMetadataKeysCompleteAction = createAction(
"[Dataset] Fetch Metadata Keys Complete",
props<{ metadataKeys: string[] }>(),
);
export const fetchMetadataKeysFailedAction = createAction(
"[Dataset] Fetch Metadata Keys Failed",
);
export const fetchDatasetAction = createAction(
"[Dataset] Fetch Dataset",
props<{ pid: string; filters?: any }>(),
);
export const fetchDatasetCompleteAction = createAction(
"[Dataset] Fetch Dataset Complete",
props<{ dataset: Dataset }>(),
);
export const fetchDatasetFailedAction = createAction(
"[Dataset] Fetch Dataset Failed",
);
export const fetchDatablocksAction = createAction(
"[Dataset] Fetch Origin Datablocks",
props<{ pid: string; filters?: any }>(),
);
export const fetchDatablocksCompleteAction = createAction(
"[Dataset] Fetch Origin Datablocks Complete",
props<{ datablocks: Datablock[] }>(),
);
export const fetchDatablocksFailedAction = createAction(
"[Dataset] Fetch Origin Datablocks Failed",
);
export const fetchOrigDatablocksAction = createAction(
"[Dataset] Fetch Origin Datablocks",
props<{ pid: string; filters?: any }>(),
);
export const fetchOrigDatablocksCompleteAction = createAction(
"[Dataset] Fetch Origin Datablocks Complete",
props<{ origdatablocks: OrigDatablock[] }>(),
);
export const fetchOrigDatablocksFailedAction = createAction(
"[Dataset] Fetch Origin Datablocks Failed",
);
export const fetchAttachmentsAction = createAction(
"[Dataset] Fetch Attachments",
props<{ pid: string; filters?: any }>(),
);
export const fetchAttachmentsCompleteAction = createAction(
"[Dataset] Fetch Attachments Complete",
props<{ attachments: Attachment[] }>(),
);
export const fetchAttachmentsFailedAction = createAction(
"[Dataset] Fetch Attachments Failed",
);
export const fetchRelatedDatasetsAction = createAction(
"[Dataset] Fetch Related Datasets",
);
export const fetchRelatedDatasetsCompleteAction = createAction(
"[Dataset] Fetch Related Datasets Complete",
props<{ relatedDatasets: Dataset[] }>(),
);
export const fetchRelatedDatasetsFailedAction = createAction(
"[Datasets] Fetch Related Datasets Failed",
);
export const fetchRelatedDatasetsCountCompleteAction = createAction(
"[Dataset] Fetch Related Datasets Count Complete",
props<{ count: number }>(),
);
export const fetchRelatedDatasetsCountFailedAction = createAction(
"[Datasets] Fetch Related Datasets Count Failed",
);
export const changeRelatedDatasetsPageAction = createAction(
"[Dataset] Change Related Datasets Page",
props<{ page: number; limit: number }>(),
);
export const prefillBatchAction = createAction("[Dataset] Prefill Batch");
export const prefillBatchCompleteAction = createAction(
"[Dataset] Prefill Batch Complete",
props<{ batch: Dataset[] }>(),
);
export const addToBatchAction = createAction("[Dataset] Add To Batch");
export const storeBatchAction = createAction(
"[Dataset] Store To Batch",
props<{ batch: Dataset[] }>(),
);
export const removeFromBatchAction = createAction(
"[Dataset] Remove From Batch",
props<{ dataset: Dataset }>(),
);
export const clearBatchAction = createAction("[Dataset] Clear Batch");
export const addDatasetAction = createAction(
"[Dataset] Add Dataset",
props<{ dataset: DerivedDataset }>(),
);
export const addDatasetCompleteAction = createAction(
"[Dataset] Add Dataset Complete",
props<{ dataset: DerivedDataset }>(),
);
export const addDatasetFailedAction = createAction(
"[Dataset] Add Dataset Failed",
);
export const updatePropertyAction = createAction(
"[Dataset] Update Property",
props<{ pid: string; property: Record<string, unknown> }>(),
);
export const updatePropertyCompleteAction = createAction(
"[Dataset] Update Property Complete",
);
export const updatePropertyFailedAction = createAction(
"[Dataset] Update Property Failed",
);
export const addAttachmentAction = createAction(
"[Dataset] Add Attachment",
props<{ attachment: Partial<Attachment> }>(),
);
export const addAttachmentCompleteAction = createAction(
"[Dataset] Add Attachment Complete",
props<{ attachment: Attachment }>(),
);
export const addAttachmentFailedAction = createAction(
"[Dataset] Add Attachment Failed",
);
export const updateAttachmentCaptionAction = createAction(
"[Dataset] Update Attachment Caption",
props<{ datasetId: string; attachmentId: string; caption: string }>(),
);
export const updateAttachmentCaptionCompleteAction = createAction(
"[Dataset] Update Attachment Caption Complete",
props<{ attachment: Attachment }>(),
);
export const updateAttachmentCaptionFailedAction = createAction(
"[Dataset] Update Attachment Action Failed",
);
export const removeAttachmentAction = createAction(
"[Dataset] Remove Attachment",
props<{ datasetId: string; attachmentId: string }>(),
);
export const removeAttachmentCompleteAction = createAction(
"[Dataset] Remove Attachment Complete",
props<{ attachmentId: string }>(),
);
export const removeAttachmentFailedAction = createAction(
"[Dataset] Remove Attachment Failed",
);
export const reduceDatasetAction = createAction(
"[Dataset] Reduce Dataset",
props<{ dataset: Dataset }>(),
);
export const reduceDatasetCompleteAction = createAction(
"[Dataset] Reduce Dataset Complete",
props<{ result: Record<string, unknown> }>(),
);
export const reduceDatasetFailedAction = createAction(
"[Dataset] Reduce Dataset Failed",
);
export const appendToDatasetArrayFieldAction = createAction(
"[Dataset] Append To Array Field",
props<{ pid: string; fieldName: string; data: any[] }>(),
);
export const appendToDatasetArrayFieldCompleteAction = createAction(
"[Dataset] Append To Array Field Complete",
);
export const appendToDatasetArrayFieldFailedAction = createAction(
"[Dataset] Append To Array Field Failed",
);
// === Dataset Table Selection ===
export const selectDatasetAction = createAction(
"[Dataset] Select Dataset",
props<{ dataset: Dataset }>(),
);
export const deselectDatasetAction = createAction(
"[Dataset] Deselect Dataset",
props<{ dataset: Dataset }>(),
);
export const selectAllDatasetsAction = createAction(
"[Dataset] Select All Datasets",
);
export const clearSelectionAction = createAction("[Dataset] Clear Selection");
// === Dataset Table Filtering ===
export const setDatasetsLimitFilterAction = createAction(
"[Dataset] Set Limit Filter",
props<{ limit: number }>(),
);
export const changePageAction = createAction(
"[Dataset] Change Page",
props<{ page: number; limit: number }>(),
);
export const sortByColumnAction = createAction(
"[Dataset] Sort By Column",
props<{ column: string; direction: string }>(),
);
export const setSearchTermsAction = createAction(
"[Dataset] Set Search Terms",
props<{ terms: string }>(),
);
export const setPidTermsAction = createAction(
"[Dataset] Set Pid Terms",
props<{ pid: string }>(),
);
export const setArchiveViewModeAction = createAction(
"[Dataset] Set Archive View Mode",
props<{ modeToggle: ArchViewMode }>(),
);
export const setPublicViewModeAction = createAction(
"[Dataset] Set Public View Mode",
props<{ isPublished: boolean | "" }>(),
);
export const prefillFiltersAction = createAction(
"[Dataset] Prefill Filters",
props<{ values: Partial<DatasetFilters> }>(),
);
export const clearFacetsAction = createAction("[Dataset] Clear Facets");
export const setTextFilterAction = createAction(
"[Dataset] Set Text Filter",
props<{ text: string }>(),
);
export const setPidTermsFilterAction = createAction(
"[Dataset] Set Text Filter",
props<{ pid: string | { $regex: string } }>(),
);
export const addLocationFilterAction = createAction(
"[Dataset] Add Location Filter",
props<{ location: string }>(),
);
export const removeLocationFilterAction = createAction(
"[Dataset] Remove Location Filter",
props<{ location: string }>(),
);
export const addGroupFilterAction = createAction(
"[Dataset] Add Group Filter",
props<{ group: string }>(),
);
export const removeGroupFilterAction = createAction(
"[Dataset] Remove Group Filter",
props<{ group: string }>(),
);
export const addTypeFilterAction = createAction(
"[Dataset] Add Type Filter",
props<{ datasetType: string }>(),
);
export const removeTypeFilterAction = createAction(
"[Dataset] Remove Type Filter",
props<{ datasetType: string }>(),
);
export const addKeywordFilterAction = createAction(
"[Dataset] Add Keyword Filter",
props<{ keyword: string }>(),
);
export const removeKeywordFilterAction = createAction(
"[Dataset] Remove Keyword Filter",
props<{ keyword: string }>(),
);
export const setDateRangeFilterAction = createAction(
"[Dataset] Set Date Range Filter",
props<{ begin: string; end: string }>(),
);
export const addScientificConditionAction = createAction(
"[Dataset] Add Scientific Condition",
props<{ condition: ScientificCondition }>(),
);
export const removeScientificConditionAction = createAction(
"[Dataset] Remove Scientific Condition",
props<{ condition: ScientificCondition }>(),
);
export const clearDatasetsStateAction = createAction("[Dataset] Clear State");
export const clearCurrentDatasetStateAction = createAction(
"[Dataset] Clear Current Dataset State",
);