@things-factory/auth-ui 8.0.38 → 9.0.0-9.0.0-beta.59.0

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.
Files changed (142) hide show
  1. package/dist-client/components/abstract-auth-page.d.ts +1 -1
  2. package/dist-client/components/abstract-auth-page.js +2 -0
  3. package/dist-client/components/abstract-auth-page.js.map +1 -1
  4. package/dist-client/components/abstract-password-reset.d.ts +2 -2
  5. package/dist-client/components/abstract-password-reset.js +5 -5
  6. package/dist-client/components/abstract-password-reset.js.map +1 -1
  7. package/dist-client/components/change-password.js +1 -1
  8. package/dist-client/components/change-password.js.map +1 -1
  9. package/dist-client/components/invite-user.d.ts +1 -1
  10. package/dist-client/components/invite-user.js +1 -2
  11. package/dist-client/components/invite-user.js.map +1 -1
  12. package/dist-client/components/partner-role-editor.js +1 -1
  13. package/dist-client/components/partner-role-editor.js.map +1 -1
  14. package/dist-client/components/profile-component.d.ts +3 -3
  15. package/dist-client/components/profile-component.js +3 -3
  16. package/dist-client/components/profile-component.js.map +1 -1
  17. package/dist-client/components/role-privilege-editor.js +2 -1
  18. package/dist-client/components/role-privilege-editor.js.map +1 -1
  19. package/dist-client/components/user-role-editor.d.ts +2 -2
  20. package/dist-client/components/user-role-editor.js +2 -2
  21. package/dist-client/components/user-role-editor.js.map +1 -1
  22. package/dist-client/constants/index.d.ts +1 -1
  23. package/dist-client/constants/index.js +1 -1
  24. package/dist-client/constants/index.js.map +1 -1
  25. package/dist-client/entries/auth/activate.d.ts +1 -1
  26. package/dist-client/entries/auth/activate.js +1 -1
  27. package/dist-client/entries/auth/activate.js.map +1 -1
  28. package/dist-client/entries/auth/checkin.js +2 -2
  29. package/dist-client/entries/auth/checkin.js.map +1 -1
  30. package/dist-client/entries/auth/forgot-password.d.ts +2 -2
  31. package/dist-client/entries/auth/forgot-password.js +11 -3
  32. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  33. package/dist-client/entries/auth/reset-password.d.ts +1 -1
  34. package/dist-client/entries/auth/reset-password.js +1 -1
  35. package/dist-client/entries/auth/reset-password.js.map +1 -1
  36. package/dist-client/entries/auth/result.d.ts +1 -1
  37. package/dist-client/entries/auth/result.js +1 -1
  38. package/dist-client/entries/auth/result.js.map +1 -1
  39. package/dist-client/entries/auth/signin.d.ts +1 -1
  40. package/dist-client/entries/auth/signin.js +1 -1
  41. package/dist-client/entries/auth/signin.js.map +1 -1
  42. package/dist-client/entries/auth/signup.d.ts +3 -1
  43. package/dist-client/entries/auth/signup.js +32 -2
  44. package/dist-client/entries/auth/signup.js.map +1 -1
  45. package/dist-client/entries/auth/unlock-user.d.ts +1 -1
  46. package/dist-client/entries/auth/unlock-user.js +1 -1
  47. package/dist-client/entries/auth/unlock-user.js.map +1 -1
  48. package/dist-client/entries/oauth2/oauth2-decision-page.d.ts +1 -1
  49. package/dist-client/entries/oauth2/oauth2-decision-page.js +1 -1
  50. package/dist-client/entries/oauth2/oauth2-decision-page.js.map +1 -1
  51. package/dist-client/entries/public/home.js +2 -2
  52. package/dist-client/entries/public/home.js.map +1 -1
  53. package/dist-client/pages/application/application.js +1 -1
  54. package/dist-client/pages/application/application.js.map +1 -1
  55. package/dist-client/pages/domain/domain-management.d.ts +1 -1
  56. package/dist-client/pages/domain/domain-management.js +1 -1
  57. package/dist-client/pages/domain/domain-management.js.map +1 -1
  58. package/dist-client/pages/domain-link/domain-link-management.d.ts +53 -0
  59. package/dist-client/pages/domain-link/domain-link-management.js +353 -0
  60. package/dist-client/pages/domain-link/domain-link-management.js.map +1 -0
  61. package/dist-client/pages/partner/partner-management.d.ts +3 -3
  62. package/dist-client/pages/partner/partner-management.js +3 -3
  63. package/dist-client/pages/partner/partner-management.js.map +1 -1
  64. package/dist-client/pages/profile.d.ts +1 -1
  65. package/dist-client/pages/profile.js +1 -1
  66. package/dist-client/pages/profile.js.map +1 -1
  67. package/dist-client/pages/role/role-management.d.ts +3 -3
  68. package/dist-client/pages/role/role-management.js +3 -3
  69. package/dist-client/pages/role/role-management.js.map +1 -1
  70. package/dist-client/pages/user/user-management.d.ts +4 -4
  71. package/dist-client/pages/user/user-management.js +4 -4
  72. package/dist-client/pages/user/user-management.js.map +1 -1
  73. package/dist-client/route.js +3 -0
  74. package/dist-client/route.js.map +1 -1
  75. package/dist-client/tsconfig.tsbuildinfo +1 -1
  76. package/dist-server/tsconfig.tsbuildinfo +1 -1
  77. package/helps/auth/domain-link.md +178 -0
  78. package/package.json +12 -12
  79. package/things-factory.config.js +2 -1
  80. package/translations/en.json +7 -0
  81. package/translations/ja.json +7 -0
  82. package/translations/ko.json +7 -0
  83. package/translations/ms.json +7 -0
  84. package/translations/zh.json +7 -0
  85. package/client/auth-style-sign.ts +0 -194
  86. package/client/bootstrap.ts +0 -55
  87. package/client/components/abstract-auth-page.ts +0 -301
  88. package/client/components/abstract-password-reset.ts +0 -163
  89. package/client/components/abstract-sign.ts +0 -127
  90. package/client/components/change-password.ts +0 -153
  91. package/client/components/contact-us.ts +0 -116
  92. package/client/components/create-domain-popup.ts +0 -141
  93. package/client/components/create-role.ts +0 -123
  94. package/client/components/create-user.ts +0 -117
  95. package/client/components/credential-manager.ts +0 -64
  96. package/client/components/delete-user-popup.ts +0 -117
  97. package/client/components/domain-switch.ts +0 -127
  98. package/client/components/invite-customer.ts +0 -104
  99. package/client/components/invite-user.ts +0 -104
  100. package/client/components/my-login-history.ts +0 -101
  101. package/client/components/ownership-transfer-popup.ts +0 -110
  102. package/client/components/partner-info-card.ts +0 -89
  103. package/client/components/partner-role-editor.ts +0 -153
  104. package/client/components/profile-component.ts +0 -392
  105. package/client/components/role-edit-form.ts +0 -92
  106. package/client/components/role-privilege-editor.ts +0 -267
  107. package/client/components/role-selector.ts +0 -102
  108. package/client/components/user-role-editor.ts +0 -499
  109. package/client/constants/application.ts +0 -9
  110. package/client/constants/index.ts +0 -1
  111. package/client/entries/auth/activate.ts +0 -272
  112. package/client/entries/auth/checkin.ts +0 -183
  113. package/client/entries/auth/forgot-password.ts +0 -104
  114. package/client/entries/auth/reset-password.ts +0 -22
  115. package/client/entries/auth/result.ts +0 -193
  116. package/client/entries/auth/signin.ts +0 -18
  117. package/client/entries/auth/signup.ts +0 -115
  118. package/client/entries/auth/unlock-user.ts +0 -22
  119. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  120. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  121. package/client/entries/public/home.ts +0 -246
  122. package/client/index.ts +0 -124
  123. package/client/pages/app-binding/app-binding.ts +0 -423
  124. package/client/pages/app-binding/app-bindings.ts +0 -171
  125. package/client/pages/appliance/appliance.ts +0 -452
  126. package/client/pages/appliance/home.ts +0 -177
  127. package/client/pages/appliance/register.ts +0 -183
  128. package/client/pages/application/application.ts +0 -428
  129. package/client/pages/application/applications.ts +0 -182
  130. package/client/pages/application/register.ts +0 -211
  131. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  132. package/client/pages/attribute/attribute-set-management.ts +0 -282
  133. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  134. package/client/pages/domain/domain-management.ts +0 -431
  135. package/client/pages/partner/partner-management.ts +0 -112
  136. package/client/pages/profile.ts +0 -32
  137. package/client/pages/role/role-management.ts +0 -134
  138. package/client/pages/user/user-management.ts +0 -223
  139. package/client/route.ts +0 -67
  140. package/client/themes/auth-theme.css +0 -65
  141. package/client/utils/password-rule.ts +0 -37
  142. package/server/index.ts +0 -0
@@ -1,431 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
-
3
- import '@operato/data-grist/ox-grist.js'
4
- import '@operato/data-grist/ox-filters-form.js'
5
- import '@operato/context/ox-context-page-toolbar.js'
6
- import '@operato/attribute/ox-attribute-view.js'
7
- import '../../components/create-domain-popup'
8
-
9
- import gql from 'graphql-tag'
10
- import { css, html } from 'lit'
11
- import { customElement, property, query } from 'lit/decorators.js'
12
- import moment from '@operato/moment-timezone-es'
13
- import { connect } from 'pwa-helpers/connect-mixin'
14
-
15
- import { DataGrist } from '@operato/data-grist/ox-grist.js'
16
- import { client } from '@operato/graphql'
17
- import { i18next, localize } from '@operato/i18n'
18
- import { openPopup } from '@operato/layout'
19
- import { PageView, store } from '@operato/shell'
20
- import { CommonHeaderStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
21
- import { isMobileDevice } from '@operato/utils'
22
- import { p13n } from '@operato/p13n'
23
- import { FetchOption } from '@operato/data-grist'
24
-
25
- function getSystemTimeZone(): string {
26
- try {
27
- const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone
28
- if (!timeZone) {
29
- throw new Error('Unable to resolve timeZone')
30
- }
31
- return timeZone
32
- } catch (e) {
33
- console.warn('Failed to get system timeZone, falling back to UTC.', e)
34
- return 'UTC'
35
- }
36
- }
37
-
38
- const DEFAULT_TZ = getSystemTimeZone()
39
- const TIMEZONE_OPTIONS = ['', DEFAULT_TZ, ...moment.tz.names().filter(tz => tz !== DEFAULT_TZ)]
40
-
41
- @customElement('domain-management')
42
- export class DomainManagement extends connect(store)(p13n(localize(i18next)(PageView))) {
43
- static styles = [
44
- CommonGristStyles,
45
- CommonHeaderStyles,
46
- ScrollbarStyles,
47
- css`
48
- :host {
49
- display: flex;
50
- flex-direction: column;
51
-
52
- overflow: hidden;
53
- }
54
-
55
- ox-grist {
56
- overflow-y: auto;
57
- flex: 1;
58
- }
59
- `
60
- ]
61
-
62
- @property({ type: Boolean }) active: boolean = false
63
- @property({ type: Object }) config: any
64
- @property({ type: String }) mode: 'CARD' | 'LIST' | 'GRID' = isMobileDevice() ? 'CARD' : 'GRID'
65
-
66
- private domainTypes?: string[]
67
-
68
- @query('ox-grist') private grist!: DataGrist
69
-
70
- get context() {
71
- return {
72
- title: i18next.t('text.domain management'),
73
- search: {
74
- handler: (search: string) => {
75
- this.grist.searchText = search
76
- },
77
- value: this.grist?.searchText || ''
78
- },
79
- filter: {
80
- handler: () => {
81
- this.grist.toggleHeadroom()
82
- }
83
- },
84
- actions: [
85
- {
86
- title: i18next.t('button.add'),
87
- action: this.onCreateDomain.bind(this),
88
- icon: 'add'
89
- },
90
- {
91
- title: i18next.t('button.save'),
92
- action: this.onUpdateDomains.bind(this),
93
- icon: 'save'
94
- }
95
- ],
96
- toolbar: false
97
- }
98
- }
99
-
100
- render() {
101
- return html`
102
- <ox-grist
103
- .mode=${this.mode}
104
- .config=${this.config}
105
- .fetchHandler=${this.fetchHandler.bind(this)}
106
- .personalConfigProvider=${this.getPagePreferenceProvider('ox-grist')!}
107
- >
108
- <div slot="headroom" class="header">
109
- <ox-context-page-toolbar class="actions" .context=${this.context}></ox-context-page-toolbar>
110
- </div>
111
-
112
- <ox-grist-personalizer slot="setting"></ox-grist-personalizer>
113
- </ox-grist>
114
- `
115
- }
116
-
117
- async pageInitialized() {
118
- this.config = {
119
- rows: {
120
- appendable: false
121
- },
122
- columns: [
123
- { type: 'gutter', gutterName: 'sequence' },
124
- {
125
- type: 'gutter',
126
- gutterName: 'button',
127
- icon: 'assignment',
128
- title: i18next.t('title.open attributes view'),
129
- handlers: {
130
- click: async (columns, data, column, record, rowIndex) => {
131
- const attributeSet = await this.getAttributeSetForDomain()
132
-
133
- openPopup(
134
- html`
135
- <ox-attribute-view
136
- .attributeSet=${attributeSet}
137
- .value=${record.attributes}
138
- style="background-color: white;"
139
- ></ox-attribute-view>
140
- `,
141
- {
142
- backdrop: true,
143
- size: 'large',
144
- title: record.name + ' ' + i18next.t('title.attributes')
145
- }
146
- )
147
- }
148
- }
149
- },
150
- {
151
- type: 'gutter',
152
- gutterName: 'button',
153
- icon: 'domain',
154
- title: i18next.t('title.move to this domain'),
155
- handlers: {
156
- click: (_columns, _data, _column, record, _rowIndex) => {
157
- if (record.id) {
158
- const subdomain = record.subdomain
159
- const extType = record.extType || 'domain'
160
- location.pathname = `/${extType}/${subdomain}/users`
161
- }
162
- }
163
- }
164
- },
165
- {
166
- type: 'string',
167
- name: 'name',
168
- header: i18next.t('field.name'),
169
- record: {
170
- editable: false
171
- },
172
- filter: 'search',
173
- sortable: true,
174
- width: 200
175
- },
176
- {
177
- type: 'string',
178
- name: 'description',
179
- header: i18next.t('field.description'),
180
- record: {
181
- editable: true
182
- },
183
- filter: 'search',
184
- width: 200
185
- },
186
- {
187
- type: 'string',
188
- name: 'subdomain',
189
- header: i18next.t('field.subdomain'),
190
- record: {
191
- editable: false
192
- },
193
- filter: 'search',
194
- width: 200
195
- },
196
- {
197
- type: 'resource-object',
198
- name: 'parent',
199
- header: i18next.t('field.parent-domain'),
200
- record: {
201
- editable: true,
202
- options: {
203
- title: i18next.t('text.select domain'),
204
- queryName: 'domains',
205
- nameField: 'name',
206
- descriptionField: 'description',
207
- select: [
208
- { name: 'id', hidden: true },
209
- { name: 'name', header: i18next.t('field.name'), filter: 'search' },
210
- { name: 'description', header: i18next.t('field.description'), filter: 'search' }
211
- ],
212
- list: { fields: ['name', 'description'] }
213
- }
214
- },
215
- width: 140
216
- },
217
- {
218
- type: 'resource-object',
219
- name: 'ownerUser',
220
- header: i18next.t('field.owner-user'),
221
- record: {
222
- editable: true,
223
- options: {
224
- title: i18next.t('title.lookup user'),
225
- queryName: 'users',
226
- nameField: 'name',
227
- descriptionField: 'email',
228
- select: [
229
- { name: 'id', hidden: true },
230
- { name: 'name', header: i18next.t('field.name'), filter: 'search' },
231
- { name: 'email', header: i18next.t('field.email'), filter: 'search' }
232
- ],
233
- filters: [{ name: 'userType', operator: 'eq', value: 'user' }],
234
- list: { fields: ['name', 'email'] }
235
- }
236
- },
237
- width: 140
238
- },
239
- {
240
- type: 'select',
241
- name: 'extType',
242
- header: i18next.t('field.type'),
243
- record: {
244
- editable: true,
245
- options: async () => {
246
- return ['', ...(await this.getDomainTypes())]
247
- }
248
- },
249
- width: 100
250
- },
251
- {
252
- type: 'select',
253
- name: 'timezone',
254
- header: i18next.t('field.timezone'),
255
- record: {
256
- editable: true,
257
- options: TIMEZONE_OPTIONS
258
- },
259
- width: 120
260
- },
261
- {
262
- type: 'attributes',
263
- name: 'attributes',
264
- header: i18next.t('field.attributes'),
265
- record: {
266
- editable: true,
267
- options: async () => {
268
- return {
269
- objectified: true,
270
- attributeSet: await this.getAttributeSetForDomain()
271
- }
272
- }
273
- },
274
- width: 120
275
- },
276
- {
277
- type: 'datetime',
278
- name: 'updatedAt',
279
- header: i18next.t('field.updated_at'),
280
- width: 180
281
- }
282
- ]
283
- }
284
- }
285
-
286
- async pageUpdated(changes, lifecycle) {
287
- if (this.active) {
288
- await this.updateComplete
289
-
290
- this.grist.fetch()
291
- }
292
- }
293
-
294
- async fetchHandler({ page, limit, sortings = [], filters = [] }: FetchOption) {
295
- const response = await client.query({
296
- query: gql`
297
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
298
- domains(filters: $filters, pagination: $pagination, sortings: $sortings) {
299
- items {
300
- id
301
- name
302
- description
303
- subdomain
304
- parent {
305
- id
306
- name
307
- }
308
- ownerUser {
309
- id
310
- name
311
- email
312
- }
313
- extType
314
- timezone
315
- attributes
316
- updatedAt
317
- }
318
- total
319
- }
320
- }
321
- `,
322
- variables: {
323
- filters,
324
- pagination: { page, limit },
325
- sortings
326
- }
327
- })
328
-
329
- return {
330
- total: response.data.domains.total || 0,
331
- records: response.data.domains.items || []
332
- }
333
- }
334
-
335
- async onUpdateDomains() {
336
- let patches = this.grist.dirtyRecords
337
-
338
- if (patches && patches.length) {
339
- patches = patches.map(domain => {
340
- let patchField = domain.id ? { id: domain.id } : {}
341
- const dirtyFields = domain.__dirtyfields__
342
- for (let key in dirtyFields) {
343
- if (key == 'ownerUser') {
344
- const ownerUser = dirtyFields[key].after
345
- patchField['owner'] = ownerUser.id || ''
346
- } else {
347
- patchField[key] = dirtyFields[key].after
348
- }
349
- }
350
-
351
- return {
352
- ...patchField
353
- }
354
- })
355
-
356
- const response = await client.mutate({
357
- mutation: gql`
358
- mutation updateDomains($patches: [DomainPatch!]!) {
359
- updateDomains(patches: $patches)
360
- }
361
- `,
362
- variables: { patches }
363
- })
364
-
365
- if (!response.errors) {
366
- this.grist.fetch()
367
- return this.showToast(i18next.t('text.updated_successfully'))
368
- }
369
- }
370
- }
371
-
372
- async onCreateDomain() {
373
- openPopup(
374
- html`
375
- <create-domain-popup
376
- @fetch-data=${async () => {
377
- this.grist.fetch()
378
- }}
379
- ></create-domain-popup>
380
- `,
381
- {
382
- size: 'small',
383
- title: `${i18next.t('title.create_domain')}`
384
- }
385
- )
386
- }
387
-
388
- async getAttributeSetForDomain() {
389
- const response = await client.query({
390
- query: gql`
391
- query {
392
- attributeSet: attributeSetByEntity(entity: "Domain") {
393
- entity
394
- description
395
- items {
396
- name
397
- description
398
- tag
399
- type
400
- active
401
- hidden
402
- options
403
- }
404
- }
405
- }
406
- `
407
- })
408
-
409
- return response.data?.attributeSet || {}
410
- }
411
-
412
- async getDomainTypes() {
413
- if (!this.domainTypes) {
414
- const response = await client.query({
415
- query: gql`
416
- query {
417
- domainTypes
418
- }
419
- `
420
- })
421
-
422
- this.domainTypes = response.data?.domainTypes || ['domain']
423
- }
424
-
425
- return this.domainTypes || []
426
- }
427
-
428
- showToast(message) {
429
- document.dispatchEvent(new CustomEvent('notify', { detail: { message } }))
430
- }
431
- }
@@ -1,112 +0,0 @@
1
- import '@things-factory/component-ui'
2
- import '../../components/partner-info-card'
3
- import '../../components/partner-role-editor'
4
- import '../../components/invite-customer'
5
-
6
- import gql from 'graphql-tag'
7
- import { css, html } from 'lit'
8
- import { customElement, property } from 'lit/decorators.js'
9
- import { connect } from 'pwa-helpers/connect-mixin.js'
10
-
11
- import { client, gqlContext } from '@operato/graphql'
12
- import { i18next } from '@operato/i18n'
13
- import { PageView, store } from '@operato/shell'
14
-
15
- @customElement('partner-management')
16
- class PartnerManagement extends connect(store)(PageView) {
17
- static styles = [
18
- css`
19
- :host {
20
- display: flex;
21
- flex-direction: column;
22
- background-color: var(--md-sys-color-background);
23
- padding: var(--spacing-large);
24
-
25
- overflow: auto;
26
- }
27
- h2 {
28
- margin: var(--title-margin);
29
- font: var(--title-font);
30
- color: var(--title-text-color);
31
- }
32
- .role-editor {
33
- flex: 1;
34
- }
35
- `
36
- ]
37
-
38
- @property({ type: Array }) customers: any[] = []
39
- @property({ type: Array }) vendors: any[] = []
40
-
41
- get context() {
42
- return {
43
- title: `${i18next.t('title.partners')}`,
44
- help: 'operato-hub/partners'
45
- }
46
- }
47
-
48
- render() {
49
- const data = {
50
- [i18next.t('label.customers')]: this.customers || [],
51
- [i18next.t('label.vendors')]: this.vendors || []
52
- }
53
-
54
- return html`
55
- <h2>partners</h2>
56
-
57
- <quick-find-list
58
- .data="${data}"
59
- .contentRenderer="${(item, currentTabKey) => html`
60
- ${currentTabKey === i18next.t('label.customers')
61
- ? html`
62
- <partner-role-editor
63
- class="role-editor"
64
- .customer="${item}"
65
- @contractTerminated="${this.refreshPartners.bind(this)}"
66
- ></partner-role-editor>
67
- `
68
- : html`<partner-info-card .partner="${item}"></partner-info-card>`}
69
- `}"
70
- >
71
- </quick-find-list>
72
-
73
- <invite-customer
74
- .customers=${this.customers || []}
75
- @invitationCompleted="${this.refreshPartners.bind(this)}"
76
- ></invite-customer>
77
- `
78
- }
79
-
80
- pageUpdated() {
81
- if (this.active) {
82
- this.refreshPartners()
83
- } else {
84
- /* this page is deactivated */
85
- }
86
- }
87
-
88
- async refreshPartners() {
89
- const response = await client.query({
90
- query: gql`
91
- query {
92
- customers {
93
- id
94
- name
95
- description
96
- }
97
- vendors {
98
- id
99
- name
100
- description
101
- }
102
- }
103
- `,
104
- context: gqlContext()
105
- })
106
-
107
- if (!response.errors?.length) {
108
- this.customers = response.data.customers
109
- this.vendors = response.data.vendors
110
- }
111
- }
112
- }
@@ -1,32 +0,0 @@
1
- import '../components/profile-component'
2
-
3
- import { css, html } from 'lit'
4
- import { customElement } from 'lit/decorators.js'
5
-
6
- import { i18next, localize } from '@operato/i18n'
7
- import { PageView } from '@operato/shell'
8
- import { ScrollbarStyles } from '@operato/styles'
9
-
10
- @customElement('auth-profile')
11
- export class AuthProfile extends localize(i18next)(PageView) {
12
- static styles = [
13
- ScrollbarStyles,
14
- css`
15
- :host {
16
- display: block;
17
- background-color: var(--md-sys-color-background);
18
- overflow-y: auto;
19
- }
20
- `
21
- ]
22
-
23
- get context() {
24
- return {
25
- title: i18next.t('text.auth profile')
26
- }
27
- }
28
-
29
- render() {
30
- return html` <profile-component></profile-component> `
31
- }
32
- }
@@ -1,134 +0,0 @@
1
- import '@things-factory/component-ui'
2
- import '../../components/create-role'
3
- import '../../components/role-edit-form'
4
- import '../../components/role-privilege-editor'
5
-
6
- import gql from 'graphql-tag'
7
- import { css, html } from 'lit'
8
- import { customElement, property, query } from 'lit/decorators.js'
9
- import { connect } from 'pwa-helpers/connect-mixin.js'
10
-
11
- import { client, gqlContext } from '@operato/graphql'
12
- import { i18next } from '@operato/i18n'
13
- import { InheritedValueType, PageView, store } from '@operato/shell'
14
-
15
- @customElement('role-management')
16
- class RoleManagement extends connect(store)(PageView) {
17
- static styles = [
18
- css`
19
- :host {
20
- 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] {
28
- padding: var(--subtitle-padding);
29
- font: var(--subtitle-font);
30
- color: var(--subtitle-text-color);
31
-
32
- text-transform: capitalize;
33
- }
34
-
35
- input {
36
- display: block;
37
- }
38
-
39
- #roles-privileges {
40
- 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
-
51
- @property({ type: String }) title: string = ''
52
- @property({ type: Object }) role: any
53
- @property({ type: Array }) roles: any[] = []
54
- @property({ type: Object }) updateRoleObj: any
55
-
56
- get context() {
57
- return {
58
- title: i18next.t('text.role_management'),
59
- help: 'auth/roles'
60
- }
61
- }
62
-
63
- render() {
64
- const data = {
65
- roles: this.roles || []
66
- }
67
-
68
- return html`
69
- <create-role
70
- @fetch-roles=${async () => {
71
- this.roles = await this.fetchRoles()
72
- }}
73
- ></create-role>
74
-
75
- <div subtitle>${i18next.t('text.registered roles')}</div>
76
- <div id="roles-privileges">
77
- <quick-find-list
78
- .data="${data}"
79
- .openHeaderRenderer=${role => html`
80
- <role-edit-form .role="${role}" @roleChanged="${e => (this.updateRoleObj = e.detail)}"></role-edit-form>
81
- `}
82
- .contentRenderer="${(role, _currentTabKey) => html`
83
- <role-privilege-editor
84
- .updateRoleObj=${this.updateRoleObj || {}}
85
- .role=${role}
86
- @fetch-roles=${async () => {
87
- this.roles = await this.fetchRoles()
88
- await this.updateComplete
89
- this.quickFindList.openByKey(role.id)
90
- }}
91
- ></role-privilege-editor>
92
- `}"
93
- ></quick-find-list>
94
- </div>
95
- `
96
- }
97
-
98
- @query('quick-find-list') quickFindList!: HTMLElement & { openByKey: (roleId: string) => void }
99
-
100
- async pageUpdated(changes, lifecycle, before) {
101
- if (this.active) {
102
- this.roles = await this.fetchRoles()
103
- this.role = this.roles && this.roles[0]
104
- }
105
- }
106
-
107
- async fetchRoles() {
108
- const response = await client.query({
109
- query: gql`
110
- query roles($sortings: [Sorting!], $inherited: InheritedValueType) {
111
- roles(sortings: $sortings, inherited: $inherited) {
112
- items {
113
- id
114
- name
115
- description
116
- privileges {
117
- id
118
- name
119
- }
120
- }
121
- total
122
- }
123
- }
124
- `,
125
- variables: {
126
- sortings: [{ name: 'name' }],
127
- inherited: InheritedValueType.Include
128
- },
129
- context: gqlContext()
130
- })
131
-
132
- return response.data.roles.items
133
- }
134
- }