@openremote/manager 1.8.0-snapshot.20250725120002 → 1.8.0-snapshot.20250728102340

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.
@@ -59,139 +59,139 @@ let PageUsers = class PageUsers extends Page {
59
59
  // language=CSS
60
60
  return [
61
61
  unsafeCSS(tableStyle),
62
- css `
63
- #wrapper {
64
- height: 100%;
65
- width: 100%;
66
- display: flex;
67
- flex-direction: column;
68
- }
69
-
70
- #title {
71
- padding: 0 20px;
72
- font-size: 18px;
73
- font-weight: bold;
74
- width: calc(100% - 40px);
75
- max-width: 1360px;
76
- margin: 20px auto;
77
- align-items: center;
78
- display: flex;
79
- color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
80
- }
81
-
82
- #title or-icon {
83
- margin-right: 10px;
84
- margin-left: 14px;
85
- }
86
-
87
- .panel {
88
- flex: 0;
89
- width: 100%;
90
- box-sizing: border-box;
91
- max-width: 1360px;
92
- background-color: white;
93
- border: 1px solid #e5e5e5;
94
- border-radius: 5px;
95
- position: relative;
96
- margin: 0 auto 16px;
97
- padding: 12px 24px 24px;
98
- display: flex;
99
- flex-direction: column;
100
- }
101
-
102
- .panel-title {
103
- display: flex;
104
- text-transform: uppercase;
105
- font-weight: bolder;
106
- color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
107
- line-height: 1em;
108
- margin-bottom: 10px;
109
- margin-top: 0;
110
- flex: 0 0 auto;
111
- letter-spacing: 0.025em;
112
- align-items: center;
113
- min-height: 36px;
114
- }
115
-
116
- or-mwc-input {
117
- margin-bottom: 20px;
118
- }
119
-
120
- or-icon {
121
- vertical-align: middle;
122
- --or-icon-width: 20px;
123
- --or-icon-height: 20px;
124
- margin-right: 2px;
125
- margin-left: -5px;
126
- }
127
-
128
- .row {
129
- display: flex;
130
- flex-direction: row;
131
- flex: 1 1 0;
132
- gap: 24px;
133
- }
134
-
135
- .column {
136
- display: flex;
137
- flex-direction: column;
138
- margin: 0px;
139
- flex: 1 1 0;
140
- }
141
-
142
- .hidden {
143
- display: none;
144
- }
145
-
146
- .breadcrumb-container {
147
- padding: 0 20px;
148
- width: calc(100% - 40px);
149
- max-width: 1360px;
150
- margin: 12px auto 0;
151
- display: flex;
152
- align-items: center;
153
- }
154
-
155
- .breadcrumb-clickable {
156
- cursor: pointer;
157
- color: var(--or-app-color4, ${unsafeCSS(DefaultColor4)});
158
- }
159
-
160
- .breadcrumb-arrow {
161
- margin: 0 5px -3px 5px;
162
- --or-icon-width: 16px;
163
- --or-icon-height: 16px;
164
- }
165
-
166
- #session-table {
167
- --or-mwc-table-column-width-3: 0;
168
- }
169
-
170
- .button-row {
171
- display: flex !important;
172
- flex-direction: row !important;
173
- margin-bottom: 0;
174
- justify-content: space-between;
175
- }
176
-
177
- @media screen and (max-width: 768px) {
178
- #title {
179
- padding: 0;
180
- width: 100%;
181
- }
182
-
183
- .row {
184
- display: block;
185
- flex-direction: column;
186
- gap: 0;
187
- }
188
-
189
- .panel {
190
- border-radius: 0;
191
- border-left: 0px;
192
- border-right: 0px;
193
- }
194
- }
62
+ css `
63
+ #wrapper {
64
+ height: 100%;
65
+ width: 100%;
66
+ display: flex;
67
+ flex-direction: column;
68
+ }
69
+
70
+ #title {
71
+ padding: 0 20px;
72
+ font-size: 18px;
73
+ font-weight: bold;
74
+ width: calc(100% - 40px);
75
+ max-width: 1360px;
76
+ margin: 20px auto;
77
+ align-items: center;
78
+ display: flex;
79
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
80
+ }
81
+
82
+ #title or-icon {
83
+ margin-right: 10px;
84
+ margin-left: 14px;
85
+ }
86
+
87
+ .panel {
88
+ flex: 0;
89
+ width: 100%;
90
+ box-sizing: border-box;
91
+ max-width: 1360px;
92
+ background-color: white;
93
+ border: 1px solid #e5e5e5;
94
+ border-radius: 5px;
95
+ position: relative;
96
+ margin: 0 auto 16px;
97
+ padding: 12px 24px 24px;
98
+ display: flex;
99
+ flex-direction: column;
100
+ }
101
+
102
+ .panel-title {
103
+ display: flex;
104
+ text-transform: uppercase;
105
+ font-weight: bolder;
106
+ color: var(--or-app-color3, ${unsafeCSS(DefaultColor3)});
107
+ line-height: 1em;
108
+ margin-bottom: 10px;
109
+ margin-top: 0;
110
+ flex: 0 0 auto;
111
+ letter-spacing: 0.025em;
112
+ align-items: center;
113
+ min-height: 36px;
114
+ }
115
+
116
+ or-mwc-input {
117
+ margin-bottom: 20px;
118
+ }
119
+
120
+ or-icon {
121
+ vertical-align: middle;
122
+ --or-icon-width: 20px;
123
+ --or-icon-height: 20px;
124
+ margin-right: 2px;
125
+ margin-left: -5px;
126
+ }
127
+
128
+ .row {
129
+ display: flex;
130
+ flex-direction: row;
131
+ flex: 1 1 0;
132
+ gap: 24px;
133
+ }
134
+
135
+ .column {
136
+ display: flex;
137
+ flex-direction: column;
138
+ margin: 0px;
139
+ flex: 1 1 0;
140
+ }
141
+
142
+ .hidden {
143
+ display: none;
144
+ }
145
+
146
+ .breadcrumb-container {
147
+ padding: 0 20px;
148
+ width: calc(100% - 40px);
149
+ max-width: 1360px;
150
+ margin: 12px auto 0;
151
+ display: flex;
152
+ align-items: center;
153
+ }
154
+
155
+ .breadcrumb-clickable {
156
+ cursor: pointer;
157
+ color: var(--or-app-color4, ${unsafeCSS(DefaultColor4)});
158
+ }
159
+
160
+ .breadcrumb-arrow {
161
+ margin: 0 5px -3px 5px;
162
+ --or-icon-width: 16px;
163
+ --or-icon-height: 16px;
164
+ }
165
+
166
+ #session-table {
167
+ --or-mwc-table-column-width-3: 0;
168
+ }
169
+
170
+ .button-row {
171
+ display: flex !important;
172
+ flex-direction: row !important;
173
+ margin-bottom: 0;
174
+ justify-content: space-between;
175
+ }
176
+
177
+ @media screen and (max-width: 768px) {
178
+ #title {
179
+ padding: 0;
180
+ width: 100%;
181
+ }
182
+
183
+ .row {
184
+ display: block;
185
+ flex-direction: column;
186
+ gap: 0;
187
+ }
188
+
189
+ .panel {
190
+ border-radius: 0;
191
+ border-left: 0px;
192
+ border-right: 0px;
193
+ }
194
+ }
195
195
  `,
196
196
  ];
197
197
  }
@@ -406,8 +406,8 @@ let PageUsers = class PageUsers extends Page {
406
406
  render() {
407
407
  var _a;
408
408
  if (!manager.authenticated) {
409
- return html `
410
- <or-translate value="notAuthenticated"></or-translate>
409
+ return html `
410
+ <or-translate value="notAuthenticated"></or-translate>
411
411
  `;
412
412
  }
413
413
  // Apply filter (such as search input)
@@ -451,82 +451,82 @@ let PageUsers = class PageUsers extends Page {
451
451
  };
452
452
  const mergedUserList = [...users, ...serviceUsers];
453
453
  const index = (this.userId ? mergedUserList.findIndex((user) => user.id === this.userId) : undefined);
454
- return html `
455
- <div id="wrapper">
456
-
457
- <!-- Breadcrumb on top of the page-->
454
+ return html `
455
+ <div id="wrapper">
456
+
457
+ <!-- Breadcrumb on top of the page-->
458
458
  ${when((this.userId && index !== undefined) || this.creationState, () => {
459
459
  var _a;
460
- return html `
461
- <div class="breadcrumb-container">
462
- <span class="breadcrumb-clickable"
463
- @click="${() => this.reset()}">${i18next.t("user_plural")}</span>
464
- <or-icon class="breadcrumb-arrow" icon="chevron-right"></or-icon>
465
- <span style="margin-left: 2px;">${index !== undefined ? (_a = mergedUserList[index]) === null || _a === void 0 ? void 0 : _a.username : (this.creationState.userModel.serviceAccount ? i18next.t('creating_serviceUser') : i18next.t('creating_regularUser'))}</span>
466
- </div>
460
+ return html `
461
+ <div class="breadcrumb-container">
462
+ <span class="breadcrumb-clickable"
463
+ @click="${() => this.reset()}">${i18next.t("user_plural")}</span>
464
+ <or-icon class="breadcrumb-arrow" icon="chevron-right"></or-icon>
465
+ <span style="margin-left: 2px;">${index !== undefined ? (_a = mergedUserList[index]) === null || _a === void 0 ? void 0 : _a.username : (this.creationState.userModel.serviceAccount ? i18next.t('creating_serviceUser') : i18next.t('creating_regularUser'))}</span>
466
+ </div>
467
467
  `;
468
- })}
469
-
470
- <div id="title">
471
- <or-icon icon="account-group"></or-icon>
472
- <span>${this.userId && index !== undefined ? (_a = mergedUserList[index]) === null || _a === void 0 ? void 0 : _a.username : i18next.t('user_plural')}</span>
473
- </div>
474
-
475
- <!-- User Specific page -->
476
- ${when((this.userId && index !== undefined) || this.creationState, () => html `
468
+ })}
469
+
470
+ <div id="title">
471
+ <or-icon icon="account-group"></or-icon>
472
+ <span>${this.userId && index !== undefined ? (_a = mergedUserList[index]) === null || _a === void 0 ? void 0 : _a.username : i18next.t('user_plural')}</span>
473
+ </div>
474
+
475
+ <!-- User Specific page -->
476
+ ${when((this.userId && index !== undefined) || this.creationState, () => html `
477
477
  ${when(mergedUserList[index] !== undefined || this.creationState, () => {
478
478
  const user = (index !== undefined ? mergedUserList[index] : this.creationState.userModel);
479
479
  const showMqttSessions = user.serviceAccount && this.userId;
480
- return html `
481
- <div id="content" class="panel">
482
- <p class="panel-title">
483
- ${user.serviceAccount ? i18next.t('serviceUser') : i18next.t('user')}
484
- ${i18next.t('settings')}</p>
485
- ${this.getSingleUserView(user, compositeRoleOptions, realmRoleOptions, ("user" + index), (readonly || this._saveUserPromise != undefined))}
486
- </div>
487
-
488
- ${when(showMqttSessions, () => this.getMQTTSessionTemplate(user))}
480
+ return html `
481
+ <div id="content" class="panel">
482
+ <p class="panel-title">
483
+ ${user.serviceAccount ? i18next.t('serviceUser') : i18next.t('user')}
484
+ ${i18next.t('settings')}</p>
485
+ ${this.getSingleUserView(user, compositeRoleOptions, realmRoleOptions, ("user" + index), (readonly || this._saveUserPromise != undefined))}
486
+ </div>
487
+
488
+ ${when(showMqttSessions, () => this.getMQTTSessionTemplate(user))}
489
489
  `;
490
- })}
491
-
492
- <!-- List of Users page -->
493
- `, () => html `
494
- <div id="content" class="panel">
495
- <div class="panel-title" style="justify-content: space-between;">
496
- <p>${i18next.t("regularUser_plural")}</p>
497
- <div style="display: flex; align-items: center; gap: 12px;">
498
- <or-mwc-input type="${InputType.TEXT}" placeholder="${i18next.t('search')}"
499
- style="margin: 0; text-transform: none;" iconTrailing="magnify" compact outlined
500
- @input="${(ev) => this.onRegularUserSearch(ev)}"
501
- ></or-mwc-input>
502
- <or-mwc-input style="margin: 0;" type="${InputType.BUTTON}" icon="plus" label="${i18next.t('add')} ${i18next.t("user")}"
503
- @or-mwc-input-changed="${() => this.creationState = { userModel: this.getNewUserModel(false) }}"
504
- ></or-mwc-input>
505
- </div>
506
- </div>
490
+ })}
491
+
492
+ <!-- List of Users page -->
493
+ `, () => html `
494
+ <div id="content" class="panel">
495
+ <div class="panel-title" style="justify-content: space-between;">
496
+ <p>${i18next.t("regularUser_plural")}</p>
497
+ <div style="display: flex; align-items: center; gap: 12px;">
498
+ <or-mwc-input type="${InputType.TEXT}" placeholder="${i18next.t('search')}"
499
+ style="margin: 0; text-transform: none;" iconTrailing="magnify" compact outlined
500
+ @input="${(ev) => this.onRegularUserSearch(ev)}"
501
+ ></or-mwc-input>
502
+ <or-mwc-input style="margin: 0;" type="${InputType.BUTTON}" icon="plus" label="${i18next.t('add')} ${i18next.t("user")}"
503
+ @or-mwc-input-changed="${() => this.creationState = { userModel: this.getNewUserModel(false) }}"
504
+ ></or-mwc-input>
505
+ </div>
506
+ </div>
507
507
  ${until(this.getUsersTable(userTableColumns, userTableRows, tableConfig, (ev) => {
508
508
  this.userId = users[ev.detail.index].id;
509
- }), html `${i18next.t('loading')}`)}
510
- </div>
511
-
512
- <div id="content" class="panel">
513
- <div class="panel-title" style="justify-content: space-between;">
514
- <p>${i18next.t("serviceUser_plural")}</p>
515
- <div style="display: flex; align-items: center; gap: 12px;">
516
- <or-mwc-input style="margin: 0; text-transform: none;" type="${InputType.TEXT}" iconTrailing="magnify" placeholder="${i18next.t('search')}" compact outlined
517
- @input="${(ev) => this.onServiceUserSearch(ev)}"
518
- ></or-mwc-input>
519
- <or-mwc-input style="margin: 0;" type="${InputType.BUTTON}" icon="plus" label="${i18next.t('add')} ${i18next.t("user")}"
520
- @or-mwc-input-changed="${() => this.creationState = { userModel: this.getNewUserModel(true) }}"
521
- ></or-mwc-input>
522
- </div>
523
- </div>
509
+ }), html `${i18next.t('loading')}`)}
510
+ </div>
511
+
512
+ <div id="content" class="panel">
513
+ <div class="panel-title" style="justify-content: space-between;">
514
+ <p>${i18next.t("serviceUser_plural")}</p>
515
+ <div style="display: flex; align-items: center; gap: 12px;">
516
+ <or-mwc-input style="margin: 0; text-transform: none;" type="${InputType.TEXT}" iconTrailing="magnify" placeholder="${i18next.t('search')}" compact outlined
517
+ @input="${(ev) => this.onServiceUserSearch(ev)}"
518
+ ></or-mwc-input>
519
+ <or-mwc-input style="margin: 0;" type="${InputType.BUTTON}" icon="plus" label="${i18next.t('add')} ${i18next.t("user")}"
520
+ @or-mwc-input-changed="${() => this.creationState = { userModel: this.getNewUserModel(true) }}"
521
+ ></or-mwc-input>
522
+ </div>
523
+ </div>
524
524
  ${until(this.getUsersTable(serviceUserTableColumns, serviceUserTableRows, tableConfig, (ev) => {
525
525
  this.userId = serviceUsers[ev.detail.index].id;
526
- }), html `${i18next.t('loading')}`)}
527
- </div>
528
- `)}
529
- </div>
526
+ }), html `${i18next.t('loading')}`)}
527
+ </div>
528
+ `)}
529
+ </div>
530
530
  `;
531
531
  }
532
532
  getUsersTable(columns, rows, config, onRowClick) {
@@ -534,14 +534,14 @@ let PageUsers = class PageUsers extends Page {
534
534
  if (this._loadDataPromise) {
535
535
  yield this._loadDataPromise;
536
536
  }
537
- return html `
538
- <or-mwc-table .columns="${columns instanceof Array ? columns : undefined}"
539
- .columnsTemplate="${!(columns instanceof Array) ? columns : undefined}"
540
- .rows="${rows instanceof Array ? rows : undefined}"
541
- .rowsTemplate="${!(rows instanceof Array) ? rows : undefined}"
542
- .config="${config}"
543
- @or-mwc-table-row-click="${rows instanceof Array ? onRowClick : undefined}"
544
- ></or-mwc-table>
537
+ return html `
538
+ <or-mwc-table .columns="${columns instanceof Array ? columns : undefined}"
539
+ .columnsTemplate="${!(columns instanceof Array) ? columns : undefined}"
540
+ .rows="${rows instanceof Array ? rows : undefined}"
541
+ .rowsTemplate="${!(rows instanceof Array) ? rows : undefined}"
542
+ .config="${config}"
543
+ @or-mwc-table-row-click="${rows instanceof Array ? onRowClick : undefined}"
544
+ ></or-mwc-table>
545
545
  `;
546
546
  });
547
547
  }
@@ -641,20 +641,20 @@ let PageUsers = class PageUsers extends Page {
641
641
  };
642
642
  const dialog = showDialog(new OrMwcDialog()
643
643
  .setHeading(i18next.t("linkedAssets"))
644
- .setContent(html `
645
- <or-asset-tree
646
- id="chart-asset-tree" readonly .selectedIds="${user.userAssetLinks.map(ual => ual.id.assetId)}"
647
- .showSortBtn="${false}" expandNodes checkboxes
644
+ .setContent(html `
645
+ <or-asset-tree
646
+ id="chart-asset-tree" readonly .selectedIds="${user.userAssetLinks.map(ual => ual.id.assetId)}"
647
+ .showSortBtn="${false}" expandNodes checkboxes
648
648
  @or-asset-tree-request-selection="${(e) => {
649
649
  if (readonly) {
650
650
  e.detail.allow = false;
651
651
  }
652
- }}"
652
+ }}"
653
653
  @or-asset-tree-selection="${(e) => {
654
654
  if (!readonly) {
655
655
  onAssetSelectionChanged(e);
656
656
  }
657
- }}"></or-asset-tree>
657
+ }}"></or-asset-tree>
658
658
  `)
659
659
  .setActions([
660
660
  {
@@ -738,7 +738,7 @@ let PageUsers = class PageUsers extends Page {
738
738
  return this._compositeRoles.filter((role) => user.roles.some(ur => ur === role.name)).flatMap((role) => role.compositeRoleIds).map(id => this._roles.find(r => r.id === id).name);
739
739
  }
740
740
  getSingleUserView(user, compositeRoleOptions, realmRoleOptions, suffix, readonly = true) {
741
- return html `
741
+ return html `
742
742
  ${when((user.loaded || (user.roles && user.realmRoles)), () => {
743
743
  return this.getSingleUserTemplate(user, compositeRoleOptions, realmRoleOptions, suffix, readonly);
744
744
  }, () => {
@@ -747,21 +747,21 @@ let PageUsers = class PageUsers extends Page {
747
747
  return this.getSingleUserTemplate(user, compositeRoleOptions, realmRoleOptions, suffix, readonly);
748
748
  });
749
749
  const content = getTemplate();
750
- return html `
751
- ${until(content, html `${i18next.t('loading')}`)}
750
+ return html `
751
+ ${until(content, html `${i18next.t('loading')}`)}
752
752
  `;
753
- })}
753
+ })}
754
754
  `;
755
755
  }
756
756
  getMQTTSessionTemplate(user) {
757
757
  if (!this._sessionLoader) {
758
758
  this._sessionLoader = this.getSessionLoader(user);
759
759
  }
760
- return html `
761
- <div id="content" class="panel">
762
- <p class="panel-title">${i18next.t('mqttSessions')}</p>
763
- ${until(this._sessionLoader, html `${i18next.t('loading')}`)}
764
- </div>
760
+ return html `
761
+ <div id="content" class="panel">
762
+ <p class="panel-title">${i18next.t('mqttSessions')}</p>
763
+ ${until(this._sessionLoader, html `${i18next.t('loading')}`)}
764
+ </div>
765
765
  `;
766
766
  }
767
767
  getSessionLoader(user) {
@@ -786,33 +786,33 @@ let PageUsers = class PageUsers extends Page {
786
786
  const isSameUser = user.username === manager.username;
787
787
  const isGatewayServiceUser = isServiceUser && ((_a = user.username) === null || _a === void 0 ? void 0 : _a.startsWith("gateway-"));
788
788
  const implicitRoleNames = user.loaded ? this.getImplicitUserRoles(user) : [];
789
- return html `
790
- <div class="row">
791
- <div class="column">
792
- <h5>${i18next.t("details")}</h5>
793
- <!-- user details -->
794
- <or-mwc-input id="new-username-${suffix}" ?readonly="${!!user.id || readonly}" .disabled="${!!user.id || (!isServiceUser && this._registrationEmailAsUsername)}"
795
- class = "validate"
796
- .label="${i18next.t("username")}"
797
- .type="${InputType.TEXT}" minLength="3" maxLength="255"
798
- ?required="${isServiceUser || !this._registrationEmailAsUsername}"
799
- pattern="[A-Za-z0-9_+@\\.\\-ßçʊÇʊ]+"
800
- .value="${user.username}" autocomplete="false"
801
- .validationMessage="${i18next.t("invalidUsername")}"
789
+ return html `
790
+ <div class="row">
791
+ <div class="column">
792
+ <h5>${i18next.t("details")}</h5>
793
+ <!-- user details -->
794
+ <or-mwc-input id="new-username-${suffix}" ?readonly="${!!user.id || readonly}" .disabled="${!!user.id || (!isServiceUser && this._registrationEmailAsUsername)}"
795
+ class = "validate"
796
+ .label="${i18next.t("username")}"
797
+ .type="${InputType.TEXT}" minLength="3" maxLength="255"
798
+ ?required="${isServiceUser || !this._registrationEmailAsUsername}"
799
+ pattern="[A-Za-z0-9_+@\\.\\-ßçʊÇʊ]+"
800
+ .value="${user.username}" autocomplete="false"
801
+ .validationMessage="${i18next.t("invalidUsername")}"
802
802
  @or-mwc-input-changed="${(e) => {
803
803
  user.username = e.detail.value;
804
804
  this.onUserChanged(suffix);
805
- }}"></or-mwc-input>
806
- <!-- if identity provider is set to use email as username, make it required -->
807
- <or-mwc-input id="new-email" ?readonly="${(!!user.id && this._registrationEmailAsUsername) || readonly}"
808
- .disabled="${!!user.id && this._registrationEmailAsUsername}"
809
- class="${isServiceUser ? "hidden" : "validate"}"
810
- .label="${i18next.t("email")}"
811
- .type="${InputType.EMAIL}"
812
- .value="${user.email}" autocomplete="false"
813
- ?required="${!isServiceUser && this._registrationEmailAsUsername}"
814
- pattern="^[\\w\\.\\-\\+\\%]+@([\\w\\-]+\\.)+[\\w]{2,}$"
815
- .validationMessage="${i18next.t("invalidEmail")}"
805
+ }}"></or-mwc-input>
806
+ <!-- if identity provider is set to use email as username, make it required -->
807
+ <or-mwc-input id="new-email" ?readonly="${(!!user.id && this._registrationEmailAsUsername) || readonly}"
808
+ .disabled="${!!user.id && this._registrationEmailAsUsername}"
809
+ class="${isServiceUser ? "hidden" : "validate"}"
810
+ .label="${i18next.t("email")}"
811
+ .type="${InputType.EMAIL}"
812
+ .value="${user.email}" autocomplete="false"
813
+ ?required="${!isServiceUser && this._registrationEmailAsUsername}"
814
+ pattern="^[\\w\\.\\-\\+\\%]+@([\\w\\-]+\\.)+[\\w]{2,}$"
815
+ .validationMessage="${i18next.t("invalidEmail")}"
816
816
  @or-mwc-input-changed="${(e) => {
817
817
  if (this._registrationEmailAsUsername) {
818
818
  user.username = e.detail.value;
@@ -820,129 +820,129 @@ let PageUsers = class PageUsers extends Page {
820
820
  user.email = e.detail.value;
821
821
  this.onUserChanged(suffix);
822
822
  this.requestUpdate(); // in case of username update, we trigger a state change
823
- }}"></or-mwc-input>
824
- <or-mwc-input id="new-firstName" ?readonly="${readonly}"
825
- class="${isServiceUser ? "hidden" : "validate"}"
826
- .label="${i18next.t("firstName")}"
827
- .type="${InputType.TEXT}" minLength="1"
828
- .value="${user.firstName}" autocomplete="false"
823
+ }}"></or-mwc-input>
824
+ <or-mwc-input id="new-firstName" ?readonly="${readonly}"
825
+ class="${isServiceUser ? "hidden" : "validate"}"
826
+ .label="${i18next.t("firstName")}"
827
+ .type="${InputType.TEXT}" minLength="1"
828
+ .value="${user.firstName}" autocomplete="false"
829
829
  @or-mwc-input-changed="${(e) => {
830
830
  user.firstName = e.detail.value;
831
831
  this.onUserChanged(suffix);
832
- }}"></or-mwc-input>
833
- <or-mwc-input id="new-surname" ?readonly="${readonly}"
834
- class="${isServiceUser ? "hidden" : "validate"}"
835
- .label="${i18next.t("surname")}"
836
- .type="${InputType.TEXT}" minLength="1"
837
- .value="${user.lastName}" autocomplete="false"
832
+ }}"></or-mwc-input>
833
+ <or-mwc-input id="new-surname" ?readonly="${readonly}"
834
+ class="${isServiceUser ? "hidden" : "validate"}"
835
+ .label="${i18next.t("surname")}"
836
+ .type="${InputType.TEXT}" minLength="1"
837
+ .value="${user.lastName}" autocomplete="false"
838
838
  @or-mwc-input-changed="${(e) => {
839
839
  user.lastName = e.detail.value;
840
840
  this.onUserChanged(suffix);
841
- }}"></or-mwc-input>
842
-
843
- <!-- password -->
844
- <h5>${i18next.t("password")}</h5>
845
- ${isServiceUser ? html `
846
- ${when(user.secret, () => html `
847
- <or-mwc-input id="new-password-${suffix}" readonly
848
- class = "validate"
849
- .label="${i18next.t("secret")}"
850
- .value="${user.secret}"
851
- .type="${InputType.TEXT}"></or-mwc-input>
852
- <or-mwc-input ?readonly="${!user.id || readonly}"
853
- ?disabled="${isGatewayServiceUser}"
854
- .label="${i18next.t("regenerateSecret")}"
855
- .type="${InputType.BUTTON}"
841
+ }}"></or-mwc-input>
842
+
843
+ <!-- password -->
844
+ <h5>${i18next.t("password")}</h5>
845
+ ${isServiceUser ? html `
846
+ ${when(user.secret, () => html `
847
+ <or-mwc-input id="new-password-${suffix}" readonly
848
+ class = "validate"
849
+ .label="${i18next.t("secret")}"
850
+ .value="${user.secret}"
851
+ .type="${InputType.TEXT}"></or-mwc-input>
852
+ <or-mwc-input ?readonly="${!user.id || readonly}"
853
+ ?disabled="${isGatewayServiceUser}"
854
+ .label="${i18next.t("regenerateSecret")}"
855
+ .type="${InputType.BUTTON}"
856
856
  @or-mwc-input-changed="${(ev) => {
857
857
  this._regenerateSecret(ev, user, "new-password-" + suffix).catch(() => showSnackbar(undefined, 'errorOccurred'));
858
858
  this.onUserChanged(suffix);
859
- }}"></or-mwc-input>
860
- `, () => html `
861
- <span>${i18next.t("generateSecretInfo")}</span>
862
- `)}
863
- ` : html `
864
- <or-mwc-input id="new-password-${suffix}"
865
- ?readonly="${readonly}"
866
- class = "validate"
867
- .label="${i18next.t("password")}"
868
- .type="${InputType.PASSWORD}" min="1" autocomplete="false"
859
+ }}"></or-mwc-input>
860
+ `, () => html `
861
+ <span>${i18next.t("generateSecretInfo")}</span>
862
+ `)}
863
+ ` : html `
864
+ <or-mwc-input id="new-password-${suffix}"
865
+ ?readonly="${readonly}"
866
+ class = "validate"
867
+ .label="${i18next.t("password")}"
868
+ .type="${InputType.PASSWORD}" min="1" autocomplete="false"
869
869
  @or-mwc-input-changed="${(e) => {
870
870
  this._onPasswordChanged(user, suffix);
871
871
  this.onUserChanged(suffix);
872
- }}"
873
- ></or-mwc-input>
874
- <or-mwc-input id="new-repeatPassword-${suffix}"
875
- helperPersistent ?readonly="${readonly}"
876
- .label="${i18next.t("repeatPassword")}"
877
- .type="${InputType.PASSWORD}" min="1" autocomplete="false"
878
- style="${this._passwordPolicy ? 'margin-bottom: 0' : undefined}"
872
+ }}"
873
+ ></or-mwc-input>
874
+ <or-mwc-input id="new-repeatPassword-${suffix}"
875
+ helperPersistent ?readonly="${readonly}"
876
+ .label="${i18next.t("repeatPassword")}"
877
+ .type="${InputType.PASSWORD}" min="1" autocomplete="false"
878
+ style="${this._passwordPolicy ? 'margin-bottom: 0' : undefined}"
879
879
  @or-mwc-input-changed="${(e) => {
880
880
  this._onPasswordChanged(user, suffix);
881
881
  this.onUserChanged(suffix);
882
- }}"
883
- ></or-mwc-input>
884
- ${when(this._passwordPolicy, () => until(this._getPasswordPolicyTemplate(user, this._passwordPolicy)))}
885
- `}
886
- </div>
887
-
888
- <div class="column">
889
- <h5>${i18next.t("settings")}</h5>
890
- <!-- enabled -->
891
- <or-mwc-input ?readonly="${readonly}"
892
- class="validate"
893
- .label="${i18next.t("active")}"
894
- .type="${InputType.CHECKBOX}"
895
- .value="${user.enabled}"
882
+ }}"
883
+ ></or-mwc-input>
884
+ ${when(this._passwordPolicy, () => until(this._getPasswordPolicyTemplate(user, this._passwordPolicy)))}
885
+ `}
886
+ </div>
887
+
888
+ <div class="column">
889
+ <h5>${i18next.t("settings")}</h5>
890
+ <!-- enabled -->
891
+ <or-mwc-input ?readonly="${readonly}"
892
+ class="validate"
893
+ .label="${i18next.t("active")}"
894
+ .type="${InputType.CHECKBOX}"
895
+ .value="${user.enabled}"
896
896
  @or-mwc-input-changed="${(e) => {
897
897
  user.enabled = e.detail.value;
898
898
  this.onUserChanged(suffix);
899
- }}"
900
- style="height: 56px;"
901
- ></or-mwc-input>
902
-
903
- <!-- realm roles -->
904
- <or-mwc-input
905
- ?readonly="${readonly}"
906
- ?disabled="${isSameUser || isGatewayServiceUser}"
907
- class = "validate"
908
- .value="${user.realmRoles}"
909
- .type="${InputType.SELECT}" multiple
910
- .options="${realmRoleOptions}"
911
- .label="${i18next.t("realm_role_plural")}"
899
+ }}"
900
+ style="height: 56px;"
901
+ ></or-mwc-input>
902
+
903
+ <!-- realm roles -->
904
+ <or-mwc-input
905
+ ?readonly="${readonly}"
906
+ ?disabled="${isSameUser || isGatewayServiceUser}"
907
+ class = "validate"
908
+ .value="${user.realmRoles}"
909
+ .type="${InputType.SELECT}" multiple
910
+ .options="${realmRoleOptions}"
911
+ .label="${i18next.t("realm_role_plural")}"
912
912
  @or-mwc-input-changed="${(e) => {
913
913
  this.onUserChanged(suffix);
914
914
  user.realmRoles = e.detail.value;
915
- }}"></or-mwc-input>
916
-
917
- <!-- composite client roles -->
918
- <or-mwc-input
919
- ?readonly="${readonly}"
920
- ?disabled="${isSameUser || isGatewayServiceUser}"
921
- class = "validate"
922
- .value="${user.roles && user.roles.length > 0 ? user.roles.filter(r => this._compositeRoles.some(cr => cr.name === r)) : undefined}"
923
- .type="${InputType.SELECT}" multiple
924
- .options="${compositeRoleOptions}"
925
- .label="${i18next.t("manager_role_plural")}"
915
+ }}"></or-mwc-input>
916
+
917
+ <!-- composite client roles -->
918
+ <or-mwc-input
919
+ ?readonly="${readonly}"
920
+ ?disabled="${isSameUser || isGatewayServiceUser}"
921
+ class = "validate"
922
+ .value="${user.roles && user.roles.length > 0 ? user.roles.filter(r => this._compositeRoles.some(cr => cr.name === r)) : undefined}"
923
+ .type="${InputType.SELECT}" multiple
924
+ .options="${compositeRoleOptions}"
925
+ .label="${i18next.t("manager_role_plural")}"
926
926
  @or-mwc-input-changed="${(e) => {
927
927
  user.roles = e.detail.value;
928
928
  this._updateUserSelectedRoles(user, suffix);
929
929
  this.onUserChanged(suffix);
930
- }}"></or-mwc-input>
931
-
932
- <!-- roles -->
933
- <div style="display:flex;flex-wrap:wrap;margin-bottom: 20px;"
934
- id="role-list-${suffix}">
930
+ }}"></or-mwc-input>
931
+
932
+ <!-- roles -->
933
+ <div style="display:flex;flex-wrap:wrap;margin-bottom: 20px;"
934
+ id="role-list-${suffix}">
935
935
  ${this._roles.map(r => {
936
- return html `
937
- <or-mwc-input
938
- ?readonly="${readonly}"
939
- ?disabled="${implicitRoleNames.find(name => r.name === name) || isGatewayServiceUser}"
940
- class = "validate"
941
- .value="${!!user.roles.find(userRole => userRole === r.name) || implicitRoleNames.some(implicitRoleName => implicitRoleName === r.name)}"
942
- .type="${InputType.CHECKBOX}"
943
- .label="${r.name}"
944
- title="${r.description}"
945
- style="flex: 0 1 160px; margin: 0; overflow: hidden;"
936
+ return html `
937
+ <or-mwc-input
938
+ ?readonly="${readonly}"
939
+ ?disabled="${implicitRoleNames.find(name => r.name === name) || isGatewayServiceUser}"
940
+ class = "validate"
941
+ .value="${!!user.roles.find(userRole => userRole === r.name) || implicitRoleNames.some(implicitRoleName => implicitRoleName === r.name)}"
942
+ .type="${InputType.CHECKBOX}"
943
+ .label="${r.name}"
944
+ title="${r.description}"
945
+ style="flex: 0 1 160px; margin: 0; overflow: hidden;"
946
946
  @or-mwc-input-changed="${(e) => {
947
947
  if (!!e.detail.value) {
948
948
  user.roles.push(r.name);
@@ -951,37 +951,37 @@ let PageUsers = class PageUsers extends Page {
951
951
  user.roles = user.roles.filter(ur => ur !== r.name);
952
952
  }
953
953
  this.onUserChanged(suffix);
954
- }}"></or-mwc-input>
954
+ }}"></or-mwc-input>
955
955
  `;
956
- })}
957
- </div>
958
-
959
- <!-- Asset-User links -->
960
- <div>
961
- <span>${i18next.t("linkedAssets")}:</span>
962
- <or-mwc-input outlined ?disabled="${readonly || isGatewayServiceUser}" style="margin-left: 4px;"
963
- .type="${InputType.BUTTON}"
964
- .label="${i18next.t("selectRestrictedAssets", { number: user.userAssetLinks.length })}"
965
- @or-mwc-input-changed="${(ev) => this._openAssetSelector(ev, user, readonly, suffix)}"></or-mwc-input>
966
- </div>
967
- </div>
968
- </div>
969
- <!-- Bottom controls (save/update and delete button) -->
970
- ${when(!(readonly && !this._saveUserPromise), () => html `
971
- <div class="row button-row">
972
-
973
- ${when((!isSameUser && !isGatewayServiceUser && user.id), () => html `
974
- <or-mwc-input style="margin: 0;" outlined ?disabled="${readonly}"
975
- .label="${i18next.t("delete")}"
976
- .type="${InputType.BUTTON}"
977
- @click="${() => this._deleteUser(user)}"
978
- ></or-mwc-input>
979
- `)}
980
- <div style="display: flex; align-items: center; gap: 16px; margin: 0 0 0 auto;">
981
- <!-- Button disabled until an input has input, and by that a valid check is done -->
982
- <or-mwc-input id="savebtn-${suffix}" style="margin: 0;" raised disabled
983
- .label="${i18next.t(user.id ? "save" : "create")}"
984
- .type="${InputType.BUTTON}"
956
+ })}
957
+ </div>
958
+
959
+ <!-- Asset-User links -->
960
+ <div>
961
+ <span>${i18next.t("linkedAssets")}:</span>
962
+ <or-mwc-input outlined ?disabled="${readonly || isGatewayServiceUser}" style="margin-left: 4px;"
963
+ .type="${InputType.BUTTON}"
964
+ .label="${i18next.t("selectRestrictedAssets", { number: user.userAssetLinks.length })}"
965
+ @or-mwc-input-changed="${(ev) => this._openAssetSelector(ev, user, readonly, suffix)}"></or-mwc-input>
966
+ </div>
967
+ </div>
968
+ </div>
969
+ <!-- Bottom controls (save/update and delete button) -->
970
+ ${when(!(readonly && !this._saveUserPromise), () => html `
971
+ <div class="row button-row">
972
+
973
+ ${when((!isSameUser && !isGatewayServiceUser && user.id), () => html `
974
+ <or-mwc-input style="margin: 0;" outlined ?disabled="${readonly}"
975
+ .label="${i18next.t("delete")}"
976
+ .type="${InputType.BUTTON}"
977
+ @click="${() => this._deleteUser(user)}"
978
+ ></or-mwc-input>
979
+ `)}
980
+ <div style="display: flex; align-items: center; gap: 16px; margin: 0 0 0 auto;">
981
+ <!-- Button disabled until an input has input, and by that a valid check is done -->
982
+ <or-mwc-input id="savebtn-${suffix}" style="margin: 0;" raised disabled
983
+ .label="${i18next.t(user.id ? "save" : "create")}"
984
+ .type="${InputType.BUTTON}"
985
985
  @or-mwc-input-changed="${(e) => {
986
986
  let error;
987
987
  this._saveUserPromise = this._createUpdateUser(user, user.id ? 'update' : 'create').then((result) => {
@@ -1012,11 +1012,11 @@ let PageUsers = class PageUsers extends Page {
1012
1012
  });
1013
1013
  }
1014
1014
  });
1015
- }}">
1016
- </or-mwc-input>
1017
- </div>
1018
- </div>
1019
- `)}
1015
+ }}">
1016
+ </or-mwc-input>
1017
+ </div>
1018
+ </div>
1019
+ `)}
1020
1020
  `;
1021
1021
  }
1022
1022
  _getPasswordPolicyTemplate(user_1) {
@@ -1070,10 +1070,10 @@ let PageUsers = class PageUsers extends Page {
1070
1070
  else if (policies.includes("notEmail")) {
1071
1071
  policyTexts.push(html `<or-translate value="password-policy-not-email"></or-translate>`);
1072
1072
  }
1073
- return html `
1074
- <ul>
1075
- ${map(policyTexts, text => html `<li>${text}</li>`)}
1076
- </ul>
1073
+ return html `
1074
+ <ul>
1075
+ ${map(policyTexts, text => html `<li>${text}</li>`)}
1076
+ </ul>
1077
1077
  `;
1078
1078
  });
1079
1079
  }