datastake-daf 0.6.813 → 0.6.815
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +3181 -4417
- package/dist/hooks/index.js +4 -11
- package/dist/layouts/index.js +478 -464
- package/dist/pages/index.js +1123 -742
- package/dist/services/index.js +6 -56
- package/dist/utils/index.js +511 -492
- package/package.json +1 -1
- package/src/@daf/core/components/AuthForm/index.jsx +3 -12
- package/src/@daf/core/components/Dashboard/Map/ChainIcon/index.js +123 -104
- package/src/@daf/core/components/Icon/configs/index.js +3 -1
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/TopContributors/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/hook.js +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminDashboard/components/UserStatistics/UserGrowth/index.jsx +3 -1
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineLocation/index.jsx +51 -51
- package/src/@daf/core/components/Screens/Admin/AdminModals/CombineSubjects/index.jsx +1 -6
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewAccount/index.jsx +31 -56
- package/src/@daf/core/components/Screens/Admin/AdminModals/NewUser/index.jsx +10 -36
- package/src/@daf/core/components/Screens/Admin/AdminModals/TransferRights/index.jsx +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Accounts.jsx +10 -37
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Dashboard.jsx +2 -2
- package/src/@daf/core/components/Screens/Admin/AdminScreens/index.js +0 -2
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/helper.js +30 -22
- package/src/@daf/core/components/Screens/Admin/AdminTables/AccountTable/index.jsx +13 -25
- package/src/@daf/core/components/Screens/Admin/AdminTables/LocationTable/index.jsx +2 -17
- package/src/@daf/core/components/Screens/Admin/AdminTables/SubjectsTable/index.jsx +13 -27
- package/src/@daf/core/components/Screens/Admin/AdminTables/UserTable/index.jsx +1 -0
- package/src/@daf/core/components/Screens/Admin/AdminTables/components/index.jsx +2 -4
- package/src/@daf/core/components/Screens/Admin/AdminTables/hook.js +0 -3
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Edit/index.jsx +9 -12
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/Users/index.jsx +4 -16
- package/src/@daf/core/components/Screens/Admin/AdminViews/components/View/helpers.js +17 -9
- package/src/@daf/core/components/Screens/Admin/AdminViews/index.jsx +8 -9
- package/src/@daf/core/components/Screens/Admin/AppInvitation/index.jsx +99 -124
- package/src/@daf/core/components/Screens/Admin/adminRoutes.js +1 -48
- package/src/@daf/core/components/Table/index.jsx +11 -6
- package/src/@daf/hooks/useAdminDashboard.js +4 -7
- package/src/@daf/pages/Events/Activities/columns.js +15 -11
- package/src/@daf/pages/Events/Incidents/columns.js +15 -11
- package/src/@daf/pages/Events/Testimonials/columns.js +173 -0
- package/src/@daf/pages/Events/Testimonials/config.js +175 -0
- package/src/@daf/pages/Events/columns.js +7 -3
- package/src/@daf/pages/Locations/MineSite/columns.js +16 -11
- package/src/@daf/pages/Locations/columns.js +7 -3
- package/src/@daf/pages/Stakeholders/Operators/columns.js +16 -12
- package/src/@daf/pages/Stakeholders/Workers/columns.js +16 -12
- package/src/@daf/pages/Stakeholders/columns.js +8 -4
- package/src/@daf/pages/TablePage/helper.js +15 -0
- package/src/@daf/pages/View/hooks/useViewActions.js +0 -13
- package/src/@daf/pages/View/hooks/useViewPermissions.js +0 -16
- package/src/@daf/pages/View/index.jsx +4 -29
- package/src/@daf/services/AdminService.js +5 -47
- package/src/@daf/services/DashboardService.js +3 -3
- package/src/@daf/utils/filters.js +15 -13
- package/src/constants/locales/en/translation.js +0 -13
- package/src/helpers/copyToClipboard.js +0 -60
- package/src/helpers/errorHandling.js +142 -74
- package/src/utils.js +1 -1
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Documents.jsx +0 -81
- package/src/@daf/core/components/Screens/Admin/AdminScreens/Events.jsx +0 -77
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/column.js +0 -127
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/helper.js +0 -43
- package/src/@daf/core/components/Screens/Admin/AdminTables/DocumentsTable/index.jsx +0 -201
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/column.js +0 -146
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/helper.js +0 -58
- package/src/@daf/core/components/Screens/Admin/AdminTables/EventsTable/index.jsx +0 -176
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Tooltip, Tag } from 'antd';
|
|
3
|
+
import { findOptions, getLinkValue } from '../../../../helpers/StringHelper.js';
|
|
4
|
+
import { renderDateFormatted } from '../../../../helpers/Forms.js';
|
|
5
|
+
import AvatarGroup from '../../../core/components/AvatarGroup/index.jsx';
|
|
6
|
+
import sourceAvatarConfig from '../../../../helpers/sourceAvatarConfig.js';
|
|
7
|
+
import { getEventCategoryBySubject } from '../helper.js';
|
|
8
|
+
import { renderStatusTag } from '../../../utils/tags.js';
|
|
9
|
+
import NavigationAction from '../../../core/components/Table/NavigationAction/index.jsx';
|
|
10
|
+
|
|
11
|
+
export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink, theme, subject, data, applications}) => [
|
|
12
|
+
{
|
|
13
|
+
dataIndex: 'datastakeId',
|
|
14
|
+
title: t('ID'),
|
|
15
|
+
ellipsis: true,
|
|
16
|
+
show: true,
|
|
17
|
+
key: "datastakeId",
|
|
18
|
+
sorter: () => 0 + 0,
|
|
19
|
+
render: (v, all) => {
|
|
20
|
+
if (all.empty) {
|
|
21
|
+
return <div className="daf-default-cell" />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
dataIndex: 'name',
|
|
29
|
+
title: t('Title'),
|
|
30
|
+
ellipsis: true,
|
|
31
|
+
show: true,
|
|
32
|
+
key: "name",
|
|
33
|
+
sorter: () => 0 + 0,
|
|
34
|
+
render: (v, all) => {
|
|
35
|
+
if (all.empty) {
|
|
36
|
+
return <div className="daf-default-cell" />
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
title: t("type"),
|
|
44
|
+
dataIndex: "typeOfTestimonials",
|
|
45
|
+
key: "typeOfTestimonials",
|
|
46
|
+
sorter: () => 0 + 0,
|
|
47
|
+
show: true,
|
|
48
|
+
render: (title, all) => {
|
|
49
|
+
if (all.empty) {
|
|
50
|
+
return <div className="daf-default-cell" />;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const type = findOptions(title, data?.options?.testimonialsType);
|
|
54
|
+
|
|
55
|
+
return type ? <Tooltip title={type}>{type}</Tooltip> : '-';
|
|
56
|
+
},
|
|
57
|
+
ellipsis: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
title: t("Date"),
|
|
61
|
+
dataIndex: "date",
|
|
62
|
+
key: "date",
|
|
63
|
+
sorter: () => 0 + 0,
|
|
64
|
+
render: (date, all) => {
|
|
65
|
+
if (all.empty) {
|
|
66
|
+
return <div className="daf-default-cell" />;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
70
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
71
|
+
},
|
|
72
|
+
ellipsis: true,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
dataIndex: 'mineSite',
|
|
76
|
+
title: t('Location'),
|
|
77
|
+
ellipsis: true,
|
|
78
|
+
show: true,
|
|
79
|
+
render: (v, all) => {
|
|
80
|
+
if (all.empty) {
|
|
81
|
+
return <div className="daf-default-cell" />
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// const country = findOptions(v, data?.options?.positionSupplyChainOptions);
|
|
85
|
+
const mineSite = all?.location?.name
|
|
86
|
+
|
|
87
|
+
return mineSite ? <Tooltip title={mineSite}>{mineSite}</Tooltip> : '-';
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
dataIndex: 'eventCategory',
|
|
92
|
+
title: t('Category'),
|
|
93
|
+
ellipsis: true,
|
|
94
|
+
show: true,
|
|
95
|
+
render: (v, all) => {
|
|
96
|
+
if (all.empty) {
|
|
97
|
+
return <div className="daf-default-cell" />
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const eventCategory = findOptions(v, data?.options?.eventCategoryOptions || data?.options?.categoryOptions);
|
|
101
|
+
const categoryValue = getEventCategoryBySubject(eventCategory, subject);
|
|
102
|
+
|
|
103
|
+
return categoryValue ? <Tooltip title={categoryValue}>{categoryValue}</Tooltip> : '-';
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: t("Sources"),
|
|
108
|
+
dataIndex: "sources",
|
|
109
|
+
key: "sources",
|
|
110
|
+
show: activeTab !== "own",
|
|
111
|
+
render: (val, all) => {
|
|
112
|
+
if (all.empty) {
|
|
113
|
+
return <div className="daf-default-cell" />;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!val || val?.length === 0) {
|
|
117
|
+
return "-";
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
121
|
+
|
|
122
|
+
return <AvatarGroup items={sources} />;
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: t("Status"),
|
|
127
|
+
dataIndex: "status",
|
|
128
|
+
key: "status",
|
|
129
|
+
show: activeTab === "own",
|
|
130
|
+
render: (val, all) => {
|
|
131
|
+
if (all.empty) {
|
|
132
|
+
return <div className="daf-default-cell" />
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const _val = all?.published || all?.status === "submitted" ? "submitted" : val;
|
|
136
|
+
|
|
137
|
+
return renderStatusTag({ value: _val, t });
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
title: t("Last Update"),
|
|
142
|
+
dataIndex: "updatedAt",
|
|
143
|
+
key: "updatedAt",
|
|
144
|
+
render: (date, all) => {
|
|
145
|
+
if (all.empty) {
|
|
146
|
+
return <div className="daf-default-cell" />;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
150
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
151
|
+
},
|
|
152
|
+
ellipsis: true,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: 'actions',
|
|
156
|
+
title: "",
|
|
157
|
+
width: 60,
|
|
158
|
+
render: (_, all) => {
|
|
159
|
+
if (all.empty) {
|
|
160
|
+
return <div className="daf-default-cell" />;
|
|
161
|
+
}
|
|
162
|
+
const onClick = () => {
|
|
163
|
+
let link = `/app/view/${subject}/${all.datastakeId}`;
|
|
164
|
+
if (activeTab === "shared") {
|
|
165
|
+
link += `?sourceId=${all?.authorId?.id}`;
|
|
166
|
+
}
|
|
167
|
+
goTo(getRedirectLink(link));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
return <NavigationAction onClick={onClick} theme={theme} />;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
].filter((column) => column.show !== false);
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { getStatusOptions } from '../../../utils/filters';
|
|
2
|
+
|
|
3
|
+
export const getFiltersConfig = ({t}) => {
|
|
4
|
+
return {
|
|
5
|
+
timeframe: {
|
|
6
|
+
type: "timeframe",
|
|
7
|
+
label: "Timeframe",
|
|
8
|
+
style: { flex: 1 },
|
|
9
|
+
t: t,
|
|
10
|
+
},
|
|
11
|
+
country: {
|
|
12
|
+
type: 'select',
|
|
13
|
+
label: 'Country',
|
|
14
|
+
placeholder: () => `${t('Filter by')} ${t('Country').toLowerCase()}`,
|
|
15
|
+
style: { flex: 1 },
|
|
16
|
+
labelStyle: { flex: 1 },
|
|
17
|
+
getLabel: (option) => option.label,
|
|
18
|
+
getValue: (option) => option.value,
|
|
19
|
+
},
|
|
20
|
+
administrativeLevel1: {
|
|
21
|
+
type: 'ajaxSelect',
|
|
22
|
+
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
23
|
+
const { administrativeLevel1 } = options;
|
|
24
|
+
|
|
25
|
+
if (administrativeLevel1) {
|
|
26
|
+
if (options.country) {
|
|
27
|
+
const _item = administrativeLevel1[filters.country];
|
|
28
|
+
if (_item) {
|
|
29
|
+
if (_item[language]) {
|
|
30
|
+
return _item[language]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return t('Province');
|
|
37
|
+
},
|
|
38
|
+
placeholder: () => `${t('Filter by')} ${t('Province').toLowerCase()}`,
|
|
39
|
+
filters: (data) => ({
|
|
40
|
+
country: data.country,
|
|
41
|
+
level: 'level_1',
|
|
42
|
+
}),
|
|
43
|
+
show: (data) => !data.country,
|
|
44
|
+
disabled: (data) => !data.country,
|
|
45
|
+
mapper: { label: "name", value: "id" },
|
|
46
|
+
method: 'getOptions',
|
|
47
|
+
entity: 'AdministrativeLevel',
|
|
48
|
+
style: { flex: 1 },
|
|
49
|
+
labelStyle: { flex: 1 },
|
|
50
|
+
},
|
|
51
|
+
administrativeLevel2: {
|
|
52
|
+
type: 'ajaxSelect',
|
|
53
|
+
label: ({ t = (s) => s, options = {}, filters = {}, language = 'en' }) => {
|
|
54
|
+
const { administrativeLevel2 } = options;
|
|
55
|
+
|
|
56
|
+
if (administrativeLevel2) {
|
|
57
|
+
if (options.country) {
|
|
58
|
+
const _item = administrativeLevel2[filters.country];
|
|
59
|
+
if (_item) {
|
|
60
|
+
if (_item[language]) {
|
|
61
|
+
return _item[language]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return t('Province');
|
|
68
|
+
},
|
|
69
|
+
show: (data) => !(data.country && data.administrativeLevel1),
|
|
70
|
+
placeholder: () => `${t('Filter by')} ${t('Territory').toLowerCase()}`,
|
|
71
|
+
filters: (data) => ({
|
|
72
|
+
country: data.country,
|
|
73
|
+
level: 'level_2',
|
|
74
|
+
administrativeLevel1: data.administrativeLevel1,
|
|
75
|
+
}),
|
|
76
|
+
disabled: (data) => !(data.country && data.administrativeLevel1),
|
|
77
|
+
mapper: { label: "name", value: "id" },
|
|
78
|
+
method: 'getOptions',
|
|
79
|
+
entity: 'AdministrativeLevel',
|
|
80
|
+
style: { flex: 1 },
|
|
81
|
+
labelStyle: { flex: 1 },
|
|
82
|
+
},
|
|
83
|
+
eventCategory: {
|
|
84
|
+
type: 'select',
|
|
85
|
+
label: 'Category',
|
|
86
|
+
placeholder: () => `${t('Filter by')} ${t('Category').toLowerCase()}`,
|
|
87
|
+
style: { flex: 1 },
|
|
88
|
+
labelStyle: { flex: 1 },
|
|
89
|
+
getLabel: (option) => option.label,
|
|
90
|
+
getValue: (option) => option.value,
|
|
91
|
+
filterOptions: (val) => {
|
|
92
|
+
if (val) {
|
|
93
|
+
const { option, filters } = val
|
|
94
|
+
if (filters && option) {
|
|
95
|
+
const { filters: optionFilters } = option;
|
|
96
|
+
if (Array.isArray(optionFilters) && optionFilters.length) {
|
|
97
|
+
const { value, condition } = optionFilters[0];
|
|
98
|
+
if (condition === 'includes') {
|
|
99
|
+
return value.includes('corporation');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
// positionInTheMineralSupplyChain: {
|
|
108
|
+
// type: 'select',
|
|
109
|
+
// label: 'Position',
|
|
110
|
+
// placeholder: () => `${t('Filter by')} ${t('Position').toLowerCase()}`,
|
|
111
|
+
// style: { flex: 1 },
|
|
112
|
+
// labelStyle: { flex: 1 },
|
|
113
|
+
// getLabel: (option) => option.label,
|
|
114
|
+
// getValue: (option) => option.value,
|
|
115
|
+
// },
|
|
116
|
+
status: {
|
|
117
|
+
type: "select",
|
|
118
|
+
label: "Status",
|
|
119
|
+
placeholder: () => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
120
|
+
style: { flex: 1 },
|
|
121
|
+
labelStyle: { fley: 1 },
|
|
122
|
+
getLabel: (option) => option.label,
|
|
123
|
+
getValue: (option) => option.value,
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export const getFilterOptions = (options, t) => {
|
|
129
|
+
const {
|
|
130
|
+
timeframe = [],
|
|
131
|
+
statusOptions,
|
|
132
|
+
categoryOptions,
|
|
133
|
+
countries,
|
|
134
|
+
subCategory,
|
|
135
|
+
category,
|
|
136
|
+
stakeholderCategoryOptions,
|
|
137
|
+
stakeholderSubCategoriesOptions,
|
|
138
|
+
administrativeLevel1,
|
|
139
|
+
administrativeLevel2,
|
|
140
|
+
positionInMineralSupplyChainOptions,
|
|
141
|
+
subCategoriesOptions,
|
|
142
|
+
eventCategoryOptions,
|
|
143
|
+
} = options || {};
|
|
144
|
+
|
|
145
|
+
const _categoryOptions = (eventCategoryOptions || categoryOptions || [])?.map((item) => ({
|
|
146
|
+
value: item.value,
|
|
147
|
+
label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label,
|
|
148
|
+
}))
|
|
149
|
+
|
|
150
|
+
const _default = {
|
|
151
|
+
timeframe: timeframe,
|
|
152
|
+
status: getStatusOptions(t) || [],
|
|
153
|
+
eventCategory: _categoryOptions || [],
|
|
154
|
+
country: countries || [],
|
|
155
|
+
subCategory: subCategoriesOptions || [],
|
|
156
|
+
// category: category,
|
|
157
|
+
administrativeLevel1,
|
|
158
|
+
administrativeLevel2,
|
|
159
|
+
// positionInTheMineralSupplyChain: positionInMineralSupplyChainOptions || [],
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return _default;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const formConfig = {
|
|
166
|
+
namespace: 'testimonials',
|
|
167
|
+
view: 'testimonials',
|
|
168
|
+
scope: 'create',
|
|
169
|
+
formType: 'testimonial',
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const viewConfig = {
|
|
173
|
+
title: "Testimonials",
|
|
174
|
+
createTitle: "New Testimonial",
|
|
175
|
+
}
|
|
@@ -147,13 +147,17 @@ export const getColumns = ({ t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
147
147
|
key: "sources",
|
|
148
148
|
show: activeTab !== "own",
|
|
149
149
|
render: (val, all) => {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
if (all.empty) {
|
|
151
|
+
return <div className="daf-default-cell" />;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (!val || val?.length === 0) {
|
|
155
|
+
return "-";
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
const sources = sourceAvatarConfig(val, user, applications);
|
|
155
159
|
|
|
156
|
-
return <AvatarGroup items={sources}
|
|
160
|
+
return <AvatarGroup items={sources} />;
|
|
157
161
|
},
|
|
158
162
|
},
|
|
159
163
|
{
|
|
@@ -145,20 +145,25 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
145
145
|
return renderStatusTag({ value: _val, t });
|
|
146
146
|
},
|
|
147
147
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
render: (v, all) => {
|
|
148
|
+
{
|
|
149
|
+
title: t("Sources"),
|
|
150
|
+
dataIndex: "sources",
|
|
151
|
+
key: "sources",
|
|
152
|
+
show: activeTab !== "own",
|
|
153
|
+
render: (val, all) => {
|
|
155
154
|
if (all.empty) {
|
|
156
|
-
|
|
155
|
+
return <div className="daf-default-cell" />;
|
|
157
156
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
|
|
158
|
+
if (!val || val?.length === 0) {
|
|
159
|
+
return "-";
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
163
|
+
|
|
164
|
+
return <AvatarGroup items={sources} />;
|
|
161
165
|
},
|
|
166
|
+
},
|
|
162
167
|
{
|
|
163
168
|
id: 'actions',
|
|
164
169
|
title: "",
|
|
@@ -105,11 +105,15 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
105
105
|
return <div className="daf-default-cell" />;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
if (!val || val?.length === 0) {
|
|
109
|
+
return "-";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
109
113
|
|
|
110
|
-
|
|
114
|
+
return <AvatarGroup items={sources} />;
|
|
111
115
|
},
|
|
112
|
-
|
|
116
|
+
},
|
|
113
117
|
{
|
|
114
118
|
title: t("Last Update"),
|
|
115
119
|
dataIndex: "updatedAt",
|
|
@@ -116,21 +116,25 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
116
116
|
},
|
|
117
117
|
ellipsis: true,
|
|
118
118
|
},
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
{
|
|
120
|
+
title: t("Sources"),
|
|
121
|
+
dataIndex: "sources",
|
|
122
|
+
key: "sources",
|
|
123
|
+
show: activeTab !== "own",
|
|
124
|
+
render: (val, all) => {
|
|
125
|
+
if (all.empty) {
|
|
126
|
+
return <div className="daf-default-cell" />;
|
|
127
|
+
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
if (!val || val?.length === 0) {
|
|
130
|
+
return "-";
|
|
131
|
+
}
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
134
|
+
|
|
135
|
+
return <AvatarGroup items={sources} />;
|
|
133
136
|
},
|
|
137
|
+
},
|
|
134
138
|
{
|
|
135
139
|
title: t("Status"),
|
|
136
140
|
dataIndex: 'status',
|
|
@@ -101,20 +101,24 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
101
101
|
ellipsis: true,
|
|
102
102
|
},
|
|
103
103
|
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
title: t("Sources"),
|
|
105
|
+
dataIndex: "sources",
|
|
106
|
+
key: "sources",
|
|
107
|
+
show: activeTab !== "own",
|
|
108
|
+
render: (val, all) => {
|
|
109
|
+
if (all.empty) {
|
|
110
|
+
return <div className="daf-default-cell" />;
|
|
111
|
+
}
|
|
112
112
|
|
|
113
|
-
|
|
113
|
+
if (!val || val?.length === 0) {
|
|
114
|
+
return "-";
|
|
115
|
+
}
|
|
114
116
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
const sources = sourceAvatarConfig(val, user, applications);
|
|
118
|
+
|
|
119
|
+
return <AvatarGroup items={sources} />;
|
|
120
|
+
},
|
|
121
|
+
},
|
|
118
122
|
{
|
|
119
123
|
title: t("Status"),
|
|
120
124
|
dataIndex: "status",
|
|
@@ -43,7 +43,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
43
43
|
return <div className="daf-default-cell" />
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
const
|
|
46
|
+
const categoriesOptions = [...(options?.categoriesOptions || []), ...(options?.category || [])]
|
|
47
|
+
|
|
48
|
+
const category = findOptions(v, categoriesOptions);
|
|
47
49
|
|
|
48
50
|
return category ? <Tooltip title={category}>{category}</Tooltip> : '-';
|
|
49
51
|
},
|
|
@@ -58,7 +60,9 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
58
60
|
return <div className="daf-default-cell" />
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
const
|
|
63
|
+
const subCategoriesOptions = [...(options?.subCategoriesOptions || []), ...(options?.subCategory || [])];
|
|
64
|
+
|
|
65
|
+
const subCategory = findOptions(v, subCategoriesOptions);
|
|
62
66
|
|
|
63
67
|
return subCategory ? <Tooltip title={subCategory}>{subCategory}</Tooltip> : '-';
|
|
64
68
|
},
|
|
@@ -89,12 +93,12 @@ export const getColumns = ({t, goTo, user, options, activeTab, getRedirectLink,
|
|
|
89
93
|
return <div className="daf-default-cell" />;
|
|
90
94
|
}
|
|
91
95
|
if (!val || val?.length === 0) {
|
|
92
|
-
return "
|
|
96
|
+
return "-";
|
|
93
97
|
}
|
|
94
98
|
|
|
95
99
|
const sources = sourceAvatarConfig(val, user, applications);
|
|
96
100
|
|
|
97
|
-
return <AvatarGroup items={sources}
|
|
101
|
+
return <AvatarGroup items={sources} />;
|
|
98
102
|
},
|
|
99
103
|
},
|
|
100
104
|
{
|
|
@@ -45,6 +45,14 @@ import {
|
|
|
45
45
|
viewConfig as viewConfigIncidents
|
|
46
46
|
} from '../Events/Incidents/config.js';
|
|
47
47
|
import { getColumns as getColumnsIncidents } from "../Events/Incidents/columns.js";
|
|
48
|
+
|
|
49
|
+
import {
|
|
50
|
+
getFiltersConfig as getFiltersConfigTestimonials,
|
|
51
|
+
getFilterOptions as getFilterOptionsTestimonials,
|
|
52
|
+
formConfig as formConfigTestimonials,
|
|
53
|
+
viewConfig as viewConfigTestimonials
|
|
54
|
+
} from '../Events/Testimonials/config.js';
|
|
55
|
+
import { getColumns as getColumnsTestimonials } from "../Events/Testimonials/columns.js";
|
|
48
56
|
|
|
49
57
|
import {
|
|
50
58
|
getFiltersConfig as getFiltersConfigLocations,
|
|
@@ -123,6 +131,13 @@ export const FILTER_REGISTRY = {
|
|
|
123
131
|
viewConfig: viewConfigIncidents,
|
|
124
132
|
columns: getColumnsIncidents,
|
|
125
133
|
},
|
|
134
|
+
testimonials: {
|
|
135
|
+
config: getFiltersConfigTestimonials,
|
|
136
|
+
options: getFilterOptionsTestimonials,
|
|
137
|
+
formConfig: formConfigTestimonials,
|
|
138
|
+
viewConfig: viewConfigTestimonials,
|
|
139
|
+
columns: getColumnsTestimonials,
|
|
140
|
+
},
|
|
126
141
|
locations: {
|
|
127
142
|
config: getFiltersConfigLocations,
|
|
128
143
|
options: getFilterOptionsLocations,
|
|
@@ -17,8 +17,6 @@ export const useViewActions = ({
|
|
|
17
17
|
t,
|
|
18
18
|
viewConfig,
|
|
19
19
|
buttonActions,
|
|
20
|
-
canDelete,
|
|
21
|
-
deleteSubject,
|
|
22
20
|
}) => {
|
|
23
21
|
const [pageActions, setPageActions] = useState([]);
|
|
24
22
|
const [extraPageActions, setExtraPageActions] = useState([]);
|
|
@@ -52,12 +50,6 @@ export const useViewActions = ({
|
|
|
52
50
|
}
|
|
53
51
|
}
|
|
54
52
|
}
|
|
55
|
-
|
|
56
|
-
if(canDelete) {
|
|
57
|
-
if(viewConfig.deleteNamespaces.includes(namespace)){
|
|
58
|
-
actions.push(buttonActions.createDeleteButton(t, deleteSubject))
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
53
|
|
|
62
54
|
if (viewConfig.summaryNamespaces.includes(namespace)) {
|
|
63
55
|
extraActions.push(
|
|
@@ -66,11 +58,6 @@ export const useViewActions = ({
|
|
|
66
58
|
extraActions.push(
|
|
67
59
|
buttonActions.createRecordsButton(t, setOpenRecordsModal)
|
|
68
60
|
);
|
|
69
|
-
if(canDelete) {
|
|
70
|
-
if(viewConfig.deleteNamespaces.includes(namespace)){
|
|
71
|
-
extraActions.push(buttonActions.createDeleteButton(t, deleteSubject))
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
61
|
}
|
|
75
62
|
|
|
76
63
|
setPageActions(actions);
|
|
@@ -6,7 +6,6 @@ export const useViewPermissions = ({
|
|
|
6
6
|
namespaceOverrides = {
|
|
7
7
|
supportedNamespaces: {},
|
|
8
8
|
canEdit: {},
|
|
9
|
-
canDelete: {},
|
|
10
9
|
},
|
|
11
10
|
namespace,
|
|
12
11
|
user,
|
|
@@ -17,7 +16,6 @@ export const useViewPermissions = ({
|
|
|
17
16
|
viewConfig,
|
|
18
17
|
}) => {
|
|
19
18
|
const baseNamespaceKeys = Object.keys(namespaceConfig || {});
|
|
20
|
-
console.log({namespaceConfig})
|
|
21
19
|
|
|
22
20
|
const baseSupportedNamespaces = baseNamespaceKeys?.reduce((acc, key) => {
|
|
23
21
|
acc[key] = () => true;
|
|
@@ -57,19 +55,6 @@ export const useViewPermissions = ({
|
|
|
57
55
|
return canEditAction[namespace] ? canEditAction[namespace]() : false;
|
|
58
56
|
}, [namespace, data, user]);
|
|
59
57
|
|
|
60
|
-
const canDelete = useMemo(() => {
|
|
61
|
-
const basecanDeleteAction = baseNamespaceKeys.reduce((acc, key) => {
|
|
62
|
-
acc[key] = () => isUserData();
|
|
63
|
-
return acc;
|
|
64
|
-
}, {});
|
|
65
|
-
|
|
66
|
-
const canDeleteAction = {
|
|
67
|
-
...namespaceOverrides.canDelete,
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
return canDeleteAction[namespace] ? canDeleteAction[namespace]() : false;
|
|
71
|
-
}, [namespace, data, user, namespaceOverrides])
|
|
72
|
-
|
|
73
58
|
useEffect(() => {
|
|
74
59
|
if (data) {
|
|
75
60
|
if (typeof isSupportedNamespaces[namespace] === "function") {
|
|
@@ -84,7 +69,6 @@ export const useViewPermissions = ({
|
|
|
84
69
|
isSupportedNamespaces,
|
|
85
70
|
canEdit,
|
|
86
71
|
isSupported,
|
|
87
|
-
canDelete
|
|
88
72
|
}
|
|
89
73
|
|
|
90
74
|
}
|