datastake-daf 0.6.762 → 0.6.764

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 (47) hide show
  1. package/dist/components/index.js +205 -165
  2. package/dist/hooks/index.js +1 -5
  3. package/dist/layouts/index.js +36 -11
  4. package/dist/pages/index.js +1922 -1021
  5. package/dist/services/index.js +1 -21
  6. package/dist/utils/index.js +0 -6
  7. package/package.json +1 -1
  8. package/src/@daf/core/components/Graphs/StakeholderMappings/index.jsx +2 -0
  9. package/src/@daf/core/components/Graphs/components/BaseGraph.jsx +2 -1
  10. package/src/@daf/core/components/Screens/TableScreen/TablePageWithTabs/index.jsx +9 -4
  11. package/src/@daf/core/components/Screens/Users/config.js +0 -1
  12. package/src/@daf/core/components/Table/index.jsx +2 -2
  13. package/src/@daf/core/components/UI/KeyIndicatorNavigateLabel/index.jsx +29 -0
  14. package/src/@daf/hooks/useFilters.js +1 -3
  15. package/src/@daf/layouts/AppLayout/components/MobileDrawer/index.js +4 -2
  16. package/src/@daf/layouts/AppLayout/components/UserDropdown/index.js +23 -2
  17. package/src/@daf/layouts/AppLayout/index.jsx +2 -0
  18. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/config.js +7 -6
  19. package/src/@daf/pages/Dashboards/SupplyChain/components/ChartsContainer/components/GenderDistribution/index.js +2 -1
  20. package/src/@daf/pages/Dashboards/SupplyChain/components/KeyIndicators/config.js +29 -53
  21. package/src/@daf/pages/Dashboards/SupplyChain/index.jsx +2 -2
  22. package/src/@daf/pages/Dashboards/UserDashboard/components/DataCompilation/index.jsx +1 -0
  23. package/src/@daf/pages/Dashboards/UserDashboard/components/DataConsilidation/index.jsx +0 -1
  24. package/src/@daf/pages/Dashboards/UserDashboard/components/KeyIndicators/config.js +36 -70
  25. package/src/@daf/pages/Documents/index.jsx +9 -13
  26. package/src/@daf/pages/Events/Activities/index.jsx +8 -21
  27. package/src/@daf/pages/Events/Incidents/index.jsx +8 -21
  28. package/src/@daf/pages/Events/config.js +0 -1
  29. package/src/@daf/pages/Events/index.jsx +8 -20
  30. package/src/@daf/pages/Locations/MineSite/columns.js +3 -3
  31. package/src/@daf/pages/Locations/MineSite/config.js +0 -1
  32. package/src/@daf/pages/Locations/MineSite/index.jsx +8 -21
  33. package/src/@daf/pages/Locations/index.jsx +9 -12
  34. package/src/@daf/pages/Partners/columns.js +421 -0
  35. package/src/@daf/pages/Partners/config.js +32 -0
  36. package/src/@daf/pages/Partners/create.jsx +145 -0
  37. package/src/@daf/pages/Partners/edit.jsx +98 -0
  38. package/src/@daf/pages/Partners/hook.js +153 -0
  39. package/src/@daf/pages/Partners/index.jsx +233 -8
  40. package/src/@daf/pages/Stakeholders/Operators/index.jsx +8 -22
  41. package/src/@daf/pages/Stakeholders/Workers/index.jsx +8 -21
  42. package/src/@daf/pages/Stakeholders/index.jsx +9 -10
  43. package/src/@daf/pages/hook.js +34 -0
  44. package/src/@daf/services/PartnerService.js +1 -16
  45. package/src/helpers/breadCrumbs.js +0 -2
  46. package/src/index.js +1 -1
  47. package/src/pages.js +1 -0
@@ -1532,30 +1532,10 @@ var OperatorService$1 = createLazyService(OperatorService);
1532
1532
 
1533
1533
  class PartnerService extends BaseService {
1534
1534
  get(tab, filters) {
1535
- const {
1536
- page,
1537
- pageSize,
1538
- search,
1539
- searchParams,
1540
- ...rest
1541
- } = filters;
1542
- const params = {
1543
- filters: rest,
1544
- pagination: {
1545
- skip: page,
1546
- take: pageSize
1547
- }
1548
- };
1549
- if (search && searchParams.length > 0) {
1550
- params.search = {
1551
- qs: search,
1552
- fields: searchParams
1553
- };
1554
- }
1555
1535
  return this.apiGet({
1556
1536
  url: "/partner",
1557
1537
  isApp: true,
1558
- params
1538
+ params: filters
1559
1539
  });
1560
1540
  }
1561
1541
  create(data) {
@@ -14257,12 +14257,6 @@ const renderBreadCrumbs = ({
14257
14257
  return Boolean(cond); // Boolean condition
14258
14258
  };
14259
14259
  const config = breadCrumbConfig[view];
14260
- console.log({
14261
- config,
14262
- breadCrumbConfig,
14263
- breadCrumbsLabels,
14264
- condition
14265
- });
14266
14260
  if (config) {
14267
14261
  const conditionContext = {
14268
14262
  isDataStore,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.762",
3
+ "version": "0.6.764",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -163,6 +163,7 @@ function StakeholderMappings({
163
163
  t = (s) => s,
164
164
  emptyString = undefined,
165
165
  isPdf = false,
166
+ zoomOutTransition = false,
166
167
  }) {
167
168
  const reactFlowWrapper = useRef(null);
168
169
  const [nodes, setNodes] = useNodesState([]);
@@ -472,6 +473,7 @@ function StakeholderMappings({
472
473
 
473
474
  return (
474
475
  <BaseGraph
476
+ zoomOutTransition={zoomOutTransition}
475
477
  nodes={nodes}
476
478
  mandatoryNodesToFit={mandatoryNodesToFit}
477
479
  edges={edges}
@@ -33,6 +33,7 @@ const BaseGraph = forwardRef(function BaseGraph(
33
33
  withDuration = true,
34
34
  onFilterChange,
35
35
  isPdf,
36
+ zoomOutTransition = false,
36
37
  ...props
37
38
  },
38
39
  ref,
@@ -86,7 +87,7 @@ const BaseGraph = forwardRef(function BaseGraph(
86
87
  fitView={true} // zoom out on default
87
88
  fitViewOptions={{
88
89
  padding: 0.2, //zoom out on default
89
- // duration: withDuration ? 300 : undefined,
90
+ ...(zoomOutTransition ? { duration: withDuration ? 300 : undefined } : {}),
90
91
  }}
91
92
  {...props}
92
93
  >
@@ -25,10 +25,13 @@ const TablePageWithTabs = ({
25
25
  isMobile,
26
26
  view,
27
27
  getActiveTab = () => {},
28
- onDownload = () => {},
28
+ onDownload,
29
29
  downloadDisabled = false,
30
30
  drawerTitle = "",
31
31
  onCreateModalClose = () => {},
32
+ tabs = [],
33
+ headerTooltip,
34
+ drawerTooltip,
32
35
  children
33
36
  }) => {
34
37
  const params = new URLSearchParams(location?.search);
@@ -57,11 +60,12 @@ const TablePageWithTabs = ({
57
60
  icon: "Add",
58
61
  },
59
62
  ]}
60
- onDownload={onDownload}
63
+ onDownload={(onDownload && typeof onDownload === 'function') ? onDownload : undefined}
61
64
  downloadDisabled={downloadDisabled}
65
+ tooltip={headerTooltip}
62
66
  />
63
67
  <Tabs
64
- items={[
68
+ items={tabs.length > 0 ? tabs : [
65
69
  { label: t("All Data"), key: "all" },
66
70
  { label: t("Own Data"), key: "own" },
67
71
  { label: t("Partners"), key: "shared" },
@@ -109,13 +113,14 @@ const TablePageWithTabs = ({
109
113
  title={t(drawerTitle)}
110
114
  />
111
115
  }
116
+ tooltip={drawerTooltip}
112
117
  open={openCreateModal}
113
118
  onClose={() => setOpenCreateModal(false)}
114
119
  width={CREATE_DRAWER_WIDTH}
115
120
  bodyStyle={{ padding: 0 }}
116
121
  >
117
122
  {typeof children === 'function'
118
- ? children({ onDrawerClose: () => setOpenCreateModal(false) })
123
+ ? children({ onDrawerClose: () => setOpenCreateModal(false), open: openCreateModal })
119
124
  : children
120
125
  }
121
126
  </Drawer>
@@ -54,7 +54,6 @@ export const getFilterOptions = (options, t) => {
54
54
  timeframeOptions = [],
55
55
  userRoleOptions = [],
56
56
  } = options || {};
57
- console.log({options})
58
57
 
59
58
  const _default = {
60
59
  timeframe: timeframeOptions,
@@ -86,10 +86,10 @@ export default function DAFTable({
86
86
  }, [sourcesKey, sources, filtersConfig, t]);
87
87
 
88
88
  useEffect(() => {
89
- if (data) {
89
+ if (data && Array.isArray(data)) {
90
90
  setSource(data);
91
91
  }
92
- }, [data]);
92
+ }, [data, data.length]);
93
93
 
94
94
  const paginationPageSize = pagination?.pageSize;
95
95
  const dataSource = useMemo(() => {
@@ -0,0 +1,29 @@
1
+ import React from 'react'
2
+ import CustomIcon from '../../Icon/CustomIcon.jsx'
3
+
4
+ function KeyIndicatorNavigateLabel({
5
+ t,
6
+ getRedirectLink,
7
+ theme,
8
+ label,
9
+ link
10
+ }) {
11
+ return (
12
+ <div className="flex">
13
+ <div className="flex-1">{t(label)}</div>
14
+ <div
15
+ className="cursor-pointer"
16
+ onClick={() => window.open(getRedirectLink(link), '_blank')}
17
+ >
18
+ <CustomIcon
19
+ name="LinkNewTab"
20
+ width={16}
21
+ height={16}
22
+ color={theme.colorPrimary}
23
+ />
24
+ </div>
25
+ </div>
26
+ )
27
+ }
28
+
29
+ export default KeyIndicatorNavigateLabel
@@ -232,9 +232,7 @@ export const useFilters = ({
232
232
  }, [pagination]);
233
233
 
234
234
  const canGoPrev = useMemo(() => pagination.current !== 1, [pagination]);
235
- const canGoNext = useMemo(() => pagination.current !== totalPages && totalPages, [pagination, totalPages]);
236
-
237
- console.log({totalPages, pagination})
235
+ const canGoNext = useMemo(() => pagination.current !== totalPages && totalPages > 0, [pagination, totalPages]);
238
236
 
239
237
  const goPrev = () => {
240
238
  if (!canGoPrev) {
@@ -28,10 +28,12 @@ export default function MobileDrawer({
28
28
  isDev = false,
29
29
  selectedProject,
30
30
  theme = {},
31
+ dropdownItems = [],
31
32
  }) {
32
33
  const items = useMemo(() => sidenavConfig[mod] || [], [sidenavConfig, mod]);
34
+ const appsWithPartners = ['tazama', 'nashiriki', 'wazi', 'hatua'];
33
35
 
34
- const canViewPartners = useMemo(() => mod === 'tazama', [mod]);
36
+ const canViewPartners = useMemo(() => appsWithPartners.includes(mod), [mod]);
35
37
  const canViewProjects = checkPermission({
36
38
  permission: 'projects.canView',
37
39
  permissions: user?.role?.permissions
@@ -93,7 +95,7 @@ export default function MobileDrawer({
93
95
  {
94
96
  type: 'link',
95
97
  name: t('Partners'),
96
- path: `/app/${mod}/partners`,
98
+ path: `/app/partners`,
97
99
  isDashboard: true,
98
100
  visible: canViewPartners
99
101
  },
@@ -6,6 +6,7 @@ import { formatClassname } from '../../../../../helpers/ClassesHelper.js';
6
6
  import { useResizeContext } from '../../../../core/context/Resize/index.js';
7
7
  import { MOBILE_W } from '../../../../../constants/Style.js';
8
8
  import MobileDrawer from '../MobileDrawer/index.js';
9
+ import { userIsAdmin } from '../../../../../helpers/user.js';
9
10
 
10
11
  export const UserDropdownMenu = ({
11
12
  user,
@@ -24,11 +25,11 @@ export const UserDropdownMenu = ({
24
25
  isDev = false,
25
26
  theme = {},
26
27
  moduleInterfaceConfig = null,
28
+ dropdownItems = [],
27
29
  }) => {
28
30
  const resizeContext = useResizeContext();
29
31
  const { windowWidth } = resizeContext || {};
30
- const { userIsAdmin } = userHelpers;
31
- const isAdmin = useMemo(() => userIsAdmin?.(user), [user, userIsAdmin]);
32
+ const isAdmin = useMemo(() => userIsAdmin(user), [user]);
32
33
 
33
34
  // Add fallback for windowWidth
34
35
  const actualWidth = windowWidth || (typeof window !== 'undefined' ? window.innerWidth : 1920);
@@ -87,6 +88,7 @@ export const UserDropdownMenu = ({
87
88
  appName={appName}
88
89
  theme={theme}
89
90
  moduleInterfaceConfig={moduleInterfaceConfig}
91
+ dropdownItems={dropdownItems}
90
92
  />
91
93
  </div>
92
94
  ) : (
@@ -104,6 +106,25 @@ export const UserDropdownMenu = ({
104
106
  <p>{user?.firstName || ''} {user?.lastName || ''}</p>
105
107
  </div>
106
108
  <div className='list'>
109
+ {dropdownItems && dropdownItems
110
+ .filter((item) => {
111
+ if (typeof item.condition === 'function') {
112
+ return item.condition({ user, isAdmin, module, checkPermission, appName });
113
+ }
114
+ if ('condition' in item) {
115
+ return !!item.condition;
116
+ }
117
+ return true;
118
+ })
119
+ .map((item) => (
120
+ <div
121
+ key={item.key}
122
+ className='list-item'
123
+ onClick={() => handlegoTo(getRedirectLink(item.path))}
124
+ >
125
+ {item.name}
126
+ </div>
127
+ ))}
107
128
  {user.company && !isDemoEnv && canViewUsers && !isAdmin ? (
108
129
  <div
109
130
  className='list-item'
@@ -66,6 +66,7 @@ function AppLayout({
66
66
  updateLanguage,
67
67
  getUserOptions,
68
68
  selectedProject,
69
+ dropdownItems = [],
69
70
 
70
71
  // Navigation (injected from app)
71
72
  goTo = () => {},
@@ -414,6 +415,7 @@ function AppLayout({
414
415
  isDev={isDev}
415
416
  theme={theme}
416
417
  moduleInterfaceConfig={moduleInterfaceConfig}
418
+ dropdownItems={dropdownItems}
417
419
  />
418
420
  </div>
419
421
  </div>
@@ -1,9 +1,10 @@
1
-
2
- export const config = [
3
- { key: "male", label: "Male", color: "#4683DE" },
4
- { key: "female", label: "Female", color: "#A6C3EF" },
5
- { key: "other", label: "Other", color: "#B6CEF2" },
6
- ];
1
+ export const getConfig = (theme) => {
2
+ return [
3
+ { key: "male", label: "Male", color: theme.colorPrimary7 },
4
+ { key: "female", label: "Female", color: theme.colorPrimary4 },
5
+ { key: "other", label: "Other", color: theme.colorPrimary3 },
6
+ ]
7
+ }
7
8
 
8
9
  export const getRoleColors = (theme) => {
9
10
  return [
@@ -1,5 +1,5 @@
1
1
  import React, { useMemo, useCallback } from 'react'
2
- import { getRoleColors, config } from './config';
2
+ import { getRoleColors, getConfig } from './config';
3
3
  import PropTypes from 'prop-types';
4
4
  import { renderTooltipJsx } from '../../../../../../../utils/tooltip.js';
5
5
  import Widget from '../../../../../../../core/components/Dashboard/Widget/index.jsx';
@@ -15,6 +15,7 @@ function GenderDistribution({
15
15
  options = {},
16
16
  }) {
17
17
  const roleColors = getRoleColors(theme);
18
+ const config = getConfig(theme);
18
19
 
19
20
  const pieData = useMemo(() => {
20
21
  const total = Object.values(data).reduce((all, val) => all + (val || 0), 0);
@@ -1,20 +1,17 @@
1
1
  import React from "react";
2
2
  import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
3
+ import KeyIndicatorNavigateLabel from '../../../../../core/components/UI/KeyIndicatorNavigateLabel/index.jsx';
3
4
 
4
5
  export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
5
6
  {
6
7
  label: (
7
- <div className="flex">
8
- <div className="flex-1">{t("Identified Mine Sites")}</div>
9
- <div className="cursor-pointer" onClick={() => goTo(getRedirectLink("/app/scl"))}>
10
- <CustomIcon
11
- name="LinkNewTab"
12
- width={16}
13
- height={16}
14
- color={theme.colorPrimary}
15
- />
16
- </div>
17
- </div>
8
+ <KeyIndicatorNavigateLabel
9
+ t={t}
10
+ getRedirectLink={getRedirectLink}
11
+ theme={theme}
12
+ label="Identified Mine Sites"
13
+ link="/app/production-sites"
14
+ />
18
15
  ),
19
16
  render: () => {
20
17
  return <span>{data.mineSites ?? 0}</span>;
@@ -22,20 +19,13 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
22
19
  },
23
20
  {
24
21
  label: (
25
- <div className="flex">
26
- <div className="flex-1">{t("Identified Operators")}</div>
27
- <div
28
- className="cursor-pointer"
29
- onClick={() => goTo(getRedirectLink("/app/operators"))}
30
- >
31
- <CustomIcon
32
- name="LinkNewTab"
33
- width={16}
34
- height={16}
35
- color={theme.colorPrimary}
36
- />
37
- </div>
38
- </div>
22
+ <KeyIndicatorNavigateLabel
23
+ t={t}
24
+ getRedirectLink={getRedirectLink}
25
+ theme={theme}
26
+ label="Identified Operators"
27
+ link="/app/operators"
28
+ />
39
29
  ),
40
30
  render: () => <span>{data?.operators ?? 0}</span>,
41
31
  },
@@ -49,39 +39,25 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
49
39
  },
50
40
  {
51
41
  label: (
52
- <div className="flex">
53
- <div className="flex-1">{t("Associated Documents")}</div>
54
- <div
55
- className="cursor-pointer"
56
- onClick={() => goTo(getRedirectLink("/app/documents"))}
57
- >
58
- <CustomIcon
59
- name="LinkNewTab"
60
- width={16}
61
- height={16}
62
- color={theme.colorPrimary}
63
- />
64
- </div>
65
- </div>
42
+ <KeyIndicatorNavigateLabel
43
+ t={t}
44
+ getRedirectLink={getRedirectLink}
45
+ theme={theme}
46
+ label="Associated Documents"
47
+ link="/app/documents"
48
+ />
66
49
  ),
67
50
  render: () => <span>{data.documents ?? 0}</span>,
68
51
  },
69
52
  {
70
53
  label: (
71
- <div className="flex">
72
- <div className="flex-1">{t("Information Sources")}</div>
73
- <div
74
- className="cursor-pointer"
75
- onClick={() => goTo(getRedirectLink("/app/partners"))}
76
- >
77
- <CustomIcon
78
- name="LinkNewTab"
79
- width={16}
80
- height={16}
81
- color={theme.colorPrimary}
82
- />
83
- </div>
84
- </div>
54
+ <KeyIndicatorNavigateLabel
55
+ t={t}
56
+ getRedirectLink={getRedirectLink}
57
+ theme={theme}
58
+ label="Information Sources"
59
+ link="/app/partners"
60
+ />
85
61
  ),
86
62
  render: () => <span>{data.sources ?? 0}</span>,
87
63
  },
@@ -79,9 +79,9 @@ function SupplyChain({
79
79
  <section>
80
80
  <SupplyChainMap selectedSources={selectedPartners} t={t} goTo={goTo} options={options} getRedirectLink={getRedirectLink} />
81
81
  </section>
82
- <section>
82
+ {/* <section>
83
83
  <TradeRelationships selectedSources={selectedPartners} t={t} options={options} goTo={goTo} hardcodedData={hardcodedData} />
84
- </section>
84
+ </section> */}
85
85
  <section>
86
86
  <ChartsContainer selectedSources={selectedPartners} t={t} theme={theme} options={options} />
87
87
  </section>
@@ -16,6 +16,7 @@ function DataCompilation({
16
16
  title={t("Data Compilation")}
17
17
  className="with-border-header"
18
18
  expandable
19
+ defaultExpanded
19
20
  addedHeaderFirst
20
21
  addedHeader={
21
22
  <>
@@ -16,7 +16,6 @@ function DataConsilidation({
16
16
  title={t("Data Consolidation")}
17
17
  className="with-border-header"
18
18
  expandable
19
- defaultExpanded
20
19
  addedHeaderFirst
21
20
  addedHeader={
22
21
  <>
@@ -1,23 +1,17 @@
1
1
  import React from 'react';
2
2
  import CustomIcon from '../../../../../core/components/Icon/CustomIcon.jsx';
3
+ import KeyIndicatorNavigateLabel from '../../../../../core/components/UI/KeyIndicatorNavigateLabel/index.jsx';
3
4
 
4
5
  export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }) => [
5
6
  {
6
7
  label: (
7
- <div className="flex">
8
- <div className="flex-1">{t("Monitored Locations")}</div>
9
- <div
10
- className="cursor-pointer"
11
- onClick={() => goTo(getRedirectLink("/app/locations"))}
12
- >
13
- <CustomIcon
14
- name="LinkNewTab"
15
- width={16}
16
- height={16}
17
- color={theme.colorPrimary}
18
- />
19
- </div>
20
- </div>
8
+ <KeyIndicatorNavigateLabel
9
+ t={t}
10
+ getRedirectLink={getRedirectLink}
11
+ theme={theme}
12
+ label="Monitored Locations"
13
+ link="/app/locations"
14
+ />
21
15
  ),
22
16
  render: () => {
23
17
  return <span>{data.locations ?? 0}</span>;
@@ -25,39 +19,25 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
25
19
  },
26
20
  {
27
21
  label: (
28
- <div className="flex">
29
- <div className="flex-1">{t("Identified Stakeholders")}</div>
30
- <div
31
- className="cursor-pointer"
32
- onClick={() => goTo(getRedirectLink("/app/stakeholders"))}
33
- >
34
- <CustomIcon
35
- name="LinkNewTab"
36
- width={16}
37
- height={16}
38
- color={theme.colorPrimary}
39
- />
40
- </div>
41
- </div>
22
+ <KeyIndicatorNavigateLabel
23
+ t={t}
24
+ getRedirectLink={getRedirectLink}
25
+ theme={theme}
26
+ label="Identified Stakeholders"
27
+ link="/app/stakeholders"
28
+ />
42
29
  ),
43
30
  render: () => <span>{data?.stakeholders ?? 0}</span>,
44
31
  },
45
32
  {
46
33
  label: (
47
- <div className="flex">
48
- <div className="flex-1">{t("Corrective Actions")}</div>
49
- <div
50
- className="cursor-pointer"
51
- onClick={() => goTo(getRedirectLink("/app/activities"))}
52
- >
53
- <CustomIcon
54
- name="LinkNewTab"
55
- width={16}
56
- height={16}
57
- color={theme.colorPrimary}
58
- />
59
- </div>
60
- </div>
34
+ <KeyIndicatorNavigateLabel
35
+ t={t}
36
+ getRedirectLink={getRedirectLink}
37
+ theme={theme}
38
+ label="Activities"
39
+ link="/app/activities"
40
+ />
61
41
  ),
62
42
  render: () => {
63
43
  return (
@@ -73,20 +53,13 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
73
53
  },
74
54
  {
75
55
  label: (
76
- <div className="flex">
77
- <div className="flex-1">{t("Reported Incidents")}</div>
78
- <div
79
- className="cursor-pointer"
80
- onClick={() => goTo(getRedirectLink("/app/incidents"))}
81
- >
82
- <CustomIcon
83
- name="LinkNewTab"
84
- width={16}
85
- height={16}
86
- color={theme.colorPrimary}
87
- />
88
- </div>
89
- </div>
56
+ <KeyIndicatorNavigateLabel
57
+ t={t}
58
+ getRedirectLink={getRedirectLink}
59
+ theme={theme}
60
+ label="Reported Incidents"
61
+ link="/app/incidents"
62
+ />
90
63
  ),
91
64
  render: () => (
92
65
  <span>
@@ -100,20 +73,13 @@ export const getRowConfig = ({ t, data = {}, goTo, getRedirectLink, theme = {} }
100
73
  },
101
74
  {
102
75
  label: (
103
- <div className="flex">
104
- <div className="flex-1">{t("Information Sources")}</div>
105
- <div
106
- className="cursor-pointer"
107
- onClick={() => goTo(getRedirectLink("/app/partners"))}
108
- >
109
- <CustomIcon
110
- name="LinkNewTab"
111
- width={16}
112
- height={16}
113
- color={theme.colorPrimary}
114
- />
115
- </div>
116
- </div>
76
+ <KeyIndicatorNavigateLabel
77
+ t={t}
78
+ getRedirectLink={getRedirectLink}
79
+ theme={theme}
80
+ label="Information Sources"
81
+ link="/app/partners"
82
+ />
117
83
  ),
118
84
  render: () => <span>{data.sources ?? 0}</span>,
119
85
  },
@@ -5,6 +5,7 @@ import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } fro
5
5
  import { useGetQueryParams } from '../../hooks/useGetQueryParams.js';
6
6
  import StakeholdersCreate from './create.jsx';
7
7
  import { displayMessage } from '../../../helpers/messages.js';
8
+ import { useFetchData } from '../hook.js';
8
9
 
9
10
  const DocumentsTable = ({
10
11
  t = () => {},
@@ -35,6 +36,7 @@ const DocumentsTable = ({
35
36
  applications = [],
36
37
  subjectClear = () => {},
37
38
  breadcrumbs = [],
39
+ extendingFilters = {},
38
40
  }) => {
39
41
  const [selectOptions, setSelectOptions] = useState();
40
42
  const [activeTab, setActiveTab] = useState("own");
@@ -50,19 +52,13 @@ const DocumentsTable = ({
50
52
  applications,
51
53
  }), [t, goTo, user, options, activeTab, getRedirectLink, theme, applications]);
52
54
 
53
- const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({location});
54
-
55
- useEffect(() => {
56
- getData({
57
- pagination: paginationQuery,
58
- ...(Object.keys(otherParams).length > 0 && { filters: otherParams }),
59
- ...(Object.keys(searchParams).length > 0 && { search: searchParams }),
60
- tab: activeTab,
61
- sortBy: {
62
- [sortBy || "updatedAt"]: sortDir ? (sortDir === "ascend" ? 1 : -1) : -1,
63
- }
64
- }, 'documents')
65
- }, [paginationQuery, otherParams, searchParams, activeTab]);
55
+ useFetchData({
56
+ location,
57
+ getData,
58
+ activeTab,
59
+ extendingFilters,
60
+ subject: 'documents',
61
+ })
66
62
 
67
63
  const selectFiltersConfig = useMemo(() => {
68
64
  return getFiltersConfig({t});