@things-factory/auth-ui 8.0.0 → 9.0.0-beta.3

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 (99) hide show
  1. package/dist-client/components/abstract-auth-page.js +10 -10
  2. package/dist-client/components/abstract-auth-page.js.map +1 -1
  3. package/dist-client/components/abstract-password-reset.d.ts +1 -2
  4. package/dist-client/components/abstract-password-reset.js +7 -14
  5. package/dist-client/components/abstract-password-reset.js.map +1 -1
  6. package/dist-client/components/abstract-sign.js +12 -11
  7. package/dist-client/components/abstract-sign.js.map +1 -1
  8. package/dist-client/components/contact-us.d.ts +1 -1
  9. package/dist-client/components/contact-us.js +10 -7
  10. package/dist-client/components/contact-us.js.map +1 -1
  11. package/dist-client/components/create-user.js +28 -5
  12. package/dist-client/components/create-user.js.map +1 -1
  13. package/dist-client/components/invite-user.js +19 -11
  14. package/dist-client/components/invite-user.js.map +1 -1
  15. package/dist-client/components/ownership-transfer-popup.js +3 -3
  16. package/dist-client/components/ownership-transfer-popup.js.map +1 -1
  17. package/dist-client/components/profile-component.d.ts +5 -1
  18. package/dist-client/components/profile-component.js +64 -4
  19. package/dist-client/components/profile-component.js.map +1 -1
  20. package/dist-client/components/role-privilege-editor.js +2 -1
  21. package/dist-client/components/role-privilege-editor.js.map +1 -1
  22. package/dist-client/components/user-role-editor.js +18 -18
  23. package/dist-client/components/user-role-editor.js.map +1 -1
  24. package/dist-client/entries/auth/checkin.js +1 -1
  25. package/dist-client/entries/auth/checkin.js.map +1 -1
  26. package/dist-client/entries/auth/forgot-password.js +11 -2
  27. package/dist-client/entries/auth/forgot-password.js.map +1 -1
  28. package/dist-client/entries/auth/signup.js +13 -7
  29. package/dist-client/entries/auth/signup.js.map +1 -1
  30. package/dist-client/index.js +1 -1
  31. package/dist-client/index.js.map +1 -1
  32. package/dist-client/pages/user/user-management.d.ts +5 -1
  33. package/dist-client/pages/user/user-management.js +6 -7
  34. package/dist-client/pages/user/user-management.js.map +1 -1
  35. package/dist-client/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +12 -12
  37. package/translations/en.json +6 -2
  38. package/translations/ja.json +6 -2
  39. package/translations/ko.json +6 -2
  40. package/translations/ms.json +6 -2
  41. package/translations/zh.json +6 -2
  42. package/client/auth-style-sign.ts +0 -194
  43. package/client/bootstrap.ts +0 -51
  44. package/client/components/abstract-auth-page.ts +0 -301
  45. package/client/components/abstract-password-reset.ts +0 -168
  46. package/client/components/abstract-sign.ts +0 -127
  47. package/client/components/change-password.ts +0 -153
  48. package/client/components/contact-us.ts +0 -113
  49. package/client/components/create-domain-popup.ts +0 -141
  50. package/client/components/create-role.ts +0 -123
  51. package/client/components/create-user.ts +0 -95
  52. package/client/components/credential-manager.ts +0 -64
  53. package/client/components/delete-user-popup.ts +0 -117
  54. package/client/components/domain-switch.ts +0 -127
  55. package/client/components/invite-customer.ts +0 -104
  56. package/client/components/invite-user.ts +0 -96
  57. package/client/components/my-login-history.ts +0 -101
  58. package/client/components/ownership-transfer-popup.ts +0 -110
  59. package/client/components/partner-info-card.ts +0 -89
  60. package/client/components/partner-role-editor.ts +0 -153
  61. package/client/components/profile-component.ts +0 -332
  62. package/client/components/role-edit-form.ts +0 -92
  63. package/client/components/role-privilege-editor.ts +0 -267
  64. package/client/components/role-selector.ts +0 -102
  65. package/client/components/user-role-editor.ts +0 -499
  66. package/client/constants/application.ts +0 -9
  67. package/client/constants/index.ts +0 -1
  68. package/client/entries/auth/activate.ts +0 -272
  69. package/client/entries/auth/checkin.ts +0 -190
  70. package/client/entries/auth/forgot-password.ts +0 -103
  71. package/client/entries/auth/reset-password.ts +0 -22
  72. package/client/entries/auth/result.ts +0 -193
  73. package/client/entries/auth/signin.ts +0 -18
  74. package/client/entries/auth/signup.ts +0 -109
  75. package/client/entries/auth/unlock-user.ts +0 -22
  76. package/client/entries/oauth2/oauth2-decision-error-page.ts +0 -50
  77. package/client/entries/oauth2/oauth2-decision-page.ts +0 -196
  78. package/client/entries/public/home.ts +0 -246
  79. package/client/index.ts +0 -124
  80. package/client/pages/app-binding/app-binding.ts +0 -423
  81. package/client/pages/app-binding/app-bindings.ts +0 -171
  82. package/client/pages/appliance/appliance.ts +0 -452
  83. package/client/pages/appliance/home.ts +0 -177
  84. package/client/pages/appliance/register.ts +0 -183
  85. package/client/pages/application/application.ts +0 -428
  86. package/client/pages/application/applications.ts +0 -182
  87. package/client/pages/application/register.ts +0 -211
  88. package/client/pages/attribute/attribute-set-item-list.ts +0 -237
  89. package/client/pages/attribute/attribute-set-management.ts +0 -282
  90. package/client/pages/auth-provider/auth-provider-management.ts +0 -381
  91. package/client/pages/domain/domain-management.ts +0 -410
  92. package/client/pages/partner/partner-management.ts +0 -112
  93. package/client/pages/profile.ts +0 -32
  94. package/client/pages/role/role-management.ts +0 -134
  95. package/client/pages/user/user-management.ts +0 -224
  96. package/client/route.ts +0 -67
  97. package/client/themes/auth-theme.css +0 -65
  98. package/client/utils/password-rule.ts +0 -37
  99. package/server/index.ts +0 -0
@@ -1,89 +0,0 @@
1
- import { css, html, LitElement } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
-
4
- import { i18next } from '@operato/i18n'
5
-
6
- @customElement('partner-info-card')
7
- export class PartnerInfoCard extends LitElement {
8
- static styles = [
9
- css`
10
- input {
11
- border: var(--border-dim-color);
12
- border-radius: var(--border-radius);
13
- margin: var(--input-margin);
14
- padding: var(--input-padding);
15
- background-color: transparent;
16
- font: var(--input-font);
17
-
18
- flex: 1;
19
- }
20
- #vendors {
21
- display: flex;
22
- max-height: 45vh;
23
- flex-direction: row;
24
- background-color: var(--md-sys-color-surface-variant);
25
- margin: 0;
26
- padding: 0;
27
- border-radius: var(--border-radius);
28
- box-shadow: var(--box-shadow);
29
- overflow: hidden;
30
- }
31
- [field-2column] {
32
- overflow: auto;
33
- flex: 1;
34
- background-color: var(--md-sys-color-surface-variant);
35
- padding: var(--spacing-medium);
36
- border-radius: var(--border-radius);
37
- display: grid;
38
- grid-template-columns: 1fr 1fr;
39
- gap: 5px 15px;
40
- clear: both;
41
- max-width: var(--input-container-max-width);
42
- }
43
- [field] {
44
- display: flex;
45
- flex-direction: column;
46
- padding-bottom: var(--spacing-medium);
47
- }
48
- label {
49
- display: flex;
50
- flex-direction: column;
51
-
52
- font: var(--label-font);
53
- color: var(--label-color, var(--md-sys-color-on-surface));
54
- text-transform: var(--label-text-transform);
55
- }
56
- @media screen and (max-width: 480px) {
57
- [field] {
58
- grid-column: span 2;
59
- }
60
- }
61
- `
62
- ]
63
-
64
- @property({ type: Object }) partner: any
65
-
66
- render() {
67
- const partner = this.partner || {}
68
-
69
- return html`
70
- <div id="vendors">
71
- <div field-2column>
72
- <div field>
73
- <label
74
- >${i18next.t('label.name')}
75
- <input type="text" name="name" readonly .value=${partner.name || ''} />
76
- </label>
77
- </div>
78
-
79
- <div field>
80
- <label
81
- >${i18next.t('label.description')}
82
- <input type="text" name="description" readonly .value=${partner.description || ''} />
83
- </label>
84
- </div>
85
- </div>
86
- </div>
87
- `
88
- }
89
- }
@@ -1,153 +0,0 @@
1
- import '@material/web/button/elevated-button.js'
2
- import './role-selector.js'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, query } from 'lit/decorators.js'
7
-
8
- import { client, gqlContext } from '@operato/graphql'
9
- import { i18next, localize } from '@operato/i18n'
10
- import { OxPrompt } from '@operato/popup/ox-prompt.js'
11
- import { ButtonContainerStyles } from '@operato/styles'
12
-
13
- import { RoleSelector } from './role-selector'
14
-
15
- @customElement('partner-role-editor')
16
- class PartnerRoleEditor extends localize(i18next)(LitElement) {
17
- static styles = [
18
- ButtonContainerStyles,
19
- css`
20
- :host {
21
- display: flex;
22
- flex-direction: column;
23
-
24
- border: 1px solid var(--md-sys-color-primary);
25
- padding: var(--spacing-medium);
26
- font: normal 15px var(--theme-font);
27
- color: var(--md-sys-color-secondary);
28
- }
29
-
30
- md-elevated-button {
31
- margin-right: var(--spacing-small);
32
- }
33
- `
34
- ]
35
-
36
- @property({ type: Object }) customer: any
37
- @property({ type: Array }) roles: any[] = []
38
- @property({ type: Array }) grantingRoles: any[] = []
39
-
40
- @query('role-selector') roleSelector!: RoleSelector
41
-
42
- render() {
43
- const roles = this.roles || []
44
- const grantingRoles = this.grantingRoles || []
45
-
46
- return html`
47
- <role-selector .roles="${roles}" .userRoles="${grantingRoles}"></role-selector>
48
-
49
- <div class="button-container">
50
- <md-elevated-button @click=${this.onSave}>${i18next.t('button.save')}</md-elevated-button>
51
- <md-elevated-button @click=${this.onTerminateContract} danger
52
- >${i18next.t('button.terminate contract')}</md-elevated-button
53
- >
54
- </div>
55
- `
56
- }
57
-
58
- updated(changes) {
59
- if (changes.has('customer')) {
60
- this.refreshRoles()
61
- }
62
- }
63
-
64
- async refreshRoles() {
65
- const response = await client.query({
66
- query: gql`
67
- query roles($customerId: String!) {
68
- roles {
69
- items {
70
- id
71
- name
72
- description
73
- }
74
- total
75
- }
76
- grantingRoles(customerId: $customerId) {
77
- id
78
- role {
79
- id
80
- name
81
- description
82
- }
83
- }
84
- }
85
- `,
86
- variables: { customerId: this.customer.id },
87
- context: gqlContext()
88
- })
89
-
90
- if (!response.errors?.length) {
91
- this.roles = response.data.roles.items
92
- this.grantingRoles = response.data.grantingRoles.map(grantingRole => grantingRole.role)
93
- } else {
94
- this.roles = []
95
- this.grantingRoles = []
96
- }
97
- }
98
-
99
- async onSave() {
100
- const roles = this.roleSelector.selectedRoles()
101
-
102
- const response = await client.mutate({
103
- mutation: gql`
104
- mutation grantRoles($customerId: String!, $roles: [RolePatch!]!) {
105
- grantRoles(customerId: $customerId, roles: $roles)
106
- }
107
- `,
108
- variables: { customerId: this.customer.id, roles },
109
- context: gqlContext()
110
- })
111
-
112
- if (!response.errors?.length) {
113
- this.showToast(i18next.t('text.data_updated_successfully'))
114
- }
115
- }
116
-
117
- async onTerminateContract() {
118
- if (
119
- await OxPrompt.open({
120
- title: i18next.t('text.are_you_sure'),
121
- text: i18next.t('text.are_you_sure_to_terminate_contract'),
122
- confirmButton: { text: i18next.t('button.terminate contract') },
123
- cancelButton: { text: i18next.t('button.cancel') }
124
- })
125
- ) {
126
- const response = await client.mutate({
127
- mutation: gql`
128
- mutation terminateContract($partnerName: String!) {
129
- terminateContract(partnerName: $partnerName)
130
- }
131
- `,
132
- variables: { partnerName: this.customer.name },
133
- context: gqlContext()
134
- })
135
-
136
- if (!response.errors?.length) {
137
- const answer = this.dispatchEvent(new CustomEvent('contractTerminated'))
138
-
139
- if (answer) {
140
- await OxPrompt.open({
141
- type: 'success',
142
- title: i18next.t('text.completed'),
143
- confirmButton: { text: i18next.t('button.confirm') }
144
- })
145
- }
146
- }
147
- }
148
- }
149
-
150
- showToast(message) {
151
- document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
152
- }
153
- }
@@ -1,332 +0,0 @@
1
- import '@operato/i18n/ox-i18n.js'
2
- import '@operato/i18n/ox-i18n-selector.js'
3
- import './change-password'
4
- import './delete-user-popup'
5
- import './my-login-history'
6
-
7
- import { gql } from 'graphql-tag'
8
- import { css, html, LitElement, nothing } from 'lit'
9
- import { customElement, property, query, state } from 'lit/decorators.js'
10
- import { startRegistration } from '@simplewebauthn/browser'
11
-
12
- import { client } from '@operato/graphql'
13
- import { i18next, localize } from '@operato/i18n'
14
- import { notify, openPopup } from '@operato/layout'
15
- import { auth, getLanguages } from '@things-factory/auth-base/dist-client'
16
-
17
- const isAvailableWebauthn = 'PublicKeyCredential' in window
18
- @customElement('profile-component')
19
- export class ProfileComponent extends localize(i18next)(LitElement) {
20
- static styles = [
21
- css`
22
- :host {
23
- display: block;
24
- background-color: var(--md-sys-color-background);
25
- padding: 15px 0;
26
- }
27
- .wrap {
28
- max-width: var(--profile-wrap-max-width, 400px);
29
- margin: auto;
30
- display: grid;
31
- grid-template-columns: 1fr 1fr;
32
- }
33
-
34
- * {
35
- box-sizing: border-box;
36
- }
37
-
38
- *:focus {
39
- outline: none;
40
- }
41
-
42
- input {
43
- margin: var(--spacing-small) 0;
44
- border: 1px solid rgba(0, 0, 0, 0.2);
45
- padding: 9px;
46
- border-radius: var(--border-radius);
47
- font: var(--auth-input-field-font);
48
- width: var(--auth-input-field-width);
49
- }
50
- input:focus {
51
- border: 1px solid var(--focus-background-color);
52
- }
53
-
54
- .user {
55
- background: url(/assets/images/icon-profile.png) center top no-repeat;
56
- margin: var(--profile-icon-margin);
57
- padding: 180px 20px 20px 20px;
58
- color: var(--md-sys-color-secondary);
59
- font: var(--header-bar-title);
60
- text-align: center;
61
- }
62
-
63
- hr {
64
- width: 100%;
65
- border: dotted 1px rgba(0, 0, 0, 0.1);
66
- }
67
-
68
- .wrap * {
69
- grid-column: span 2;
70
- }
71
-
72
- label {
73
- font: bold 14px var(--theme-font);
74
- color: var(--md-sys-color-primary);
75
- text-transform: capitalize;
76
- grid-column: 1;
77
- }
78
-
79
- .wrap *.inline {
80
- grid-column: unset;
81
- }
82
-
83
- ox-i18n-selector {
84
- --i18n-selector-field-width: var(--auth-input-field-width);
85
- --i18n-selector-field-margin: var(--change-password-field-margin);
86
- --i18n-selector-field-padding: var(--spacing-medium);
87
- --i18n-selector-field-border-radius: var(--border-radius);
88
- margin: var(--change-password-field-margin);
89
- }
90
-
91
- md-text-button {
92
- text-transform: capitalize;
93
- }
94
-
95
- footer {
96
- padding: 20px;
97
- text-align: center;
98
- }
99
-
100
- footer p {
101
- font-size: 14px;
102
- margin-bottom: 5px;
103
- color: var(--md-sys-color-on-background);
104
- }
105
-
106
- footer a {
107
- color: var(--md-sys-color-primary);
108
- text-decoration: none;
109
- font-weight: bold;
110
- }
111
- `
112
- ]
113
-
114
- @property({ type: String }) userId?: string
115
- @property({ type: String }) email?: string
116
- @property({ type: String }) name?: string
117
-
118
- @state() languages: { code: string; display: string }[] = []
119
- @state() passwordRule: {
120
- lowerCase?: boolean
121
- upperCase?: boolean
122
- digit?: boolean
123
- specialCharacter?: boolean
124
- allowRepeat?: boolean
125
- useTightPattern?: boolean
126
- useLoosePattern?: boolean
127
- tightCharacterLength?: number
128
- looseCharacterLength?: number
129
- } = {}
130
-
131
- @query('#name') nameEl!: HTMLInputElement
132
- @query('#locale') localeEl!: HTMLInputElement
133
-
134
- async connectedCallback(): Promise<void> {
135
- super.connectedCallback()
136
-
137
- const response = await client.query({
138
- query: gql`
139
- query {
140
- passwordRule {
141
- lowerCase
142
- upperCase
143
- digit
144
- specialCharacter
145
- allowRepeat
146
- useTightPattern
147
- useLoosePattern
148
- tightCharacterLength
149
- looseCharacterLength
150
- }
151
- }
152
- `
153
- })
154
-
155
- this.passwordRule = response.data
156
- }
157
-
158
- async firstUpdated() {
159
- auth.on('profile', ({ credential }) => {
160
- this.setCredential(credential)
161
- })
162
-
163
- this.setCredential(auth.credential)
164
-
165
- this.languages = await getLanguages()
166
- }
167
-
168
- setCredential(credential) {
169
- if (credential) {
170
- this.userId = credential.id
171
- this.name = credential.name
172
- this.email = credential.email
173
- } else {
174
- this.userId = ''
175
- this.name = ''
176
- this.email = ''
177
- }
178
- }
179
-
180
- render() {
181
- return html`
182
- <div class="wrap">
183
- <div class="user">${this.email || ''}</div>
184
-
185
- <label for="name"><ox-i18n slot="title" msgid="label.name"></ox-i18n></label>
186
- <input id="name" @change=${e => this.onNameChanged(e.target.value)} .value=${this.name || ''} />
187
-
188
- <hr />
189
-
190
- <label for="locale"><ox-i18n slot="title" msgid="label.language"></ox-i18n></label>
191
- <ox-i18n-selector
192
- id="locale"
193
- @change=${e => this.onLocaleChanged(e.detail)}
194
- value=${i18next.language || 'en-US'}
195
- .languages=${this.languages}
196
- ></ox-i18n-selector>
197
-
198
- <hr />
199
-
200
- <label for="change-password">
201
- <ox-i18n msgid="label.password"></ox-i18n>
202
- </label>
203
-
204
- <change-password id="change-password" .passwordRule=${this.passwordRule}></change-password>
205
-
206
- ${isAvailableWebauthn
207
- ? html`
208
- <md-text-button @click=${() => this.registerUser()}
209
- >${i18next.t('button.security-key registration')}</md-text-button
210
- >
211
- `
212
- : nothing}
213
-
214
- <footer>
215
- <p>
216
- ${i18next.t('text.click login history')}
217
- <a href="javascript:void(0);" @click=${this.openLoginHistory.bind(this)}
218
- >${i18next.t('label.login_history')}</a
219
- >
220
- </p>
221
- </footer>
222
- </div>
223
- `
224
- }
225
-
226
- async onNameChanged(name) {
227
- if (!name) return
228
-
229
- var oldName = this.name
230
-
231
- try {
232
- const message = await auth.updateProfile({
233
- name
234
- })
235
-
236
- notify({
237
- level: 'info',
238
- message
239
- })
240
- } catch (e: any) {
241
- this.nameEl.value = oldName || ''
242
-
243
- notify({
244
- level: 'error',
245
- message: 'message' in e ? e.message : e
246
- })
247
- }
248
- }
249
-
250
- async onLocaleChanged(value) {
251
- if (!value) return
252
-
253
- var oldLocale = i18next.language
254
-
255
- try {
256
- const message = await auth.updateProfile({
257
- locale: value
258
- })
259
-
260
- i18next.changeLanguage(value)
261
-
262
- notify({
263
- level: 'info',
264
- message
265
- })
266
- } catch (e: any) {
267
- this.localeEl.value = oldLocale
268
-
269
- notify({
270
- level: 'error',
271
- message: 'message' in e ? e.message : e
272
- })
273
- }
274
- }
275
-
276
- openLoginHistory() {
277
- openPopup(html` <my-login-history></my-login-history> `, {
278
- title: i18next.t('label.login_history')
279
- })
280
- }
281
-
282
- deleteUser() {
283
- openPopup(html` <delete-user-popup></delete-user-popup> `, {
284
- title: i18next.t('label.delete account')
285
- })
286
- }
287
-
288
- async registerUser() {
289
- try {
290
- const options = await fetch('/auth/register-webauthn/challenge').then(res => res.json())
291
- const attResp = await startRegistration(options)
292
- const verification = await fetch('/auth/verify-registration', {
293
- method: 'POST',
294
- headers: {
295
- 'Content-Type': 'application/json'
296
- },
297
- body: JSON.stringify(attResp)
298
- }).then(res => res.json())
299
-
300
- if (verification.verified) {
301
- notify({
302
- level: 'info',
303
- message: i18next.t('text.user credential registered successfully')
304
- })
305
- } else {
306
- console.error(await verification.text())
307
-
308
- notify({
309
- level: 'error',
310
- message: i18next.t('error.user credential registeration not allowed')
311
- })
312
- }
313
- } catch (error) {
314
- notify({
315
- level: 'error',
316
- message: i18next.t('error.user credential registeration failed')
317
- })
318
- }
319
- }
320
-
321
- get applicationMeta() {
322
- var iconLink: HTMLLinkElement | null = document.querySelector('link[rel="application-icon"]')
323
- var titleMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-name"]')
324
- var descriptionMeta: HTMLMetaElement | null = document.querySelector('meta[name="application-description"]')
325
-
326
- return {
327
- icon: iconLink?.href || '',
328
- title: titleMeta?.content || 'Things Factory',
329
- description: descriptionMeta?.content || 'Reimagining Software'
330
- }
331
- }
332
- }
@@ -1,92 +0,0 @@
1
- import { css, html, LitElement } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- import { i18next, localize } from '@operato/i18n'
5
-
6
- @customElement('role-edit-form')
7
- class RoleEditForm extends localize(i18next)(LitElement) {
8
- static styles = css`
9
- [field-2column] {
10
- border-radius: var(--border-radius);
11
- display: grid;
12
- grid-template-columns: 1fr 1fr;
13
- gap: 5px 15px;
14
- clear: both;
15
- max-width: var(--input-container-max-width);
16
- }
17
- [field] {
18
- display: flex;
19
- flex-direction: column;
20
- padding-bottom: var(--spacing-medium);
21
- }
22
- input {
23
- border: var(--border-dim-color);
24
- border-radius: var(--border-radius);
25
- margin: var(--input-margin);
26
- padding: var(--input-padding);
27
- min-width: 250px;
28
- font: var(--input-font);
29
- }
30
- label {
31
- display: flex;
32
- flex-direction: column;
33
- font: var(--label-font);
34
- color: var(--md-sys-color-on-primary);
35
- text-transform: var(--label-text-transform);
36
- }
37
- @media screen and (max-width: 480px) {
38
- [field] {
39
- grid-column: span 2;
40
- }
41
- }
42
- `
43
- @property({ type: Object }) role: any
44
-
45
- render() {
46
- const role = this.role || { name: '', description: '' }
47
-
48
- return html`
49
- <form field-2column @input="${this.dispatchRoleChanged.bind(this)}">
50
- <div field>
51
- <label
52
- >role name
53
- <input name="name" value="${role.name}" @click="${e => e.stopPropagation()}" />
54
- </label>
55
- </div>
56
-
57
- <div field>
58
- <label
59
- >role description
60
- <input name="description" .value="${role.description}" @click="${e => e.stopPropagation()}" />
61
- </label>
62
- </div>
63
- </form>
64
- `
65
- }
66
-
67
- @query('input[name=name]') nameInput!: HTMLInputElement
68
- @query('input[name=description]') descriptionInput!: HTMLInputElement
69
-
70
- getRole() {
71
- const name = this.nameInput.value
72
- const description = this.descriptionInput.value
73
-
74
- if (!name) {
75
- return this.showToast(i18next.t('error.value is empty', { value: i18next.t('field.name') }))
76
- }
77
-
78
- return { name, description }
79
- }
80
-
81
- dispatchRoleChanged() {
82
- this.dispatchEvent(
83
- new CustomEvent('roleChanged', {
84
- detail: this.getRole()
85
- })
86
- )
87
- }
88
-
89
- showToast(message) {
90
- document.dispatchEvent(new CustomEvent('notify', { detail: { message, option: { timer: 1000 } } }))
91
- }
92
- }