@gen-epix/ui-client-casedb 4.3.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/Dashboard.js +613 -666
- package/dist/_chunks/Dashboard.js.map +1 -1
- package/dist/_chunks/LegendaItem.js.map +1 -1
- package/dist/_chunks/UploadUtil.js +4 -6
- package/dist/_chunks/UploadUtil.js.map +1 -1
- package/dist/_chunks/_baseClone.js +1 -1
- package/dist/_chunks/_baseClone.js.map +1 -1
- package/dist/_chunks/cloneDeep.js +1 -1
- package/dist/_chunks/cloneDeep.js.map +1 -1
- package/dist/_chunks/esm.js +93 -101
- package/dist/_chunks/esm.js.map +1 -1
- package/dist/_chunks/react.js +1 -1
- package/dist/_chunks/react.js.map +1 -1
- package/dist/_chunks/shallow.js +2 -2
- package/dist/_chunks/shallow.js.map +1 -1
- package/dist/_chunks/sync.js +4 -4
- package/dist/_chunks/sync.js.map +1 -1
- package/dist/_chunks/vanilla.js +1 -1
- package/dist/_chunks/vanilla.js.map +1 -1
- package/dist/_chunks/yup.js +2 -2
- package/dist/_chunks/yup.js.map +1 -1
- package/dist/components/ui/ContextMenu/index.js +1 -1
- package/dist/components/ui/ContextMenu/index.js.map +1 -1
- package/dist/components/ui/CreateEventDialog/index.js +1 -1
- package/dist/components/ui/CreateEventDialog/index.js.map +1 -1
- package/dist/components/ui/HistogramWidget/index.js +1 -1
- package/dist/components/ui/HistogramWidget/index.js.map +1 -1
- package/dist/components/ui/PanelSeparator/index.js +50 -2
- package/dist/components/ui/PanelSeparator/index.js.map +1 -0
- package/dist/pages/CasesDetailPage/index.js +16 -16
- package/dist/pages/ColsAdminPage/index.js +77 -77
- package/dist/pages/ColsAdminPage/index.js.map +1 -1
- package/dist/pages/ConceptsAdminPage/index.js +31 -31
- package/dist/pages/DataCollectionVisualizationPage/index.js +1 -1
- package/dist/pages/DataCollectionVisualizationPage/index.js.map +1 -1
- package/dist/pages/DimsAdminPage/index.js +46 -46
- package/dist/pages/EventsDetailPage/index.js +18 -18
- package/dist/pages/RefColsAdminPage/index.js +94 -94
- package/dist/pages/RegionSetShapesAdminPage/index.js +26 -26
- package/dist/pages/RegionsAdminPage/index.js +33 -33
- package/dist/pages/UserEffectiveRightsAdminPage/index.js +56 -56
- package/dist/pages/UserEffectiveRightsAdminPage/index.js.map +1 -1
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js +45 -45
- package/dist/pages/UserEffectiveRightsTesterAdminPage/index.js.map +1 -1
- package/dist/utils/CaseDbStandardConfigUtil/index.js +1 -5
- package/dist/utils/CaseDbStandardConfigUtil/index.js.map +1 -1
- package/dist/utils/MapUtil/index.js +1 -1
- package/dist/utils/MapUtil/index.js.map +1 -1
- package/package.json +17 -12
- package/dist/_chunks/PanelSeparator.js +0 -1666
- package/dist/_chunks/PanelSeparator.js.map +0 -1
- package/dist/_chunks/chunk-OB3PAWPO.js +0 -1162
- package/dist/_chunks/chunk-OB3PAWPO.js.map +0 -1
|
@@ -3,26 +3,26 @@ import { CaseDbDataUtil as t } from "../../utils/CaseDbDataUtil/index.js";
|
|
|
3
3
|
import { useCaseTypeMapQuery as n, useCaseTypeOptionsQuery as r } from "../../dataHooks/useCaseTypesQuery/index.js";
|
|
4
4
|
import { useDimMapQuery as i, useDimOptionsQuery as a } from "../../dataHooks/useDimsQuery/index.js";
|
|
5
5
|
import { useColMapQuery as o, useColOptionsQuery as s } from "../../dataHooks/useColsQuery/index.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { jsx as te } from "react/jsx-runtime";
|
|
6
|
+
import { useRefColMapQuery as ee, useRefColOptionsQuery as c } from "../../dataHooks/useRefColsQuery/index.js";
|
|
7
|
+
import { useTreeAlgorithmCodeOptionsQuery as l } from "../../dataHooks/useTreeAlgorithmCodesQuery/index.js";
|
|
8
|
+
import { useRefColsValidationRulesQuery as u } from "../../dataHooks/useRefColsValidationRulesQuery/index.js";
|
|
9
|
+
import { useRefDimMapQuery as d } from "../../dataHooks/useRefDimsQuery/index.js";
|
|
10
|
+
import { array as f, object as p, string as m } from "yup";
|
|
11
|
+
import { CaseDbCaseApi as h, CaseDbColType as g, CaseDbCommandName as _ } from "@gen-epix/api-casedb";
|
|
12
|
+
import { FORM_FIELD_DEFINITION_TYPE as v } from "@gen-epix/ui-core-form/models/form";
|
|
13
|
+
import { DATE_FORMAT as y } from "@gen-epix/ui-core/constants/date";
|
|
14
|
+
import { useCallback as b, useMemo as x, useRef as S } from "react";
|
|
15
|
+
import { useTranslation as C } from "react-i18next";
|
|
16
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
18
17
|
import { useArray as T } from "@gen-epix/ui-core/hooks/useArray";
|
|
19
18
|
import { TableUtil as E } from "@gen-epix/ui-client-common/utils/TableUtil";
|
|
20
|
-
import { TestIdUtil as
|
|
21
|
-
import { SchemaUtil as
|
|
22
|
-
import { CrudPage as
|
|
19
|
+
import { TestIdUtil as D } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
20
|
+
import { SchemaUtil as O } from "@gen-epix/ui-core-form/utils/SchemaUtil";
|
|
21
|
+
import { CrudPage as te } from "@gen-epix/ui-client-common/pages/CrudPage";
|
|
22
|
+
import { useParams as ne } from "react-router-dom";
|
|
23
23
|
//#region src/pages/ColsAdminPage/ColsAdminPage.tsx
|
|
24
24
|
var k = /^NCBI:txid\d+/, A = () => {
|
|
25
|
-
let { t: A } =
|
|
25
|
+
let { t: A } = C(), { caseTypeId: j, dimId: M } = ne(), N = c(), P = ee(), F = d(), I = l(), L = r(), R = s(), z = o(), B = n(), V = i(), H = a(), U = u(), W = T([
|
|
26
26
|
F,
|
|
27
27
|
P,
|
|
28
28
|
U,
|
|
@@ -33,14 +33,14 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
33
33
|
N,
|
|
34
34
|
I,
|
|
35
35
|
R
|
|
36
|
-
]), G =
|
|
36
|
+
]), G = S(/* @__PURE__ */ new Map()), K = S(/* @__PURE__ */ new Map()), q = S(/* @__PURE__ */ new Map()), J = x(() => M ? V.map.get(M)?.case_type_id ?? null : j || null, [
|
|
37
37
|
M,
|
|
38
38
|
V.map,
|
|
39
39
|
j
|
|
40
|
-
]), Y =
|
|
40
|
+
]), Y = b(async (e) => (await h.getInstance().colsGetAll(null, null, { signal: e }))?.data, []), X = b((e) => M ? e.filter((e) => e.dim_id === M) : e, [M]), re = b(async (e) => await h.getInstance().colsDeleteOne(e.id), []), ie = b(async (e, t) => (await h.getInstance().colsPutOne(t.id, {
|
|
41
41
|
id: t.id,
|
|
42
42
|
...e
|
|
43
|
-
})).data, []), ae =
|
|
43
|
+
})).data, []), ae = b(async (e) => (await h.getInstance().colsPostOne(e)).data, []), oe = b((e) => e.label, []), Z = b((e) => {
|
|
44
44
|
if (G.current.has(e)) return G.current.get(e);
|
|
45
45
|
let n = t.getDimOptionsForCaseTypeId({
|
|
46
46
|
caseTypeId: e,
|
|
@@ -48,7 +48,7 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
48
48
|
dimOptions: H.options
|
|
49
49
|
});
|
|
50
50
|
return G.current.set(e, n), n;
|
|
51
|
-
}, [V.map, H.options]), Q =
|
|
51
|
+
}, [V.map, H.options]), Q = b((e) => {
|
|
52
52
|
if (K.current.has(e)) return K.current.get(e);
|
|
53
53
|
let n = t.getRefColOptionsForDimId({
|
|
54
54
|
colsValidationRules: U.data?.valid_col_types_by_dim_type ?? {},
|
|
@@ -65,7 +65,7 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
65
65
|
N.options,
|
|
66
66
|
U.data?.valid_col_types_by_dim_type,
|
|
67
67
|
F.map
|
|
68
|
-
]), $ =
|
|
68
|
+
]), $ = b((e) => {
|
|
69
69
|
if (q.current.has(e)) return q.current.get(e);
|
|
70
70
|
let n = t.getGeneticSequenceColOptionsForCaseTypeId({
|
|
71
71
|
caseTypeId: e,
|
|
@@ -78,37 +78,37 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
78
78
|
P.map,
|
|
79
79
|
z.map,
|
|
80
80
|
R.options
|
|
81
|
-
]), se =
|
|
82
|
-
case_type_id:
|
|
83
|
-
code:
|
|
84
|
-
description:
|
|
85
|
-
dim_id:
|
|
86
|
-
genetic_sequence_col_id:
|
|
87
|
-
is: (e) => P.map.get(e)?.col_type ===
|
|
88
|
-
otherwise: () =>
|
|
89
|
-
then: () =>
|
|
81
|
+
]), se = x(() => p().shape({
|
|
82
|
+
case_type_id: m().uuid4().required().max(100),
|
|
83
|
+
code: O.code,
|
|
84
|
+
description: O.description,
|
|
85
|
+
dim_id: m().uuid4().required().max(100),
|
|
86
|
+
genetic_sequence_col_id: m().when("ref_col_id", {
|
|
87
|
+
is: (e) => P.map.get(e)?.col_type === g.GENETIC_DISTANCE,
|
|
88
|
+
otherwise: () => m().nullable().notRequired(),
|
|
89
|
+
then: () => m().uuid4().required()
|
|
90
90
|
}),
|
|
91
|
-
label:
|
|
92
|
-
max_datetime:
|
|
93
|
-
max_length:
|
|
94
|
-
max_value:
|
|
95
|
-
min_datetime:
|
|
96
|
-
min_length:
|
|
97
|
-
min_value:
|
|
98
|
-
ncbi_taxid:
|
|
99
|
-
is: (e) => P.map.get(e)?.col_type ===
|
|
100
|
-
otherwise: () =>
|
|
101
|
-
then: () =>
|
|
91
|
+
label: O.label,
|
|
92
|
+
max_datetime: O.isoString.optional(),
|
|
93
|
+
max_length: O.number.integer().positive().max(1e4),
|
|
94
|
+
max_value: O.number.positive().max(1e4),
|
|
95
|
+
min_datetime: O.isoString.optional(),
|
|
96
|
+
min_length: O.number.integer().positive().max(1e4),
|
|
97
|
+
min_value: O.number.positive().max(1e4),
|
|
98
|
+
ncbi_taxid: m().when("ref_col_id", {
|
|
99
|
+
is: (e) => P.map.get(e)?.col_type === g.GENETIC_DISTANCE,
|
|
100
|
+
otherwise: () => m().notRequired(),
|
|
101
|
+
then: () => m().matches(k).required()
|
|
102
102
|
}),
|
|
103
|
-
pattern:
|
|
104
|
-
rank:
|
|
105
|
-
ref_col_id:
|
|
106
|
-
tree_algorithm_codes:
|
|
107
|
-
is: (e) => P.map.get(e)?.col_type ===
|
|
108
|
-
otherwise: () =>
|
|
109
|
-
then: () =>
|
|
103
|
+
pattern: m().regex(),
|
|
104
|
+
rank: O.rank,
|
|
105
|
+
ref_col_id: m().uuid4().required().max(100),
|
|
106
|
+
tree_algorithm_codes: f().when("ref_col_id", {
|
|
107
|
+
is: (e) => P.map.get(e)?.col_type === g.GENETIC_DISTANCE,
|
|
108
|
+
otherwise: () => f().nullable().notRequired(),
|
|
109
|
+
then: () => f().min(1).required()
|
|
110
110
|
})
|
|
111
|
-
}), [P.map]), ce =
|
|
111
|
+
}), [P.map]), ce = b((e, t, n) => {
|
|
112
112
|
if (t.case_type_id && t.dim_id) {
|
|
113
113
|
let e = Z(t.case_type_id);
|
|
114
114
|
e.find((e) => e.value === t.dim_id) || (n.setValue("dim_id", e.length === 1 ? e[0].value : null), n.setValue("ref_col_id", null));
|
|
@@ -125,102 +125,102 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
125
125
|
Z,
|
|
126
126
|
Q,
|
|
127
127
|
$
|
|
128
|
-
]), le =
|
|
128
|
+
]), le = b((e, t) => {
|
|
129
129
|
let n = t?.dim_id ?? e?.dim_id ?? null, r = V.map.get(n)?.case_type_id ?? null, i = t?.case_type_id ?? J ?? r, a = Z(i), o = Q(n), s = $(i);
|
|
130
130
|
return [
|
|
131
131
|
{
|
|
132
|
-
definition:
|
|
132
|
+
definition: v.AUTOCOMPLETE,
|
|
133
133
|
disabled: !!e,
|
|
134
134
|
label: A`Case type`,
|
|
135
135
|
name: "case_type_id",
|
|
136
136
|
options: L.options
|
|
137
137
|
},
|
|
138
138
|
{
|
|
139
|
-
definition:
|
|
139
|
+
definition: v.AUTOCOMPLETE,
|
|
140
140
|
disabled: !!e,
|
|
141
141
|
label: A`Dimension`,
|
|
142
142
|
name: "dim_id",
|
|
143
143
|
options: a
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
|
-
definition:
|
|
146
|
+
definition: v.AUTOCOMPLETE,
|
|
147
147
|
disabled: !!e,
|
|
148
148
|
label: A`Reference column`,
|
|
149
149
|
name: "ref_col_id",
|
|
150
150
|
options: o
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
|
-
definition:
|
|
153
|
+
definition: v.TEXTFIELD,
|
|
154
154
|
label: A`Code`,
|
|
155
155
|
name: "code"
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
|
-
definition:
|
|
158
|
+
definition: v.NUMBER,
|
|
159
159
|
label: A`Rank`,
|
|
160
160
|
name: "rank"
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
-
definition:
|
|
163
|
+
definition: v.TEXTFIELD,
|
|
164
164
|
label: A`Label`,
|
|
165
165
|
name: "label"
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
|
-
definition:
|
|
168
|
+
definition: v.RICH_TEXT,
|
|
169
169
|
label: A`Description`,
|
|
170
170
|
name: "description"
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
|
-
definition:
|
|
173
|
+
definition: v.NUMBER,
|
|
174
174
|
label: A`Min value`,
|
|
175
175
|
name: "min_value"
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
|
-
definition:
|
|
178
|
+
definition: v.NUMBER,
|
|
179
179
|
label: A`Max value`,
|
|
180
180
|
name: "max_value"
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
|
-
dateFormat:
|
|
184
|
-
definition:
|
|
183
|
+
dateFormat: y.DATE_TIME,
|
|
184
|
+
definition: v.DATE,
|
|
185
185
|
label: A`Min datetime`,
|
|
186
186
|
name: "min_datetime"
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
dateFormat:
|
|
190
|
-
definition:
|
|
189
|
+
dateFormat: y.DATE_TIME,
|
|
190
|
+
definition: v.DATE,
|
|
191
191
|
label: A`Max datetime`,
|
|
192
192
|
name: "max_datetime"
|
|
193
193
|
},
|
|
194
194
|
{
|
|
195
|
-
definition:
|
|
195
|
+
definition: v.NUMBER,
|
|
196
196
|
label: A`Min length`,
|
|
197
197
|
name: "min_length"
|
|
198
198
|
},
|
|
199
199
|
{
|
|
200
|
-
definition:
|
|
200
|
+
definition: v.NUMBER,
|
|
201
201
|
label: A`Max length`,
|
|
202
202
|
name: "max_length"
|
|
203
203
|
},
|
|
204
204
|
{
|
|
205
|
-
definition:
|
|
205
|
+
definition: v.SELECT,
|
|
206
206
|
label: A`Genetic sequence column`,
|
|
207
207
|
name: "genetic_sequence_col_id",
|
|
208
208
|
options: s
|
|
209
209
|
},
|
|
210
210
|
{
|
|
211
|
-
definition:
|
|
211
|
+
definition: v.SELECT,
|
|
212
212
|
label: A`Tree algorithm codes`,
|
|
213
213
|
multiple: !0,
|
|
214
214
|
name: "tree_algorithm_codes",
|
|
215
215
|
options: I.options
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
|
-
definition:
|
|
218
|
+
definition: v.TEXTFIELD,
|
|
219
219
|
label: A`NCBI TaxID`,
|
|
220
220
|
name: "ncbi_taxid"
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
|
-
definition:
|
|
223
|
+
definition: v.TEXTFIELD,
|
|
224
224
|
label: A`Pattern`,
|
|
225
225
|
name: "pattern",
|
|
226
226
|
type: "text"
|
|
@@ -235,7 +235,7 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
235
235
|
J,
|
|
236
236
|
A,
|
|
237
237
|
I.options
|
|
238
|
-
]), ue =
|
|
238
|
+
]), ue = x(() => {
|
|
239
239
|
let e = [];
|
|
240
240
|
return j || e.push(E.createOptionsColumn({
|
|
241
241
|
id: "case_type_id",
|
|
@@ -263,15 +263,15 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
263
263
|
L.options,
|
|
264
264
|
N.options,
|
|
265
265
|
A
|
|
266
|
-
]), de =
|
|
266
|
+
]), de = b((e, t) => ({
|
|
267
267
|
case_type_id: t.case_type_id,
|
|
268
268
|
dim_id: t.dim_id,
|
|
269
269
|
id: t.id,
|
|
270
270
|
...e
|
|
271
|
-
}), []), fe =
|
|
271
|
+
}), []), fe = x(() => ({
|
|
272
272
|
case_type_id: J,
|
|
273
273
|
dim_id: M ?? null
|
|
274
|
-
}), [M, J]), pe =
|
|
274
|
+
}), [M, J]), pe = x(() => {
|
|
275
275
|
let e = [];
|
|
276
276
|
return j && B.map.has(j) && e.push(B.map.get(j)?.name), M && V.map.has(M) && e.push(V.map.get(M)?.label), e.push(A`Columns`), e;
|
|
277
277
|
}, [
|
|
@@ -280,14 +280,14 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
280
280
|
B.map,
|
|
281
281
|
V.map,
|
|
282
282
|
A
|
|
283
|
-
]), me =
|
|
283
|
+
]), me = x(() => {
|
|
284
284
|
let e = [];
|
|
285
285
|
return j && e.push("CaseType"), M && e.push("Dim"), e.join("_");
|
|
286
286
|
}, [M, j]);
|
|
287
|
-
return /* @__PURE__ */ te
|
|
287
|
+
return /* @__PURE__ */ w(te, {
|
|
288
288
|
createItemDialogTitle: A`Create new column`,
|
|
289
289
|
createOne: ae,
|
|
290
|
-
crudCommandType:
|
|
290
|
+
crudCommandType: _.ColCrudCommand,
|
|
291
291
|
defaultNewItem: fe,
|
|
292
292
|
defaultSortByField: M ?? j ? "rank" : "case_type_id",
|
|
293
293
|
defaultSortDirection: "asc",
|
|
@@ -304,7 +304,7 @@ var k = /^NCBI:txid\d+/, A = () => {
|
|
|
304
304
|
schema: se,
|
|
305
305
|
tableColumns: ue,
|
|
306
306
|
tableStoreStorageNamePostFix: me,
|
|
307
|
-
testIdAttributes:
|
|
307
|
+
testIdAttributes: D.createAttributes("ColsAdminPage"),
|
|
308
308
|
title: pe,
|
|
309
309
|
updateOne: ie
|
|
310
310
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pages/ColsAdminPage/ColsAdminPage.tsx"],"sourcesContent":["import {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n array,\n object,\n string,\n} from 'yup';\nimport { useParams } from 'react-router-dom';\nimport type { UseFormReturn } from 'react-hook-form';\nimport type {\n CaseDbApiPermission,\n CaseDbCol,\n} from '@gen-epix/api-casedb';\nimport {\n CaseDbCaseApi,\n CaseDbColType,\n CaseDbCommandName,\n} from '@gen-epix/api-casedb';\nimport type { OmitWithMetaData } from '@gen-epix/ui-client-common/models/data';\nimport type { TableColumn } from '@gen-epix/ui-client-common/models/table';\nimport { CrudPage } from '@gen-epix/ui-client-common/pages/CrudPage';\nimport { TableUtil } from '@gen-epix/ui-client-common/utils/TableUtil';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport type {\n FormFieldDefinition,\n OptionBase,\n} from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\nimport { SchemaUtil } from '@gen-epix/ui-core-form/utils/SchemaUtil';\nimport { DATE_FORMAT } from '@gen-epix/ui-core/constants/date';\n\nimport {\n useColMapQuery,\n useColOptionsQuery,\n} from '../../dataHooks/useColsQuery';\nimport {\n useCaseTypeMapQuery,\n useCaseTypeOptionsQuery,\n} from '../../dataHooks/useCaseTypesQuery';\nimport {\n useRefColMapQuery,\n useRefColOptionsQuery,\n} from '../../dataHooks/useRefColsQuery';\nimport { useTreeAlgorithmCodeOptionsQuery } from '../../dataHooks/useTreeAlgorithmCodesQuery';\nimport {\n useDimMapQuery,\n useDimOptionsQuery,\n} from '../../dataHooks/useDimsQuery';\nimport { useRefColsValidationRulesQuery } from '../../dataHooks/useRefColsValidationRulesQuery';\nimport { useRefDimMapQuery } from '../../dataHooks/useRefDimsQuery';\nimport { CaseDbDataUtil } from '../../utils/CaseDbDataUtil';\nimport { CASEDB_QUERY_KEY } from '../../constants/query';\n\ntype FormFields = OmitWithMetaData<CaseDbCol, 'case_type' | 'dim' | 'props' | 'ref_col'>;\n\nconst NCBI_TAXID_REGEX = /^NCBI:txid\\d+/;\n\nexport const ColsAdminPage = () => {\n const { t } = useTranslation();\n const { caseTypeId, dimId } = useParams();\n const refColOptionsQuery = useRefColOptionsQuery();\n const refColMapQuery = useRefColMapQuery();\n const refDimMapQuery = useRefDimMapQuery();\n const treeAlgorithmCodesOptionsQuery = useTreeAlgorithmCodeOptionsQuery();\n const caseTypeOptionsQuery = useCaseTypeOptionsQuery();\n const colOptionsQuery = useColOptionsQuery();\n const colMapQuery = useColMapQuery();\n const caseTypeMapQuery = useCaseTypeMapQuery();\n const dimMapQuery = useDimMapQuery();\n const dimOptionsQuery = useDimOptionsQuery();\n const colsValidationRulesQuery = useRefColsValidationRulesQuery();\n const loadables = useArray([refDimMapQuery, refColMapQuery, colsValidationRulesQuery, dimOptionsQuery, dimMapQuery, caseTypeMapQuery, caseTypeOptionsQuery, refColOptionsQuery, treeAlgorithmCodesOptionsQuery, colOptionsQuery]);\n const dimOptionsByCaseTypeIdCacheRef = useRef(new Map<string, OptionBase<string>[]>());\n const refColOptionsByDimIdCacheRef = useRef(new Map<string, OptionBase<string>[]>());\n const geneticSequenceColOptionsByCaseTypeIdCacheRef = useRef(new Map<string, OptionBase<string>[]>());\n\n const normalizedCaseTypeId = useMemo(() => {\n if (dimId) {\n return dimMapQuery.map.get(dimId)?.case_type_id ?? null;\n }\n if (caseTypeId) {\n return caseTypeId;\n }\n return null;\n }, [dimId, dimMapQuery.map, caseTypeId]);\n\n const fetchAll = useCallback(async (signal: AbortSignal) => {\n return (await CaseDbCaseApi.getInstance().colsGetAll(null, null, { signal }))?.data;\n }, []);\n\n const fetchAllSelect = useCallback((cols: CaseDbCol[]) => {\n if (dimId) {\n return cols.filter((col) => col.dim_id === dimId);\n }\n return cols;\n }, [dimId]);\n\n const deleteOne = useCallback(async (item: CaseDbCol) => {\n return await CaseDbCaseApi.getInstance().colsDeleteOne(item.id);\n }, []);\n\n const updateOne = useCallback(async (variables: FormFields, item: CaseDbCol) => {\n return (await CaseDbCaseApi.getInstance().colsPutOne(item.id, { id: item.id, ...variables })).data;\n }, []);\n\n const createOne = useCallback(async (variables: FormFields) => {\n return (await CaseDbCaseApi.getInstance().colsPostOne(variables)).data;\n }, []);\n\n const getName = useCallback((item: CaseDbCol) => {\n return item.label;\n }, []);\n\n const getDimOptionsForCaseTypeId = useCallback((id: string): OptionBase<string>[] => {\n if (dimOptionsByCaseTypeIdCacheRef.current.has(id)) {\n return dimOptionsByCaseTypeIdCacheRef.current.get(id);\n }\n const options = CaseDbDataUtil.getDimOptionsForCaseTypeId({\n caseTypeId: id,\n dimMap: dimMapQuery.map,\n dimOptions: dimOptionsQuery.options,\n });\n dimOptionsByCaseTypeIdCacheRef.current.set(id, options);\n return options;\n }, [dimMapQuery.map, dimOptionsQuery.options]);\n\n const getRefColOptionsForDimId = useCallback((id: string): OptionBase<string>[] => {\n if (refColOptionsByDimIdCacheRef.current.has(id)) {\n return refColOptionsByDimIdCacheRef.current.get(id);\n }\n const options = CaseDbDataUtil.getRefColOptionsForDimId({\n colsValidationRules: colsValidationRulesQuery.data?.valid_col_types_by_dim_type ?? {},\n dimId: id,\n dimMap: dimMapQuery.map,\n refColMap: refColMapQuery.map,\n refColOptions: refColOptionsQuery.options,\n refDimMap: refDimMapQuery.map,\n });\n refColOptionsByDimIdCacheRef.current.set(id, options);\n return options;\n }, [dimMapQuery.map, refColMapQuery.map, refColOptionsQuery.options, colsValidationRulesQuery.data?.valid_col_types_by_dim_type, refDimMapQuery.map]);\n\n const getGeneticSequenceColOptionsForCaseTypeId = useCallback((id: string): OptionBase<string>[] => {\n if (geneticSequenceColOptionsByCaseTypeIdCacheRef.current.has(id)) {\n return geneticSequenceColOptionsByCaseTypeIdCacheRef.current.get(id);\n }\n const options = CaseDbDataUtil.getGeneticSequenceColOptionsForCaseTypeId({\n caseTypeId: id,\n colMap: colMapQuery.map,\n colOptions: colOptionsQuery.options,\n refColMap: refColMapQuery.map,\n });\n geneticSequenceColOptionsByCaseTypeIdCacheRef.current.set(id, options);\n return options;\n }, [refColMapQuery.map, colMapQuery.map, colOptionsQuery.options]);\n\n const schema = useMemo(() => {\n return object<FormFields>().shape({\n case_type_id: string().uuid4().required().max(100),\n code: SchemaUtil.code,\n description: SchemaUtil.description,\n dim_id: string().uuid4().required().max(100),\n genetic_sequence_col_id: string().when('ref_col_id', {\n is: (ref_col_id: string) => refColMapQuery.map.get(ref_col_id)?.col_type === CaseDbColType.GENETIC_DISTANCE,\n otherwise: () => string().nullable().notRequired(),\n then: () => string().uuid4().required(),\n }),\n label: SchemaUtil.label,\n max_datetime: SchemaUtil.isoString.optional(),\n max_length: SchemaUtil.number.integer().positive().max(10000),\n max_value: SchemaUtil.number.positive().max(10000),\n min_datetime: SchemaUtil.isoString.optional(),\n min_length: SchemaUtil.number.integer().positive().max(10000),\n min_value: SchemaUtil.number.positive().max(10000),\n ncbi_taxid: string().when('ref_col_id', {\n is: (ref_col_id: string) => refColMapQuery.map.get(ref_col_id)?.col_type === CaseDbColType.GENETIC_DISTANCE,\n otherwise: () => string().notRequired(),\n then: () => string().matches(NCBI_TAXID_REGEX).required(),\n }),\n pattern: string().regex(),\n rank: SchemaUtil.rank,\n ref_col_id: string().uuid4().required().max(100),\n tree_algorithm_codes: array().when('ref_col_id', {\n is: (ref_col_id: string) => refColMapQuery.map.get(ref_col_id)?.col_type === CaseDbColType.GENETIC_DISTANCE,\n otherwise: () => array().nullable().notRequired(),\n then: () => array().min(1).required(),\n }),\n });\n }, [refColMapQuery.map]);\n\n const onFormChange = useCallback((_item: CaseDbCol, values: FormFields, formMethods: UseFormReturn<FormFields>) => {\n if (values.case_type_id && values.dim_id) {\n const validDimOptions = getDimOptionsForCaseTypeId(values.case_type_id);\n if (!validDimOptions.find(option => option.value === values.dim_id)) {\n formMethods.setValue('dim_id', validDimOptions.length === 1 ? validDimOptions[0].value : null);\n formMethods.setValue('ref_col_id', null);\n }\n }\n\n if (values.dim_id && values.ref_col_id) {\n const validColOptions = getRefColOptionsForDimId(values.dim_id);\n if (!validColOptions.find(option => option.value === values.ref_col_id)) {\n formMethods.setValue('ref_col_id', validColOptions.length === 1 ? validColOptions[0].value : null);\n }\n }\n\n if (values.case_type_id && values.genetic_sequence_col_id) {\n const validColOptions = getGeneticSequenceColOptionsForCaseTypeId(values.case_type_id);\n if (!validColOptions.find(option => option.value === values.genetic_sequence_col_id)) {\n formMethods.setValue('genetic_sequence_col_id', validColOptions.length === 1 ? validColOptions[0].value : null);\n }\n }\n }, [getDimOptionsForCaseTypeId, getRefColOptionsForDimId, getGeneticSequenceColOptionsForCaseTypeId]);\n\n const formFieldDefinitions = useCallback((item: CaseDbCol, values: FormFields): FormFieldDefinition<FormFields>[] => {\n const normalizedDimId = values?.dim_id ?? item?.dim_id ?? null;\n const caseTypeIdFromDimId = dimMapQuery.map.get(normalizedDimId)?.case_type_id ?? null;\n const normalizedCaseTypeIdWithValues = values?.case_type_id ?? normalizedCaseTypeId ?? caseTypeIdFromDimId;\n\n const dimOptions = getDimOptionsForCaseTypeId(normalizedCaseTypeIdWithValues);\n const refColOptions = getRefColOptionsForDimId(normalizedDimId);\n const geneticSequenceColOptions = getGeneticSequenceColOptionsForCaseTypeId(normalizedCaseTypeIdWithValues);\n\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !!item,\n label: t`Case type`,\n name: 'case_type_id',\n options: caseTypeOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !!item,\n label: t`Dimension`,\n name: 'dim_id',\n options: dimOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !!item,\n label: t`Reference column`,\n name: 'ref_col_id',\n options: refColOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Code`,\n name: 'code',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Rank`,\n name: 'rank',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Label`,\n name: 'label',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.RICH_TEXT,\n label: t`Description`,\n name: 'description',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Min value`,\n name: 'min_value',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Max value`,\n name: 'max_value',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Min datetime`,\n name: 'min_datetime',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Max datetime`,\n name: 'max_datetime',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Min length`,\n name: 'min_length',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Max length`,\n name: 'max_length',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.SELECT,\n label: t`Genetic sequence column`,\n name: 'genetic_sequence_col_id',\n options: geneticSequenceColOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.SELECT,\n label: t`Tree algorithm codes`,\n multiple: true,\n name: 'tree_algorithm_codes',\n options: treeAlgorithmCodesOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`NCBI TaxID`,\n name: 'ncbi_taxid',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Pattern`,\n name: 'pattern',\n type: 'text',\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const satisfies FormFieldDefinition<FormFields>[];\n }, [dimMapQuery.map, caseTypeOptionsQuery.options, getDimOptionsForCaseTypeId, getRefColOptionsForDimId, getGeneticSequenceColOptionsForCaseTypeId, normalizedCaseTypeId, t, treeAlgorithmCodesOptionsQuery.options]);\n\n const tableColumns = useMemo((): TableColumn<CaseDbCol>[] => {\n const columns: TableColumn<CaseDbCol>[] = [];\n if (!caseTypeId) {\n columns.push(TableUtil.createOptionsColumn<CaseDbCol>({ id: 'case_type_id', name: t`Case type`, options: caseTypeOptionsQuery.options }));\n }\n if (!dimId) {\n columns.push(TableUtil.createOptionsColumn<CaseDbCol>({ id: 'dim_id', name: t`Dimension`, options: dimOptionsQuery.options }));\n }\n\n columns.push(\n TableUtil.createOptionsColumn<CaseDbCol>({ id: 'ref_col_id', name: t`Column`, options: refColOptionsQuery.options }),\n TableUtil.createTextColumn<CaseDbCol>({ id: 'code', name: t`Code` }),\n TableUtil.createNumberColumn<CaseDbCol>({ id: 'rank', name: t`Rank` }),\n );\n return columns;\n }, [dimId, dimOptionsQuery.options, caseTypeId, caseTypeOptionsQuery.options, refColOptionsQuery.options, t]);\n\n const getOptimisticUpdateIntermediateItem = useCallback((variables: FormFields, previousItem: CaseDbCol): CaseDbCol => {\n return {\n case_type_id: previousItem.case_type_id,\n dim_id: previousItem.dim_id,\n id: previousItem.id,\n ...variables,\n };\n }, []);\n\n const defaultNewItem = useMemo<Partial<FormFields>>(() => {\n return {\n case_type_id: normalizedCaseTypeId,\n dim_id: dimId ?? null,\n };\n }, [dimId, normalizedCaseTypeId]);\n\n const title = useMemo(() => {\n const parts: string[] = [];\n\n if (caseTypeId && caseTypeMapQuery.map.has(caseTypeId)) {\n parts.push(caseTypeMapQuery.map.get(caseTypeId)?.name);\n }\n if (dimId && dimMapQuery.map.has(dimId)) {\n parts.push(dimMapQuery.map.get(dimId)?.label);\n }\n parts.push(t`Columns`);\n\n return parts;\n }, [caseTypeId, dimId, caseTypeMapQuery.map, dimMapQuery.map, t]);\n\n const tableStoreStorageNamePostFix = useMemo(() => {\n const parts: string[] = [];\n if (caseTypeId) {\n parts.push('CaseType');\n }\n if (dimId) {\n parts.push('Dim');\n }\n return parts.join('_');\n }, [dimId, caseTypeId]);\n\n return (\n <CrudPage<FormFields, CaseDbCol, CaseDbCol, CASEDB_QUERY_KEY, CaseDbApiPermission>\n createItemDialogTitle={t`Create new column`}\n createOne={createOne}\n crudCommandType={CaseDbCommandName.ColCrudCommand}\n defaultNewItem={defaultNewItem}\n defaultSortByField={(dimId ?? caseTypeId) ? 'rank' : 'case_type_id'}\n defaultSortDirection={'asc'}\n deleteOne={deleteOne}\n fetchAll={fetchAll}\n fetchAllSelect={fetchAllSelect}\n formFieldDefinitions={formFieldDefinitions}\n getName={getName}\n getOptimisticUpdateIntermediateItem={getOptimisticUpdateIntermediateItem}\n itemName={t`Column`}\n loadables={loadables}\n onFormChange={onFormChange}\n resourceQueryKeyBase={CASEDB_QUERY_KEY.COLS}\n schema={schema}\n tableColumns={tableColumns}\n tableStoreStorageNamePostFix={tableStoreStorageNamePostFix}\n testIdAttributes={TestIdUtil.createAttributes('ColsAdminPage')}\n title={title}\n updateOne={updateOne}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4DA,IAAM,IAAmB,iBA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CAAU,CAAC;CAEtB,OACE,mBAAC,GAAD;EACE,uBAAuB,CAAC;EACb;EACX,iBAAiB,EAAkB;EACnB;EAChB,oBAAqB,KAAS,IAAc,SAAS;EACrD,sBAAsB;EACX;EACD;EACM;EACM;EACb;EAC4B;EACrC,UAAU,CAAC;EACA;EACG;EACd,sBAAsB,EAAiB;EAC/B;EACM;EACgB;EAC9B,kBAAkB,GAAW,iBAAiB,eAAe;EACtD;EACI;CACZ,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/pages/ColsAdminPage/ColsAdminPage.tsx"],"sourcesContent":["import {\n useCallback,\n useMemo,\n useRef,\n} from 'react';\nimport { useTranslation } from 'react-i18next';\nimport {\n array,\n object,\n string,\n} from 'yup';\nimport { useParams } from 'react-router-dom';\nimport type { UseFormReturn } from 'react-hook-form';\nimport type {\n CaseDbApiPermission,\n CaseDbCol,\n} from '@gen-epix/api-casedb';\nimport {\n CaseDbCaseApi,\n CaseDbColType,\n CaseDbCommandName,\n} from '@gen-epix/api-casedb';\nimport type { OmitWithMetaData } from '@gen-epix/ui-client-common/models/data';\nimport type { TableColumn } from '@gen-epix/ui-client-common/models/table';\nimport { CrudPage } from '@gen-epix/ui-client-common/pages/CrudPage';\nimport { TableUtil } from '@gen-epix/ui-client-common/utils/TableUtil';\nimport { TestIdUtil } from '@gen-epix/ui-core/utils/TestIdUtil';\nimport { useArray } from '@gen-epix/ui-core/hooks/useArray';\nimport type {\n FormFieldDefinition,\n OptionBase,\n} from '@gen-epix/ui-core-form/models/form';\nimport { FORM_FIELD_DEFINITION_TYPE } from '@gen-epix/ui-core-form/models/form';\nimport { SchemaUtil } from '@gen-epix/ui-core-form/utils/SchemaUtil';\nimport { DATE_FORMAT } from '@gen-epix/ui-core/constants/date';\n\nimport {\n useColMapQuery,\n useColOptionsQuery,\n} from '../../dataHooks/useColsQuery';\nimport {\n useCaseTypeMapQuery,\n useCaseTypeOptionsQuery,\n} from '../../dataHooks/useCaseTypesQuery';\nimport {\n useRefColMapQuery,\n useRefColOptionsQuery,\n} from '../../dataHooks/useRefColsQuery';\nimport { useTreeAlgorithmCodeOptionsQuery } from '../../dataHooks/useTreeAlgorithmCodesQuery';\nimport {\n useDimMapQuery,\n useDimOptionsQuery,\n} from '../../dataHooks/useDimsQuery';\nimport { useRefColsValidationRulesQuery } from '../../dataHooks/useRefColsValidationRulesQuery';\nimport { useRefDimMapQuery } from '../../dataHooks/useRefDimsQuery';\nimport { CaseDbDataUtil } from '../../utils/CaseDbDataUtil';\nimport { CASEDB_QUERY_KEY } from '../../constants/query';\n\ntype FormFields = OmitWithMetaData<CaseDbCol, 'case_type' | 'dim' | 'props' | 'ref_col'>;\n\nconst NCBI_TAXID_REGEX = /^NCBI:txid\\d+/;\n\nexport const ColsAdminPage = () => {\n const { t } = useTranslation();\n const { caseTypeId, dimId } = useParams();\n const refColOptionsQuery = useRefColOptionsQuery();\n const refColMapQuery = useRefColMapQuery();\n const refDimMapQuery = useRefDimMapQuery();\n const treeAlgorithmCodesOptionsQuery = useTreeAlgorithmCodeOptionsQuery();\n const caseTypeOptionsQuery = useCaseTypeOptionsQuery();\n const colOptionsQuery = useColOptionsQuery();\n const colMapQuery = useColMapQuery();\n const caseTypeMapQuery = useCaseTypeMapQuery();\n const dimMapQuery = useDimMapQuery();\n const dimOptionsQuery = useDimOptionsQuery();\n const colsValidationRulesQuery = useRefColsValidationRulesQuery();\n const loadables = useArray([refDimMapQuery, refColMapQuery, colsValidationRulesQuery, dimOptionsQuery, dimMapQuery, caseTypeMapQuery, caseTypeOptionsQuery, refColOptionsQuery, treeAlgorithmCodesOptionsQuery, colOptionsQuery]);\n const dimOptionsByCaseTypeIdCacheRef = useRef(new Map<string, OptionBase<string>[]>());\n const refColOptionsByDimIdCacheRef = useRef(new Map<string, OptionBase<string>[]>());\n const geneticSequenceColOptionsByCaseTypeIdCacheRef = useRef(new Map<string, OptionBase<string>[]>());\n\n const normalizedCaseTypeId = useMemo(() => {\n if (dimId) {\n return dimMapQuery.map.get(dimId)?.case_type_id ?? null;\n }\n if (caseTypeId) {\n return caseTypeId;\n }\n return null;\n }, [dimId, dimMapQuery.map, caseTypeId]);\n\n const fetchAll = useCallback(async (signal: AbortSignal) => {\n return (await CaseDbCaseApi.getInstance().colsGetAll(null, null, { signal }))?.data;\n }, []);\n\n const fetchAllSelect = useCallback((cols: CaseDbCol[]) => {\n if (dimId) {\n return cols.filter((col) => col.dim_id === dimId);\n }\n return cols;\n }, [dimId]);\n\n const deleteOne = useCallback(async (item: CaseDbCol) => {\n return await CaseDbCaseApi.getInstance().colsDeleteOne(item.id);\n }, []);\n\n const updateOne = useCallback(async (variables: FormFields, item: CaseDbCol) => {\n return (await CaseDbCaseApi.getInstance().colsPutOne(item.id, { id: item.id, ...variables })).data;\n }, []);\n\n const createOne = useCallback(async (variables: FormFields) => {\n return (await CaseDbCaseApi.getInstance().colsPostOne(variables)).data;\n }, []);\n\n const getName = useCallback((item: CaseDbCol) => {\n return item.label;\n }, []);\n\n const getDimOptionsForCaseTypeId = useCallback((id: string): OptionBase<string>[] => {\n if (dimOptionsByCaseTypeIdCacheRef.current.has(id)) {\n return dimOptionsByCaseTypeIdCacheRef.current.get(id);\n }\n const options = CaseDbDataUtil.getDimOptionsForCaseTypeId({\n caseTypeId: id,\n dimMap: dimMapQuery.map,\n dimOptions: dimOptionsQuery.options,\n });\n dimOptionsByCaseTypeIdCacheRef.current.set(id, options);\n return options;\n }, [dimMapQuery.map, dimOptionsQuery.options]);\n\n const getRefColOptionsForDimId = useCallback((id: string): OptionBase<string>[] => {\n if (refColOptionsByDimIdCacheRef.current.has(id)) {\n return refColOptionsByDimIdCacheRef.current.get(id);\n }\n const options = CaseDbDataUtil.getRefColOptionsForDimId({\n colsValidationRules: colsValidationRulesQuery.data?.valid_col_types_by_dim_type ?? {},\n dimId: id,\n dimMap: dimMapQuery.map,\n refColMap: refColMapQuery.map,\n refColOptions: refColOptionsQuery.options,\n refDimMap: refDimMapQuery.map,\n });\n refColOptionsByDimIdCacheRef.current.set(id, options);\n return options;\n }, [dimMapQuery.map, refColMapQuery.map, refColOptionsQuery.options, colsValidationRulesQuery.data?.valid_col_types_by_dim_type, refDimMapQuery.map]);\n\n const getGeneticSequenceColOptionsForCaseTypeId = useCallback((id: string): OptionBase<string>[] => {\n if (geneticSequenceColOptionsByCaseTypeIdCacheRef.current.has(id)) {\n return geneticSequenceColOptionsByCaseTypeIdCacheRef.current.get(id);\n }\n const options = CaseDbDataUtil.getGeneticSequenceColOptionsForCaseTypeId({\n caseTypeId: id,\n colMap: colMapQuery.map,\n colOptions: colOptionsQuery.options,\n refColMap: refColMapQuery.map,\n });\n geneticSequenceColOptionsByCaseTypeIdCacheRef.current.set(id, options);\n return options;\n }, [refColMapQuery.map, colMapQuery.map, colOptionsQuery.options]);\n\n const schema = useMemo(() => {\n return object<FormFields>().shape({\n case_type_id: string().uuid4().required().max(100),\n code: SchemaUtil.code,\n description: SchemaUtil.description,\n dim_id: string().uuid4().required().max(100),\n genetic_sequence_col_id: string().when('ref_col_id', {\n is: (ref_col_id: string) => refColMapQuery.map.get(ref_col_id)?.col_type === CaseDbColType.GENETIC_DISTANCE,\n otherwise: () => string().nullable().notRequired(),\n then: () => string().uuid4().required(),\n }),\n label: SchemaUtil.label,\n max_datetime: SchemaUtil.isoString.optional(),\n max_length: SchemaUtil.number.integer().positive().max(10000),\n max_value: SchemaUtil.number.positive().max(10000),\n min_datetime: SchemaUtil.isoString.optional(),\n min_length: SchemaUtil.number.integer().positive().max(10000),\n min_value: SchemaUtil.number.positive().max(10000),\n ncbi_taxid: string().when('ref_col_id', {\n is: (ref_col_id: string) => refColMapQuery.map.get(ref_col_id)?.col_type === CaseDbColType.GENETIC_DISTANCE,\n otherwise: () => string().notRequired(),\n then: () => string().matches(NCBI_TAXID_REGEX).required(),\n }),\n pattern: string().regex(),\n rank: SchemaUtil.rank,\n ref_col_id: string().uuid4().required().max(100),\n tree_algorithm_codes: array().when('ref_col_id', {\n is: (ref_col_id: string) => refColMapQuery.map.get(ref_col_id)?.col_type === CaseDbColType.GENETIC_DISTANCE,\n otherwise: () => array().nullable().notRequired(),\n then: () => array().min(1).required(),\n }),\n });\n }, [refColMapQuery.map]);\n\n const onFormChange = useCallback((_item: CaseDbCol, values: FormFields, formMethods: UseFormReturn<FormFields>) => {\n if (values.case_type_id && values.dim_id) {\n const validDimOptions = getDimOptionsForCaseTypeId(values.case_type_id);\n if (!validDimOptions.find(option => option.value === values.dim_id)) {\n formMethods.setValue('dim_id', validDimOptions.length === 1 ? validDimOptions[0].value : null);\n formMethods.setValue('ref_col_id', null);\n }\n }\n\n if (values.dim_id && values.ref_col_id) {\n const validColOptions = getRefColOptionsForDimId(values.dim_id);\n if (!validColOptions.find(option => option.value === values.ref_col_id)) {\n formMethods.setValue('ref_col_id', validColOptions.length === 1 ? validColOptions[0].value : null);\n }\n }\n\n if (values.case_type_id && values.genetic_sequence_col_id) {\n const validColOptions = getGeneticSequenceColOptionsForCaseTypeId(values.case_type_id);\n if (!validColOptions.find(option => option.value === values.genetic_sequence_col_id)) {\n formMethods.setValue('genetic_sequence_col_id', validColOptions.length === 1 ? validColOptions[0].value : null);\n }\n }\n }, [getDimOptionsForCaseTypeId, getRefColOptionsForDimId, getGeneticSequenceColOptionsForCaseTypeId]);\n\n const formFieldDefinitions = useCallback((item: CaseDbCol, values: FormFields): FormFieldDefinition<FormFields>[] => {\n const normalizedDimId = values?.dim_id ?? item?.dim_id ?? null;\n const caseTypeIdFromDimId = dimMapQuery.map.get(normalizedDimId)?.case_type_id ?? null;\n const normalizedCaseTypeIdWithValues = values?.case_type_id ?? normalizedCaseTypeId ?? caseTypeIdFromDimId;\n\n const dimOptions = getDimOptionsForCaseTypeId(normalizedCaseTypeIdWithValues);\n const refColOptions = getRefColOptionsForDimId(normalizedDimId);\n const geneticSequenceColOptions = getGeneticSequenceColOptionsForCaseTypeId(normalizedCaseTypeIdWithValues);\n\n return [\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !!item,\n label: t`Case type`,\n name: 'case_type_id',\n options: caseTypeOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !!item,\n label: t`Dimension`,\n name: 'dim_id',\n options: dimOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.AUTOCOMPLETE,\n disabled: !!item,\n label: t`Reference column`,\n name: 'ref_col_id',\n options: refColOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Code`,\n name: 'code',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Rank`,\n name: 'rank',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Label`,\n name: 'label',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.RICH_TEXT,\n label: t`Description`,\n name: 'description',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Min value`,\n name: 'min_value',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Max value`,\n name: 'max_value',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Min datetime`,\n name: 'min_datetime',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n dateFormat: DATE_FORMAT.DATE_TIME,\n definition: FORM_FIELD_DEFINITION_TYPE.DATE,\n label: t`Max datetime`,\n name: 'max_datetime',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Min length`,\n name: 'min_length',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.NUMBER,\n label: t`Max length`,\n name: 'max_length',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.SELECT,\n label: t`Genetic sequence column`,\n name: 'genetic_sequence_col_id',\n options: geneticSequenceColOptions,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.SELECT,\n label: t`Tree algorithm codes`,\n multiple: true,\n name: 'tree_algorithm_codes',\n options: treeAlgorithmCodesOptionsQuery.options,\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`NCBI TaxID`,\n name: 'ncbi_taxid',\n } as const satisfies FormFieldDefinition<FormFields>,\n {\n definition: FORM_FIELD_DEFINITION_TYPE.TEXTFIELD,\n label: t`Pattern`,\n name: 'pattern',\n type: 'text',\n } as const satisfies FormFieldDefinition<FormFields>,\n ] as const satisfies FormFieldDefinition<FormFields>[];\n }, [dimMapQuery.map, caseTypeOptionsQuery.options, getDimOptionsForCaseTypeId, getRefColOptionsForDimId, getGeneticSequenceColOptionsForCaseTypeId, normalizedCaseTypeId, t, treeAlgorithmCodesOptionsQuery.options]);\n\n const tableColumns = useMemo((): TableColumn<CaseDbCol>[] => {\n const columns: TableColumn<CaseDbCol>[] = [];\n if (!caseTypeId) {\n columns.push(TableUtil.createOptionsColumn<CaseDbCol>({ id: 'case_type_id', name: t`Case type`, options: caseTypeOptionsQuery.options }));\n }\n if (!dimId) {\n columns.push(TableUtil.createOptionsColumn<CaseDbCol>({ id: 'dim_id', name: t`Dimension`, options: dimOptionsQuery.options }));\n }\n\n columns.push(\n TableUtil.createOptionsColumn<CaseDbCol>({ id: 'ref_col_id', name: t`Column`, options: refColOptionsQuery.options }),\n TableUtil.createTextColumn<CaseDbCol>({ id: 'code', name: t`Code` }),\n TableUtil.createNumberColumn<CaseDbCol>({ id: 'rank', name: t`Rank` }),\n );\n return columns;\n }, [dimId, dimOptionsQuery.options, caseTypeId, caseTypeOptionsQuery.options, refColOptionsQuery.options, t]);\n\n const getOptimisticUpdateIntermediateItem = useCallback((variables: FormFields, previousItem: CaseDbCol): CaseDbCol => {\n return {\n case_type_id: previousItem.case_type_id,\n dim_id: previousItem.dim_id,\n id: previousItem.id,\n ...variables,\n };\n }, []);\n\n const defaultNewItem = useMemo<Partial<FormFields>>(() => {\n return {\n case_type_id: normalizedCaseTypeId,\n dim_id: dimId ?? null,\n };\n }, [dimId, normalizedCaseTypeId]);\n\n const title = useMemo(() => {\n const parts: string[] = [];\n\n if (caseTypeId && caseTypeMapQuery.map.has(caseTypeId)) {\n parts.push(caseTypeMapQuery.map.get(caseTypeId)?.name);\n }\n if (dimId && dimMapQuery.map.has(dimId)) {\n parts.push(dimMapQuery.map.get(dimId)?.label);\n }\n parts.push(t`Columns`);\n\n return parts;\n }, [caseTypeId, dimId, caseTypeMapQuery.map, dimMapQuery.map, t]);\n\n const tableStoreStorageNamePostFix = useMemo(() => {\n const parts: string[] = [];\n if (caseTypeId) {\n parts.push('CaseType');\n }\n if (dimId) {\n parts.push('Dim');\n }\n return parts.join('_');\n }, [dimId, caseTypeId]);\n\n return (\n <CrudPage<FormFields, CaseDbCol, CaseDbCol, CASEDB_QUERY_KEY, CaseDbApiPermission>\n createItemDialogTitle={t`Create new column`}\n createOne={createOne}\n crudCommandType={CaseDbCommandName.ColCrudCommand}\n defaultNewItem={defaultNewItem}\n defaultSortByField={(dimId ?? caseTypeId) ? 'rank' : 'case_type_id'}\n defaultSortDirection={'asc'}\n deleteOne={deleteOne}\n fetchAll={fetchAll}\n fetchAllSelect={fetchAllSelect}\n formFieldDefinitions={formFieldDefinitions}\n getName={getName}\n getOptimisticUpdateIntermediateItem={getOptimisticUpdateIntermediateItem}\n itemName={t`Column`}\n loadables={loadables}\n onFormChange={onFormChange}\n resourceQueryKeyBase={CASEDB_QUERY_KEY.COLS}\n schema={schema}\n tableColumns={tableColumns}\n tableStoreStorageNamePostFix={tableStoreStorageNamePostFix}\n testIdAttributes={TestIdUtil.createAttributes('ColsAdminPage')}\n title={title}\n updateOne={updateOne}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4DA,IAAM,IAAmB,iBAEZ,UAAsB;CACjC,IAAM,EAAE,SAAM,EAAe,GACvB,EAAE,eAAY,aAAU,GAAU,GAClC,IAAqB,EAAsB,GAC3C,IAAiB,GAAkB,GACnC,IAAiB,EAAkB,GACnC,IAAiC,EAAiC,GAClE,IAAuB,EAAwB,GAC/C,IAAkB,EAAmB,GACrC,IAAc,EAAe,GAC7B,IAAmB,EAAoB,GACvC,IAAc,EAAe,GAC7B,IAAkB,EAAmB,GACrC,IAA2B,EAA+B,GAC1D,IAAY,EAAS;EAAC;EAAgB;EAAgB;EAA0B;EAAiB;EAAa;EAAkB;EAAsB;EAAoB;EAAgC;CAAe,CAAC,GAC1N,IAAiC,kBAAO,IAAI,IAAkC,CAAC,GAC/E,IAA+B,kBAAO,IAAI,IAAkC,CAAC,GAC7E,IAAgD,kBAAO,IAAI,IAAkC,CAAC,GAE9F,IAAuB,QACvB,IACK,EAAY,IAAI,IAAI,CAAK,CAAC,EAAE,gBAAgB,OAEjD,KAGG,MACN;EAAC;EAAO,EAAY;EAAK;CAAU,CAAC,GAEjC,IAAW,EAAY,OAAO,OAC1B,MAAM,EAAc,YAAY,CAAC,CAAC,WAAW,MAAM,MAAM,EAAE,UAAO,CAAC,EAAA,EAAI,MAC9E,CAAC,CAAC,GAEC,IAAiB,GAAa,MAC9B,IACK,EAAK,QAAQ,MAAQ,EAAI,WAAW,CAAK,IAE3C,GACN,CAAC,CAAK,CAAC,GAEJ,KAAY,EAAY,OAAO,MAC5B,MAAM,EAAc,YAAY,CAAC,CAAC,cAAc,EAAK,EAAE,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C,EAAE,KAAK,GAE9C,EAAM,KAAK,CAAC,SAAS,GAEd;CACT,GAAG;EAAC;EAAY;EAAO,EAAiB;EAAK,EAAY;EAAK;CAAC,CAAC,GAE1D,KAA+B,QAAc;EACjD,IAAM,IAAkB,CAAC;EAOzB,OANI,KACF,EAAM,KAAK,UAAU,GAEnB,KACF,EAAM,KAAK,KAAK,GAEX,EAAM,KAAK,GAAG;CACvB,GAAG,CAAC,GAAO,CAAU,CAAC;CAEtB,OACE,kBAAC,IAAD;EACE,uBAAuB,CAAC;EACb;EACX,iBAAiB,EAAkB;EACnB;EAChB,oBAAqB,KAAS,IAAc,SAAS;EACrD,sBAAsB;EACX;EACD;EACM;EACM;EACb;EAC4B;EACrC,UAAU,CAAC;EACA;EACG;EACd,sBAAsB,EAAiB;EAC/B;EACM;EACgB;EAC9B,kBAAkB,EAAW,iBAAiB,eAAe;EACtD;EACI;CACZ,CAAA;AAEL"}
|
|
@@ -1,76 +1,76 @@
|
|
|
1
1
|
import { CASEDB_QUERY_KEY as e } from "../../constants/query.js";
|
|
2
|
-
import { t } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
2
|
+
import { object as t } from "yup";
|
|
3
|
+
import { CaseDbCommandName as n, CaseDbOntologyApi as r } from "@gen-epix/api-casedb";
|
|
4
|
+
import { FORM_FIELD_DEFINITION_TYPE as i } from "@gen-epix/ui-core-form/models/form";
|
|
5
|
+
import { useCallback as a, useMemo as o } from "react";
|
|
6
|
+
import { useTranslation as s } from "react-i18next";
|
|
7
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
8
|
+
import { TableUtil as l } from "@gen-epix/ui-client-common/utils/TableUtil";
|
|
9
|
+
import { TestIdUtil as u } from "@gen-epix/ui-core/utils/TestIdUtil";
|
|
10
|
+
import { SchemaUtil as d } from "@gen-epix/ui-core-form/utils/SchemaUtil";
|
|
11
|
+
import { CrudPage as f } from "@gen-epix/ui-client-common/pages/CrudPage";
|
|
12
|
+
import { useParams as p } from "react-router-dom";
|
|
13
13
|
//#region src/pages/ConceptsAdminPage/ConceptsAdminPage.tsx
|
|
14
14
|
var m = () => {
|
|
15
|
-
let { conceptSetId: m } =
|
|
15
|
+
let { conceptSetId: m } = p(), { t: h } = s(), g = a(async (e) => (await r.getInstance().conceptsGetAll(null, null, { signal: e }))?.data, []), _ = a((e) => e.filter((e) => e.concept_set_id === m), [m]), v = a(async (e) => await r.getInstance().conceptsDeleteOne(e.id), []), y = a(async (e, t) => (await r.getInstance().conceptsPutOne(t.id, {
|
|
16
16
|
...e,
|
|
17
17
|
concept_set_id: m,
|
|
18
18
|
id: t.id
|
|
19
|
-
})).data, [m]), b =
|
|
19
|
+
})).data, [m]), b = a(async (e) => (await r.getInstance().conceptsPostOne({
|
|
20
20
|
...e,
|
|
21
21
|
concept_set_id: m
|
|
22
|
-
})).data, [m]), x =
|
|
23
|
-
code:
|
|
24
|
-
description:
|
|
25
|
-
name:
|
|
26
|
-
rank:
|
|
27
|
-
}), []), C =
|
|
22
|
+
})).data, [m]), x = a((e) => e.name, []), S = o(() => t().shape({
|
|
23
|
+
code: d.code,
|
|
24
|
+
description: d.description,
|
|
25
|
+
name: d.name,
|
|
26
|
+
rank: d.rank
|
|
27
|
+
}), []), C = o(() => [
|
|
28
28
|
{
|
|
29
|
-
definition:
|
|
29
|
+
definition: i.TEXTFIELD,
|
|
30
30
|
label: h`Rank`,
|
|
31
31
|
name: "rank",
|
|
32
32
|
type: "number"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
definition:
|
|
35
|
+
definition: i.TEXTFIELD,
|
|
36
36
|
label: h`Name`,
|
|
37
37
|
name: "name"
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
definition:
|
|
40
|
+
definition: i.TEXTFIELD,
|
|
41
41
|
label: h`Code`,
|
|
42
42
|
name: "code"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
|
-
definition:
|
|
45
|
+
definition: i.TEXTFIELD,
|
|
46
46
|
label: h`Description`,
|
|
47
47
|
multiline: !0,
|
|
48
48
|
name: "description",
|
|
49
49
|
rows: 4
|
|
50
50
|
}
|
|
51
|
-
], [h]), w =
|
|
52
|
-
|
|
51
|
+
], [h]), w = o(() => [
|
|
52
|
+
l.createNumberColumn({
|
|
53
53
|
flex: .25,
|
|
54
54
|
id: "rank",
|
|
55
55
|
name: h`Rank`
|
|
56
56
|
}),
|
|
57
|
-
|
|
57
|
+
l.createTextColumn({
|
|
58
58
|
id: "name",
|
|
59
59
|
name: h`Name`
|
|
60
60
|
}),
|
|
61
|
-
|
|
61
|
+
l.createTextColumn({
|
|
62
62
|
id: "code",
|
|
63
63
|
name: h`Code`
|
|
64
64
|
})
|
|
65
|
-
], [h]), T =
|
|
65
|
+
], [h]), T = a((e, t) => ({
|
|
66
66
|
concept_set_id: t.concept_set_id,
|
|
67
67
|
id: t.id,
|
|
68
68
|
...e
|
|
69
69
|
}), []);
|
|
70
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ c(f, {
|
|
71
71
|
createItemDialogTitle: h`Create new concept`,
|
|
72
72
|
createOne: b,
|
|
73
|
-
crudCommandType:
|
|
73
|
+
crudCommandType: n.ConceptCrudCommand,
|
|
74
74
|
defaultSortByField: "rank",
|
|
75
75
|
defaultSortDirection: "asc",
|
|
76
76
|
deleteOne: v,
|
|
@@ -83,7 +83,7 @@ var m = () => {
|
|
|
83
83
|
resourceQueryKeyBase: e.CONCEPTS,
|
|
84
84
|
schema: S,
|
|
85
85
|
tableColumns: w,
|
|
86
|
-
testIdAttributes:
|
|
86
|
+
testIdAttributes: u.createAttributes("ConceptsAdminPage"),
|
|
87
87
|
title: h`Concepts`,
|
|
88
88
|
updateOne: y
|
|
89
89
|
});
|
|
@@ -65,7 +65,7 @@ var N = {
|
|
|
65
65
|
z,
|
|
66
66
|
r
|
|
67
67
|
]), H = x(() => V.find((e) => e.value === a) ?? null, [a, V]), U = r === "organization" ? t`Organization` : t`Data collection`, W = !!a, G = b((e, t) => {
|
|
68
|
-
|
|
68
|
+
t && t !== r && (i(t), o(null));
|
|
69
69
|
}, [r]), K = b((e) => e.label, []), q = b((e, t) => e.value === t.value, []), J = b((e, t) => {
|
|
70
70
|
o(t?.value ?? null);
|
|
71
71
|
}, []), Y = b((e) => /* @__PURE__ */ w(h, {
|