datastake-daf 0.6.759 → 0.6.760

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.
Files changed (44) hide show
  1. package/dist/components/index.js +924 -1046
  2. package/dist/constants/index.js +76 -0
  3. package/dist/pages/index.js +133 -311
  4. package/dist/services/index.js +91 -0
  5. package/dist/utils/index.js +388 -0
  6. package/package.json +1 -1
  7. package/rollup.config.js +20 -0
  8. package/src/@daf/core/components/EditForm/storyConfig2.js +866 -25029
  9. package/src/@daf/core/components/Screens/FindInformation/index.js +2 -1
  10. package/src/@daf/core/components/Screens/Users/columns.js +0 -6
  11. package/src/@daf/core/components/Table/NavigationAction/index.jsx +24 -0
  12. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  13. package/src/@daf/pages/Documents/columns.js +5 -22
  14. package/src/@daf/pages/Documents/index.jsx +2 -3
  15. package/src/@daf/pages/Events/Activities/columns.js +7 -59
  16. package/src/@daf/pages/Events/Activities/index.jsx +2 -3
  17. package/src/@daf/pages/Events/Incidents/columns.js +7 -61
  18. package/src/@daf/pages/Events/Incidents/index.jsx +2 -3
  19. package/src/@daf/pages/Events/columns.js +6 -47
  20. package/src/@daf/pages/Events/helper.js +14 -0
  21. package/src/@daf/pages/Events/index.jsx +2 -3
  22. package/src/@daf/pages/Locations/MineSite/columns.js +7 -12
  23. package/src/@daf/pages/Locations/MineSite/index.jsx +5 -4
  24. package/src/@daf/pages/Locations/columns.js +6 -32
  25. package/src/@daf/pages/Locations/index.jsx +2 -3
  26. package/src/@daf/pages/Partners/index.jsx +11 -0
  27. package/src/@daf/pages/Stakeholders/Operators/columns.js +2 -8
  28. package/src/@daf/pages/Stakeholders/Operators/index.jsx +2 -2
  29. package/src/@daf/pages/Stakeholders/Workers/columns.js +10 -49
  30. package/src/@daf/pages/Stakeholders/Workers/index.jsx +2 -3
  31. package/src/@daf/pages/Stakeholders/columns.js +4 -25
  32. package/src/@daf/pages/Stakeholders/index.jsx +2 -3
  33. package/src/@daf/pages/Summary/Minesite/components/LocationMap/index.js +0 -1
  34. package/src/@daf/pages/Summary/Minesite/index.jsx +2 -0
  35. package/src/@daf/pages/Summary/Operator/index.jsx +3 -1
  36. package/src/@daf/services/PartnerService.js +76 -0
  37. package/src/@daf/utils/tags.js +26 -0
  38. package/src/constants/breadCrumbs.js +22 -0
  39. package/src/constants.js +2 -0
  40. package/src/helpers/breadCrumbs.js +347 -0
  41. package/src/index.js +1 -1
  42. package/src/services.js +2 -1
  43. package/src/utils.js +5 -1
  44. package/dist/style/datastake/mapbox-gl.css +0 -330
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ const Partners = () => {
4
+ return (
5
+ <div>
6
+ <h1>Partners</h1>
7
+ </div>
8
+ );
9
+ };
10
+
11
+ export default Partners
@@ -1,17 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
- import { findOptions } from '../../../../helpers/StringHelper.js';
3
+ import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
5
  import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
6
6
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
8
  import MoreMenu from '../../../core/components/Table/MoreMenu/index.jsx';
9
- const getLinkValue = (value, linkingObject) => {
10
- if(linkingObject && linkingObject?.[value]) {
11
- return linkingObject?.[value]?.name;
12
- }
13
- return null;
14
- }
15
9
 
16
10
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
17
11
  {
@@ -153,7 +147,7 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
153
147
  return <div className="daf-default-cell" />;
154
148
  }
155
149
  const onClick = () => {
156
- const link = `/app/view/${subject}/${all.datastakeId}`;
150
+ let link = `/app/view/${subject}/${all.datastakeId}`;
157
151
  if (activeTab === "shared") {
158
152
  link += `?sourceId=${all?.authorId?.id}`;
159
153
  }
@@ -35,6 +35,7 @@ const OperatorsTable = ({
35
35
  extendingFilters = {},
36
36
  createDefaultValues = {},
37
37
  applications = [],
38
+ breadcrumbs = [],
38
39
  }) => {
39
40
  const [selectOptions, setSelectOptions] = useState();
40
41
  const [activeTab, setActiveTab] = useState('own');
@@ -52,7 +53,6 @@ const OperatorsTable = ({
52
53
  applications,
53
54
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
54
55
 
55
- const breadCrumbs = [];
56
56
 
57
57
  const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
58
58
 
@@ -95,7 +95,7 @@ const OperatorsTable = ({
95
95
  <TablePageWithTabs
96
96
  t={t}
97
97
  title={t("Operators")}
98
- breadCrumbs={breadCrumbs}
98
+ breadCrumbs={breadcrumbs}
99
99
  location={location}
100
100
  loading={loading}
101
101
  goTo={goTo}
@@ -2,41 +2,10 @@ import React from 'react';
2
2
  import { Tooltip, Tag } from 'antd';
3
3
  import { findOptions } from '../../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../../helpers/Forms.js';
5
- import CustomIcon from '../../../core/components/Icon/CustomIcon.jsx';
5
+ import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
6
6
  import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
7
7
  import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
8
-
9
- const getLinkValue = (value, linkingObject) => {
10
- if(linkingObject && linkingObject?.[value]) {
11
- return linkingObject?.[value]?.name;
12
- }
13
- return null;
14
- }
15
-
16
- export const renderStatusTag = ({ value, t = (s) => s }) => {
17
- const width = 87;
18
-
19
- switch (value) {
20
- case "edited":
21
- return (
22
- <Tag color="yellow" style={{ width }} className="text-center">
23
- {t("Edited")}
24
- </Tag>
25
- );
26
- case "submitted":
27
- return (
28
- <Tag color="green" style={{ width }} className="text-center">
29
- {t("Submitted")}
30
- </Tag>
31
- );
32
- default:
33
- return (
34
- <Tag color="blue" style={{ width }} className="text-center">
35
- {t("Private")}
36
- </Tag>
37
- );
38
- }
39
- };
8
+ import { renderStatusTag } from '../../../utils/tags.js';
40
9
 
41
10
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
42
11
  // {
@@ -164,23 +133,15 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
164
133
  return <div className="daf-default-cell" />;
165
134
  }
166
135
 
167
- const link = `/app/view/${subject}/${all.datastakeId}`;
136
+ const onClick = () => {
137
+ let link = `/app/view/${subject}/${all.datastakeId}`;
138
+ if (activeTab === "shared") {
139
+ link += `?sourceId=${all?.authorId?.id}`;
140
+ }
141
+ goTo(getRedirectLink(link));
142
+ };
168
143
 
169
- return <div style={{ display: "flex", justifyContent: "center" }}>
170
- <button
171
- onClick={() => goTo(getRedirectLink(link))}
172
- style={{
173
- cursor: 'pointer',
174
- border: 'none',
175
- background: 'transparent',
176
- padding: 0,
177
- display: 'flex',
178
- alignItems: 'center'
179
- }}
180
- >
181
- <CustomIcon name="Link" size={15} color={theme.baseGray70} />
182
- </button>
183
- </div>;
144
+ return <NavigationAction onClick={onClick} theme={theme} />;
184
145
  }
185
146
  }
186
147
  ].filter((column) => column.show !== false);
@@ -35,6 +35,7 @@ const WorkersTable = ({
35
35
  extendingFilters = {},
36
36
  createDefaultValues = {},
37
37
  applications = [],
38
+ breadcrumbs = [],
38
39
  }) => {
39
40
  const [selectOptions, setSelectOptions] = useState();
40
41
  const [activeTab, setActiveTab] = useState('own');
@@ -52,8 +53,6 @@ const WorkersTable = ({
52
53
  applications,
53
54
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, data, applications]);
54
55
 
55
- const breadCrumbs = [];
56
-
57
56
  const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
58
57
 
59
58
  const filters = useMemo(() => {
@@ -95,7 +94,7 @@ const WorkersTable = ({
95
94
  <TablePageWithTabs
96
95
  t={t}
97
96
  title={t("Workers")}
98
- breadCrumbs={breadCrumbs}
97
+ breadCrumbs={breadcrumbs}
99
98
  location={location}
100
99
  loading={loading}
101
100
  goTo={goTo}
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { Tooltip } from 'antd';
3
3
  import { findOptions } from '../../../helpers/StringHelper.js';
4
4
  import { renderDateFormatted } from '../../../helpers/Forms.js';
5
- import CustomIcon from '../../core/components/Icon/CustomIcon.jsx';
6
5
  import AvatarGroup from '../../core/components/AvatarGroup/index.jsx';
7
6
  import sourceAvatarConfig from '../../../helpers/sourceAvatarConfig.js';
8
- import MoreMenu from '../../core/components/Table/MoreMenu/index.jsx';
7
+ import NavigationAction from '../../core/components/Table/NavigationAction/index.jsx';
8
+
9
9
  export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, applications}) => [
10
10
  {
11
11
  dataIndex: 'datastakeId',
@@ -121,34 +121,13 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
121
121
  return <div className="daf-default-cell" />;
122
122
  }
123
123
  const onClick = () => {
124
- const link = `/app/view/${subject}/${all.datastakeId}`;
124
+ let link = `/app/view/${subject}/${all.datastakeId}`;
125
125
  if (activeTab === "shared") {
126
126
  link += `?sourceId=${all?.authorId?.id}`;
127
127
  }
128
128
  goTo(getRedirectLink(link));
129
129
  };
130
- const moreMenuItems = [
131
- {
132
- label: t("Details"),
133
- value: "details",
134
- onClick: onClick,
135
- },
136
- {
137
- label: t("Summary"),
138
- value: "Summary",
139
- onClick: () => {
140
- let link = `/app/summary/${subject}/${all.datastakeId}`
141
- if (activeTab === "shared") {
142
- link += `?sourceId=${all?.authorId?.id}`;
143
- }
144
- goTo(getRedirectLink(link));
145
- },
146
- // disabled: true,
147
- },
148
- ];
149
- return <div >
150
- <MoreMenu items={moreMenuItems} />
151
- </div>;
130
+ return <NavigationAction onClick={onClick} theme={theme} />;
152
131
  }
153
132
  }
154
133
  ].filter((column) => column.show !== false);
@@ -35,6 +35,7 @@ const StakeholdersTable = ({
35
35
  form = {},
36
36
  applications = [],
37
37
  subjectClear = () => {},
38
+ breadcrumbs = [],
38
39
  }) => {
39
40
  const [selectOptions, setSelectOptions] = useState();
40
41
  const [activeTab, setActiveTab] = useState("own");
@@ -50,8 +51,6 @@ const StakeholdersTable = ({
50
51
  applications,
51
52
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
52
53
 
53
- const breadCrumbs = [];
54
-
55
54
  const { paginationQuery, searchParams, otherParams } = useGetQueryParams({location});
56
55
 
57
56
  useEffect(() => {
@@ -89,7 +88,7 @@ const StakeholdersTable = ({
89
88
  <TablePageWithTabs
90
89
  t={t}
91
90
  title={t("Stakeholders")}
92
- breadCrumbs={breadCrumbs}
91
+ breadCrumbs={breadcrumbs}
93
92
  location={location}
94
93
  loading={loading}
95
94
  goTo={goTo}
@@ -1,7 +1,6 @@
1
1
  import React, { useMemo } from 'react'
2
2
  import Widget from '../../../../../core/components/Dashboard/Widget/index.jsx'
3
3
  import Map from '../../../../../core/components/Dashboard/Map/index.jsx'
4
- import { getLinkValue } from '../../../../../../helpers/StringHelper.js'
5
4
 
6
5
  const LocationMap = ({
7
6
  selectedPartners = {},
@@ -29,6 +29,7 @@ const MineSummary = ({
29
29
  getRedirectLink = () => {},
30
30
  goBack = () => {},
31
31
  onIdChange = () => {},
32
+ breadcrumbs = [],
32
33
  }) => {
33
34
  const {
34
35
  selectedItem,
@@ -70,6 +71,7 @@ const MineSummary = ({
70
71
  className="with-border-header h-w-btn-header no-px-body"
71
72
  goBackTo={!hasSelect && goBack}
72
73
  loading={loading}
74
+ breadcrumbs={breadcrumbs}
73
75
  addedHeaderFirst
74
76
  actionButtons={[
75
77
  {
@@ -29,7 +29,8 @@ const OperatorSummary = ({
29
29
  goTo = () => {},
30
30
  getRedirectLink = () => {},
31
31
  goBack = () => {},
32
- onIdChange = () => {}
32
+ onIdChange = () => {},
33
+ breadcrumbs = [],
33
34
  }) => {
34
35
  const {
35
36
  selectedItem,
@@ -70,6 +71,7 @@ const OperatorSummary = ({
70
71
  title={hasSelect ? t("Operator Review") : (singleItemData?.name || "") + " " + t("Summary")}
71
72
  className="with-border-header h-w-btn-header no-px-body"
72
73
  goBackTo={!hasSelect && goBack}
74
+ breadcrumbs={breadcrumbs}
73
75
  addedHeaderFirst
74
76
  actionButtons={[
75
77
  {
@@ -0,0 +1,76 @@
1
+ import { BaseService } from "./BaseService.js";
2
+ import { createLazyService } from "./helpers/LazyService.js";
3
+
4
+ class PartnerService extends BaseService {
5
+ get(tab, filters) {
6
+ const { page, pageSize, search, searchParams, ...rest } = filters;
7
+ const params = {
8
+ filters: rest,
9
+ pagination: {
10
+ skip: page,
11
+ take: pageSize,
12
+ },
13
+ };
14
+ if (search && searchParams.length > 0) {
15
+ params.search = {
16
+ qs: search,
17
+ fields: searchParams,
18
+ };
19
+ }
20
+
21
+ return this.apiGet({
22
+ url: "/partner",
23
+ isApp: true,
24
+ params,
25
+ });
26
+ }
27
+
28
+ create(data) {
29
+ return this.apiPost({
30
+ url: "/partner",
31
+ isApp: true,
32
+ data,
33
+ });
34
+ }
35
+
36
+ accept(id) {
37
+ return this.apiPut({ url: `/partner/approve/${id}`, isApp: true });
38
+ }
39
+
40
+ activate(id) {
41
+ return this.apiPut({ url: `/partner/activate/${id}`, isApp: true });
42
+ }
43
+
44
+ decline(id) {
45
+ return this.apiPut({ url: `/partner/decline/${id}`, isApp: true });
46
+ }
47
+
48
+ suspend(id) {
49
+ return this.apiPut({ url: `/partner/suspend/${id}`, isApp: true });
50
+ }
51
+
52
+ block(id) {
53
+ return this.apiPut({ url: `/partner/block/${id}`, isApp: true });
54
+ }
55
+
56
+ resendInvite(id) {
57
+ return this.apiPut({ url: `/partner/resendInvite/${id}`, isApp: true });
58
+ }
59
+
60
+ getSubjectSources({ id, namespace = "stakeholder" }) {
61
+ return this.apiGet({
62
+ url: `/${namespace}/sources-for-subject/${id}`,
63
+ isApp: true,
64
+ });
65
+ }
66
+
67
+ update(id, data) {
68
+ return this.apiPut({
69
+ url: `/partner/${id}`,
70
+ isApp: true,
71
+ data,
72
+ });
73
+ }
74
+ }
75
+
76
+ export default createLazyService(PartnerService);
@@ -0,0 +1,26 @@
1
+ import { Tag } from "antd";
2
+
3
+ export const renderStatusTag = ({ value, t = (s) => s }) => {
4
+ const width = 87;
5
+
6
+ switch (value) {
7
+ case "edited":
8
+ return (
9
+ <Tag color="yellow" style={{ width }} className="text-center">
10
+ {t("Edited")}
11
+ </Tag>
12
+ );
13
+ case "submitted":
14
+ return (
15
+ <Tag color="green" style={{ width }} className="text-center">
16
+ {t("Submitted")}
17
+ </Tag>
18
+ );
19
+ default:
20
+ return (
21
+ <Tag color="blue" style={{ width }} className="text-center">
22
+ {t("Private")}
23
+ </Tag>
24
+ );
25
+ }
26
+ };
@@ -0,0 +1,22 @@
1
+ export const defaultBreadCrumbsLabels = {
2
+ events: "Events",
3
+ accounts: "Accounts",
4
+ modules: "Modules",
5
+ settings: "Settings",
6
+ user: "Users",
7
+ analysis: "Analysis",
8
+ 'data-store': "Data Store",
9
+ data: "Data",
10
+ partners: "Partners",
11
+ locations: "Locations",
12
+ 'information-channels': 'Channels',
13
+ 'find-information': 'Query',
14
+ stakeholders: "Stakeholders",
15
+ documents: "Documents",
16
+ mines: "Mines",
17
+ summary: "Summary",
18
+ edit: "Edit",
19
+ details: "Details",
20
+ query: "Query",
21
+ channels: "Channels",
22
+ }
@@ -0,0 +1,2 @@
1
+ export { defaultBreadCrumbsLabels } from './constants/breadCrumbs.js';
2
+ export { CREATE_DRAWER_WIDTH, CREATE_DRAWER_WIDTH_LARGE } from './helpers/Forms.js';