datastake-daf 0.6.721 → 0.6.723
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 +13 -7
- package/dist/context/index.js +7 -1
- package/dist/hooks/index.js +21 -4659
- package/dist/pages/index.js +1481 -38
- package/dist/services/index.js +7 -1
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +18 -13
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/helper.js +1 -1
- package/src/@daf/hooks/useWidgetFetch.js +1 -0
- package/src/@daf/pages/dashboards/SupplyChain/components/ChartsContainer/components/Identification/hook.js +1 -1
- package/src/@daf/pages/dashboards/UserDashboard/components/AccumulationGraph/hook.js +139 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/AccumulationGraph/index.jsx +78 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/ContributionsGraph/helper.js +75 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/ContributionsGraph/hook.js +46 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/ContributionsGraph/index.jsx +49 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/CustomSegment/index.jsx +26 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/DataChainOfCustody/index.jsx +18 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/DataCompilation/index.jsx +69 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/DataConsilidation/index.jsx +72 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/KeyIndicators/config.js +120 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/KeyIndicators/index.jsx +52 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/MineSites/config.js +22 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/MineSites/helper.js +142 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/MineSites/index.jsx +209 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/Triangulation/config.js +20 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/Triangulation/hook.js +87 -0
- package/src/@daf/pages/dashboards/UserDashboard/components/Triangulation/index.jsx +68 -0
- package/src/@daf/pages/dashboards/UserDashboard/config.js +24 -24
- package/src/@daf/pages/dashboards/UserDashboard/index.jsx +56 -0
- package/src/@daf/services/AuthenticationService.js +7 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { useMemo, useCallback } from "react";
|
|
2
|
+
import { renderTooltipJsx } from '../../../../../utils/tooltip.js'
|
|
3
|
+
import { getConfig } from './config.js'
|
|
4
|
+
|
|
5
|
+
export const useTriangulation = ({ widgetData, t = () => {}, section, theme = {} }) => {
|
|
6
|
+
|
|
7
|
+
const config = useMemo(() => getConfig(theme), [theme]);
|
|
8
|
+
|
|
9
|
+
const data = useMemo(() => {
|
|
10
|
+
const data = {
|
|
11
|
+
singleSource: 0,
|
|
12
|
+
multipleSource: 0,
|
|
13
|
+
total: 0,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
Object.values(widgetData).forEach((val) => {
|
|
17
|
+
data.total += val?.total || 0;
|
|
18
|
+
data.singleSource += val?.singleSource || 0;
|
|
19
|
+
data.multipleSource += val?.multiSource || 0;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
singleSource: data.total > 0 ? Math.round((data.singleSource / data.total) * 100) : 0,
|
|
25
|
+
multipleSource:
|
|
26
|
+
data.total > 0 ? Math.round((data.multipleSource / data.total) * 100) : 0,
|
|
27
|
+
};
|
|
28
|
+
}, [widgetData]);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const pieData = useMemo(() => {
|
|
32
|
+
// console.log("data", data);
|
|
33
|
+
const total = Object.values(data).reduce((all, val) => all + (val || 0), 0);
|
|
34
|
+
return config.map((conf) => ({
|
|
35
|
+
percent: (data[conf.key] || 0) / total,
|
|
36
|
+
color: conf.color,
|
|
37
|
+
key: conf.key,
|
|
38
|
+
}));
|
|
39
|
+
}, [data]);
|
|
40
|
+
|
|
41
|
+
const isEmpty = useMemo(() => Object.keys(data).filter((k) => !!data[k]).length === 0, [data]);
|
|
42
|
+
|
|
43
|
+
const getTooltipChildren = useCallback(
|
|
44
|
+
(item) => {
|
|
45
|
+
if (isEmpty) {
|
|
46
|
+
return renderTooltipJsx({
|
|
47
|
+
title: t("Triangulation"),
|
|
48
|
+
items: config.map((conf) => ({
|
|
49
|
+
label: t(conf.label[section]),
|
|
50
|
+
color: conf.color,
|
|
51
|
+
value: "0%",
|
|
52
|
+
})),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const _config = config.find((c) => c.key === item.key);
|
|
57
|
+
|
|
58
|
+
if (_config) {
|
|
59
|
+
return renderTooltipJsx({
|
|
60
|
+
title: t(
|
|
61
|
+
section === "data-compilation"
|
|
62
|
+
? "nashiriki::Information Sharing"
|
|
63
|
+
: "Triangulation",
|
|
64
|
+
),
|
|
65
|
+
items: [
|
|
66
|
+
{
|
|
67
|
+
// color: _config.color,
|
|
68
|
+
label: t(_config.label[section]),
|
|
69
|
+
value: `${data[_config.key] || 0}%`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return null;
|
|
76
|
+
},
|
|
77
|
+
[t, data, section, isEmpty],
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
pieData,
|
|
82
|
+
isEmpty,
|
|
83
|
+
getTooltipChildren,
|
|
84
|
+
data,
|
|
85
|
+
config,
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useMemo, useCallback } from 'react'
|
|
2
|
+
import { useWidgetFetch } from '../../../../../hooks/useWidgetFetch.js'
|
|
3
|
+
import { getConfig } from './config.js'
|
|
4
|
+
import { renderTooltipJsx } from '../../../../../utils/tooltip.js'
|
|
5
|
+
import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx'
|
|
6
|
+
import PieChart from '../../../../../core/components/Charts/PieChart/chart.jsx'
|
|
7
|
+
import { useTriangulation } from './hook.js'
|
|
8
|
+
|
|
9
|
+
const defaultFetchConfig = {
|
|
10
|
+
basepath: "analytics",
|
|
11
|
+
url: "/widgets/triangulation",
|
|
12
|
+
defaultData: [],
|
|
13
|
+
filters: {},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function Triangulation({
|
|
17
|
+
section = "data-compilation",
|
|
18
|
+
tabSelected = "dataFlow",
|
|
19
|
+
t=() => {},
|
|
20
|
+
user = {},
|
|
21
|
+
theme = {}
|
|
22
|
+
}) {
|
|
23
|
+
const fetchConfig = useMemo(
|
|
24
|
+
() => ({
|
|
25
|
+
...defaultFetchConfig,
|
|
26
|
+
filters: {
|
|
27
|
+
section: section,
|
|
28
|
+
tabSelected: tabSelected,
|
|
29
|
+
},
|
|
30
|
+
stop: false,
|
|
31
|
+
}),
|
|
32
|
+
[tabSelected],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const { data: widgetData, loading } = useWidgetFetch({config: fetchConfig});
|
|
36
|
+
|
|
37
|
+
const { pieData, isEmpty, getTooltipChildren } = useTriangulation({ widgetData, theme, t, section });
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Widget
|
|
41
|
+
loading={loading}
|
|
42
|
+
title={t(
|
|
43
|
+
section === "data-compilation"
|
|
44
|
+
? "Information Sharing"
|
|
45
|
+
: "Triangulation",
|
|
46
|
+
)}
|
|
47
|
+
className="with-border-header flex-1 h-w-btn-header"
|
|
48
|
+
>
|
|
49
|
+
<div className="flex flex-1 flex-column justify-content-center pl-4 pr-4">
|
|
50
|
+
<div className="flex justify-content-center">
|
|
51
|
+
<PieChart
|
|
52
|
+
mouseXOffset={10}
|
|
53
|
+
mouseYOffset={10}
|
|
54
|
+
changeOpacityOnHover={false}
|
|
55
|
+
data={pieData}
|
|
56
|
+
doConstraints={false}
|
|
57
|
+
isPie
|
|
58
|
+
t={t}
|
|
59
|
+
isEmpty={isEmpty}
|
|
60
|
+
getTooltipChildren={getTooltipChildren}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
</Widget>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default Triangulation
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
export const getActionWidgetsConfig = ({ goTo, getRedirectLink, APP, t }) => [
|
|
2
2
|
...(APP === 'nashiriki' ? [{
|
|
3
3
|
icon: "MineSite",
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}] :
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
];
|
|
4
|
+
title: t("nashiriki::create-mine-site"),
|
|
5
|
+
onClick: () => goTo(getRedirectLink("/app/scl?create=true")),
|
|
6
|
+
}] : []),
|
|
7
|
+
{
|
|
8
|
+
icon: "FileEdit",
|
|
9
|
+
title: "Report Activity",
|
|
10
|
+
onClick: () => goTo(getRedirectLink("/app/corrective-actions?create=true")),
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
icon: "ReportIncidents",
|
|
14
|
+
title: "Report Incident",
|
|
15
|
+
onClick: () => goTo(getRedirectLink("/app/incident?create=true")),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
icon: "Search",
|
|
19
|
+
title: "Find Information",
|
|
20
|
+
onClick: () => goTo(getRedirectLink("/app/find-information")),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
icon: "Share",
|
|
24
|
+
title: "Share Information",
|
|
25
|
+
onClick: () => goTo(getRedirectLink("/app/partners")),
|
|
26
|
+
},
|
|
27
|
+
];
|
|
@@ -3,12 +3,23 @@ import { getActionWidgetsConfig } from './config'
|
|
|
3
3
|
import ActionWidget from '../../../core/components/Dashboard/Widget/ActionWidget/index.jsx'
|
|
4
4
|
import Header from '../../../core/components/Header/index.jsx'
|
|
5
5
|
import DashboardLayout from '../../../core/components/Dashboard/DashboardLayout/index.jsx'
|
|
6
|
+
import KeyIndicators from './components/KeyIndicators/index.jsx'
|
|
7
|
+
import MineSites from './components/MineSites/index.jsx'
|
|
8
|
+
import DataCompilation from './components/DataCompilation/index.jsx'
|
|
9
|
+
import DataConsilidation from './components/DataConsilidation/index.jsx'
|
|
6
10
|
|
|
7
11
|
function UserDashboard({
|
|
8
12
|
t = () => {},
|
|
9
13
|
goTo = () => {},
|
|
10
14
|
getRedirectLink = () => {},
|
|
11
15
|
APP,
|
|
16
|
+
theme = {},
|
|
17
|
+
partners,
|
|
18
|
+
selectedPartners,
|
|
19
|
+
setSelectedPartners,
|
|
20
|
+
informationSources,
|
|
21
|
+
user = {},
|
|
22
|
+
options = {},
|
|
12
23
|
}) {
|
|
13
24
|
|
|
14
25
|
const actionsWidgetsConfig = useMemo(
|
|
@@ -16,6 +27,14 @@ function UserDashboard({
|
|
|
16
27
|
[t, getRedirectLink, APP, t],
|
|
17
28
|
);
|
|
18
29
|
|
|
30
|
+
const informationSourcesCount = useMemo(() => {
|
|
31
|
+
return informationSources > 0
|
|
32
|
+
? informationSources
|
|
33
|
+
: selectedPartners?.partners?.length > 0
|
|
34
|
+
? selectedPartners?.partners?.length
|
|
35
|
+
: 0
|
|
36
|
+
}, [informationSources, selectedPartners]);
|
|
37
|
+
|
|
19
38
|
return (
|
|
20
39
|
<DashboardLayout
|
|
21
40
|
header={
|
|
@@ -35,6 +54,43 @@ function UserDashboard({
|
|
|
35
54
|
/>
|
|
36
55
|
))}
|
|
37
56
|
</section>
|
|
57
|
+
<section>
|
|
58
|
+
<KeyIndicators
|
|
59
|
+
theme={theme}
|
|
60
|
+
partners={informationSourcesCount}
|
|
61
|
+
t={t}
|
|
62
|
+
goTo={goTo}
|
|
63
|
+
getRedirectLink={getRedirectLink}
|
|
64
|
+
/>
|
|
65
|
+
</section>
|
|
66
|
+
<section>
|
|
67
|
+
<MineSites
|
|
68
|
+
t={t}
|
|
69
|
+
goTo={goTo}
|
|
70
|
+
getRedirectLink={getRedirectLink}
|
|
71
|
+
theme={theme}
|
|
72
|
+
selectedPartners={selectedPartners}
|
|
73
|
+
setSelectedPartners={setSelectedPartners}
|
|
74
|
+
partners={partners}
|
|
75
|
+
user={user}
|
|
76
|
+
options={options}
|
|
77
|
+
APP={APP}
|
|
78
|
+
/>
|
|
79
|
+
</section>
|
|
80
|
+
<section>
|
|
81
|
+
<DataCompilation
|
|
82
|
+
t={t}
|
|
83
|
+
user={user}
|
|
84
|
+
theme={theme}
|
|
85
|
+
/>
|
|
86
|
+
</section>
|
|
87
|
+
<section>
|
|
88
|
+
<DataConsilidation
|
|
89
|
+
t={t}
|
|
90
|
+
user={user}
|
|
91
|
+
theme={theme}
|
|
92
|
+
/>
|
|
93
|
+
</section>
|
|
38
94
|
|
|
39
95
|
</DashboardLayout>
|
|
40
96
|
)
|
|
@@ -128,7 +128,13 @@ class AuthenticationService extends BaseService {
|
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
inviteUser(payload) {
|
|
131
|
+
inviteUser(payload, id) {
|
|
132
|
+
if(id) {
|
|
133
|
+
return this.apiPost({
|
|
134
|
+
url: `/companies/${id}/invite`,
|
|
135
|
+
data: payload,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
132
138
|
return this.apiPost({
|
|
133
139
|
url: '/companies/invite',
|
|
134
140
|
data: payload,
|
package/build/favicon.ico
DELETED
|
Binary file
|
package/build/logo192.png
DELETED
|
Binary file
|
package/build/logo512.png
DELETED
|
Binary file
|
package/build/manifest.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
package/build/robots.txt
DELETED