datastake-daf 0.6.770 → 0.6.771
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/components/index.js +3366 -3147
- package/dist/pages/index.js +2278 -2142
- package/dist/services/index.js +6 -2
- package/dist/utils/index.js +4 -16
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +1 -0
- package/src/@daf/core/components/Dashboard/Map/hook.js +12 -1
- package/src/@daf/core/components/Graphs/TradeRelationship/index.jsx +4 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/index.jsx +0 -2
- package/src/@daf/core/components/Screens/Settings/Edit/index.js +2 -0
- package/src/@daf/core/components/Screens/Settings/components/Header/index.js +1 -1
- package/src/@daf/core/components/ViewForm/components/Records/config.js +22 -0
- package/src/@daf/core/components/ViewForm/components/Records/index.jsx +155 -0
- package/src/@daf/pages/Dashboards/SupplyChain/components/SupplyChainMap/index.js +3 -3
- package/src/@daf/pages/Documents/config.js +12 -0
- package/src/@daf/pages/Documents/index.jsx +3 -13
- package/src/@daf/pages/Events/Activities/config.js +12 -0
- package/src/@daf/pages/Events/Activities/index.jsx +2 -13
- package/src/@daf/pages/Events/Incidents/config.js +12 -0
- package/src/@daf/pages/Events/Incidents/index.jsx +2 -12
- package/src/@daf/pages/Events/config.js +12 -0
- package/src/@daf/pages/Events/index.jsx +2 -12
- package/src/@daf/pages/Locations/MineSite/config.js +12 -0
- package/src/@daf/pages/Locations/MineSite/index.jsx +2 -12
- package/src/@daf/pages/Locations/config.js +12 -0
- package/src/@daf/pages/Locations/index.jsx +2 -17
- package/src/@daf/pages/Stakeholders/Operators/config.js +12 -0
- package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -12
- package/src/@daf/pages/Stakeholders/Workers/config.js +12 -0
- package/src/@daf/pages/Stakeholders/Workers/index.jsx +2 -10
- package/src/@daf/pages/Stakeholders/config.js +12 -0
- package/src/@daf/pages/Stakeholders/index.jsx +3 -18
- package/src/@daf/pages/Summary/Operator/components/TradeRelationships/index.js +1 -0
- package/src/@daf/pages/Summary/hook.js +13 -3
- package/src/@daf/pages/TablePage/columns.js +29 -0
- package/src/@daf/pages/TablePage/config.js +19 -62
- package/src/@daf/pages/TablePage/helper.js +140 -0
- package/src/@daf/pages/TablePage/hook.js +20 -2
- package/src/@daf/pages/TablePage/index.jsx +12 -20
- package/src/@daf/services/LinkedSubjects.js +2 -2
- package/src/@daf/services/VersionService.js +13 -0
- package/src/@daf/utils/tooltip.js +3 -16
- package/src/index.js +1 -0
- package/src/pages.js +1 -0
- package/dist/style/datastake/mapbox-gl.css +0 -330
|
@@ -149,4 +149,16 @@ export const getFilterOptions = (options, t) => {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
return _default;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export const formConfig = {
|
|
155
|
+
namespace: 'OPERATOR',
|
|
156
|
+
view: ['scoping', 'new'],
|
|
157
|
+
scope: 'global',
|
|
158
|
+
formType: 'operator',
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const viewConfig = {
|
|
162
|
+
title: "Operators",
|
|
163
|
+
createTitle: "Create Operator",
|
|
152
164
|
}
|
|
@@ -47,17 +47,11 @@ const OperatorsTable = ({
|
|
|
47
47
|
APP={APP}
|
|
48
48
|
location={location}
|
|
49
49
|
applications={applications}
|
|
50
|
-
|
|
51
50
|
subject="operators"
|
|
52
51
|
getData={getData}
|
|
53
52
|
getApiBaseUrl={getApiBaseUrl}
|
|
54
53
|
getAppHeader={getAppHeader}
|
|
55
|
-
|
|
56
|
-
viewConfig={{
|
|
57
|
-
title: "Operators",
|
|
58
|
-
breadcrumbs: breadcrumbs,
|
|
59
|
-
createTitle: "Create Operator",
|
|
60
|
-
}}
|
|
54
|
+
breadcrumbs={breadcrumbs}
|
|
61
55
|
extendingFilters={extendingFilters}
|
|
62
56
|
formConfig={{
|
|
63
57
|
getFormData,
|
|
@@ -71,12 +65,8 @@ const OperatorsTable = ({
|
|
|
71
65
|
formData,
|
|
72
66
|
formValue,
|
|
73
67
|
form,
|
|
74
|
-
namespace: "OPERATOR",
|
|
75
|
-
view: ['scoping', 'new'],
|
|
76
|
-
scope: 'global',
|
|
77
|
-
formType: 'operator',
|
|
78
|
-
defaultValues: createDefaultValues,
|
|
79
68
|
}}
|
|
69
|
+
defaultValues={createDefaultValues}
|
|
80
70
|
onDownload={() => console.log("download")}
|
|
81
71
|
/>
|
|
82
72
|
)
|
|
@@ -153,4 +153,16 @@ export const getFilterOptions = (options, t) => {
|
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
return _default;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const formConfig = {
|
|
159
|
+
namespace: 'WORKERS',
|
|
160
|
+
view: ['scoping', 'new'],
|
|
161
|
+
scope: 'global',
|
|
162
|
+
formType: 'worker',
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const viewConfig = {
|
|
166
|
+
title: "Workers",
|
|
167
|
+
createTitle: "Create Worker",
|
|
156
168
|
}
|
|
@@ -53,11 +53,7 @@ const WorkersTable = ({
|
|
|
53
53
|
getApiBaseUrl={getApiBaseUrl}
|
|
54
54
|
getAppHeader={getAppHeader}
|
|
55
55
|
getColumns={getColumns}
|
|
56
|
-
|
|
57
|
-
title: "Workers",
|
|
58
|
-
breadcrumbs: breadcrumbs,
|
|
59
|
-
createTitle: "Create Worker",
|
|
60
|
-
}}
|
|
56
|
+
breadcrumbs={breadcrumbs}
|
|
61
57
|
extendingFilters={extendingFilters}
|
|
62
58
|
formConfig={{
|
|
63
59
|
getFormData,
|
|
@@ -71,12 +67,8 @@ const WorkersTable = ({
|
|
|
71
67
|
formData,
|
|
72
68
|
formValue,
|
|
73
69
|
form,
|
|
74
|
-
namespace: "WORKERS",
|
|
75
|
-
view: ['scoping', 'new'],
|
|
76
|
-
scope: 'global',
|
|
77
|
-
formType: 'worker',
|
|
78
|
-
defaultValues: createDefaultValues,
|
|
79
70
|
}}
|
|
71
|
+
defaultValues={createDefaultValues}
|
|
80
72
|
onDownload={() => console.log("download")}
|
|
81
73
|
/>
|
|
82
74
|
)
|
|
@@ -26,4 +26,16 @@ export const getFilterOptions = (options, t) => {
|
|
|
26
26
|
country: countries,
|
|
27
27
|
category: categoriesOptions || category,
|
|
28
28
|
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const formConfig = {
|
|
32
|
+
namespace: 'stakeholders',
|
|
33
|
+
view: 'scoping',
|
|
34
|
+
scope: 'create',
|
|
35
|
+
formType: 'stakeholder',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const viewConfig = {
|
|
39
|
+
title: "Stakeholders",
|
|
40
|
+
createTitle: "Create Stakeholder",
|
|
29
41
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { getColumns } from './columns.js';
|
|
3
2
|
import TablePage from '../TablePage/index.jsx';
|
|
4
3
|
|
|
5
4
|
const StakeholdersTable = ({
|
|
@@ -48,22 +47,13 @@ const StakeholdersTable = ({
|
|
|
48
47
|
APP={APP}
|
|
49
48
|
location={location}
|
|
50
49
|
applications={applications}
|
|
51
|
-
|
|
52
50
|
subject="stakeholders"
|
|
53
51
|
getData={getData}
|
|
54
52
|
getApiBaseUrl={getApiBaseUrl}
|
|
55
53
|
getAppHeader={getAppHeader}
|
|
56
54
|
subjectClear={subjectClear}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
viewConfig={{
|
|
60
|
-
title: "Stakeholders",
|
|
61
|
-
breadcrumbs: breadcrumbs,
|
|
62
|
-
createTitle: "Create Stakeholder",
|
|
63
|
-
}}
|
|
64
|
-
|
|
65
|
-
extendingFilters={extendingFilters}
|
|
66
|
-
|
|
55
|
+
breadcrumbs={breadcrumbs}
|
|
56
|
+
extendingFilters={extendingFilters}
|
|
67
57
|
formConfig={{
|
|
68
58
|
getFormData,
|
|
69
59
|
saveFormData,
|
|
@@ -76,13 +66,8 @@ const StakeholdersTable = ({
|
|
|
76
66
|
formData,
|
|
77
67
|
formValue,
|
|
78
68
|
form,
|
|
79
|
-
namespace: 'stakeholders',
|
|
80
|
-
view: 'scoping',
|
|
81
|
-
scope: 'create',
|
|
82
|
-
formType: 'stakeholder',
|
|
83
|
-
defaultValues: createDefaultValues,
|
|
84
69
|
}}
|
|
85
|
-
|
|
70
|
+
defaultValues={createDefaultValues}
|
|
86
71
|
onDownload={() => console.log("download")}
|
|
87
72
|
/>
|
|
88
73
|
)
|
|
@@ -34,6 +34,9 @@ export const useSummary = ({
|
|
|
34
34
|
const mappedData = Array.isArray(data) ? data.map((item) => ({
|
|
35
35
|
label: item?.name,
|
|
36
36
|
value: item?.datastakeId
|
|
37
|
+
})) : Array.isArray(data?.data) ? data?.data.map((item) => ({
|
|
38
|
+
label: item?.name,
|
|
39
|
+
value: item?.datastakeId
|
|
37
40
|
})) : [];
|
|
38
41
|
|
|
39
42
|
const storedData = StorageManager.get(storageKey);
|
|
@@ -82,9 +85,16 @@ export const useSummary = ({
|
|
|
82
85
|
}, [hasSelect, storageKey, isPdf, id, debouncedSearch, hasInitialized, dataOptions]);
|
|
83
86
|
|
|
84
87
|
useEffect(() => {
|
|
85
|
-
if (selectedItem
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
if (selectedItem) {
|
|
89
|
+
let selectedData;
|
|
90
|
+
|
|
91
|
+
if (Array.isArray(data)) {
|
|
92
|
+
selectedData = data.find((item) => item?.datastakeId === selectedItem);
|
|
93
|
+
} else if (Array.isArray(data?.data)) {
|
|
94
|
+
selectedData = data.data.find((item) => item?.datastakeId === selectedItem);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (selectedData) {
|
|
88
98
|
const saved = {
|
|
89
99
|
label: selectedData.name,
|
|
90
100
|
value: selectedData.datastakeId,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FILTER_REGISTRY, DEFAULT_SUBJECT } from './helper.js';
|
|
2
|
+
|
|
3
|
+
export const getColumns = ({
|
|
4
|
+
t,
|
|
5
|
+
goTo,
|
|
6
|
+
user,
|
|
7
|
+
options,
|
|
8
|
+
activeTab,
|
|
9
|
+
getRedirectLink,
|
|
10
|
+
theme,
|
|
11
|
+
subject,
|
|
12
|
+
data,
|
|
13
|
+
applications,
|
|
14
|
+
}) => {
|
|
15
|
+
const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
|
|
16
|
+
|
|
17
|
+
return registry?.columns({
|
|
18
|
+
t,
|
|
19
|
+
goTo,
|
|
20
|
+
user,
|
|
21
|
+
options,
|
|
22
|
+
activeTab,
|
|
23
|
+
getRedirectLink,
|
|
24
|
+
theme,
|
|
25
|
+
subject,
|
|
26
|
+
data,
|
|
27
|
+
applications,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getFiltersConfig as getFiltersConfigOperators, getFilterOptions as getFilterOptionsOperators } from '../Stakeholders/Operators/config';
|
|
3
|
-
import { getFiltersConfig as getFiltersConfigWorkers, getFilterOptions as getFilterOptionsWorkers } from '../Stakeholders/Workers/config';
|
|
4
|
-
|
|
5
|
-
import { getFiltersConfig as getFiltersConfigEvents, getFilterOptions as getFilterOptionsEvents } from '../Events/config';
|
|
6
|
-
import { getFiltersConfig as getFiltersConfigActivities, getFilterOptions as getFilterOptionsActivities } from '../Events/Activities/config';
|
|
7
|
-
import { getFiltersConfig as getFiltersConfigIncidents, getFilterOptions as getFilterOptionsIncidents } from '../Events/Incidents/config';
|
|
8
|
-
|
|
9
|
-
import { getFiltersConfig as getFiltersConfigLocations, getFilterOptions as getFilterOptionsLocations } from '../Locations/config';
|
|
10
|
-
import { getFiltersConfig as getFiltersConfigProductionSites, getFilterOptions as getFilterOptionsProductionSites } from '../Locations/MineSite/config';
|
|
11
|
-
|
|
12
|
-
import { getFiltersConfig as getFilterConfigDocuments, getFilterOptions as getFilterOptionsDocuments } from '../Documents/config';
|
|
13
|
-
|
|
1
|
+
import { FILTER_REGISTRY, DEFAULT_SUBJECT } from './helper.js';
|
|
14
2
|
|
|
15
3
|
export const getCheckboxConfig = ({ subject }) => {
|
|
16
4
|
return {
|
|
@@ -26,53 +14,22 @@ export const getSelectFiltersConfig = ({ subject }) => {
|
|
|
26
14
|
}
|
|
27
15
|
};
|
|
28
16
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
workers: {
|
|
35
|
-
config: getFiltersConfigWorkers,
|
|
36
|
-
options: getFilterOptionsWorkers,
|
|
37
|
-
},
|
|
38
|
-
operators: {
|
|
39
|
-
config: getFiltersConfigOperators,
|
|
40
|
-
options: getFilterOptionsOperators,
|
|
41
|
-
},
|
|
42
|
-
events: {
|
|
43
|
-
config: getFiltersConfigEvents,
|
|
44
|
-
options: getFilterOptionsEvents,
|
|
45
|
-
},
|
|
46
|
-
activities: {
|
|
47
|
-
config: getFiltersConfigActivities,
|
|
48
|
-
options: getFilterOptionsActivities,
|
|
49
|
-
},
|
|
50
|
-
incidents: {
|
|
51
|
-
config: getFiltersConfigIncidents,
|
|
52
|
-
options: getFilterOptionsIncidents,
|
|
53
|
-
},
|
|
54
|
-
locations: {
|
|
55
|
-
config: getFiltersConfigLocations,
|
|
56
|
-
options: getFilterOptionsLocations,
|
|
57
|
-
},
|
|
58
|
-
'production-sites': {
|
|
59
|
-
config: getFiltersConfigProductionSites,
|
|
60
|
-
options: getFilterOptionsProductionSites,
|
|
61
|
-
},
|
|
62
|
-
documents: {
|
|
63
|
-
config: getFilterConfigDocuments,
|
|
64
|
-
options: getFilterOptionsDocuments,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const DEFAULT_SUBJECT = 'stakeholders';
|
|
69
|
-
|
|
70
|
-
export const getFiltersConfig = ({ t, subject }) => {
|
|
71
|
-
const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
|
|
72
|
-
return registry?.config({ t });
|
|
73
|
-
};
|
|
17
|
+
export const getFiltersConfig = ({ t, subject }) => {
|
|
18
|
+
const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
|
|
19
|
+
return registry?.config({ t });
|
|
20
|
+
};
|
|
74
21
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
22
|
+
export const getFilterOptions = ({ t, subject, options }) => {
|
|
23
|
+
const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
|
|
24
|
+
return registry.options(options, t);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const getFormConfig = ({ subject }) => {
|
|
28
|
+
const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
|
|
29
|
+
return registry?.formConfig;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const getViewConfig = ({ subject }) => {
|
|
33
|
+
const registry = FILTER_REGISTRY[subject] || FILTER_REGISTRY[DEFAULT_SUBJECT];
|
|
34
|
+
return registry?.viewConfig;
|
|
35
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getFiltersConfig as getFiltersConfigStakeholders,
|
|
3
|
+
getFilterOptions as getFilterOptionsStakeholders,
|
|
4
|
+
formConfig as formConfigStakeholders,
|
|
5
|
+
viewConfig as viewConfigStakeholders
|
|
6
|
+
} from '../Stakeholders/config.js';
|
|
7
|
+
import { getColumns as getColumnsStakeholders } from "../Stakeholders/columns.js";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
getFiltersConfig as getFiltersConfigOperators,
|
|
11
|
+
getFilterOptions as getFilterOptionsOperators,
|
|
12
|
+
formConfig as formConfigOperators,
|
|
13
|
+
viewConfig as viewConfigOperators
|
|
14
|
+
} from '../Stakeholders/Operators/config.js';
|
|
15
|
+
import { getColumns as getColumnsOperators } from "../Stakeholders/Operators/columns.js";
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
getFiltersConfig as getFiltersConfigWorkers,
|
|
19
|
+
getFilterOptions as getFilterOptionsWorkers,
|
|
20
|
+
formConfig as formConfigWorkers,
|
|
21
|
+
viewConfig as viewConfigWorkers
|
|
22
|
+
} from '../Stakeholders/Workers/config.js';
|
|
23
|
+
import { getColumns as getColumnsWorkers } from "../Stakeholders/Workers/columns.js";
|
|
24
|
+
|
|
25
|
+
import {
|
|
26
|
+
getFiltersConfig as getFiltersConfigEvents,
|
|
27
|
+
getFilterOptions as getFilterOptionsEvents,
|
|
28
|
+
formConfig as formConfigEvents,
|
|
29
|
+
viewConfig as viewConfigEvents
|
|
30
|
+
} from '../Events/config.js';
|
|
31
|
+
import { getColumns as getColumnsEvents } from "../Events/columns.js";
|
|
32
|
+
|
|
33
|
+
import {
|
|
34
|
+
getFiltersConfig as getFiltersConfigActivities,
|
|
35
|
+
getFilterOptions as getFilterOptionsActivities,
|
|
36
|
+
formConfig as formConfigActivities,
|
|
37
|
+
viewConfig as viewConfigActivities
|
|
38
|
+
} from '../Events/Activities/config.js';
|
|
39
|
+
import { getColumns as getColumnsActivities } from "../Events/Activities/columns.js";
|
|
40
|
+
|
|
41
|
+
import {
|
|
42
|
+
getFiltersConfig as getFiltersConfigIncidents,
|
|
43
|
+
getFilterOptions as getFilterOptionsIncidents,
|
|
44
|
+
formConfig as formConfigIncidents,
|
|
45
|
+
viewConfig as viewConfigIncidents
|
|
46
|
+
} from '../Events/Incidents/config.js';
|
|
47
|
+
import { getColumns as getColumnsIncidents } from "../Events/Incidents/columns.js";
|
|
48
|
+
|
|
49
|
+
import {
|
|
50
|
+
getFiltersConfig as getFiltersConfigLocations,
|
|
51
|
+
getFilterOptions as getFilterOptionsLocations,
|
|
52
|
+
formConfig as formConfigLocations,
|
|
53
|
+
viewConfig as viewConfigLocations
|
|
54
|
+
} from '../Locations/config.js';
|
|
55
|
+
import { getColumns as getColumnsLocations } from "../Locations/columns.js";
|
|
56
|
+
|
|
57
|
+
import {
|
|
58
|
+
getFiltersConfig as getFiltersConfigProductionSites,
|
|
59
|
+
getFilterOptions as getFilterOptionsProductionSites,
|
|
60
|
+
formConfig as formConfigProductionSites,
|
|
61
|
+
viewConfig as viewConfigProductionSites
|
|
62
|
+
} from '../Locations/MineSite/config.js';
|
|
63
|
+
import { getColumns as getColumnsProductionSites } from "../Locations/MineSite/columns.js";
|
|
64
|
+
|
|
65
|
+
import {
|
|
66
|
+
getFiltersConfig as getFilterConfigDocuments,
|
|
67
|
+
getFilterOptions as getFilterOptionsDocuments,
|
|
68
|
+
formConfig as formConfigDocuments,
|
|
69
|
+
viewConfig as viewConfigDocuments
|
|
70
|
+
} from '../Documents/config.js';
|
|
71
|
+
import { getColumns as getColumnsDocuments } from "../Documents/columns.js";
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export const FILTER_REGISTRY = {
|
|
75
|
+
stakeholders: {
|
|
76
|
+
config: getFiltersConfigStakeholders,
|
|
77
|
+
options: getFilterOptionsStakeholders,
|
|
78
|
+
formConfig: formConfigStakeholders,
|
|
79
|
+
viewConfig: viewConfigStakeholders,
|
|
80
|
+
columns: getColumnsStakeholders,
|
|
81
|
+
},
|
|
82
|
+
workers: {
|
|
83
|
+
config: getFiltersConfigWorkers,
|
|
84
|
+
options: getFilterOptionsWorkers,
|
|
85
|
+
formConfig: formConfigWorkers,
|
|
86
|
+
viewConfig: viewConfigWorkers,
|
|
87
|
+
columns: getColumnsWorkers,
|
|
88
|
+
},
|
|
89
|
+
operators: {
|
|
90
|
+
config: getFiltersConfigOperators,
|
|
91
|
+
options: getFilterOptionsOperators,
|
|
92
|
+
formConfig: formConfigOperators,
|
|
93
|
+
viewConfig: viewConfigOperators,
|
|
94
|
+
columns: getColumnsOperators,
|
|
95
|
+
},
|
|
96
|
+
events: {
|
|
97
|
+
config: getFiltersConfigEvents,
|
|
98
|
+
options: getFilterOptionsEvents,
|
|
99
|
+
formConfig: formConfigEvents,
|
|
100
|
+
viewConfig: viewConfigEvents,
|
|
101
|
+
columns: getColumnsEvents,
|
|
102
|
+
},
|
|
103
|
+
activities: {
|
|
104
|
+
config: getFiltersConfigActivities,
|
|
105
|
+
options: getFilterOptionsActivities,
|
|
106
|
+
formConfig: formConfigActivities,
|
|
107
|
+
viewConfig: viewConfigActivities,
|
|
108
|
+
columns: getColumnsActivities,
|
|
109
|
+
},
|
|
110
|
+
incidents: {
|
|
111
|
+
config: getFiltersConfigIncidents,
|
|
112
|
+
options: getFilterOptionsIncidents,
|
|
113
|
+
formConfig: formConfigIncidents,
|
|
114
|
+
viewConfig: viewConfigIncidents,
|
|
115
|
+
columns: getColumnsIncidents,
|
|
116
|
+
},
|
|
117
|
+
locations: {
|
|
118
|
+
config: getFiltersConfigLocations,
|
|
119
|
+
options: getFilterOptionsLocations,
|
|
120
|
+
formConfig: formConfigLocations,
|
|
121
|
+
viewConfig: viewConfigLocations,
|
|
122
|
+
columns: getColumnsLocations,
|
|
123
|
+
},
|
|
124
|
+
'production-sites': {
|
|
125
|
+
config: getFiltersConfigProductionSites,
|
|
126
|
+
options: getFilterOptionsProductionSites,
|
|
127
|
+
formConfig: formConfigProductionSites,
|
|
128
|
+
viewConfig: viewConfigProductionSites,
|
|
129
|
+
columns: getColumnsProductionSites,
|
|
130
|
+
},
|
|
131
|
+
documents: {
|
|
132
|
+
config: getFilterConfigDocuments,
|
|
133
|
+
options: getFilterOptionsDocuments,
|
|
134
|
+
formConfig: formConfigDocuments,
|
|
135
|
+
viewConfig: viewConfigDocuments,
|
|
136
|
+
columns: getColumnsDocuments,
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const DEFAULT_SUBJECT = 'stakeholders';
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { useGetQueryParams } from "../../hooks/useGetQueryParams.js";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getFiltersConfig,
|
|
5
|
+
getFilterOptions,
|
|
6
|
+
getCheckboxConfig,
|
|
7
|
+
getSelectFiltersConfig,
|
|
8
|
+
getFormConfig,
|
|
9
|
+
getViewConfig
|
|
10
|
+
} from './config.js';
|
|
11
|
+
import { getColumns } from './columns.js';
|
|
4
12
|
|
|
5
13
|
export const useFetchData = ({
|
|
6
14
|
location,
|
|
@@ -38,7 +46,6 @@ export const useTablePage = ({
|
|
|
38
46
|
subject,
|
|
39
47
|
location,
|
|
40
48
|
getData,
|
|
41
|
-
getColumns,
|
|
42
49
|
extendingFilters,
|
|
43
50
|
options,
|
|
44
51
|
t,
|
|
@@ -98,6 +105,15 @@ export const useTablePage = ({
|
|
|
98
105
|
return getSelectFiltersConfig({ subject });
|
|
99
106
|
}, [subject, getSelectFiltersConfig]);
|
|
100
107
|
|
|
108
|
+
const formInfo = useMemo(() =>
|
|
109
|
+
getFormConfig({ subject }),
|
|
110
|
+
[subject, getFormConfig]
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
const viewConfig = useMemo(() =>
|
|
114
|
+
getViewConfig({ subject }),
|
|
115
|
+
[subject, getViewConfig]
|
|
116
|
+
);
|
|
101
117
|
const handleActiveTabChange = useCallback((value) => {
|
|
102
118
|
setActiveTab(value);
|
|
103
119
|
}, []);
|
|
@@ -119,5 +135,7 @@ export const useTablePage = ({
|
|
|
119
135
|
handleActiveTabChange,
|
|
120
136
|
checkboxConfig,
|
|
121
137
|
_filtersConfig,
|
|
138
|
+
formInfo,
|
|
139
|
+
viewConfig,
|
|
122
140
|
};
|
|
123
141
|
}
|
|
@@ -28,12 +28,8 @@ const TablePage = ({
|
|
|
28
28
|
formData: {},
|
|
29
29
|
formValue: {},
|
|
30
30
|
form: {},
|
|
31
|
-
namespace: '',
|
|
32
|
-
view: '',
|
|
33
|
-
scope: '',
|
|
34
|
-
formType: '',
|
|
35
|
-
defaultValues: {},
|
|
36
31
|
},
|
|
32
|
+
defaultValues = {},
|
|
37
33
|
extendingFilters = {},
|
|
38
34
|
getData = () => {},
|
|
39
35
|
getApiBaseUrl = () => {},
|
|
@@ -41,12 +37,7 @@ const TablePage = ({
|
|
|
41
37
|
applications = [],
|
|
42
38
|
subjectClear,
|
|
43
39
|
subject,
|
|
44
|
-
|
|
45
|
-
viewConfig = {
|
|
46
|
-
title: '',
|
|
47
|
-
breadcrumbs: [],
|
|
48
|
-
createTitle: '',
|
|
49
|
-
},
|
|
40
|
+
breadcrumbs = [],
|
|
50
41
|
onDownload,
|
|
51
42
|
}) => {
|
|
52
43
|
|
|
@@ -58,11 +49,12 @@ const TablePage = ({
|
|
|
58
49
|
handleActiveTabChange,
|
|
59
50
|
checkboxConfig,
|
|
60
51
|
_filtersConfig,
|
|
52
|
+
formInfo,
|
|
53
|
+
viewConfig,
|
|
61
54
|
} = useTablePage({
|
|
62
55
|
subject,
|
|
63
56
|
location,
|
|
64
57
|
getData,
|
|
65
|
-
getColumns,
|
|
66
58
|
extendingFilters,
|
|
67
59
|
options,
|
|
68
60
|
t,
|
|
@@ -78,8 +70,8 @@ const TablePage = ({
|
|
|
78
70
|
return (
|
|
79
71
|
<TablePageWithTabs
|
|
80
72
|
t={t}
|
|
81
|
-
title={t(viewConfig
|
|
82
|
-
breadCrumbs={
|
|
73
|
+
title={t(viewConfig?.title || "")}
|
|
74
|
+
breadCrumbs={breadcrumbs}
|
|
83
75
|
location={location}
|
|
84
76
|
loading={loading}
|
|
85
77
|
goTo={goTo}
|
|
@@ -97,7 +89,7 @@ const TablePage = ({
|
|
|
97
89
|
view={subject}
|
|
98
90
|
getActiveTab={handleActiveTabChange}
|
|
99
91
|
onDownload={onDownload && typeof onDownload === 'function' ? onDownload : undefined}
|
|
100
|
-
drawerTitle={t(viewConfig
|
|
92
|
+
drawerTitle={t(viewConfig?.createTitle || "")}
|
|
101
93
|
>
|
|
102
94
|
{({onDrawerClose}) => (
|
|
103
95
|
<Create
|
|
@@ -128,11 +120,11 @@ const TablePage = ({
|
|
|
128
120
|
formData={formConfig.formData}
|
|
129
121
|
formValue={formConfig.formValue}
|
|
130
122
|
form={formConfig.form}
|
|
131
|
-
namespace={
|
|
132
|
-
view={
|
|
133
|
-
scope={
|
|
134
|
-
formType={
|
|
135
|
-
defaultData={
|
|
123
|
+
namespace={formInfo.namespace}
|
|
124
|
+
view={formInfo.view}
|
|
125
|
+
scope={formInfo.scope}
|
|
126
|
+
formType={formInfo.formType}
|
|
127
|
+
defaultData={defaultValues}
|
|
136
128
|
/>
|
|
137
129
|
)}
|
|
138
130
|
</TablePageWithTabs>
|
|
@@ -48,12 +48,12 @@ class LinkedSubjectsService extends BaseService {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
getOne({ id, signal, namespace, sourceId }) {
|
|
51
|
+
getOne({ id, signal, namespace, sourceId, source, version }) {
|
|
52
52
|
return this.apiGet({
|
|
53
53
|
url: `/${namespace === "nashirikiEvent" ? "event" : namespace}/${id}`,
|
|
54
54
|
isApp: true,
|
|
55
55
|
signal,
|
|
56
|
-
params: { authorId: sourceId },
|
|
56
|
+
params: { authorId: sourceId, source, version },
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseService } from "./BaseService.js";
|
|
2
|
+
import { createLazyService } from "./helpers/LazyService.js";
|
|
3
|
+
|
|
4
|
+
class VersionService extends BaseService {
|
|
5
|
+
getSources({type,id, params}) {
|
|
6
|
+
return this.apiGet({
|
|
7
|
+
url: `/${type}/versions/${id}`,
|
|
8
|
+
params,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default createLazyService(VersionService);
|
|
@@ -76,6 +76,7 @@ export const renderTooltipJsx = ({
|
|
|
76
76
|
link,
|
|
77
77
|
onClickLink,
|
|
78
78
|
total,
|
|
79
|
+
isNewTab = false,
|
|
79
80
|
}) => {
|
|
80
81
|
return (
|
|
81
82
|
<>
|
|
@@ -116,25 +117,11 @@ export const renderTooltipJsx = ({
|
|
|
116
117
|
</div>
|
|
117
118
|
</div>
|
|
118
119
|
{link ? (
|
|
119
|
-
typeof onClickLink === "function" || typeof link !== "string" ? (
|
|
120
120
|
<div className="flex flex-column">
|
|
121
121
|
<div className="link-cont" onClick={onClickLink}>
|
|
122
|
-
<CustomIcon width={10} height={10} name="Link" />
|
|
122
|
+
<CustomIcon width={10} height={10} name={isNewTab ? "LinkNewTab" : "Link"} />
|
|
123
123
|
</div>
|
|
124
|
-
</div>
|
|
125
|
-
) : (
|
|
126
|
-
<div className="flex flex-column">
|
|
127
|
-
<a
|
|
128
|
-
href={link}
|
|
129
|
-
className="link-cont"
|
|
130
|
-
target="_blank"
|
|
131
|
-
rel="noopener noreferrer"
|
|
132
|
-
>
|
|
133
|
-
<CustomIcon width={10} height={10} name="LinkNewTab" />
|
|
134
|
-
</a>
|
|
135
|
-
</div>
|
|
136
|
-
)
|
|
137
|
-
) : null}
|
|
124
|
+
</div>) : null}
|
|
138
125
|
</div>
|
|
139
126
|
<div className="daf-tooltip-list">
|
|
140
127
|
{items &&
|
package/src/index.js
CHANGED
|
@@ -83,6 +83,7 @@ export { default as StatCard } from "./@daf/core/components/Dashboard/Widget/Sta
|
|
|
83
83
|
// Forms
|
|
84
84
|
export { default as ViewForm } from "./@daf/core/components/ViewForm/content.jsx";
|
|
85
85
|
export { default as ViewFormInput } from "./@daf/core/components/ViewForm/components/input.js";
|
|
86
|
+
export { default as Records } from "./@daf/core/components/ViewForm/components/Records/index.jsx";
|
|
86
87
|
export { default as DynamicForm } from "./@daf/core/components/DynamicForm/index.jsx";
|
|
87
88
|
export { EditForm } from "./@daf/core/components/EditForm/form.jsx";
|
|
88
89
|
export { Sections as EditFormSections } from "./@daf/core/components/EditForm/sections.jsx";
|
package/src/pages.js
CHANGED
|
@@ -13,6 +13,7 @@ export { default as IncidentsTable } from './@daf/pages/Events/Incidents/index.j
|
|
|
13
13
|
export { default as ProductionSitesTable } from './@daf/pages/Locations/MineSite/index.jsx';
|
|
14
14
|
export { default as UsersTable } from './@daf/core/components/Screens/Users/index.jsx';
|
|
15
15
|
export { default as PartnersTable } from './@daf/pages/Partners/index.jsx';
|
|
16
|
+
export { default as TablePage } from './@daf/pages/TablePage/index.jsx';
|
|
16
17
|
|
|
17
18
|
// Summary
|
|
18
19
|
export { default as OperatorSummary } from './@daf/pages/Summary/Operator/index.jsx';
|