@genesislcap/foundation-entity-management 14.70.2 → 14.70.4-es2021.1
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/esm/components/components.js +18 -23
- package/dist/esm/entities/entities.js +62 -69
- package/dist/esm/list/list.js +6 -10
- package/dist/esm/list/list.template.js +9 -9
- package/dist/esm/main/main.js +16 -7
- package/dist/esm/profiles/profiles.js +22 -26
- package/dist/esm/routes/config.js +8 -8
- package/dist/esm/users/users.js +97 -67
- package/package.json +13 -13
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __awaiter } from "tslib";
|
|
2
1
|
import { FoundationRouter } from '@genesislcap/foundation-ui';
|
|
3
2
|
import { zeroGridComponents } from '@genesislcap/foundation-zero-grid-pro';
|
|
4
3
|
import { allComponents, provideFASTDesignSystem } from '@microsoft/fast-components';
|
|
@@ -23,29 +22,25 @@ function loadZeroFallback() {
|
|
|
23
22
|
/**
|
|
24
23
|
* Granular
|
|
25
24
|
*/
|
|
26
|
-
function loadZeroDesignSystem() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
});
|
|
25
|
+
async function loadZeroDesignSystem() {
|
|
26
|
+
let type = ResourceType.REMOTE;
|
|
27
|
+
try {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
return await import('foundationZero/ZeroDesignSystem');
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
type = ResourceType.LOCAL;
|
|
33
|
+
return await loadZeroFallback();
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
logger.debug(`Using '${type}' version of foundationZero/ZeroDesignSystem`);
|
|
37
|
+
}
|
|
41
38
|
}
|
|
42
|
-
export function loadRemotes() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
});
|
|
39
|
+
export async function loadRemotes() {
|
|
40
|
+
const { provideDesignSystem, baseComponents } = await loadZeroDesignSystem();
|
|
41
|
+
return {
|
|
42
|
+
ZeroDesignSystem: provideDesignSystem().register(baseComponents, zeroGridComponents),
|
|
43
|
+
};
|
|
49
44
|
}
|
|
50
45
|
/**
|
|
51
46
|
* Ensure tree shaking doesn't remove these
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { Connect } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { ErrorBoundaryEvent, getErrorBuilder, getErrorDialogBuilder, getNotificationBuilder, getSnackbarBuilder, } from '@genesislcap/foundation-errors';
|
|
4
4
|
import { showDialog } from '@genesislcap/foundation-errors';
|
|
@@ -78,21 +78,16 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
78
78
|
* Set up the web component
|
|
79
79
|
* @internal
|
|
80
80
|
*/
|
|
81
|
-
connectedCallback() {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.addEventListener('create-entity', this.createEntity);
|
|
92
|
-
this.addEventListener('edit-entity', this.editEntity);
|
|
93
|
-
this.addEventListener('read-entity', this.readEntity);
|
|
94
|
-
this.addEventListener('criteria-changed', this.criteriaChanged);
|
|
95
|
-
});
|
|
81
|
+
async connectedCallback() {
|
|
82
|
+
super.connectedCallback();
|
|
83
|
+
this.addEventListener('rowSelected', this.selectEntity);
|
|
84
|
+
if (this.deleteEvent) {
|
|
85
|
+
this.addEventListener('delete-entity', this.deleteEntity);
|
|
86
|
+
}
|
|
87
|
+
this.addEventListener('create-entity', this.createEntity);
|
|
88
|
+
this.addEventListener('edit-entity', this.editEntity);
|
|
89
|
+
this.addEventListener('read-entity', this.readEntity);
|
|
90
|
+
this.addEventListener('criteria-changed', this.criteriaChanged);
|
|
96
91
|
}
|
|
97
92
|
/**
|
|
98
93
|
* Override the deepClone method to ensure that observable attributes are cloned
|
|
@@ -109,7 +104,7 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
109
104
|
copy.updateFormUiSchema = structuredClone(this.updateFormUiSchema);
|
|
110
105
|
copy.defaultEntityValues = structuredClone(this.defaultEntityValues);
|
|
111
106
|
// this.columns[number] might contain a function, so can't use structuredClone
|
|
112
|
-
copy.columns = this.columns ? [...this.columns].map((x) => (
|
|
107
|
+
copy.columns = this.columns ? [...this.columns].map((x) => ({ ...x })) : this.columns;
|
|
113
108
|
return copy;
|
|
114
109
|
}
|
|
115
110
|
/**
|
|
@@ -120,10 +115,8 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
120
115
|
* Emits an event upon error
|
|
121
116
|
* @public
|
|
122
117
|
*/
|
|
123
|
-
submitEntityChanges(e) {
|
|
124
|
-
|
|
125
|
-
this.closeModal();
|
|
126
|
-
});
|
|
118
|
+
async submitEntityChanges(e) {
|
|
119
|
+
this.closeModal();
|
|
127
120
|
}
|
|
128
121
|
/**
|
|
129
122
|
* Show the entity create form
|
|
@@ -134,7 +127,7 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
134
127
|
this.editDialogTitle = `Add ${this.entityLabel}`;
|
|
135
128
|
this.formUiSchema = this.createFormUiSchema;
|
|
136
129
|
this.formResourceName = this.createEvent;
|
|
137
|
-
this.editedEntity =
|
|
130
|
+
this.editedEntity = { ...this.defaultEntityValues };
|
|
138
131
|
this.editModalVisible = true;
|
|
139
132
|
}
|
|
140
133
|
/**
|
|
@@ -143,30 +136,34 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
143
136
|
* @param e - CustomEvent where `e.detail` is the entity to edit.
|
|
144
137
|
* @internal
|
|
145
138
|
*/
|
|
146
|
-
editEntity({ detail }) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
this.editedEntity
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const readEventReq = yield this.connect.request(this.readEvent, {
|
|
160
|
-
REQUEST: formData,
|
|
161
|
-
});
|
|
162
|
-
this.editedEntity = Object.assign(Object.assign({}, this.editedEntity), readEventReq.REPLY[0]);
|
|
163
|
-
}
|
|
139
|
+
async editEntity({ detail }) {
|
|
140
|
+
this.editDialogTitle = `Edit ${this.entityLabel}`;
|
|
141
|
+
this.formUiSchema = this.updateFormUiSchema;
|
|
142
|
+
this.formResourceName = this.updateEvent;
|
|
143
|
+
if (detail) {
|
|
144
|
+
const { ROW_REF, ...formData } = detail;
|
|
145
|
+
this.editedEntity = formData;
|
|
146
|
+
if (this.readEventFn) {
|
|
147
|
+
const readEntityReq = await this.readEventFn(formData);
|
|
148
|
+
this.editedEntity = {
|
|
149
|
+
...this.editedEntity,
|
|
150
|
+
...readEntityReq,
|
|
151
|
+
};
|
|
164
152
|
}
|
|
165
|
-
else {
|
|
166
|
-
|
|
153
|
+
else if (this.readEvent) {
|
|
154
|
+
const readEventReq = await this.connect.request(this.readEvent, {
|
|
155
|
+
REQUEST: formData,
|
|
156
|
+
});
|
|
157
|
+
this.editedEntity = {
|
|
158
|
+
...this.editedEntity,
|
|
159
|
+
...readEventReq.REPLY[0],
|
|
160
|
+
};
|
|
167
161
|
}
|
|
168
|
-
|
|
169
|
-
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.editedEntity = { ...this.defaultEntityValues };
|
|
165
|
+
}
|
|
166
|
+
this.editModalVisible = true;
|
|
170
167
|
}
|
|
171
168
|
readEntity(e) {
|
|
172
169
|
this.readonly = true;
|
|
@@ -178,7 +175,7 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
178
175
|
this.editModalVisible = false;
|
|
179
176
|
}
|
|
180
177
|
criteriaChanged(e) {
|
|
181
|
-
this.datasourceConfig =
|
|
178
|
+
this.datasourceConfig = { ...this.datasourceConfig, criteria: e.detail };
|
|
182
179
|
}
|
|
183
180
|
/**
|
|
184
181
|
* Handler for deleting the entity. Added as an event listener on the class when receiving the `delete-entity` event.
|
|
@@ -186,32 +183,28 @@ let EntityManagement = class EntityManagement extends LifecycleMixin(FASTElement
|
|
|
186
183
|
* @param e - CustomEvent where `e.detail` contains data to update the selectedEntity reference with the entity to delete.
|
|
187
184
|
* @internal
|
|
188
185
|
*/
|
|
189
|
-
deleteEntity(e) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
this.showDeleteConfirmation();
|
|
193
|
-
});
|
|
186
|
+
async deleteEntity(e) {
|
|
187
|
+
this.selectedEntity = e.detail;
|
|
188
|
+
this.showDeleteConfirmation();
|
|
194
189
|
}
|
|
195
|
-
confirmDelete() {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
logger.error('No required fields found for delete event', this.deleteEvent);
|
|
212
|
-
}
|
|
190
|
+
async confirmDelete() {
|
|
191
|
+
const schema = await this.connect.getJSONSchema(this.deleteEvent);
|
|
192
|
+
const DETAILS = {};
|
|
193
|
+
if (typeof schema.INBOUND.properties.DETAILS !== 'boolean') {
|
|
194
|
+
const requiredFields = Object.keys(schema.INBOUND.properties.DETAILS.properties);
|
|
195
|
+
if (requiredFields) {
|
|
196
|
+
requiredFields.forEach((property) => {
|
|
197
|
+
DETAILS[property] = this.selectedEntity[property];
|
|
198
|
+
});
|
|
199
|
+
const deleteReq = await this.connect.commitEvent(this.deleteEvent, {
|
|
200
|
+
DETAILS,
|
|
201
|
+
});
|
|
202
|
+
this.errorNotify(deleteReq);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
logger.error('No required fields found for delete event', this.deleteEvent);
|
|
213
206
|
}
|
|
214
|
-
}
|
|
207
|
+
}
|
|
215
208
|
}
|
|
216
209
|
showDeleteConfirmation() {
|
|
217
210
|
showDialog(getErrorBuilder()
|
package/dist/esm/list/list.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { Events } from '@ag-grid-community/core';
|
|
3
3
|
import { attr, customElement, FASTElement, observable } from '@microsoft/fast-element';
|
|
4
4
|
import { buttonCellRenderer } from '../utils';
|
|
@@ -46,23 +46,19 @@ let List = class List extends FASTElement {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
handleFilterChanged(e) {
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
const filter = (_b = e === null || e === void 0 ? void 0 : e.detail) === null || _b === void 0 ? void 0 : _b.filter;
|
|
49
|
+
const fieldName = e?.detail?.fieldName;
|
|
50
|
+
const filter = e?.detail?.filter;
|
|
52
51
|
fieldName && filter && this.datasource.setFilter(fieldName, filter);
|
|
53
52
|
}
|
|
54
53
|
handleFilterCleared(e) {
|
|
55
|
-
|
|
56
|
-
const fieldName = (_a = e === null || e === void 0 ? void 0 : e.detail) === null || _a === void 0 ? void 0 : _a.fieldName;
|
|
54
|
+
const fieldName = e?.detail?.fieldName;
|
|
57
55
|
this.datasource.removeFilter(fieldName);
|
|
58
56
|
}
|
|
59
57
|
select(e) {
|
|
60
58
|
this.$emit('rowSelected', e);
|
|
61
59
|
}
|
|
62
|
-
delete(e) {
|
|
63
|
-
|
|
64
|
-
this.$emit('delete-entity', e);
|
|
65
|
-
});
|
|
60
|
+
async delete(e) {
|
|
61
|
+
this.$emit('delete-entity', e);
|
|
66
62
|
}
|
|
67
63
|
};
|
|
68
64
|
__decorate([
|
|
@@ -4,8 +4,8 @@ export const listTemplate = html `
|
|
|
4
4
|
${when((x) => x.enableFilterBar, html `
|
|
5
5
|
<zero-filter-bar
|
|
6
6
|
resource=${(x) => x.resourceName}
|
|
7
|
-
only=${(x) =>
|
|
8
|
-
labels=${(x) =>
|
|
7
|
+
only=${(x) => x.columns?.map((colDef) => colDef.field).filter((field) => !!field)}
|
|
8
|
+
labels=${(x) => x.columns?.map((colDef) => colDef.headerName || '')}
|
|
9
9
|
target="datasource"
|
|
10
10
|
></zero-filter-bar>
|
|
11
11
|
`)}
|
|
@@ -25,13 +25,13 @@ export const listTemplate = html `
|
|
|
25
25
|
${ref('datasource')}
|
|
26
26
|
:deferredGridOptions=${(x) => x.gridOptions}
|
|
27
27
|
resource-name=${(x) => x.resourceName}
|
|
28
|
-
criteria=${(x) =>
|
|
29
|
-
fields=${(x) =>
|
|
30
|
-
is-snapshot=${(x) =>
|
|
31
|
-
max-rows=${(x) =>
|
|
32
|
-
max-view=${(x) =>
|
|
33
|
-
order-by=${(x) =>
|
|
34
|
-
reverse=${(x) =>
|
|
28
|
+
criteria=${(x) => x.datasourceConfig?.criteria}
|
|
29
|
+
fields=${(x) => x.datasourceConfig?.fields}
|
|
30
|
+
is-snapshot=${(x) => x.datasourceConfig?.isSnapshot}
|
|
31
|
+
max-rows=${(x) => x.datasourceConfig?.maxRows}
|
|
32
|
+
max-view=${(x) => x.datasourceConfig?.maxView}
|
|
33
|
+
order-by=${(x) => x.datasourceConfig?.orderBy}
|
|
34
|
+
reverse=${(x) => x.datasourceConfig?.reverse}
|
|
35
35
|
></grid-pro-genesis-datasource>
|
|
36
36
|
${repeat((x) => x.columns, html `
|
|
37
37
|
<grid-pro-column :definition=${(x) => x}></grid-pro-column>
|
package/dist/esm/main/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { Connect, ConnectConfig, defaultConnectConfig, Session, SocketReconnectStrategy, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { baseLayerLuminance, StandardLuminance } from '@microsoft/fast-components';
|
|
4
4
|
import { FASTElement, customElement, observable } from '@microsoft/fast-element';
|
|
@@ -28,11 +28,9 @@ let MainApplication = class MainApplication extends FASTElement {
|
|
|
28
28
|
? StandardLuminance.LightMode
|
|
29
29
|
: StandardLuminance.DarkMode);
|
|
30
30
|
}
|
|
31
|
-
loadRemotes() {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
this.ready = true;
|
|
35
|
-
});
|
|
31
|
+
async loadRemotes() {
|
|
32
|
+
await Components.loadRemotes();
|
|
33
|
+
this.ready = true;
|
|
36
34
|
}
|
|
37
35
|
selectTemplate() {
|
|
38
36
|
return this.ready ? MainTemplate : LoadingTemplate;
|
|
@@ -51,7 +49,18 @@ let MainApplication = class MainApplication extends FASTElement {
|
|
|
51
49
|
* },
|
|
52
50
|
* }),
|
|
53
51
|
*/
|
|
54
|
-
Registration.instance(ConnectConfig,
|
|
52
|
+
Registration.instance(ConnectConfig, {
|
|
53
|
+
...defaultConnectConfig,
|
|
54
|
+
connect: {
|
|
55
|
+
...defaultConnectConfig.connect,
|
|
56
|
+
heartbeatInterval: 15000,
|
|
57
|
+
},
|
|
58
|
+
reconnect: {
|
|
59
|
+
...defaultConnectConfig.reconnect,
|
|
60
|
+
reconnectAttempts: 15,
|
|
61
|
+
reconnectStrategy: SocketReconnectStrategy.Exponential,
|
|
62
|
+
},
|
|
63
|
+
}));
|
|
55
64
|
}
|
|
56
65
|
};
|
|
57
66
|
__decorate([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { Auth } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { customElement } from '@microsoft/fast-element';
|
|
4
4
|
import { EntityManagement, styles, template } from '../entities';
|
|
@@ -45,34 +45,30 @@ let Profiles = class Profiles extends EntityManagement {
|
|
|
45
45
|
this.title = 'Profile Management';
|
|
46
46
|
this.entityLabel = 'Profile';
|
|
47
47
|
}
|
|
48
|
-
readProfileData(profile) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
const selectedUsersReq = yield this.connect.request('PROFILE_USER', {
|
|
57
|
-
REQUEST: {
|
|
58
|
-
PROFILE_NAME: profile.PROFILE_NAME,
|
|
59
|
-
USER_NAME: '*',
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
return {
|
|
63
|
-
RIGHT_CODES: selectedRightsReq.REPLY.map((v) => v.RIGHT_CODE),
|
|
64
|
-
USER_NAMES: Array.from(new Set(selectedUsersReq.REPLY.map((v) => v.USER_NAME))),
|
|
65
|
-
NAME: profile.PROFILE_NAME,
|
|
66
|
-
};
|
|
48
|
+
async readProfileData(profile) {
|
|
49
|
+
const selectedRightsReq = await this.connect.request('PROFILE_RIGHT', {
|
|
50
|
+
REQUEST: {
|
|
51
|
+
PROFILE_NAME: profile.PROFILE_NAME,
|
|
52
|
+
RIGHT_CODE: '*',
|
|
53
|
+
},
|
|
67
54
|
});
|
|
55
|
+
const selectedUsersReq = await this.connect.request('PROFILE_USER', {
|
|
56
|
+
REQUEST: {
|
|
57
|
+
PROFILE_NAME: profile.PROFILE_NAME,
|
|
58
|
+
USER_NAME: '*',
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
RIGHT_CODES: selectedRightsReq.REPLY.map((v) => v.RIGHT_CODE),
|
|
63
|
+
USER_NAMES: Array.from(new Set(selectedUsersReq.REPLY.map((v) => v.USER_NAME))),
|
|
64
|
+
NAME: profile.PROFILE_NAME,
|
|
65
|
+
};
|
|
68
66
|
}
|
|
69
|
-
confirmDelete() {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
DETAILS: { NAME: this.selectedEntity.PROFILE_NAME },
|
|
73
|
-
});
|
|
74
|
-
this.errorNotify(deleteReq);
|
|
67
|
+
async confirmDelete() {
|
|
68
|
+
const deleteReq = await this.connect.commitEvent(this.deleteEvent, {
|
|
69
|
+
DETAILS: { NAME: this.selectedEntity.PROFILE_NAME },
|
|
75
70
|
});
|
|
71
|
+
this.errorNotify(deleteReq);
|
|
76
72
|
}
|
|
77
73
|
};
|
|
78
74
|
__decorate([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate, __param } from "tslib";
|
|
2
2
|
import { Auth, Session, FoundationAnalytics, FoundationAnalyticsEventType, } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { Container } from '@microsoft/fast-foundation';
|
|
4
4
|
import { RouterConfiguration, Route } from '@microsoft/fast-router';
|
|
@@ -28,8 +28,8 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
28
28
|
path: '',
|
|
29
29
|
name: 'auth',
|
|
30
30
|
title: 'Login',
|
|
31
|
-
element: () =>
|
|
32
|
-
const { configure, define } =
|
|
31
|
+
element: async () => {
|
|
32
|
+
const { configure, define } = await import(
|
|
33
33
|
/* webpackChunkName: "foundation-login" */
|
|
34
34
|
'@genesislcap/foundation-login');
|
|
35
35
|
configure(this.container, {
|
|
@@ -44,13 +44,13 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
44
44
|
return define({
|
|
45
45
|
name: `entity-management-login`,
|
|
46
46
|
});
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
48
|
layout: loginLayout,
|
|
49
49
|
settings: { public: true },
|
|
50
50
|
childRouters: true,
|
|
51
51
|
}, {
|
|
52
52
|
path: 'entity-management-demo',
|
|
53
|
-
element: () =>
|
|
53
|
+
element: async () => (await import('./demo/entity-management')).EntityManagementDemo,
|
|
54
54
|
title: 'Entity Management Demo',
|
|
55
55
|
name: 'entity-management-demo',
|
|
56
56
|
settings: { autoAuth: true },
|
|
@@ -67,7 +67,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
67
67
|
* Example of a NavigationContributor
|
|
68
68
|
*/
|
|
69
69
|
this.contributors.push({
|
|
70
|
-
navigate: (phase) =>
|
|
70
|
+
navigate: async (phase) => {
|
|
71
71
|
const settings = phase.route.settings;
|
|
72
72
|
/**
|
|
73
73
|
* TODO: Centralise
|
|
@@ -91,7 +91,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
91
91
|
/**
|
|
92
92
|
* If autoAuth and session is valid try to connect+auto-login
|
|
93
93
|
*/
|
|
94
|
-
if (settings && settings.autoAuth && (
|
|
94
|
+
if (settings && settings.autoAuth && (await auth.reAuthFromSession())) {
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
@@ -101,7 +101,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
101
101
|
session.captureReturnUrl();
|
|
102
102
|
Route.name.replace(phase.router, 'auth');
|
|
103
103
|
});
|
|
104
|
-
}
|
|
104
|
+
},
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
construct(Type) {
|
package/dist/esm/users/users.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
2
|
import { Auth, Connect } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { ErrorBoundaryEvent, getErrorBuilder, getNotificationBuilder, } from '@genesislcap/foundation-errors';
|
|
4
4
|
import { LifecycleMixin } from '@genesislcap/foundation-utils';
|
|
@@ -21,11 +21,31 @@ const defaultColumnConfig = {
|
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
23
|
export const UsersColumnConfig = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
{
|
|
25
|
+
...defaultColumnConfig,
|
|
26
|
+
field: 'USER_NAME',
|
|
27
|
+
headerName: 'Username',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
...defaultColumnConfig,
|
|
31
|
+
field: 'FIRST_NAME',
|
|
32
|
+
headerName: 'First Name',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
...defaultColumnConfig,
|
|
36
|
+
field: 'LAST_NAME',
|
|
37
|
+
headerName: 'Last Name',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
...defaultColumnConfig,
|
|
41
|
+
field: 'EMAIL_ADDRESS',
|
|
42
|
+
headerName: 'Email',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
...defaultColumnConfig,
|
|
46
|
+
field: 'LAST_LOGIN',
|
|
47
|
+
headerName: 'Last Login',
|
|
48
|
+
valueFormatter: ({ value }) => value
|
|
29
49
|
? new Intl.DateTimeFormat('default', {
|
|
30
50
|
year: 'numeric',
|
|
31
51
|
month: 'numeric',
|
|
@@ -33,7 +53,8 @@ export const UsersColumnConfig = [
|
|
|
33
53
|
hour: 'numeric',
|
|
34
54
|
minute: 'numeric',
|
|
35
55
|
}).format(value)
|
|
36
|
-
: ''
|
|
56
|
+
: '',
|
|
57
|
+
},
|
|
37
58
|
];
|
|
38
59
|
/**
|
|
39
60
|
* Main class which defines the user management functionality
|
|
@@ -80,7 +101,15 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
|
|
|
80
101
|
* @internal
|
|
81
102
|
*/
|
|
82
103
|
statusColumn() {
|
|
83
|
-
return
|
|
104
|
+
return {
|
|
105
|
+
...defaultColumnConfig,
|
|
106
|
+
headerName: 'Status',
|
|
107
|
+
field: 'STATUS',
|
|
108
|
+
minWidth: 135,
|
|
109
|
+
width: 135,
|
|
110
|
+
suppressSizeToFit: true,
|
|
111
|
+
cellRendererSelector: this.statusRendererSelector.bind(this),
|
|
112
|
+
};
|
|
84
113
|
}
|
|
85
114
|
/**
|
|
86
115
|
* Returns the config for an entity column if the entityID attribute is defined
|
|
@@ -91,7 +120,11 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
|
|
|
91
120
|
entityColumn() {
|
|
92
121
|
return this.entityID
|
|
93
122
|
? [
|
|
94
|
-
|
|
123
|
+
{
|
|
124
|
+
...defaultColumnConfig,
|
|
125
|
+
headerName: this.entityLabel,
|
|
126
|
+
field: this.entityID,
|
|
127
|
+
},
|
|
95
128
|
]
|
|
96
129
|
: [];
|
|
97
130
|
}
|
|
@@ -150,21 +183,16 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
|
|
|
150
183
|
: '';
|
|
151
184
|
this.updateEvent = this.auth.currentUser.hasPermission('AMEND_USER') ? 'EVENT_AMEND_USER' : '';
|
|
152
185
|
}
|
|
153
|
-
connectedCallback() {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
_super.connectedCallback.call(this);
|
|
159
|
-
// retrieving access type of currently logged-in user
|
|
160
|
-
const userReq = yield this.connect.snapshot('ALL_USERS', {
|
|
161
|
-
CRITERIA_MATCH: `USER_NAME == '${this.auth.currentUser.username}'`,
|
|
162
|
-
});
|
|
163
|
-
if (userReq.ROW[0]) {
|
|
164
|
-
this.allAccessType = userReq.ROW[0].ACCESS_TYPE === 'ALL';
|
|
165
|
-
this.entityIdValue = userReq.ROW[0][this.entityID];
|
|
166
|
-
}
|
|
186
|
+
async connectedCallback() {
|
|
187
|
+
super.connectedCallback();
|
|
188
|
+
// retrieving access type of currently logged-in user
|
|
189
|
+
const userReq = await this.connect.snapshot('ALL_USERS', {
|
|
190
|
+
CRITERIA_MATCH: `USER_NAME == '${this.auth.currentUser.username}'`,
|
|
167
191
|
});
|
|
192
|
+
if (userReq.ROW[0]) {
|
|
193
|
+
this.allAccessType = userReq.ROW[0].ACCESS_TYPE === 'ALL';
|
|
194
|
+
this.entityIdValue = userReq.ROW[0][this.entityID];
|
|
195
|
+
}
|
|
168
196
|
}
|
|
169
197
|
deepClone() {
|
|
170
198
|
const copy = super.deepClone();
|
|
@@ -176,7 +204,7 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
|
|
|
176
204
|
copy.deleteEvent = structuredClone(this.deleteEvent);
|
|
177
205
|
copy.updateEvent = structuredClone(this.updateEvent);
|
|
178
206
|
// this.columns[number] might contain a function, so can't use structuredClone
|
|
179
|
-
copy.columns = this.columns ? [...this.columns].map((x) => (
|
|
207
|
+
copy.columns = this.columns ? [...this.columns].map((x) => ({ ...x })) : this.columns;
|
|
180
208
|
return copy;
|
|
181
209
|
}
|
|
182
210
|
/**
|
|
@@ -202,55 +230,57 @@ let Users = class Users extends LifecycleMixin(FASTElement) {
|
|
|
202
230
|
*
|
|
203
231
|
* @internal
|
|
204
232
|
*/
|
|
205
|
-
changeStatus(params) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
},
|
|
215
|
-
});
|
|
216
|
-
if (changeStatusRequest.ERROR) {
|
|
217
|
-
logger.error(changeStatusRequest.ERROR);
|
|
218
|
-
const notificationCloseTimeout = 5000;
|
|
219
|
-
changeStatusRequest.ERROR.forEach((err) => {
|
|
220
|
-
this.$emit(ErrorBoundaryEvent.ERROR_BOUNDARY_EVENT, getErrorBuilder()
|
|
221
|
-
.withTitle(err.CODE)
|
|
222
|
-
.withErrorDetails(getErrorFormat(err))
|
|
223
|
-
.withNotification(getNotificationBuilder()
|
|
224
|
-
.withType('warning')
|
|
225
|
-
.withAutoClose(true)
|
|
226
|
-
.withCloseTimeout(notificationCloseTimeout)
|
|
227
|
-
.build())
|
|
228
|
-
.build());
|
|
229
|
-
});
|
|
230
|
-
// bring back original value
|
|
231
|
-
params.setValue(previousValue);
|
|
232
|
-
}
|
|
233
|
+
async changeStatus(params) {
|
|
234
|
+
const isEnabled = params.data.STATUS === 'ENABLED';
|
|
235
|
+
// optimistically set value and store previous value
|
|
236
|
+
const previousValue = params.data.STATUS;
|
|
237
|
+
params.setValue(isEnabled ? 'DISABLED' : 'ENABLED');
|
|
238
|
+
const changeStatusRequest = await this.connect.commitEvent(isEnabled ? 'EVENT_DISABLE_USER' : 'EVENT_ENABLE_USER', {
|
|
239
|
+
DETAILS: {
|
|
240
|
+
USER_NAME: params.data.USER_NAME,
|
|
241
|
+
},
|
|
233
242
|
});
|
|
243
|
+
if (changeStatusRequest.ERROR) {
|
|
244
|
+
logger.error(changeStatusRequest.ERROR);
|
|
245
|
+
const notificationCloseTimeout = 5000;
|
|
246
|
+
changeStatusRequest.ERROR.forEach((err) => {
|
|
247
|
+
this.$emit(ErrorBoundaryEvent.ERROR_BOUNDARY_EVENT, getErrorBuilder()
|
|
248
|
+
.withTitle(err.CODE)
|
|
249
|
+
.withErrorDetails(getErrorFormat(err))
|
|
250
|
+
.withNotification(getNotificationBuilder()
|
|
251
|
+
.withType('warning')
|
|
252
|
+
.withAutoClose(true)
|
|
253
|
+
.withCloseTimeout(notificationCloseTimeout)
|
|
254
|
+
.build())
|
|
255
|
+
.build());
|
|
256
|
+
});
|
|
257
|
+
// bring back original value
|
|
258
|
+
params.setValue(previousValue);
|
|
259
|
+
}
|
|
234
260
|
}
|
|
235
261
|
/**
|
|
236
262
|
* @internal
|
|
237
263
|
*/
|
|
238
|
-
readUserData(user) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
USER_NAME: user.USER_NAME,
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
const defaultValues = !this.allAccessType && ((_a = this.entityIdValue) === null || _a === void 0 ? void 0 : _a.length)
|
|
247
|
-
? {
|
|
248
|
-
ACCESS_TYPE: 'ENTITY',
|
|
249
|
-
[this.entityID]: this.entityIdValue,
|
|
250
|
-
}
|
|
251
|
-
: {};
|
|
252
|
-
return Object.assign(Object.assign({}, defaultValues), { USER_PROFILES: (userProfiles.REPLY || []).map((profile) => profile.PROFILE_NAME), ADDRESS_LINE_1: user.ADDRESS_LINE1, ADDRESS_LINE_2: user.ADDRESS_LINE2, ADDRESS_LINE_3: user.ADDRESS_LINE3, ADDRESS_LINE_4: user.ADDRESS_LINE4 });
|
|
264
|
+
async readUserData(user) {
|
|
265
|
+
const userProfiles = await this.connect.request('PROFILE_USER', {
|
|
266
|
+
REQUEST: {
|
|
267
|
+
USER_NAME: user.USER_NAME,
|
|
268
|
+
},
|
|
253
269
|
});
|
|
270
|
+
const defaultValues = !this.allAccessType && this.entityIdValue?.length
|
|
271
|
+
? {
|
|
272
|
+
ACCESS_TYPE: 'ENTITY',
|
|
273
|
+
[this.entityID]: this.entityIdValue,
|
|
274
|
+
}
|
|
275
|
+
: {};
|
|
276
|
+
return {
|
|
277
|
+
...defaultValues,
|
|
278
|
+
USER_PROFILES: (userProfiles.REPLY || []).map((profile) => profile.PROFILE_NAME),
|
|
279
|
+
ADDRESS_LINE_1: user.ADDRESS_LINE1,
|
|
280
|
+
ADDRESS_LINE_2: user.ADDRESS_LINE2,
|
|
281
|
+
ADDRESS_LINE_3: user.ADDRESS_LINE3,
|
|
282
|
+
ADDRESS_LINE_4: user.ADDRESS_LINE4,
|
|
283
|
+
};
|
|
254
284
|
}
|
|
255
285
|
};
|
|
256
286
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-entity-management",
|
|
3
3
|
"description": "Genesis Foundation Entity Management",
|
|
4
|
-
"version": "14.70.
|
|
4
|
+
"version": "14.70.4-es2021.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@genesislcap/foundation-login": "^14.40.0",
|
|
44
|
-
"@genesislcap/foundation-testing": "14.70.
|
|
45
|
-
"@genesislcap/genx": "14.70.
|
|
44
|
+
"@genesislcap/foundation-testing": "14.70.4-es2021.1",
|
|
45
|
+
"@genesislcap/genx": "14.70.4-es2021.1",
|
|
46
46
|
"rimraf": "^3.0.2"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@ag-grid-community/core": "29.2.0",
|
|
50
|
-
"@genesislcap/foundation-comms": "14.70.
|
|
51
|
-
"@genesislcap/foundation-errors": "14.70.
|
|
52
|
-
"@genesislcap/foundation-forms": "14.70.
|
|
53
|
-
"@genesislcap/foundation-login": "14.70.
|
|
54
|
-
"@genesislcap/foundation-ui": "14.70.
|
|
55
|
-
"@genesislcap/foundation-utils": "14.70.
|
|
56
|
-
"@genesislcap/foundation-zero": "14.70.
|
|
57
|
-
"@genesislcap/foundation-zero-grid-pro": "14.70.
|
|
58
|
-
"@genesislcap/grid-pro": "14.70.
|
|
50
|
+
"@genesislcap/foundation-comms": "14.70.4-es2021.1",
|
|
51
|
+
"@genesislcap/foundation-errors": "14.70.4-es2021.1",
|
|
52
|
+
"@genesislcap/foundation-forms": "14.70.4-es2021.1",
|
|
53
|
+
"@genesislcap/foundation-login": "14.70.4-es2021.1",
|
|
54
|
+
"@genesislcap/foundation-ui": "14.70.4-es2021.1",
|
|
55
|
+
"@genesislcap/foundation-utils": "14.70.4-es2021.1",
|
|
56
|
+
"@genesislcap/foundation-zero": "14.70.4-es2021.1",
|
|
57
|
+
"@genesislcap/foundation-zero-grid-pro": "14.70.4-es2021.1",
|
|
58
|
+
"@genesislcap/grid-pro": "14.70.4-es2021.1",
|
|
59
59
|
"@microsoft/fast-components": "^2.21.3",
|
|
60
60
|
"@microsoft/fast-element": "^1.7.0",
|
|
61
61
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"customElements": "dist/custom-elements.json",
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "5d0d8ee36cfd068cfc6211033b326d0a978cfc05"
|
|
75
75
|
}
|