@c8y/ngx-components 1021.22.151 → 1021.22.154
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/context-dashboard/context-dashboard.service.d.ts +13 -0
- package/context-dashboard/context-dashboard.service.d.ts.map +1 -1
- package/core/modal/modal-confirm.component.d.ts +10 -3
- package/core/modal/modal-confirm.component.d.ts.map +1 -1
- package/core/modal/modal.module.d.ts +3 -2
- package/core/modal/modal.module.d.ts.map +1 -1
- package/core/modal/modal.service.d.ts +2 -1
- package/core/modal/modal.service.d.ts.map +1 -1
- package/esm2022/context-dashboard/context-dashboard.service.mjs +17 -1
- package/esm2022/core/bootstrap/cookie-banner/cookie-banner-preferences-modal/cookie-banner-preferences-modal.component.mjs +1 -1
- package/esm2022/core/modal/modal-confirm.component.mjs +32 -5
- package/esm2022/core/modal/modal.module.mjs +5 -4
- package/esm2022/core/modal/modal.service.mjs +11 -3
- package/esm2022/sub-assets/delete-assets-modal/delete-assets-modal.component.mjs +1 -1
- package/esm2022/sub-assets/unassign-assets-modal/unassign-modal.component.mjs +1 -1
- package/esm2022/tenants/tenant-list/tenant-list.component.mjs +72 -33
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs +16 -0
- package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-sub-assets.mjs +2 -2
- package/fesm2022/c8y-ngx-components-sub-assets.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components-tenants.mjs +71 -32
- package/fesm2022/c8y-ngx-components-tenants.mjs.map +1 -1
- package/fesm2022/c8y-ngx-components.mjs +96 -62
- package/fesm2022/c8y-ngx-components.mjs.map +1 -1
- package/locales/de.po +12 -0
- package/locales/es.po +12 -0
- package/locales/fr.po +12 -0
- package/locales/ja_JP.po +12 -0
- package/locales/ko.po +12 -0
- package/locales/locales.pot +12 -0
- package/locales/nl.po +12 -0
- package/locales/pl.po +12 -0
- package/locales/pt_BR.po +12 -0
- package/locales/zh_CN.po +12 -0
- package/locales/zh_TW.po +12 -0
- package/package.json +1 -1
- package/tenants/tenant-list/tenant-list.component.d.ts +1 -0
- package/tenants/tenant-list/tenant-list.component.d.ts.map +1 -1
|
@@ -364,22 +364,30 @@ class TenantListComponent {
|
|
|
364
364
|
}
|
|
365
365
|
}
|
|
366
366
|
async suspendTenant(tenant) {
|
|
367
|
-
const title = gettext('Suspend tenant');
|
|
368
|
-
const confirmationText = gettext('You are about to suspend tenant "{{ company }}" (ID "{{ id }}").');
|
|
369
|
-
const proceed = gettext('Do you want to proceed?');
|
|
370
|
-
const body = [
|
|
371
|
-
this.translateService.instant(confirmationText, {
|
|
372
|
-
company: tenant.company,
|
|
373
|
-
id: tenant.id
|
|
374
|
-
}),
|
|
375
|
-
this.translateService.instant(proceed)
|
|
376
|
-
].join(' ');
|
|
377
|
-
const labels = {
|
|
378
|
-
ok: gettext('Suspend`tenant`')
|
|
379
|
-
};
|
|
380
367
|
try {
|
|
381
|
-
await this.
|
|
382
|
-
const
|
|
368
|
+
const user = await this.appState.currentUser.value;
|
|
369
|
+
const isExternalUser = user.customProperties?.userOrigin === 'OAUTH2';
|
|
370
|
+
let confirmed;
|
|
371
|
+
if (isExternalUser) {
|
|
372
|
+
confirmed = await this.showExternalUserConfirmModal('suspend', tenant);
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
const title = gettext('Suspend tenant');
|
|
376
|
+
const confirmationText = gettext('You are about to suspend tenant "{{ company }}" (ID "{{ id }}").');
|
|
377
|
+
const proceed = gettext('Do you want to proceed?');
|
|
378
|
+
const body = [
|
|
379
|
+
this.translateService.instant(confirmationText, {
|
|
380
|
+
company: tenant.company,
|
|
381
|
+
id: tenant.id
|
|
382
|
+
}),
|
|
383
|
+
this.translateService.instant(proceed)
|
|
384
|
+
].join(' ');
|
|
385
|
+
const labels = {
|
|
386
|
+
ok: gettext('Suspend`tenant`')
|
|
387
|
+
};
|
|
388
|
+
await this.modalService.confirm(title, body, Status.DANGER, labels);
|
|
389
|
+
confirmed = await this.passwordService.confirmPassword().toPromise();
|
|
390
|
+
}
|
|
383
391
|
if (confirmed === true) {
|
|
384
392
|
const { data: savedTenant } = await this.tenantService.update({
|
|
385
393
|
id: tenant.id,
|
|
@@ -396,24 +404,32 @@ class TenantListComponent {
|
|
|
396
404
|
}
|
|
397
405
|
}
|
|
398
406
|
async delete(tenant) {
|
|
399
|
-
const title = gettext('Delete tenant');
|
|
400
|
-
const confirmationText = gettext('You are about to delete tenant "{{ company }}" (ID "{{ id }}").');
|
|
401
|
-
const hint = gettext('This operation is irreversible.');
|
|
402
|
-
const proceed = gettext('Do you want to proceed?');
|
|
403
|
-
const body = [
|
|
404
|
-
this.translateService.instant(confirmationText, {
|
|
405
|
-
company: tenant.company,
|
|
406
|
-
id: tenant.id
|
|
407
|
-
}),
|
|
408
|
-
this.translateService.instant(hint),
|
|
409
|
-
this.translateService.instant(proceed)
|
|
410
|
-
].join(' ');
|
|
411
|
-
const labels = {
|
|
412
|
-
ok: gettext('Delete`tenant`')
|
|
413
|
-
};
|
|
414
407
|
try {
|
|
415
|
-
await this.
|
|
416
|
-
const
|
|
408
|
+
const user = await this.appState.currentUser.value;
|
|
409
|
+
const isExternalUser = user.customProperties?.userOrigin === 'OAUTH2';
|
|
410
|
+
let confirmed;
|
|
411
|
+
if (isExternalUser) {
|
|
412
|
+
confirmed = await this.showExternalUserConfirmModal('delete', tenant);
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
const title = gettext('Delete tenant');
|
|
416
|
+
const confirmationText = gettext('You are about to delete tenant "{{ company }}" (ID "{{ id }}").');
|
|
417
|
+
const hint = gettext('This operation is irreversible.');
|
|
418
|
+
const proceed = gettext('Do you want to proceed?');
|
|
419
|
+
const body = [
|
|
420
|
+
this.translateService.instant(confirmationText, {
|
|
421
|
+
company: tenant.company,
|
|
422
|
+
id: tenant.id
|
|
423
|
+
}),
|
|
424
|
+
this.translateService.instant(hint),
|
|
425
|
+
this.translateService.instant(proceed)
|
|
426
|
+
].join(' ');
|
|
427
|
+
const labels = {
|
|
428
|
+
ok: gettext('Delete`tenant`')
|
|
429
|
+
};
|
|
430
|
+
await this.modalService.confirm(title, body, Status.DANGER, labels);
|
|
431
|
+
confirmed = await this.passwordService.confirmPassword().toPromise();
|
|
432
|
+
}
|
|
417
433
|
if (confirmed === true) {
|
|
418
434
|
await this.tenantService.delete(tenant);
|
|
419
435
|
const tenantsWithoutRemovedOne = this.tenants$.value.filter(t => t !== tenant);
|
|
@@ -441,6 +457,29 @@ class TenantListComponent {
|
|
|
441
457
|
const blob = new Blob([data], { type: contentType });
|
|
442
458
|
saveAs(blob, filename);
|
|
443
459
|
}
|
|
460
|
+
async showExternalUserConfirmModal(action, tenant) {
|
|
461
|
+
try {
|
|
462
|
+
const title = action === 'suspend' ? gettext('Suspend tenant') : gettext('Delete tenant');
|
|
463
|
+
const confirmationText = action === 'suspend'
|
|
464
|
+
? gettext('You are about to suspend tenant "{{ company }}" (ID "{{ id }}"). This action will immediately affect all users of this tenant.')
|
|
465
|
+
: gettext('You are about to delete tenant "{{ company }}" (ID "{{ id }}"). This action will immediately affect all users of this tenant.');
|
|
466
|
+
const hint = action === 'delete' ? gettext('This operation is irreversible.') + '<br><br>' : '';
|
|
467
|
+
const instruction = gettext('For security reasons, the external authentication server (single sign-on) does not allow for password confirmation. Instead, enter the following code to continue:');
|
|
468
|
+
const body = `${this.translateService.instant(confirmationText, {
|
|
469
|
+
company: tenant.company,
|
|
470
|
+
id: tenant.id
|
|
471
|
+
})}<br><br>${hint}${this.translateService.instant(instruction)}`;
|
|
472
|
+
const labels = {
|
|
473
|
+
ok: action === 'suspend' ? gettext('Suspend`tenant`') : gettext('Delete`tenant`')
|
|
474
|
+
};
|
|
475
|
+
const status = action === 'suspend' ? Status.WARNING : Status.DANGER;
|
|
476
|
+
await this.modalService.confirm(title, body, status, labels, {}, undefined, true);
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
catch {
|
|
480
|
+
return false;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
444
483
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.9", ngImport: i0, type: TenantListComponent, deps: [{ token: i1.AppStateService }, { token: i1.AlertService }, { token: i1.ModalService }, { token: i3.TranslateService }, { token: i1$1.TenantService }, { token: i1.TenantUiService }, { token: i4.Location }, { token: i1.PasswordService }, { token: i1$1.UserService }, { token: i1.Permissions }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
445
484
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.9", type: TenantListComponent, selector: "c8y-tenant-list", ngImport: i0, template: "<c8y-title>\n {{ 'Subtenants' | translate }}\n</c8y-title>\n\n<c8y-breadcrumb>\n <c8y-breadcrumb-item\n icon=\"c8y-layers\"\n label=\"{{ 'Tenants' | translate }}\"\n ></c8y-breadcrumb-item>\n <c8y-breadcrumb-item\n [icon]=\"'c8y-layers'\"\n [label]=\"'Subtenants' | translate\"\n ></c8y-breadcrumb-item>\n</c8y-breadcrumb>\n\n<c8y-action-bar-item\n *ngIf=\"!!(appState.state$ | async).newsletter\"\n [placement]=\"'right'\"\n>\n <button\n class=\"btn btn-link\"\n title=\"{{\n 'Downloads the list of emails of users subscribed for newsletter on the current tenant and its subtenants.'\n | translate\n }}\"\n type=\"button\"\n (click)=\"downloadNewsletterEmails()\"\n >\n <i c8yIcon=\"download\"></i>\n {{ 'Email addresses' | translate }}\n </button>\n</c8y-action-bar-item>\n\n<c8y-action-bar-item [placement]=\"'right'\">\n <button\n class=\"btn btn-link\"\n title=\"{{ 'Create tenant' | translate }}\"\n type=\"button\"\n (click)=\"createTenant()\"\n [disabled]=\"!isPermittedToCreateTenanant\"\n >\n <i c8yIcon=\"plus-circle\"></i>\n {{ 'Create tenant' | translate }}\n </button>\n</c8y-action-bar-item>\n\n<c8y-help src=\"/docs/enterprise-tenant/managing-tenants/#managing-subtenants\"></c8y-help>\n\n<div class=\"content-fullpage border-top border-bottom\">\n <c8y-data-grid\n [title]=\"title\"\n [loadMoreItemsLabel]=\"loadMoreItemsLabel\"\n [loadingItemsLabel]=\"loadingItemsLabel\"\n [displayOptions]=\"displayOptions\"\n [columns]=\"columns\"\n [rows]=\"tenants$ | async\"\n [pagination]=\"pagination\"\n [showSearch]=\"showSearch\"\n [actionControls]=\"actionControls\"\n (onReload)=\"loadTenants()\"\n >\n <ng-container *ngIf=\"!(tenants$ | async); else empty\">\n <c8y-loading></c8y-loading>\n </ng-container>\n <ng-template #empty>\n <c8y-ui-empty-state\n [icon]=\"stats?.size > 0 ? 'search' : 'c8y-layers'\"\n [title]=\"stats?.size > 0 ? (noResultsMessage | translate) : (noDataMessage | translate)\"\n [subtitle]=\"\n stats?.size > 0 ? (noResultsSubtitle | translate) : (noDataSubtitle | translate)\n \"\n *emptyStateContext=\"let stats\"\n [horizontal]=\"stats?.size > 0\"\n >\n <ng-container *ngIf=\"stats?.size === 0\">\n <div>\n <button\n class=\"btn btn-primary\"\n title=\"{{ 'Create tenant' | translate }}\"\n (click)=\"createTenant()\"\n [disabled]=\"!isPermittedToCreateTenanant\"\n >\n {{ 'Create tenant' | translate }}\n </button>\n </div>\n <p c8y-guide-docs>\n <small\n translate\n ngNonBindable\n >\n Find out more in the\n <a c8y-guide-href=\"/docs/enterprise-tenant/managing-tenants\">user documentation</a>\n .\n </small>\n </p>\n </ng-container>\n </c8y-ui-empty-state>\n </ng-template>\n\n <c8y-column name=\"company\">\n <ng-container *c8yCellRendererDef=\"let context\">\n <span title=\"{{ context.value }}\">\n <a [routerLink]=\"['/tenants', context.item.id]\">{{ context.value }}</a>\n </span>\n </ng-container>\n </c8y-column>\n\n <c8y-column name=\"parent\">\n <ng-container *c8yCellRendererDef=\"let context\">\n <span title=\"{{ context.value || currentTenant.name }}\">\n {{ context.value || currentTenant.name }}\n </span>\n </ng-container>\n </c8y-column>\n\n <c8y-column name=\"creationTime\">\n <ng-container *c8yCellRendererDef=\"let context\">\n <span title=\"{{ context.value | c8yDate }}\">\n {{ context.value | c8yDate }}\n </span>\n </ng-container>\n </c8y-column>\n\n <c8y-column name=\"status\">\n <ng-container *c8yCellRendererDef=\"let context\">\n <span\n title=\"{{ 'Active`tenant`' | translate }}\"\n *ngIf=\"context.item.status === TenantStatus.ACTIVE\"\n >\n <i\n class=\"text-success\"\n c8yIcon=\"check-circle\"\n ></i>\n </span>\n <span\n title=\"{{ 'Suspended`tenant`' | translate }}\"\n *ngIf=\"context.item.status === TenantStatus.SUSPENDED\"\n >\n <i\n class=\"text-danger\"\n c8yIcon=\"ban\"\n ></i>\n </span>\n </ng-container>\n </c8y-column>\n </c8y-data-grid>\n</div>\n", dependencies: [{ kind: "directive", type: i3$1.RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "routerLink"] }, { kind: "component", type: i1.ActionBarItemComponent, selector: "c8y-action-bar-item", inputs: ["placement", "priority", "itemClass", "injector", "groupId", "inGroupPriority"] }, { kind: "component", type: i1.BreadcrumbComponent, selector: "c8y-breadcrumb" }, { kind: "component", type: i1.BreadcrumbItemComponent, selector: "c8y-breadcrumb-item", inputs: ["icon", "translate", "label", "path", "injector"] }, { kind: "component", type: i1.EmptyStateComponent, selector: "c8y-ui-empty-state", inputs: ["icon", "title", "subtitle", "horizontal"] }, { kind: "directive", type: i1.EmptyStateContextDirective, selector: "[emptyStateContext]" }, { kind: "directive", type: i1.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: i1.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "message"] }, { kind: "directive", type: i1.CellRendererDefDirective, selector: "[c8yCellRendererDef]" }, { kind: "directive", type: i1.ColumnDirective, selector: "c8y-column", inputs: ["name"] }, { kind: "component", type: i1.DataGridComponent, selector: "c8y-data-grid", inputs: ["title", "loadMoreItemsLabel", "loadingItemsLabel", "showSearch", "refresh", "columns", "rows", "pagination", "infiniteScroll", "serverSideDataCallback", "selectable", "singleSelection", "selectionPrimaryKey", "displayOptions", "actionControls", "bulkActionControls", "headerActionControls", "searchText", "configureColumnsEnabled", "showCounterWarning", "activeClassName", "expandableRows"], outputs: ["rowMouseOver", "rowMouseLeave", "rowClick", "onConfigChange", "onBeforeFilter", "onBeforeSearch", "onFilter", "itemsSelect", "onReload", "onAddCustomColumn", "onRemoveCustomColumn", "onColumnFilterReset", "onSort", "onPageSizeChange", "onColumnReordered", "onColumnVisibilityChange"] }, { kind: "component", type: i1.TitleComponent, selector: "c8y-title", inputs: ["pageTitleUpdate"] }, { kind: "directive", type: i1.GuideHrefDirective, selector: "[c8y-guide-href]", inputs: ["c8y-guide-href"] }, { kind: "component", type: i1.GuideDocsComponent, selector: "[c8y-guide-docs]" }, { kind: "component", type: i1.HelpComponent, selector: "c8y-help", inputs: ["src", "isCollapsed", "priority", "icon"] }, { kind: "pipe", type: i1.C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: i1.DatePipe, name: "c8yDate" }] }); }
|
|
446
485
|
}
|