datastake-daf 0.6.754 → 0.6.755
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 +56 -62
- package/dist/pages/index.js +702 -92
- package/package.json +1 -1
- package/src/@daf/core/components/Screens/Users/columns.js +216 -0
- package/src/@daf/core/components/Screens/Users/config.js +174 -0
- package/src/@daf/core/components/Screens/Users/create.jsx +63 -0
- package/src/@daf/core/components/Screens/Users/index.jsx +173 -0
- package/src/@daf/core/components/TableScreen/TablePageWithTabs/index.jsx +4 -4
- package/src/pages.js +1 -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
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/package.json
CHANGED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Modal, Tag, Typography, message ,Tooltip} from "antd";
|
|
3
|
+
|
|
4
|
+
import { renderDateFormatted } from '../../../../../helpers/Forms.js';
|
|
5
|
+
import MoreMenu from '../../../../core/components/Table/MoreMenu/index.jsx';
|
|
6
|
+
const getLinkValue = (value, linkingObject) => {
|
|
7
|
+
if(linkingObject && linkingObject?.[value]) {
|
|
8
|
+
return linkingObject?.[value]?.name;
|
|
9
|
+
}
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const getColumns = ({t, goTo, user, removeUser = () => {},
|
|
14
|
+
resendInvite = () => {},
|
|
15
|
+
setUserToEdit = () => {},
|
|
16
|
+
userRoles = [],
|
|
17
|
+
company = {},
|
|
18
|
+
canCreate = false,
|
|
19
|
+
app}) => [
|
|
20
|
+
// {
|
|
21
|
+
// dataIndex: 'datastakeId',
|
|
22
|
+
// title: t('ID'),
|
|
23
|
+
// ellipsis: true,
|
|
24
|
+
// show: true,
|
|
25
|
+
// render: (v, all) => {
|
|
26
|
+
// if (all.empty) {
|
|
27
|
+
// return <div className="daf-default-cell" />
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
// return <Tooltip title={v}>{v}</Tooltip>;
|
|
31
|
+
// },
|
|
32
|
+
// },
|
|
33
|
+
{
|
|
34
|
+
dataIndex: 'firstName',
|
|
35
|
+
title: t('Name'),
|
|
36
|
+
ellipsis: true,
|
|
37
|
+
show: true,
|
|
38
|
+
render: (v, all) => {
|
|
39
|
+
if (all.empty) {
|
|
40
|
+
return <div className="daf-default-cell" />
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
dataIndex: 'lastName',
|
|
48
|
+
title: t('Last Name'),
|
|
49
|
+
ellipsis: true,
|
|
50
|
+
show: true,
|
|
51
|
+
render: (v, all) => {
|
|
52
|
+
if (all.empty) {
|
|
53
|
+
return <div className="daf-default-cell" />
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
dataIndex: 'email',
|
|
61
|
+
title: t('Email'),
|
|
62
|
+
ellipsis: true,
|
|
63
|
+
show: true,
|
|
64
|
+
render: (v, all) => {
|
|
65
|
+
if (all.empty) {
|
|
66
|
+
return <div className="daf-default-cell" />
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return <Tooltip title={v}>{v}</Tooltip>;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
title: t("Status"),
|
|
75
|
+
dataIndex: "status",
|
|
76
|
+
key: "status",
|
|
77
|
+
width: 150,
|
|
78
|
+
ellipsis: false,
|
|
79
|
+
show: true,
|
|
80
|
+
render: (status, users) => {
|
|
81
|
+
if (users.empty) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (status === "inactive") {
|
|
86
|
+
return (
|
|
87
|
+
<Tag color="red" style={{ width: 100, textAlign: "center" }}>
|
|
88
|
+
{t("Blocked")}
|
|
89
|
+
</Tag>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (status === "active") {
|
|
94
|
+
return (
|
|
95
|
+
<Tag color="green" style={{ width: 100, textAlign: "center" }}>
|
|
96
|
+
{t("Active")}
|
|
97
|
+
</Tag>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Tag color="orange" style={{ width: 100, textAlign: "center" }}>
|
|
103
|
+
{t("Pending")}
|
|
104
|
+
</Tag>
|
|
105
|
+
);
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: t("Last Login"),
|
|
110
|
+
dataIndex: "lastLogin",
|
|
111
|
+
key: "lastLogin",
|
|
112
|
+
width: 125,
|
|
113
|
+
render: (date, all) => {
|
|
114
|
+
if (all.empty) {
|
|
115
|
+
return <div className="daf-default-cell" />;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const _date = date ? renderDateFormatted(date, "DD MMM YYYY", user?.language || 'en') : "-";
|
|
119
|
+
return <Tooltip title={_date}>{_date}</Tooltip>;
|
|
120
|
+
},
|
|
121
|
+
ellipsis: true,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
title: t("User Role"),
|
|
125
|
+
dataIndex: "roleName",
|
|
126
|
+
key: "role",
|
|
127
|
+
show: true,
|
|
128
|
+
render: (val, all) => {
|
|
129
|
+
if (all.empty) {
|
|
130
|
+
return <div className="daf-default-cell" />;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Display role name if available, fallback to role ID
|
|
134
|
+
const displayValue = val || all.role;
|
|
135
|
+
return <Tooltip title={displayValue}>{displayValue}</Tooltip>;
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
title: t(""),
|
|
140
|
+
key: "actions",
|
|
141
|
+
width: 60,
|
|
142
|
+
show: removeUser || setUserToEdit,
|
|
143
|
+
render: (row, all) => {
|
|
144
|
+
if (all.empty) {
|
|
145
|
+
return <div className="daf-default-cell" />;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const _v = userRoles?.find((r) => r.value === all.role);
|
|
149
|
+
|
|
150
|
+
const items = [
|
|
151
|
+
removeUser
|
|
152
|
+
? {
|
|
153
|
+
key: "removeUser",
|
|
154
|
+
onClick: () => {
|
|
155
|
+
Modal.confirm({
|
|
156
|
+
title: t(
|
|
157
|
+
"Are you sure you want to remove this user from your organisation?",
|
|
158
|
+
),
|
|
159
|
+
onOk: () => removeUser(all.id),
|
|
160
|
+
cancelText: t("No"),
|
|
161
|
+
okText: "Yes",
|
|
162
|
+
closable: true,
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
label: t("Remove User"),
|
|
166
|
+
}
|
|
167
|
+
: null,
|
|
168
|
+
setUserToEdit ? {
|
|
169
|
+
key: "editPermission",
|
|
170
|
+
onClick: () => setUserToEdit(all),
|
|
171
|
+
disabled: all.isAdmin || _v?.isForAppAdmin,
|
|
172
|
+
label: t("Edit Permissions"),
|
|
173
|
+
}
|
|
174
|
+
: null,
|
|
175
|
+
all.invitationToken && canCreate
|
|
176
|
+
? {
|
|
177
|
+
key: "copyLink",
|
|
178
|
+
onClick: () => {
|
|
179
|
+
if (location.pathname.includes(`/${APP}`)) {
|
|
180
|
+
navigator.clipboard.writeText(
|
|
181
|
+
`${window.location.host}/${app}/r/${company.inviteToken}/${all.invitationToken}`,
|
|
182
|
+
);
|
|
183
|
+
} else {
|
|
184
|
+
navigator.clipboard.writeText(
|
|
185
|
+
`${window.location.host}/r/${company.inviteToken}/${all.invitationToken}`,
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
message.info({ content: t("Invitation link copied") });
|
|
189
|
+
},
|
|
190
|
+
label: t("Copy Invitation Link"),
|
|
191
|
+
}
|
|
192
|
+
: null,
|
|
193
|
+
all.invitationToken && canCreate
|
|
194
|
+
? {
|
|
195
|
+
key: "resendInvite",
|
|
196
|
+
onClick: () => {
|
|
197
|
+
Modal.confirm({
|
|
198
|
+
title: t(
|
|
199
|
+
"Are you sure you want to invite this user again? This user will receive a new notification",
|
|
200
|
+
),
|
|
201
|
+
onOk: () => resendInvite(all.id),
|
|
202
|
+
cancelText: t("No"),
|
|
203
|
+
okText: "Yes",
|
|
204
|
+
closable: true,
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
label: t("Resend Invite"),
|
|
208
|
+
}
|
|
209
|
+
: null,
|
|
210
|
+
];
|
|
211
|
+
|
|
212
|
+
return <MoreMenu items={items} />;
|
|
213
|
+
},
|
|
214
|
+
client: false,
|
|
215
|
+
},
|
|
216
|
+
].filter((column) => column.show !== false);
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export const checkboxConfig = {
|
|
2
|
+
name: 'Name',
|
|
3
|
+
datastakeId: 'ID'
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const getFiltersConfig = ({t}) => {
|
|
7
|
+
return {
|
|
8
|
+
email: {
|
|
9
|
+
type: 'text',
|
|
10
|
+
label: 'Email',
|
|
11
|
+
placeholder: (t) => `${t('Filter by')} ${t('Email').toLowerCase()}`,
|
|
12
|
+
style: { flex: 1 },
|
|
13
|
+
labelStyle: { flex: 1 },
|
|
14
|
+
getLabel: (option) => option.label,
|
|
15
|
+
getValue: (option) => option.value,
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
status: {
|
|
20
|
+
type: "select",
|
|
21
|
+
label: "Status",
|
|
22
|
+
placeholder: (t) => `${t("Filter by")} ${t("Status").toLowerCase()}`,
|
|
23
|
+
style: { flex: 1 },
|
|
24
|
+
labelStyle: { fley: 1 },
|
|
25
|
+
getLabel: (option) => option.label,
|
|
26
|
+
getValue: (option) => option.value,
|
|
27
|
+
},
|
|
28
|
+
timeframe: {
|
|
29
|
+
type: "timeframe",
|
|
30
|
+
label: "Timeframe",
|
|
31
|
+
placeholder: (t) => `${t("Filter by")} ${t("Timeframe").toLowerCase()}`,
|
|
32
|
+
style: { flex: 1 },
|
|
33
|
+
labelStyle: { flex: 1 },
|
|
34
|
+
},
|
|
35
|
+
userRole: {
|
|
36
|
+
type: "select",
|
|
37
|
+
label: "User Role",
|
|
38
|
+
placeholder: (t) => `${t("Filter by")} ${t("User Role").toLowerCase()}`,
|
|
39
|
+
style: { flex: 1 },
|
|
40
|
+
labelStyle: { flex: 1 },
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const filtersConfig = {
|
|
46
|
+
name: '',
|
|
47
|
+
datastakeId: '',
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getFilterOptions = (options, t) => {
|
|
51
|
+
const {
|
|
52
|
+
emailOptions = [],
|
|
53
|
+
statusOptions = [],
|
|
54
|
+
timeframeOptions = [],
|
|
55
|
+
userRoleOptions = [],
|
|
56
|
+
} = options || {};
|
|
57
|
+
console.log({options})
|
|
58
|
+
|
|
59
|
+
const _default = {
|
|
60
|
+
timeframe: timeframeOptions,
|
|
61
|
+
email: emailOptions,
|
|
62
|
+
status: statusOptions,
|
|
63
|
+
userRole: userRoleOptions,
|
|
64
|
+
status: [
|
|
65
|
+
{
|
|
66
|
+
value: "active",
|
|
67
|
+
label: "Active",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
value: "pending",
|
|
71
|
+
label: "Pending",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return _default;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const getUserForm = ({ t, userRoles = [], APP }) => {
|
|
80
|
+
return {
|
|
81
|
+
user: {
|
|
82
|
+
position: 0,
|
|
83
|
+
firstName: {
|
|
84
|
+
group: "user",
|
|
85
|
+
section: "user",
|
|
86
|
+
moduleScope: {
|
|
87
|
+
cadd: ["scoping", "new", "linking-extra"],
|
|
88
|
+
pme: ["scoping", "new", "linking-extra"],
|
|
89
|
+
},
|
|
90
|
+
label: t("First Name"),
|
|
91
|
+
comment: false,
|
|
92
|
+
type: "text",
|
|
93
|
+
rules: [
|
|
94
|
+
{
|
|
95
|
+
required: true,
|
|
96
|
+
message: "This field is required",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
mergeStrategy: "simple",
|
|
100
|
+
position: 1,
|
|
101
|
+
},
|
|
102
|
+
lastName: {
|
|
103
|
+
group: "user",
|
|
104
|
+
section: "user",
|
|
105
|
+
moduleScope: {
|
|
106
|
+
cadd: ["scoping", "new", "linking-extra"],
|
|
107
|
+
pme: ["scoping", "new", "linking-extra"],
|
|
108
|
+
},
|
|
109
|
+
label: t("Last Name"),
|
|
110
|
+
comment: false,
|
|
111
|
+
type: "text",
|
|
112
|
+
rules: [
|
|
113
|
+
{
|
|
114
|
+
required: true,
|
|
115
|
+
message: "This field is required",
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
mergeStrategy: "simple",
|
|
119
|
+
position: 2,
|
|
120
|
+
},
|
|
121
|
+
email: {
|
|
122
|
+
group: "user",
|
|
123
|
+
section: "user",
|
|
124
|
+
moduleScope: {
|
|
125
|
+
cadd: ["scoping", "new", "linking-extra"],
|
|
126
|
+
pme: ["scoping", "new", "linking-extra"],
|
|
127
|
+
},
|
|
128
|
+
label: t("Email"),
|
|
129
|
+
comment: false,
|
|
130
|
+
type: "text",
|
|
131
|
+
rules: [
|
|
132
|
+
{
|
|
133
|
+
required: true,
|
|
134
|
+
message: "This field is required",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: "email",
|
|
138
|
+
message: "errors::field must be email",
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
mergeStrategy: "simple",
|
|
142
|
+
position: 3,
|
|
143
|
+
},
|
|
144
|
+
role: {
|
|
145
|
+
group: "user",
|
|
146
|
+
section: "user",
|
|
147
|
+
moduleScope: {
|
|
148
|
+
cadd: ["scoping", "new", "linking", "linking-extra", "admin"],
|
|
149
|
+
pme: ["scoping", "new", "linking", "linking-extra", "admin"],
|
|
150
|
+
},
|
|
151
|
+
label: t("User Role"),
|
|
152
|
+
placeholder: t("User Role"),
|
|
153
|
+
comment: false,
|
|
154
|
+
type: "select",
|
|
155
|
+
options: userRoles
|
|
156
|
+
.filter((r) => r.canBeAssignedToSubUsers && r.app === APP)
|
|
157
|
+
.map((v) => ({
|
|
158
|
+
label: t(v.label),
|
|
159
|
+
value: v.value,
|
|
160
|
+
})),
|
|
161
|
+
optionsName: "userRoles",
|
|
162
|
+
// tooltip: <UserRolePopover t={t} />,
|
|
163
|
+
sortOptions: true,
|
|
164
|
+
rules: [
|
|
165
|
+
{
|
|
166
|
+
required: true,
|
|
167
|
+
message: "This field is required",
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
position: 4,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { getUserForm } from './config.js';
|
|
3
|
+
import DynamicForm from '../../../../core/components/DynamicForm/index.jsx';
|
|
4
|
+
|
|
5
|
+
const UsersCreate = ({
|
|
6
|
+
onSubmitted = () => {},
|
|
7
|
+
onCancel = () => {},
|
|
8
|
+
user = {},
|
|
9
|
+
APP,
|
|
10
|
+
query,
|
|
11
|
+
goTo = () => {},
|
|
12
|
+
t = () => {},
|
|
13
|
+
ajaxForms = {},
|
|
14
|
+
changeAjaxForms = () => {},
|
|
15
|
+
ajaxOptions = {},
|
|
16
|
+
changeAjaxOptions = () => {},
|
|
17
|
+
getAppHeader = () => {},
|
|
18
|
+
getApiBaseUrl = () => {},
|
|
19
|
+
userToEdit = null,
|
|
20
|
+
userRoles = [],
|
|
21
|
+
}) => {
|
|
22
|
+
const disabledInputs = useMemo(() => !userToEdit ? [] : ['firstName', 'lastName', 'email'], [userToEdit]);
|
|
23
|
+
const data = useMemo(() => ({ ...(userToEdit || {}), userRole: userToEdit?.role }), [userToEdit]);
|
|
24
|
+
const form = useMemo(() => getUserForm({ t, userRoles, APP }), [t, userRoles, APP]);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div className="daf-create-form">
|
|
28
|
+
<DynamicForm
|
|
29
|
+
form={form}
|
|
30
|
+
data={data}
|
|
31
|
+
showSaveAndNext={false}
|
|
32
|
+
module={APP}
|
|
33
|
+
onCancel={onCancel}
|
|
34
|
+
isCreate
|
|
35
|
+
t={t}
|
|
36
|
+
user={user}
|
|
37
|
+
ajaxForms={ajaxForms}
|
|
38
|
+
ajaxOptions={ajaxOptions}
|
|
39
|
+
getAppHeader={getAppHeader}
|
|
40
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
41
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
42
|
+
app={APP}
|
|
43
|
+
query={query}
|
|
44
|
+
goTo={goTo}
|
|
45
|
+
changeAjaxForms={changeAjaxForms}
|
|
46
|
+
disabledInputs={disabledInputs}
|
|
47
|
+
submit={(payload) => {
|
|
48
|
+
onSubmitted({
|
|
49
|
+
...payload,
|
|
50
|
+
apps: {
|
|
51
|
+
[APP]: {
|
|
52
|
+
...((userToEdit?.apps || {})[APP] || {}),
|
|
53
|
+
role: payload.role,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default UsersCreate
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import React, { useMemo, useState, useEffect } from 'react'
|
|
2
|
+
import { Drawer } from 'antd'
|
|
3
|
+
import { getColumns } from './columns.js';
|
|
4
|
+
import { checkboxConfig, getFiltersConfig, filtersConfig, getFilterOptions } from './config.js';
|
|
5
|
+
import { useGetQueryParams } from '../../../../hooks/useGetQueryParams.js';
|
|
6
|
+
import UsersCreate from './create.jsx';
|
|
7
|
+
import Header from '../../../../core/components/Header/index.jsx';
|
|
8
|
+
import BaseScreen from '../BaseScreen/index.jsx';
|
|
9
|
+
import { CREATE_DRAWER_WIDTH } from '../../../../../helpers/Forms.js';
|
|
10
|
+
import DrawerHeader from '../../../../core/components/Header/DrawerHeader/index.jsx';
|
|
11
|
+
|
|
12
|
+
const UsersTable = ({
|
|
13
|
+
t = () => {},
|
|
14
|
+
goTo = () => {},
|
|
15
|
+
user = {},
|
|
16
|
+
options = {},
|
|
17
|
+
getRedirectLink = () => {},
|
|
18
|
+
theme = {},
|
|
19
|
+
loading = false,
|
|
20
|
+
data = {},
|
|
21
|
+
isMobile,
|
|
22
|
+
APP,
|
|
23
|
+
location,
|
|
24
|
+
getData = () => {},
|
|
25
|
+
getApiBaseUrl = () => {},
|
|
26
|
+
getAppHeader = () => {},
|
|
27
|
+
onInviteUser = () => {},
|
|
28
|
+
onEditUser = () => {},
|
|
29
|
+
query = {},
|
|
30
|
+
ajaxForms = {},
|
|
31
|
+
changeAjaxForms = () => {},
|
|
32
|
+
ajaxOptions = {},
|
|
33
|
+
changeAjaxOptions = () => {},
|
|
34
|
+
extendingFilters = {},
|
|
35
|
+
userRoles = [],
|
|
36
|
+
}) => {
|
|
37
|
+
const [selectOptions, setSelectOptions] = useState();
|
|
38
|
+
const params = new URLSearchParams(location?.search);
|
|
39
|
+
const [openCreateModal, setOpenCreateModal] = useState(params.has("create"));
|
|
40
|
+
const [userToEdit, setUserToEdit] = useState(null);
|
|
41
|
+
|
|
42
|
+
const columns = useMemo(() => getColumns({
|
|
43
|
+
t,
|
|
44
|
+
goTo,
|
|
45
|
+
user,
|
|
46
|
+
options,
|
|
47
|
+
getRedirectLink,
|
|
48
|
+
theme,
|
|
49
|
+
subject: 'user',
|
|
50
|
+
data,
|
|
51
|
+
setUserToEdit,
|
|
52
|
+
}), [t, goTo, user, options, getRedirectLink, theme, data]);
|
|
53
|
+
|
|
54
|
+
const breadCrumbs = [];
|
|
55
|
+
|
|
56
|
+
const { paginationQuery, searchParams, otherParams, sortBy, sortDir } = useGetQueryParams({ location });
|
|
57
|
+
|
|
58
|
+
const filters = useMemo(() => ({
|
|
59
|
+
...otherParams,
|
|
60
|
+
...extendingFilters,
|
|
61
|
+
}), [otherParams, extendingFilters]);
|
|
62
|
+
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
getData({
|
|
65
|
+
pagination: paginationQuery,
|
|
66
|
+
...(Object.keys(searchParams).length > 0 && { search: searchParams }),
|
|
67
|
+
...otherParams,
|
|
68
|
+
sortBy: {
|
|
69
|
+
[sortBy || 'updatedAt']: sortDir ? (sortDir === 'ascend' ? 1 : -1) : -1,
|
|
70
|
+
},
|
|
71
|
+
...extendingFilters,
|
|
72
|
+
}, 'users');
|
|
73
|
+
}, [location.search, JSON.stringify(extendingFilters)]);
|
|
74
|
+
|
|
75
|
+
const selectFiltersConfig = useMemo(() => getFiltersConfig({ t }), [t]);
|
|
76
|
+
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
setSelectOptions((prev) => ({
|
|
79
|
+
...prev,
|
|
80
|
+
...getFilterOptions(options, t),
|
|
81
|
+
}));
|
|
82
|
+
}, [options, t]);
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<div className="semibold form-input-output daf-create-view">
|
|
86
|
+
<Header
|
|
87
|
+
title={t("users")}
|
|
88
|
+
breadcrumbs={breadCrumbs}
|
|
89
|
+
actionButtons={[
|
|
90
|
+
{
|
|
91
|
+
type: "primary",
|
|
92
|
+
onClick: () => setOpenCreateModal(true),
|
|
93
|
+
tooltip: t("New"),
|
|
94
|
+
icon: "Add",
|
|
95
|
+
},
|
|
96
|
+
]}
|
|
97
|
+
// onDownload={() => {
|
|
98
|
+
// console.log("download");
|
|
99
|
+
// }}
|
|
100
|
+
// downloadDisabled={false}
|
|
101
|
+
/>
|
|
102
|
+
<BaseScreen
|
|
103
|
+
t={t}
|
|
104
|
+
checkboxConfig={checkboxConfig}
|
|
105
|
+
defaultTableFilters={{}}
|
|
106
|
+
columns={columns}
|
|
107
|
+
data={data}
|
|
108
|
+
loading={loading}
|
|
109
|
+
location={location}
|
|
110
|
+
goTo={goTo}
|
|
111
|
+
APP={APP}
|
|
112
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
113
|
+
selectOptions={selectOptions}
|
|
114
|
+
selectFilters={selectFiltersConfig}
|
|
115
|
+
view="users"
|
|
116
|
+
getRedirectLink={getRedirectLink}
|
|
117
|
+
defaultUrlParams={{}}
|
|
118
|
+
module={APP}
|
|
119
|
+
filtersConfig={filtersConfig}
|
|
120
|
+
isMobile={isMobile}
|
|
121
|
+
/>
|
|
122
|
+
{(openCreateModal || !!userToEdit) && (
|
|
123
|
+
<Drawer
|
|
124
|
+
destroyOnClose
|
|
125
|
+
title={
|
|
126
|
+
<DrawerHeader
|
|
127
|
+
title={t(userToEdit ? "Edit User" : "New User")}
|
|
128
|
+
/>
|
|
129
|
+
}
|
|
130
|
+
open={openCreateModal || !!userToEdit}
|
|
131
|
+
onClose={() => {
|
|
132
|
+
setOpenCreateModal(false);
|
|
133
|
+
setUserToEdit(null);
|
|
134
|
+
}}
|
|
135
|
+
width={CREATE_DRAWER_WIDTH}
|
|
136
|
+
bodyStyle={{ padding: 0 }}
|
|
137
|
+
maskClosable={false}
|
|
138
|
+
>
|
|
139
|
+
<UsersCreate
|
|
140
|
+
t={t}
|
|
141
|
+
goTo={goTo}
|
|
142
|
+
user={user}
|
|
143
|
+
APP={APP}
|
|
144
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
145
|
+
getAppHeader={getAppHeader}
|
|
146
|
+
onSubmitted={(payload) => {
|
|
147
|
+
if (userToEdit) {
|
|
148
|
+
onEditUser(payload);
|
|
149
|
+
} else {
|
|
150
|
+
onInviteUser(payload);
|
|
151
|
+
}
|
|
152
|
+
setOpenCreateModal(false);
|
|
153
|
+
setUserToEdit(null);
|
|
154
|
+
}}
|
|
155
|
+
onCancel={() => {
|
|
156
|
+
setOpenCreateModal(false);
|
|
157
|
+
setUserToEdit(null);
|
|
158
|
+
}}
|
|
159
|
+
query={query}
|
|
160
|
+
ajaxForms={ajaxForms}
|
|
161
|
+
changeAjaxForms={changeAjaxForms}
|
|
162
|
+
ajaxOptions={ajaxOptions}
|
|
163
|
+
changeAjaxOptions={changeAjaxOptions}
|
|
164
|
+
userRoles={userRoles}
|
|
165
|
+
userToEdit={userToEdit}
|
|
166
|
+
/>
|
|
167
|
+
</Drawer>
|
|
168
|
+
)}
|
|
169
|
+
</div>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export default UsersTable;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef } from 'react'
|
|
2
2
|
import { Tabs, Drawer } from 'antd'
|
|
3
|
-
import Header from '
|
|
4
|
-
import BaseScreen from '
|
|
5
|
-
import { CREATE_DRAWER_WIDTH } from '
|
|
6
|
-
import DrawerHeader from '
|
|
3
|
+
import Header from '../../../../core/components/Header/index.jsx'
|
|
4
|
+
import BaseScreen from '../../../components/Screens/BaseScreen/index.jsx'
|
|
5
|
+
import { CREATE_DRAWER_WIDTH } from '../../../../../helpers/Forms.js'
|
|
6
|
+
import DrawerHeader from '../../../../core/components/Header/DrawerHeader/index.jsx'
|
|
7
7
|
|
|
8
8
|
const TablePageWithTabs = ({
|
|
9
9
|
t= () => {},
|
package/src/pages.js
CHANGED
|
@@ -11,7 +11,7 @@ export { default as ActivitiesTable } from './@daf/pages/Events/Activities/index
|
|
|
11
11
|
|
|
12
12
|
export { default as IncidentsTable } from './@daf/pages/Events/Incidents/index.jsx';
|
|
13
13
|
export { default as ProductionSitesTable } from './@daf/pages/Locations/MineSite/index.jsx';
|
|
14
|
-
|
|
14
|
+
export { default as UsersTable } from './@daf/core/components/Screens/Users/index.jsx';
|
|
15
15
|
|
|
16
16
|
// Summary
|
|
17
17
|
export { default as OperatorSummary } from './@daf/pages/Summary/Operator/index.jsx';
|
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