datastake-daf 0.6.835 → 0.6.838
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 +720 -727
- package/dist/hooks/index.js +23 -11
- package/dist/pages/index.js +426 -196
- package/dist/services/index.js +7 -8
- package/dist/style/datastake/mapbox-gl.css +330 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/hook.js +3 -3
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/index.jsx +2 -6
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +0 -1
- package/src/@daf/hooks/useWidgetFetch.js +20 -7
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/KeyIndicators/config.js +2 -3
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/KeyIndicators/index.js +2 -2
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/MineSite/index.js +3 -3
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/config.js +206 -0
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +48 -0
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +154 -0
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +83 -0
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/RisksWidget/components/ProblemSolver/index.js +14 -7
- package/src/@daf/pages/Dashboards/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/config.js +10 -0
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/index.js +18 -13
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/RisksWidget/index.js +1 -1
- package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/index.js +17 -19
- package/src/@daf/pages/Summary/Activities/PlantingCycle/components/PlantingLocations/index.jsx +5 -5
- package/src/@daf/services/DashboardService.js +8 -8
- package/src/pages.js +1 -1
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/IncidentsTime/hook.js +0 -32
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/IncidentsTime/index.js +0 -73
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/ProblemSolver/hook.js +0 -86
- package/src/@daf/core/components/Screens/ConflictManagement/components/RisksWidget/components/TerritorialDistribution/config.js +0 -34
- /package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/MineSite/helper.js +0 -0
- /package/src/@daf/{core/components/Screens → pages/Dashboards}/ConflictManagement/components/RisksWidget/config.js +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useMemo, useEffect } from "react";
|
|
2
|
-
import Header from "../../Header/index.jsx";
|
|
3
2
|
import KeyIndicators from "./components/KeyIndicators/index.js";
|
|
4
|
-
import Multiselect from "../../Select/MultiSelect/index.jsx";
|
|
5
3
|
import MineSites from "./components/MineSite/index.js";
|
|
6
4
|
import RisksWidget from "./components/RisksWidget/index.js";
|
|
7
|
-
import { useSources } from "
|
|
8
|
-
import { renderBreadCrumbs } from "
|
|
9
|
-
import CustomIcon from "
|
|
5
|
+
import { useSources } from "../../../hooks/useSources.js";
|
|
6
|
+
import { renderBreadCrumbs } from "../../../../helpers/breadCrumbs.js";
|
|
7
|
+
import CustomIcon from "../../../core/components/Icon/CustomIcon.jsx";
|
|
8
|
+
import { Header, Multiselect } from "../../../../index.js";
|
|
9
|
+
import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx';
|
|
10
10
|
|
|
11
11
|
export default function ConflictManagement({
|
|
12
12
|
t=()=>{},
|
|
@@ -15,7 +15,9 @@ export default function ConflictManagement({
|
|
|
15
15
|
goTo = () => {},
|
|
16
16
|
getRedirectLink = (s) => s,
|
|
17
17
|
theme = {},
|
|
18
|
-
options = {}
|
|
18
|
+
options = {},
|
|
19
|
+
breadcrumbs = [],
|
|
20
|
+
|
|
19
21
|
}) {
|
|
20
22
|
const { partners, selectedPartners, setSelectedPartners, informationSources } =
|
|
21
23
|
useSources({ user, t });
|
|
@@ -45,8 +47,11 @@ export default function ConflictManagement({
|
|
|
45
47
|
}, [partners, user, theme]);
|
|
46
48
|
|
|
47
49
|
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
|
|
51
|
+
<DashboardLayout
|
|
52
|
+
|
|
53
|
+
header={
|
|
54
|
+
<Header
|
|
50
55
|
title={t("conflict-management")}
|
|
51
56
|
breadcrumbs={breadCrumbs}
|
|
52
57
|
supportText={
|
|
@@ -63,7 +68,6 @@ export default function ConflictManagement({
|
|
|
63
68
|
}
|
|
64
69
|
addedHeader={
|
|
65
70
|
<div>
|
|
66
|
-
<div className="flex-1" />
|
|
67
71
|
<Multiselect
|
|
68
72
|
options={[...sourceOptions]}
|
|
69
73
|
isAvatarGroup
|
|
@@ -82,12 +86,9 @@ export default function ConflictManagement({
|
|
|
82
86
|
/>
|
|
83
87
|
</div>
|
|
84
88
|
}
|
|
85
|
-
/>
|
|
89
|
+
/>}
|
|
90
|
+
>
|
|
86
91
|
|
|
87
|
-
<div className="content">
|
|
88
|
-
<div className="view-content">
|
|
89
|
-
<div className="daf-analysis-layout">
|
|
90
|
-
<div className="sections-cont w-pt">
|
|
91
92
|
<section>
|
|
92
93
|
<KeyIndicators
|
|
93
94
|
selectedPartners={selectedPartners}
|
|
@@ -126,11 +127,8 @@ export default function ConflictManagement({
|
|
|
126
127
|
options={options}
|
|
127
128
|
/>
|
|
128
129
|
</section>
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
</div>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
130
|
+
|
|
131
|
+
</DashboardLayout>
|
|
134
132
|
);
|
|
135
133
|
}
|
|
136
134
|
|
package/src/@daf/pages/Summary/Activities/PlantingCycle/components/PlantingLocations/index.jsx
CHANGED
|
@@ -64,11 +64,11 @@ const PlantingLocations = ({
|
|
|
64
64
|
) || locations[0];
|
|
65
65
|
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
const area = matchingLocation?.perimeter ? matchingLocation.perimeter.map(coord =>
|
|
68
|
+
Array.isArray(coord) && coord.length >= 2
|
|
69
|
+
? [coord[0], coord[1]]
|
|
70
|
+
: coord
|
|
71
|
+
) : null;
|
|
72
72
|
|
|
73
73
|
// Only include area if it has at least 3 valid coordinates
|
|
74
74
|
const validArea = area && Array.isArray(area) && area.length >= 3 ? area : null;
|
|
@@ -25,14 +25,14 @@ class DashboardService extends BaseService {
|
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
getWidgetConflictManagement(url, params, basepath = "dashboard/conflict-management") {
|
|
29
|
+
return this.apiGet({
|
|
30
|
+
url: `/${basepath}${url}`,
|
|
31
|
+
params,
|
|
32
|
+
isApp: true,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export default createLazyService(DashboardService);
|
package/src/pages.js
CHANGED
|
@@ -23,4 +23,4 @@ export { default as View } from './@daf/pages/View/index.jsx';
|
|
|
23
23
|
export { default as Edit } from './@daf/pages/Edit/index.jsx';
|
|
24
24
|
|
|
25
25
|
// Conflict Management
|
|
26
|
-
export { default as ConflictManagement } from './@daf/
|
|
26
|
+
export { default as ConflictManagement } from './@daf/pages/Dashboards/ConflictManagement/index.js'
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { useMemo, useState } from "react";
|
|
2
|
-
|
|
3
|
-
export default function useIncidentsTimeline({ t=()=>{}, options = {} }) {
|
|
4
|
-
const [filters, setFilters] = useState({ severity: "all" });
|
|
5
|
-
|
|
6
|
-
const filtersConfig = useMemo(
|
|
7
|
-
() => ({
|
|
8
|
-
filtersConfig: {
|
|
9
|
-
severity: {
|
|
10
|
-
type: "select",
|
|
11
|
-
label: "",
|
|
12
|
-
placeholder: (t) => t(""),
|
|
13
|
-
style: { flex: 1 },
|
|
14
|
-
labelStyle: { flex: 1 },
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
onApply: (val) => setFilters(val),
|
|
18
|
-
options: {
|
|
19
|
-
severity: [{ value: "all", label: t("All") }, ...(options?.severityOptions || [])],
|
|
20
|
-
},
|
|
21
|
-
selectedFilters: filters,
|
|
22
|
-
type: "small",
|
|
23
|
-
t,
|
|
24
|
-
}),
|
|
25
|
-
[t, filters, options?.severityOptions],
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
filters,
|
|
30
|
-
filtersConfig,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
-
import StackChart from "../../../../../../Charts/StackChart/index.jsx";
|
|
3
|
-
import Widget from "../../../../../../Dashboard/Widget/index.jsx";
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import useIncidentsTimeline from "./hook.js";
|
|
6
|
-
|
|
7
|
-
export default function IncidentsTime({ selectedRange, selectedPartners = {} ,t=()=>{},goTo=(s)=>s,getRedirectLink=(s)=>s, theme = {}, APP , options = {}}) {
|
|
8
|
-
const { filters, filtersConfig } = useIncidentsTimeline({ t, options });
|
|
9
|
-
const { user } = useSelector((state) => state.authentication);
|
|
10
|
-
|
|
11
|
-
const getSourceParam = useCallback((sourceId) => {
|
|
12
|
-
if (user?.company?.id !== sourceId) {
|
|
13
|
-
return `?sourceId=${sourceId}`;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return "";
|
|
17
|
-
}, [user?.company?.id]);
|
|
18
|
-
|
|
19
|
-
const defaultFetchConfig = useMemo(
|
|
20
|
-
() => ({
|
|
21
|
-
url: `/incidents-timeline`,
|
|
22
|
-
filters: {
|
|
23
|
-
...filters,
|
|
24
|
-
severity: filters.severity ? filters.severity : "all",
|
|
25
|
-
period: selectedRange,
|
|
26
|
-
sources: selectedPartners?.partners || [],
|
|
27
|
-
},
|
|
28
|
-
defaultData: [],
|
|
29
|
-
stop: selectedPartners?.loading,
|
|
30
|
-
}),
|
|
31
|
-
[filters, selectedRange, selectedPartners],
|
|
32
|
-
);
|
|
33
|
-
const renderSeverity = (val) => {
|
|
34
|
-
const colors = getColors("INCIDENTS", app);
|
|
35
|
-
|
|
36
|
-
switch (val) {
|
|
37
|
-
case "major":
|
|
38
|
-
return <span style={{ color: colors.major }}>{t("Major")}</span>;
|
|
39
|
-
case "minor":
|
|
40
|
-
return <span style={{ color: colors.minor }}>{t("Minor")}</span>;
|
|
41
|
-
case "moderate":
|
|
42
|
-
return <span style={{ color: colors.moderate }}>{t("Moderate")}</span>;
|
|
43
|
-
default:
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const chartConfig = {}; const { data, loading } = useWidgetFetch(defaultFetchConfig);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<Widget
|
|
53
|
-
loading={loading}
|
|
54
|
-
filtersConfig={filtersConfig}
|
|
55
|
-
title={t("Incidents Timeline")}
|
|
56
|
-
className="with-border-header"
|
|
57
|
-
t={t}
|
|
58
|
-
>
|
|
59
|
-
<StackChart {...chartConfig} height="400px" t={t} />
|
|
60
|
-
</Widget>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
IncidentsTime.propTypes = {
|
|
65
|
-
selectedRange: PropTypes.string,
|
|
66
|
-
selectedPartners: PropTypes.object,
|
|
67
|
-
t: PropTypes.func,
|
|
68
|
-
goTo: PropTypes.func,
|
|
69
|
-
getRedirectLink: PropTypes.func,
|
|
70
|
-
theme: PropTypes.object,
|
|
71
|
-
APP: PropTypes.string,
|
|
72
|
-
options: PropTypes.object,
|
|
73
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import DashboardService from "../../../../../../../../services/DashboardService.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default function useProblemSolvers(t = () => {}) {
|
|
6
|
-
const [filters, setFilters] = useState({
|
|
7
|
-
administrativeLevel1: "all",
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const [filterOptions, setFilterOptions] = useState([]);
|
|
11
|
-
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
async function fetchOptions() {
|
|
14
|
-
try {
|
|
15
|
-
const { data } = await DashboardService.getWidget({
|
|
16
|
-
url: "/problem-solvers",
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const rawOptions = Object.keys(data)
|
|
21
|
-
.map((agentKey) => {
|
|
22
|
-
const actions = data[agentKey]?.actions || [];
|
|
23
|
-
|
|
24
|
-
return actions
|
|
25
|
-
.map((action) => {
|
|
26
|
-
const lvl1 = action?.location?.administrativeLevel1;
|
|
27
|
-
const name =
|
|
28
|
-
action?.location?.name ||
|
|
29
|
-
action?.location?.administrativeLevel1 ||
|
|
30
|
-
null;
|
|
31
|
-
|
|
32
|
-
if (!lvl1 || !name) return undefined;
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
label: name,
|
|
36
|
-
value: lvl1,
|
|
37
|
-
};
|
|
38
|
-
})
|
|
39
|
-
.filter(Boolean);
|
|
40
|
-
})
|
|
41
|
-
.flat();
|
|
42
|
-
|
|
43
|
-
const unique = [
|
|
44
|
-
...new Map(rawOptions.map((item) => [item.value, item])).values(),
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
setFilterOptions(unique);
|
|
48
|
-
} catch (err) {
|
|
49
|
-
console.error("Problem Solvers fetch failed:", err);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
fetchOptions();
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const filtersConfig = useMemo(
|
|
58
|
-
() => ({
|
|
59
|
-
filtersConfig: {
|
|
60
|
-
administrativeLevel1: {
|
|
61
|
-
type: "select",
|
|
62
|
-
label: "",
|
|
63
|
-
placeholder: t("Select"),
|
|
64
|
-
style: { flex: 1 },
|
|
65
|
-
labelStyle: { flex: 1 },
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
onApply: (val) => setFilters(val),
|
|
69
|
-
options: {
|
|
70
|
-
administrativeLevel1: [
|
|
71
|
-
{ label: t("All"), value: "all" },
|
|
72
|
-
...filterOptions,
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
selectedFilters: filters,
|
|
76
|
-
type: "small",
|
|
77
|
-
t,
|
|
78
|
-
}),
|
|
79
|
-
[t, filters, filterOptions]
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
filters,
|
|
84
|
-
filtersConfig,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { useMemo, useState } from "react";
|
|
3
|
-
|
|
4
|
-
export default function useTerritorialDistribution({ t = (s)=>{s}, options = {} }) {
|
|
5
|
-
const [filters, setFilters] = useState({ filter1: 'all', filter2: 'all' });
|
|
6
|
-
|
|
7
|
-
const filtersConfig = useMemo((t) => ({
|
|
8
|
-
onApply: (val) => setFilters(val),
|
|
9
|
-
options: {
|
|
10
|
-
filter1: [{ label: t('All'), value: 'all' }],
|
|
11
|
-
filter2: [{ label: t('All'), value: 'all' }],
|
|
12
|
-
},
|
|
13
|
-
selectedFilters: filters,
|
|
14
|
-
type: 'small',
|
|
15
|
-
t,
|
|
16
|
-
}), [t, filters]);
|
|
17
|
-
|
|
18
|
-
return {
|
|
19
|
-
filters,
|
|
20
|
-
filtersConfig,
|
|
21
|
-
setFilters,
|
|
22
|
-
t,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const getColors = (theme) => {
|
|
27
|
-
return [
|
|
28
|
-
theme.colorPrimary8,
|
|
29
|
-
theme.colorPrimary7,
|
|
30
|
-
theme.colorPrimary5,
|
|
31
|
-
theme.colorPrimary6,
|
|
32
|
-
theme.colorPrimary4,
|
|
33
|
-
]
|
|
34
|
-
}
|
|
File without changes
|
|
File without changes
|