@dssp/dcsp 1.0.0-alpha.23 → 1.0.0-alpha.24

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.
@@ -0,0 +1,219 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import '@material/web/icon/icon.js';
3
+ import '@things-factory/component-ui';
4
+ import '@things-factory/auth-ui/dist-client/components/ownership-transfer-popup';
5
+ import '@things-factory/auth-ui/dist-client/components/user-role-editor';
6
+ import '@things-factory/auth-ui/dist-client/components/create-user';
7
+ import gql from 'graphql-tag';
8
+ import { css, html } from 'lit';
9
+ import { customElement, property, query } from 'lit/decorators.js';
10
+ import { client, gqlContext } from '@operato/graphql';
11
+ import { i18next } from '@operato/i18n';
12
+ import { PageView } from '@operato/shell';
13
+ import { OxPrompt } from '@operato/popup/ox-prompt.js';
14
+ let SVUserManagement = class SVUserManagement extends PageView {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.domainUsers = [];
18
+ this.currentTab = '';
19
+ this.passwordResettable = false;
20
+ this.userCreatable = false;
21
+ }
22
+ get context() {
23
+ return {
24
+ title: i18next.t('text.user management'),
25
+ help: 'auth/users'
26
+ };
27
+ }
28
+ render() {
29
+ const groupingUser = (this.domainUsers || []).reduce((groupingUser, user) => {
30
+ const userType = user.userType;
31
+ if (!groupingUser[userType]) {
32
+ groupingUser[userType] = [];
33
+ }
34
+ user.activated = user.status === 'activated';
35
+ groupingUser[userType].push(user);
36
+ return groupingUser;
37
+ }, {
38
+ admin: [],
39
+ user: [],
40
+ application: [],
41
+ appliance: []
42
+ });
43
+ const USER_TYPES = {
44
+ USER: i18next.t('label.user'),
45
+ APPLICATION: i18next.t('label.application'),
46
+ APPLIANCE: i18next.t('text.appliance')
47
+ };
48
+ const userSet = {
49
+ [USER_TYPES.USER]: [...groupingUser.user, ...groupingUser.admin],
50
+ [USER_TYPES.APPLICATION]: groupingUser.application,
51
+ [USER_TYPES.APPLIANCE]: groupingUser.appliance
52
+ };
53
+ return html `
54
+ ${this.userCreatable
55
+ ? html `<create-user
56
+ @create-user=${async (event) => {
57
+ const user = event.detail;
58
+ user.userType = 'user';
59
+ await this.createUser(user);
60
+ }}
61
+ ></create-user>`
62
+ : ''}
63
+ <quick-find-list
64
+ id="user-list"
65
+ .data=${userSet}
66
+ @tabChanged=${e => (this.currentTab = e.detail.currentTabKey)}
67
+ .headerRenderer=${user => {
68
+ return html `
69
+ ${!user.activated
70
+ ? html `
71
+ <md-icon>do_disturb</md-icon>
72
+ ${user.name}
73
+ `
74
+ : html ` ${user.owner ? html ` <md-icon>supervisor_account</md-icon> ` : ''} ${user.name} `}
75
+ `;
76
+ }}
77
+ .contentRenderer=${user => html ` <user-role-editor
78
+ .user=${user}
79
+ .domainOwner=${this.owner}
80
+ .activate=${user.activated}
81
+ @userUpdated=${this.refreshUsers.bind(this)}
82
+ @ownershipTransferred=${this.refreshUsers.bind(this)}
83
+ .passwordResettable=${this.passwordResettable}
84
+ ></user-role-editor>`}
85
+ ></quick-find-list>
86
+ `;
87
+ }
88
+ async pageUpdated(changes, lifecycle, before) {
89
+ if (this.active) {
90
+ this.refreshUsers();
91
+ this.checkPasswordResettable();
92
+ this.checkUserCreatable();
93
+ }
94
+ }
95
+ async refreshUsers() {
96
+ var _a, _b;
97
+ const domainUsersResp = await client.query({
98
+ query: gql `
99
+ query {
100
+ users {
101
+ items {
102
+ id
103
+ name
104
+ email
105
+ userType
106
+ status
107
+ owner
108
+ }
109
+ }
110
+ }
111
+ `,
112
+ context: gqlContext()
113
+ });
114
+ if (!((_a = domainUsersResp.errors) === null || _a === void 0 ? void 0 : _a.length)) {
115
+ this.domainUsers = domainUsersResp.data.users.items || [];
116
+ this.owner = this.domainUsers.filter(user => user.owner)[0] || {};
117
+ (_b = this.userListElement) === null || _b === void 0 ? void 0 : _b.close();
118
+ }
119
+ }
120
+ async checkPasswordResettable() {
121
+ const response = await client.query({
122
+ query: gql `
123
+ query {
124
+ checkResettablePasswordToDefault
125
+ }
126
+ `
127
+ });
128
+ if (!response.errors) {
129
+ this.passwordResettable = response.data.checkResettablePasswordToDefault;
130
+ }
131
+ }
132
+ async checkUserCreatable() {
133
+ const response = await client.query({
134
+ query: gql `
135
+ query {
136
+ checkDefaultPassword
137
+ }
138
+ `
139
+ });
140
+ if (!response.errors) {
141
+ this.userCreatable = response.data.checkDefaultPassword;
142
+ }
143
+ }
144
+ async createUser(user) {
145
+ if (await OxPrompt.open({
146
+ title: i18next.t('text.are_you_sure'),
147
+ text: i18next.t('text.are_you_sure_to_x_user', { x: i18next.t('button.create') }),
148
+ confirmButton: { text: i18next.t('button.confirm') },
149
+ cancelButton: { text: i18next.t('button.cancel') }
150
+ })) {
151
+ const response = await client.mutate({
152
+ mutation: gql `
153
+ mutation createUser($user: NewUser!) {
154
+ createUser(user: $user) {
155
+ name
156
+ }
157
+ }
158
+ `,
159
+ variables: { user },
160
+ context: gqlContext()
161
+ });
162
+ if (!response.errors) {
163
+ await OxPrompt.open({
164
+ title: i18next.t('text.completed'),
165
+ confirmButton: { text: i18next.t('button.confirm') }
166
+ });
167
+ await this.refreshUsers();
168
+ }
169
+ }
170
+ }
171
+ showToast(message) {
172
+ document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }));
173
+ }
174
+ };
175
+ SVUserManagement.styles = [
176
+ css `
177
+ :host {
178
+ display: flex;
179
+ flex-direction: column;
180
+ background-color: var(--main-section-background-color);
181
+ padding: var(--padding-wide);
182
+ overflow: auto;
183
+ }
184
+
185
+ @media screen and (max-width: 600px) {
186
+ :host {
187
+ padding: var(--padding-narrow);
188
+ }
189
+ }
190
+ `
191
+ ];
192
+ __decorate([
193
+ property({ type: Array }),
194
+ __metadata("design:type", Array)
195
+ ], SVUserManagement.prototype, "domainUsers", void 0);
196
+ __decorate([
197
+ property({ type: Object }),
198
+ __metadata("design:type", Object)
199
+ ], SVUserManagement.prototype, "owner", void 0);
200
+ __decorate([
201
+ property({ type: String }),
202
+ __metadata("design:type", String)
203
+ ], SVUserManagement.prototype, "currentTab", void 0);
204
+ __decorate([
205
+ property({ type: Boolean }),
206
+ __metadata("design:type", Boolean)
207
+ ], SVUserManagement.prototype, "passwordResettable", void 0);
208
+ __decorate([
209
+ property({ type: Boolean }),
210
+ __metadata("design:type", Boolean)
211
+ ], SVUserManagement.prototype, "userCreatable", void 0);
212
+ __decorate([
213
+ query('#user-list'),
214
+ __metadata("design:type", Object)
215
+ ], SVUserManagement.prototype, "userListElement", void 0);
216
+ SVUserManagement = __decorate([
217
+ customElement('sv-user-management')
218
+ ], SVUserManagement);
219
+ //# sourceMappingURL=sv-user-management.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sv-user-management.js","sourceRoot":"","sources":["../../client/pages/sv-user-management.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,8BAA8B,CAAA;AACrC,OAAO,yEAAyE,CAAA;AAChF,OAAO,iEAAiE,CAAA;AACxE,OAAO,4DAA4D,CAAA;AAEnE,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,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAGtD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,QAAQ;IAAvC;;QAmB6B,gBAAW,GAAU,EAAE,CAAA;QAEtB,eAAU,GAAW,EAAE,CAAA;QACtB,uBAAkB,GAAY,KAAK,CAAA;QACnC,kBAAa,GAAY,KAAK,CAAA;IAkL7D,CAAC;IA9KC,IAA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AC;;+CAAW;AACV;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDAAwB;AACtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;4DAAoC;AACnC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;uDAA+B;AAEtC;IAApB,KAAK,CAAC,YAAY,CAAC;;yDAAsD;AAzBtE,gBAAgB;IADrB,aAAa,CAAC,oBAAoB,CAAC;GAC9B,gBAAgB,CAyMrB","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@things-factory/component-ui'\nimport '@things-factory/auth-ui/dist-client/components/ownership-transfer-popup'\nimport '@things-factory/auth-ui/dist-client/components/user-role-editor'\nimport '@things-factory/auth-ui/dist-client/components/create-user'\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 } from '@operato/i18n'\nimport { PageView } from '@operato/shell'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\n\n@customElement('sv-user-management')\nclass SVUserManagement extends PageView {\n static styles = [\n css`\n :host {\n display: flex;\n flex-direction: column;\n background-color: var(--main-section-background-color);\n padding: var(--padding-wide);\n overflow: auto;\n }\n\n @media screen and (max-width: 600px) {\n :host {\n padding: var(--padding-narrow);\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 html`\n ${!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 }}\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 }\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 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) {\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"]}
@@ -0,0 +1 @@
1
+ export default function route(page: string): "/dashboard" | "users" | undefined;
@@ -0,0 +1,10 @@
1
+ export default function route(page) {
2
+ switch (page) {
3
+ case '':
4
+ return '/dashboard';
5
+ case 'users':
6
+ import('./pages/sv-user-management');
7
+ return page;
8
+ }
9
+ }
10
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../client/route.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAY;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,EAAE;YACL,OAAO,YAAY,CAAA;QAErB,KAAK,OAAO;YACV,MAAM,CAAC,4BAA4B,CAAC,CAAA;YACpC,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC","sourcesContent":["export default function route(page: string) {\n switch (page) {\n case '':\n return '/dashboard'\n\n case 'users':\n import('./pages/sv-user-management')\n return page\n }\n}\n"]}