@things-factory/auth-ui 10.1.4 → 10.1.7
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-client/components/change-password.d.ts +11 -0
- package/dist-client/components/change-password.js +103 -6
- package/dist-client/components/change-password.js.map +1 -1
- package/dist-client/components/role-privilege-picker.d.ts +37 -0
- package/dist-client/components/role-privilege-picker.js +58 -0
- package/dist-client/components/role-privilege-picker.js.map +1 -0
- package/dist-client/components/role-template-picker.d.ts +83 -0
- package/dist-client/components/role-template-picker.js +487 -0
- package/dist-client/components/role-template-picker.js.map +1 -0
- package/dist-client/components/user-detail.d.ts +151 -0
- package/dist-client/components/user-detail.js +631 -0
- package/dist-client/components/user-detail.js.map +1 -0
- package/dist-client/components/user-invite.d.ts +80 -0
- package/dist-client/components/user-invite.js +422 -0
- package/dist-client/components/user-invite.js.map +1 -0
- package/dist-client/entries/auth/activate.d.ts +0 -1
- package/dist-client/entries/auth/activate.js +0 -8
- package/dist-client/entries/auth/activate.js.map +1 -1
- package/dist-client/pages/role/role-list-page.d.ts +203 -0
- package/dist-client/pages/role/role-list-page.js +838 -0
- package/dist-client/pages/role/role-list-page.js.map +1 -0
- package/dist-client/pages/role/role-privilege-page.d.ts +181 -0
- package/dist-client/pages/role/role-privilege-page.js +980 -0
- package/dist-client/pages/role/role-privilege-page.js.map +1 -0
- package/dist-client/pages/user/user-list-page.d.ts +88 -0
- package/dist-client/pages/user/user-list-page.js +474 -0
- package/dist-client/pages/user/user-list-page.js.map +1 -0
- package/dist-client/route.js +5 -2
- package/dist-client/route.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/things-factory.config.js +3 -2
- package/translations/en.json +72 -3
- package/translations/ja.json +14 -3
- package/translations/ko.json +73 -4
- package/translations/ms.json +15 -4
- package/translations/zh.json +14 -3
- package/dist-client/components/contact-us.d.ts +0 -20
- package/dist-client/components/contact-us.js +0 -121
- package/dist-client/components/contact-us.js.map +0 -1
- package/dist-client/components/create-role.d.ts +0 -1
- package/dist-client/components/create-role.js +0 -117
- package/dist-client/components/create-role.js.map +0 -1
- package/dist-client/components/credential-manager.d.ts +0 -11
- package/dist-client/components/credential-manager.js +0 -64
- package/dist-client/components/credential-manager.js.map +0 -1
- package/dist-client/components/role-edit-form.d.ts +0 -1
- package/dist-client/components/role-edit-form.js +0 -95
- package/dist-client/components/role-edit-form.js.map +0 -1
- package/dist-client/components/role-privilege-editor.d.ts +0 -1
- package/dist-client/components/role-privilege-editor.js +0 -368
- package/dist-client/components/role-privilege-editor.js.map +0 -1
- package/dist-client/pages/role/role-management.d.ts +0 -4
- package/dist-client/pages/role/role-management.js +0 -137
- package/dist-client/pages/role/role-management.js.map +0 -1
- package/dist-client/pages/user/user-management.d.ts +0 -35
- package/dist-client/pages/user/user-management.js +0 -223
- package/dist-client/pages/user/user-management.js.map +0 -1
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import '@things-factory/component-ui';
|
|
3
|
-
import '../../components/create-role.js';
|
|
4
|
-
import '../../components/role-edit-form.js';
|
|
5
|
-
import '../../components/role-privilege-editor.js';
|
|
6
|
-
import gql from 'graphql-tag';
|
|
7
|
-
import { css, html } from 'lit';
|
|
8
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
9
|
-
import { client, gqlContext } from '@operato/graphql';
|
|
10
|
-
import { i18next } from '@operato/i18n';
|
|
11
|
-
import { InheritedValueType, PageView } from '@operato/shell';
|
|
12
|
-
let RoleManagement = class RoleManagement extends PageView {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
this.title = '';
|
|
16
|
-
this.roles = [];
|
|
17
|
-
}
|
|
18
|
-
static { this.styles = [
|
|
19
|
-
css `
|
|
20
|
-
:host { display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
background-color: var(--md-sys-color-background);
|
|
23
|
-
padding: var(--spacing-large);
|
|
24
|
-
overflow: auto;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
[subtitle] { padding: var(--subtitle-padding);
|
|
28
|
-
font: var(--subtitle-font);
|
|
29
|
-
color: var(--subtitle-text-color);
|
|
30
|
-
|
|
31
|
-
text-transform: capitalize;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
input {
|
|
35
|
-
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
36
|
-
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
37
|
-
display: block;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
#roles-privileges { flex: 1;
|
|
41
|
-
display: flex;
|
|
42
|
-
margin-top: var(--spacing-medium);
|
|
43
|
-
max-width: var(--content-container-max-width);
|
|
44
|
-
flex-direction: row;
|
|
45
|
-
overflow: auto;
|
|
46
|
-
border-top: var(--border-dim-color);
|
|
47
|
-
}
|
|
48
|
-
`
|
|
49
|
-
]; }
|
|
50
|
-
get context() {
|
|
51
|
-
return { title: i18next.t('text.role_management'),
|
|
52
|
-
help: 'auth/roles'
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
render() {
|
|
56
|
-
const data = { roles: this.roles || []
|
|
57
|
-
};
|
|
58
|
-
return html `
|
|
59
|
-
<create-role
|
|
60
|
-
@fetch-roles=${async () => {
|
|
61
|
-
this.roles = await this.fetchRoles();
|
|
62
|
-
}}
|
|
63
|
-
></create-role>
|
|
64
|
-
|
|
65
|
-
<div subtitle>${i18next.t('text.registered roles')}</div>
|
|
66
|
-
<div id="roles-privileges">
|
|
67
|
-
<quick-find-list
|
|
68
|
-
.data="${data}"
|
|
69
|
-
.openHeaderRenderer=${role => html `
|
|
70
|
-
<role-edit-form .role="${role}" @roleChanged="${e => (this.updateRoleObj = e.detail)}"></role-edit-form>
|
|
71
|
-
`}
|
|
72
|
-
.contentRenderer="${(role, _currentTabKey) => html `
|
|
73
|
-
<role-privilege-editor
|
|
74
|
-
.updateRoleObj=${this.updateRoleObj || {}}
|
|
75
|
-
.role=${role}
|
|
76
|
-
@fetch-roles=${async () => {
|
|
77
|
-
this.roles = await this.fetchRoles();
|
|
78
|
-
await this.updateComplete;
|
|
79
|
-
this.quickFindList.openByKey(role.id);
|
|
80
|
-
}}
|
|
81
|
-
></role-privilege-editor>
|
|
82
|
-
`}"
|
|
83
|
-
></quick-find-list>
|
|
84
|
-
</div>
|
|
85
|
-
`;
|
|
86
|
-
}
|
|
87
|
-
async pageUpdated(changes, lifecycle, before) {
|
|
88
|
-
if (this.active) {
|
|
89
|
-
this.roles = await this.fetchRoles();
|
|
90
|
-
this.role = this.roles && this.roles[0];
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
async fetchRoles() {
|
|
94
|
-
const response = await client.query({ query: gql `
|
|
95
|
-
query roles($sortings: [Sorting!], $inherited: InheritedValueType) { roles(sortings: $sortings, inherited: $inherited) { items { id
|
|
96
|
-
name
|
|
97
|
-
description
|
|
98
|
-
privileges { id
|
|
99
|
-
name
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
total
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`,
|
|
106
|
-
variables: { sortings: [{ name: 'name' }],
|
|
107
|
-
inherited: InheritedValueType.Include
|
|
108
|
-
},
|
|
109
|
-
context: gqlContext()
|
|
110
|
-
});
|
|
111
|
-
return response.data.roles.items;
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
__decorate([
|
|
115
|
-
property({ type: String }),
|
|
116
|
-
__metadata("design:type", String)
|
|
117
|
-
], RoleManagement.prototype, "title", void 0);
|
|
118
|
-
__decorate([
|
|
119
|
-
property({ type: Object }),
|
|
120
|
-
__metadata("design:type", Object)
|
|
121
|
-
], RoleManagement.prototype, "role", void 0);
|
|
122
|
-
__decorate([
|
|
123
|
-
property({ type: Array }),
|
|
124
|
-
__metadata("design:type", Array)
|
|
125
|
-
], RoleManagement.prototype, "roles", void 0);
|
|
126
|
-
__decorate([
|
|
127
|
-
property({ type: Object }),
|
|
128
|
-
__metadata("design:type", Object)
|
|
129
|
-
], RoleManagement.prototype, "updateRoleObj", void 0);
|
|
130
|
-
__decorate([
|
|
131
|
-
query('quick-find-list'),
|
|
132
|
-
__metadata("design:type", Object)
|
|
133
|
-
], RoleManagement.prototype, "quickFindList", void 0);
|
|
134
|
-
RoleManagement = __decorate([
|
|
135
|
-
customElement('role-management')
|
|
136
|
-
], RoleManagement);
|
|
137
|
-
//# sourceMappingURL=role-management.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-management.js","sourceRoot":"","sources":["../../../client/pages/role/role-management.ts"],"names":[],"mappings":";AAAA,OAAO,8BAA8B,CAAA;AACrC,OAAO,iCAAiC,CAAA;AACxC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,2CAA2C,CAAA;AAElD,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAG7D,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,QAAQ;IAArC;;QAiC8B,UAAK,GAAW,EAAE,CAAA;QAEnB,UAAK,GAAU,EAAE,CAAA;IAkE9C,CAAC;aArGgD,WAAM,GAAG;QACtD,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6BF;KACF,AA/BoD,CA+BpD;IAOD,IAAI,OAAO;QAAS,OAAO,EAAQ,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,sBAAsB,CAA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K,EAAE,GAAG,CAAA;;;;;;;;;;;OAW1E;YACD,SAAS,EAAE,EAAU,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gBAC/C,SAAS,EAAE,kBAAkB,CAAC,OAAO;aAC3C;YACI,OAAO,EAAE,UAAU,EAAE;SACzB,CAAC,CAAA;QAEC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;IACnC,CAAC;;AAnE4B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAAU;AACV;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;;6CAAkB;AAChB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qDAAmB;AAsCpB;IAAzB,KAAK,CAAC,iBAAiB,CAAC;;qDAAsE;AA1E3F,cAAc;IADnB,aAAa,CAAC,iBAAiB,CAAC;GAC3B,cAAc,CAqGnB","sourcesContent":["import '@things-factory/component-ui'\nimport '../../components/create-role.js'\nimport '../../components/role-edit-form.js'\nimport '../../components/role-privilege-editor.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next } from '@operato/i18n'\nimport { InheritedValueType, PageView } from '@operato/shell'\n\n@customElement('role-management')\nclass RoleManagement extends PageView { static styles = [\n css`\n :host { display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n overflow: auto;\n }\n\n [subtitle] { padding: var(--subtitle-padding);\n font: var(--subtitle-font);\n color: var(--subtitle-text-color);\n\n text-transform: capitalize;\n }\n\n input {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n display: block;\n }\n\n #roles-privileges { flex: 1;\n display: flex;\n margin-top: var(--spacing-medium);\n max-width: var(--content-container-max-width);\n flex-direction: row;\n overflow: auto;\n border-top: var(--border-dim-color);\n }\n `\n ]\n\n @property({ type: String }) title: string = ''\n @property({ type: Object }) role: any\n @property({ type: Array }) roles: any[] = []\n @property({ type: Object }) updateRoleObj: any\n\n get context() { return { title: i18next.t('text.role_management'),\n help: 'auth/roles'\n }\n }\n\n render() { const data = { roles: this.roles || []\n }\n\n return html`\n <create-role\n @fetch-roles=${async () => { this.roles = await this.fetchRoles()\n }}\n ></create-role>\n\n <div subtitle>${i18next.t('text.registered roles')}</div>\n <div id=\"roles-privileges\">\n <quick-find-list\n .data=\"${data}\"\n .openHeaderRenderer=${role => html`\n <role-edit-form .role=\"${role}\" @roleChanged=\"${e => (this.updateRoleObj = e.detail)}\"></role-edit-form>\n `}\n .contentRenderer=\"${(role, _currentTabKey) => html`\n <role-privilege-editor\n .updateRoleObj=${this.updateRoleObj || {}}\n .role=${role}\n @fetch-roles=${async () => { this.roles = await this.fetchRoles()\n await this.updateComplete\n this.quickFindList.openByKey(role.id)\n }}\n ></role-privilege-editor>\n `}\"\n ></quick-find-list>\n </div>\n `\n }\n\n @query('quick-find-list') quickFindList!: HTMLElement & { openByKey: (roleId: string) => void }\n\n async pageUpdated(changes, lifecycle, before) { if (this.active) { this.roles = await this.fetchRoles()\n this.role = this.roles && this.roles[0]\n }\n }\n\n async fetchRoles() { const response = await client.query({ query: gql`\n query roles($sortings: [Sorting!], $inherited: InheritedValueType) { roles(sortings: $sortings, inherited: $inherited) { items { id\n name\n description\n privileges { id\n name\n }\n }\n total\n }\n }\n `,\n variables: { sortings: [{ name: 'name' }],\n inherited: InheritedValueType.Include\n },\n context: gqlContext()\n })\n\n return response.data.roles.items\n }\n}\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js';
|
|
2
|
-
import '@things-factory/component-ui';
|
|
3
|
-
import '../../components/invite-user.js';
|
|
4
|
-
import '../../components/ownership-transfer-popup.js';
|
|
5
|
-
import '../../components/user-role-editor.js';
|
|
6
|
-
import '../../components/create-user.js';
|
|
7
|
-
import { PageView } from '@operato/shell';
|
|
8
|
-
declare const UserManagement_base: (new (...args: any[]) => import("lit").LitElement) & typeof PageView;
|
|
9
|
-
export declare class UserManagement extends UserManagement_base {
|
|
10
|
-
static styles: import("lit").CSSResult[];
|
|
11
|
-
domainUsers: any[];
|
|
12
|
-
owner: any;
|
|
13
|
-
currentTab: string;
|
|
14
|
-
passwordResettable: boolean;
|
|
15
|
-
userCreatable: boolean;
|
|
16
|
-
userListElement: HTMLElement & {
|
|
17
|
-
close: () => void;
|
|
18
|
-
};
|
|
19
|
-
get context(): {
|
|
20
|
-
title: string;
|
|
21
|
-
help: string;
|
|
22
|
-
};
|
|
23
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
24
|
-
pageUpdated(changes: any, lifecycle: any, before: any): Promise<void>;
|
|
25
|
-
refreshUsers(): Promise<void>;
|
|
26
|
-
checkPasswordResettable(): Promise<void>;
|
|
27
|
-
checkUserCreatable(): Promise<void>;
|
|
28
|
-
createUser(user: {
|
|
29
|
-
username: string;
|
|
30
|
-
name: string;
|
|
31
|
-
email: string;
|
|
32
|
-
}): Promise<void>;
|
|
33
|
-
showToast(message: any): void;
|
|
34
|
-
}
|
|
35
|
-
export {};
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import '@material/web/icon/icon.js';
|
|
3
|
-
import '@things-factory/component-ui';
|
|
4
|
-
import '../../components/invite-user.js';
|
|
5
|
-
import '../../components/ownership-transfer-popup.js';
|
|
6
|
-
import '../../components/user-role-editor.js';
|
|
7
|
-
import '../../components/create-user.js';
|
|
8
|
-
import gql from 'graphql-tag';
|
|
9
|
-
import { css, html } from 'lit';
|
|
10
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
11
|
-
import { client, gqlContext } from '@operato/graphql';
|
|
12
|
-
import { i18next, localize } from '@operato/i18n';
|
|
13
|
-
import { PageView } from '@operato/shell';
|
|
14
|
-
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
15
|
-
let UserManagement = class UserManagement extends localize(i18next)(PageView) {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.domainUsers = [];
|
|
19
|
-
this.currentTab = '';
|
|
20
|
-
this.passwordResettable = false;
|
|
21
|
-
this.userCreatable = false;
|
|
22
|
-
}
|
|
23
|
-
static { this.styles = [
|
|
24
|
-
css `
|
|
25
|
-
:host {
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
background-color: var(--md-sys-color-background);
|
|
29
|
-
padding: var(--spacing-large);
|
|
30
|
-
overflow: auto;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@media screen and (max-width: 600px) {
|
|
34
|
-
:host {
|
|
35
|
-
padding: var(--spacing-small);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
`
|
|
39
|
-
]; }
|
|
40
|
-
get context() {
|
|
41
|
-
return {
|
|
42
|
-
title: i18next.t('text.user management'),
|
|
43
|
-
help: 'auth/users'
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
const groupingUser = (this.domainUsers || []).reduce((groupingUser, user) => {
|
|
48
|
-
const userType = user.userType;
|
|
49
|
-
if (!groupingUser[userType]) {
|
|
50
|
-
groupingUser[userType] = [];
|
|
51
|
-
}
|
|
52
|
-
user.activated = user.status === 'activated';
|
|
53
|
-
groupingUser[userType].push(user);
|
|
54
|
-
return groupingUser;
|
|
55
|
-
}, {
|
|
56
|
-
admin: [],
|
|
57
|
-
user: [],
|
|
58
|
-
application: [],
|
|
59
|
-
appliance: []
|
|
60
|
-
});
|
|
61
|
-
const USER_TYPES = {
|
|
62
|
-
USER: i18next.t('label.user'),
|
|
63
|
-
APPLICATION: i18next.t('label.application'),
|
|
64
|
-
APPLIANCE: i18next.t('text.appliance')
|
|
65
|
-
};
|
|
66
|
-
const userSet = {
|
|
67
|
-
[USER_TYPES.USER]: [...groupingUser.user, ...groupingUser.admin],
|
|
68
|
-
[USER_TYPES.APPLICATION]: groupingUser.application,
|
|
69
|
-
[USER_TYPES.APPLIANCE]: groupingUser.appliance
|
|
70
|
-
};
|
|
71
|
-
return html `
|
|
72
|
-
${this.userCreatable
|
|
73
|
-
? html `<create-user
|
|
74
|
-
@create-user=${async (event) => {
|
|
75
|
-
const user = event.detail;
|
|
76
|
-
user.userType = 'user';
|
|
77
|
-
await this.createUser(user);
|
|
78
|
-
}}
|
|
79
|
-
></create-user>`
|
|
80
|
-
: ''}
|
|
81
|
-
<quick-find-list
|
|
82
|
-
id="user-list"
|
|
83
|
-
.data=${userSet}
|
|
84
|
-
@tabChanged=${e => (this.currentTab = e.detail.currentTabKey)}
|
|
85
|
-
.headerRenderer=${user => {
|
|
86
|
-
return !user.activated
|
|
87
|
-
? html `
|
|
88
|
-
<md-icon>do_disturb</md-icon>
|
|
89
|
-
${user.name}
|
|
90
|
-
`
|
|
91
|
-
: html ` ${user.owner ? html ` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `;
|
|
92
|
-
}}
|
|
93
|
-
.contentRenderer=${user => html ` <user-role-editor
|
|
94
|
-
.user=${user}
|
|
95
|
-
.domainOwner=${this.owner}
|
|
96
|
-
.activate=${user.activated}
|
|
97
|
-
@userUpdated=${this.refreshUsers.bind(this)}
|
|
98
|
-
@ownershipTransferred=${this.refreshUsers.bind(this)}
|
|
99
|
-
.passwordResettable=${this.passwordResettable}
|
|
100
|
-
></user-role-editor>`}
|
|
101
|
-
></quick-find-list>
|
|
102
|
-
|
|
103
|
-
${this.currentTab === USER_TYPES.USER
|
|
104
|
-
? html `<invite-user @invitationCompleted=${this.refreshUsers.bind(this)}></invite-user>`
|
|
105
|
-
: ''}
|
|
106
|
-
`;
|
|
107
|
-
}
|
|
108
|
-
async pageUpdated(changes, lifecycle, before) {
|
|
109
|
-
if (this.active) {
|
|
110
|
-
this.refreshUsers();
|
|
111
|
-
this.checkPasswordResettable();
|
|
112
|
-
this.checkUserCreatable();
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
async refreshUsers() {
|
|
116
|
-
const domainUsersResp = await client.query({
|
|
117
|
-
query: gql `
|
|
118
|
-
query {
|
|
119
|
-
users {
|
|
120
|
-
items {
|
|
121
|
-
id
|
|
122
|
-
username
|
|
123
|
-
name
|
|
124
|
-
email
|
|
125
|
-
userType
|
|
126
|
-
status
|
|
127
|
-
owner
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
`,
|
|
132
|
-
context: gqlContext()
|
|
133
|
-
});
|
|
134
|
-
if (!domainUsersResp.errors?.length) {
|
|
135
|
-
this.domainUsers = domainUsersResp.data.users.items || [];
|
|
136
|
-
this.owner = this.domainUsers.filter(user => user.owner)[0] || {};
|
|
137
|
-
this.userListElement?.close();
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async checkPasswordResettable() {
|
|
141
|
-
const response = await client.query({
|
|
142
|
-
query: gql `
|
|
143
|
-
query {
|
|
144
|
-
checkResettablePasswordToDefault
|
|
145
|
-
}
|
|
146
|
-
`
|
|
147
|
-
});
|
|
148
|
-
if (!response.errors) {
|
|
149
|
-
this.passwordResettable = response.data.checkResettablePasswordToDefault;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
async checkUserCreatable() {
|
|
153
|
-
const response = await client.query({
|
|
154
|
-
query: gql `
|
|
155
|
-
query {
|
|
156
|
-
checkDefaultPassword
|
|
157
|
-
}
|
|
158
|
-
`
|
|
159
|
-
});
|
|
160
|
-
if (!response.errors) {
|
|
161
|
-
this.userCreatable = response.data.checkDefaultPassword;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async createUser(user) {
|
|
165
|
-
if (await OxPrompt.open({
|
|
166
|
-
title: i18next.t('text.are_you_sure'),
|
|
167
|
-
text: i18next.t('text.are_you_sure_to_x_user', { x: i18next.t('button.create') }),
|
|
168
|
-
confirmButton: { text: i18next.t('button.confirm') },
|
|
169
|
-
cancelButton: { text: i18next.t('button.cancel') }
|
|
170
|
-
})) {
|
|
171
|
-
const response = await client.mutate({
|
|
172
|
-
mutation: gql `
|
|
173
|
-
mutation createUser($user: NewUser!) {
|
|
174
|
-
createUser(user: $user) {
|
|
175
|
-
name
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
`,
|
|
179
|
-
variables: { user },
|
|
180
|
-
context: gqlContext()
|
|
181
|
-
});
|
|
182
|
-
if (!response.errors) {
|
|
183
|
-
await OxPrompt.open({
|
|
184
|
-
title: i18next.t('text.completed'),
|
|
185
|
-
confirmButton: { text: i18next.t('button.confirm') }
|
|
186
|
-
});
|
|
187
|
-
await this.refreshUsers();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
showToast(message) {
|
|
192
|
-
document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }));
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
__decorate([
|
|
196
|
-
property({ type: Array }),
|
|
197
|
-
__metadata("design:type", Array)
|
|
198
|
-
], UserManagement.prototype, "domainUsers", void 0);
|
|
199
|
-
__decorate([
|
|
200
|
-
property({ type: Object }),
|
|
201
|
-
__metadata("design:type", Object)
|
|
202
|
-
], UserManagement.prototype, "owner", void 0);
|
|
203
|
-
__decorate([
|
|
204
|
-
property({ type: String }),
|
|
205
|
-
__metadata("design:type", String)
|
|
206
|
-
], UserManagement.prototype, "currentTab", void 0);
|
|
207
|
-
__decorate([
|
|
208
|
-
property({ type: Boolean }),
|
|
209
|
-
__metadata("design:type", Boolean)
|
|
210
|
-
], UserManagement.prototype, "passwordResettable", void 0);
|
|
211
|
-
__decorate([
|
|
212
|
-
property({ type: Boolean }),
|
|
213
|
-
__metadata("design:type", Boolean)
|
|
214
|
-
], UserManagement.prototype, "userCreatable", void 0);
|
|
215
|
-
__decorate([
|
|
216
|
-
query('#user-list'),
|
|
217
|
-
__metadata("design:type", Object)
|
|
218
|
-
], UserManagement.prototype, "userListElement", void 0);
|
|
219
|
-
UserManagement = __decorate([
|
|
220
|
-
customElement('user-management')
|
|
221
|
-
], UserManagement);
|
|
222
|
-
export { UserManagement };
|
|
223
|
-
//# sourceMappingURL=user-management.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"user-management.js","sourceRoot":"","sources":["../../../client/pages/user/user-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AAEnC,OAAO,8BAA8B,CAAA;AACrC,OAAO,iCAAiC,CAAA;AACxC,OAAO,8CAA8C,CAAA;AACrD,OAAO,sCAAsC,CAAA;AAC7C,OAAO,iCAAiC,CAAA;AAExC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAElE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAG/C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,QAAQ,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAAxD;;QAmBsB,gBAAW,GAAU,EAAE,CAAA;QAEtB,eAAU,GAAW,EAAE,CAAA;QACtB,uBAAkB,GAAY,KAAK,CAAA;QACnC,kBAAa,GAAY,KAAK,CAAA;IAqL7D,CAAC;aA3MQ,WAAM,GAAG;QACd,GAAG,CAAA;;;;;;;;;;;;;;KAcF;KACF,AAhBY,CA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ACtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;kDAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DAAoC;AACnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;qDAA+B;AAEtC;IAApB,KAAK,CAAC,YAAY,CAAC;;uDAAsD;AAzB/D,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA4M1B","sourcesContent":["import '@material/web/icon/icon.js'\n\nimport '@things-factory/component-ui'\nimport '../../components/invite-user.js'\nimport '../../components/ownership-transfer-popup.js'\nimport '../../components/user-role-editor.js'\nimport '../../components/create-user.js'\n\nimport gql from 'graphql-tag'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\n\nimport { client, gqlContext } from '@operato/graphql'\nimport { i18next, localize } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('user-management')\nexport class UserManagement extends localize(i18next)(PageView) {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--md-sys-color-background);\n padding: var(--spacing-large);\n overflow: auto;\n }\n\n @media screen and (max-width: 600px) {\n :host {\n padding: var(--spacing-small);\n }\n }\n `\n ]\n\n @property({ type: Array }) domainUsers: any[] = []\n @property({ type: Object }) owner: any\n @property({ type: String }) currentTab: string = ''\n @property({ type: Boolean }) passwordResettable: boolean = false\n @property({ type: Boolean }) userCreatable: boolean = false\n\n @query('#user-list') userListElement!: HTMLElement & { close: () => void }\n\n get context() {\n return {\n title: i18next.t('text.user management'),\n help: 'auth/users'\n }\n }\n\n render() {\n const groupingUser = (this.domainUsers || []).reduce(\n (groupingUser, user) => {\n const userType = user.userType\n if (!groupingUser[userType]) {\n groupingUser[userType] = []\n }\n user.activated = user.status === 'activated'\n groupingUser[userType].push(user)\n\n return groupingUser\n },\n {\n admin: [],\n user: [],\n application: [],\n appliance: []\n }\n )\n\n const USER_TYPES = {\n USER: i18next.t('label.user'),\n APPLICATION: i18next.t('label.application'),\n APPLIANCE: i18next.t('text.appliance')\n }\n\n const userSet = {\n [USER_TYPES.USER]: [...groupingUser.user, ...groupingUser.admin],\n [USER_TYPES.APPLICATION]: groupingUser.application,\n [USER_TYPES.APPLIANCE]: groupingUser.appliance\n }\n\n return html`\n ${this.userCreatable\n ? html`<create-user\n @create-user=${async event => {\n const user = event.detail\n user.userType = 'user'\n\n await this.createUser(user)\n }}\n ></create-user>`\n : ''}\n <quick-find-list\n id=\"user-list\"\n .data=${userSet}\n @tabChanged=${e => (this.currentTab = e.detail.currentTabKey)}\n .headerRenderer=${user => {\n return !user.activated\n ? html`\n <md-icon>do_disturb</md-icon>\n ${user.name}\n `\n : html` ${user.owner ? html` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `\n }}\n .contentRenderer=${user =>\n html` <user-role-editor\n .user=${user}\n .domainOwner=${this.owner}\n .activate=${user.activated}\n @userUpdated=${this.refreshUsers.bind(this)}\n @ownershipTransferred=${this.refreshUsers.bind(this)}\n .passwordResettable=${this.passwordResettable}\n ></user-role-editor>`}\n ></quick-find-list>\n\n ${this.currentTab === USER_TYPES.USER\n ? html`<invite-user @invitationCompleted=${this.refreshUsers.bind(this)}></invite-user>`\n : ''}\n `\n }\n\n async pageUpdated(changes, lifecycle, before) {\n if (this.active) {\n this.refreshUsers()\n this.checkPasswordResettable()\n this.checkUserCreatable()\n }\n }\n\n async refreshUsers() {\n const domainUsersResp = await client.query({\n query: gql`\n query {\n users {\n items {\n id\n username\n name\n email\n userType\n status\n owner\n }\n }\n }\n `,\n context: gqlContext()\n })\n\n if (!domainUsersResp.errors?.length) {\n this.domainUsers = domainUsersResp.data.users.items || []\n this.owner = this.domainUsers.filter(user => user.owner)[0] || {}\n this.userListElement?.close()\n }\n }\n\n async checkPasswordResettable() {\n const response = await client.query({\n query: gql`\n query {\n checkResettablePasswordToDefault\n }\n `\n })\n\n if (!response.errors) {\n this.passwordResettable = response.data.checkResettablePasswordToDefault\n }\n }\n\n async checkUserCreatable() {\n const response = await client.query({\n query: gql`\n query {\n checkDefaultPassword\n }\n `\n })\n\n if (!response.errors) {\n this.userCreatable = response.data.checkDefaultPassword\n }\n }\n\n async createUser(user: { username: string; name: string; email: string }) {\n if (\n await OxPrompt.open({\n title: i18next.t('text.are_you_sure'),\n text: i18next.t('text.are_you_sure_to_x_user', { x: i18next.t('button.create') }),\n confirmButton: { text: i18next.t('button.confirm') },\n cancelButton: { text: i18next.t('button.cancel') }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation createUser($user: NewUser!) {\n createUser(user: $user) {\n name\n }\n }\n `,\n variables: { user },\n context: gqlContext()\n })\n\n if (!response.errors) {\n await OxPrompt.open({\n title: i18next.t('text.completed'),\n confirmButton: { text: i18next.t('button.confirm') }\n })\n\n await this.refreshUsers()\n }\n }\n }\n\n showToast(message) {\n document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))\n }\n}\n"]}
|