tenants/tenant-list/tenant-list.component.ts
OnInit
selector | c8y-tenant-list |
templateUrl | ./tenant-list.component.html |
Properties |
Methods |
|
constructor(appState: AppStateService, alertService: AlertService, modalService: ModalService, translateService: TranslateService, tenantService: TenantService, tenantUiService: TenantUiService, location: Location, passwordService: PasswordService, userService: UserService, permissionsService: Permissions)
|
|||||||||||||||||||||||||||||||||
Parameters :
|
Async activateTenant | ||||
activateTenant(tenant)
|
||||
Parameters :
Returns :
any
|
createTenant |
createTenant()
|
Returns :
void
|
Async delete | ||||
delete(tenant)
|
||||
Parameters :
Returns :
any
|
Async downloadNewsletterEmails |
downloadNewsletterEmails()
|
Returns :
any
|
getActionControls |
getActionControls()
|
Returns :
ActionControl[]
|
getColumns |
getColumns()
|
Returns :
Column[]
|
getPagination |
getPagination()
|
Returns :
Pagination
|
goToDetails | ||||||
goToDetails(tenant: ITenant)
|
||||||
Parameters :
Returns :
void
|
isActive | ||||||
isActive(tenant: ITenant)
|
||||||
Parameters :
Returns :
boolean
|
isSuspended | ||||||
isSuspended(tenant: ITenant)
|
||||||
Parameters :
Returns :
boolean
|
loadTenants |
loadTenants()
|
Returns :
void
|
Async ngOnInit |
ngOnInit()
|
Returns :
any
|
Async suspendTenant | ||||
suspendTenant(tenant)
|
||||
Parameters :
Returns :
any
|
actionControls |
Type : ActionControl[]
|
Default value : this.getActionControls()
|
Public appState |
Type : AppStateService
|
columns |
Type : Column[]
|
Default value : this.getColumns()
|
currentTenant |
Type : ICurrentTenant
|
displayOptions |
Type : DisplayOptions
|
Default value : {
bordered: false,
striped: true,
filter: true,
gridHeader: true,
hover: true
}
|
isManagementTenant |
Type : boolean
|
isPermittedToCreateTenanant |
Default value : this.permissionsService.hasAnyRole([
Permissions.ROLE_TENANT_MANAGEMENT_ADMIN,
Permissions.ROLE_TENANT_MANAGEMENT_CREATE
])
|
loadingItemsLabel |
Type : string
|
Default value : gettext('Loading tenants…')
|
loadMoreItemsLabel |
Type : string
|
Default value : gettext('Load more tenants')
|
noDataMessage |
Default value : gettext('There are no tenants defined.')
|
noDataSubtitle |
Default value : gettext('Create the first tenant.')
|
noResultsMessage |
Default value : gettext('No tenants to display.')
|
noResultsSubtitle |
Default value : gettext('Refine your search terms or check your spelling.')
|
pagination |
Type : Pagination
|
Default value : this.getPagination()
|
showSearch |
Default value : true
|
tenants$ |
Type : BehaviorSubject<ITenant[]>
|
Default value : new BehaviorSubject(undefined)
|
TenantStatus |
Default value : TenantStatus
|
title |
Type : string
|
Default value : null
|
TOP_TENANT_NAME |
Type : string
|
Default value : 'management'
|
<c8y-title>
{{ 'Subtenants' | translate }}
</c8y-title>
<c8y-breadcrumb>
<c8y-breadcrumb-item
icon="c8y-layers"
label="{{ 'Tenants' | translate }}"
></c8y-breadcrumb-item>
<c8y-breadcrumb-item
[icon]="'c8y-layers'"
[label]="'Subtenants' | translate"
></c8y-breadcrumb-item>
</c8y-breadcrumb>
<c8y-action-bar-item
*ngIf="!!(appState.state$ | async).newsletter"
[placement]="'right'"
>
<button
class="btn btn-link"
title="{{
'Downloads the list of emails of users subscribed for newsletter on the current tenant and its subtenants.'
| translate
}}"
type="button"
(click)="downloadNewsletterEmails()"
>
<i c8yIcon="download"></i>
{{ 'Email addresses' | translate }}
</button>
</c8y-action-bar-item>
<c8y-action-bar-item [placement]="'right'">
<button
class="btn btn-link"
title="{{ 'Create tenant' | translate }}"
type="button"
(click)="createTenant()"
[disabled]="!isPermittedToCreateTenanant"
>
<i c8yIcon="plus-circle"></i>
{{ 'Create tenant' | translate }}
</button>
</c8y-action-bar-item>
<c8y-help src="/docs/enterprise-tenant/managing-tenants/#managing-subtenants"></c8y-help>
<div class="content-fullpage border-top border-bottom">
<c8y-data-grid
[title]="title"
[loadMoreItemsLabel]="loadMoreItemsLabel"
[loadingItemsLabel]="loadingItemsLabel"
[displayOptions]="displayOptions"
[columns]="columns"
[rows]="tenants$ | async"
[pagination]="pagination"
[showSearch]="showSearch"
[actionControls]="actionControls"
(onReload)="loadTenants()"
>
<ng-container *ngIf="!(tenants$ | async); else empty">
<c8y-loading></c8y-loading>
</ng-container>
<ng-template #empty>
<c8y-ui-empty-state
[icon]="stats?.size > 0 ? 'search' : 'c8y-layers'"
[title]="stats?.size > 0 ? (noResultsMessage | translate) : (noDataMessage | translate)"
[subtitle]="
stats?.size > 0 ? (noResultsSubtitle | translate) : (noDataSubtitle | translate)
"
*emptyStateContext="let stats"
[horizontal]="stats?.size > 0"
>
<ng-container *ngIf="stats?.size === 0">
<div>
<button
class="btn btn-primary"
title="{{ 'Create tenant' | translate }}"
(click)="createTenant()"
[disabled]="!isPermittedToCreateTenanant"
>
{{ 'Create tenant' | translate }}
</button>
</div>
<p c8y-guide-docs>
<small
translate
ngNonBindable
>
Find out more in the
<a c8y-guide-href="/docs/enterprise-tenant/managing-tenants">user documentation</a>
.
</small>
</p>
</ng-container>
</c8y-ui-empty-state>
</ng-template>
<c8y-column name="company">
<ng-container *c8yCellRendererDef="let context">
<span title="{{ context.value }}">
<a [routerLink]="['/tenants', context.item.id]">{{ context.value }}</a>
</span>
</ng-container>
</c8y-column>
<c8y-column name="parent">
<ng-container *c8yCellRendererDef="let context">
<span title="{{ context.value || currentTenant.name }}">
{{ context.value || currentTenant.name }}
</span>
</ng-container>
</c8y-column>
<c8y-column name="creationTime">
<ng-container *c8yCellRendererDef="let context">
<span title="{{ context.value | c8yDate }}">
{{ context.value | c8yDate }}
</span>
</ng-container>
</c8y-column>
<c8y-column name="status">
<ng-container *c8yCellRendererDef="let context">
<span
title="{{ 'Active`tenant`' | translate }}"
*ngIf="context.item.status === TenantStatus.ACTIVE"
>
<i
class="text-success"
c8yIcon="check-circle"
></i>
</span>
<span
title="{{ 'Suspended`tenant`' | translate }}"
*ngIf="context.item.status === TenantStatus.SUSPENDED"
>
<i
class="text-danger"
c8yIcon="ban"
></i>
</span>
</ng-container>
</c8y-column>
</c8y-data-grid>
</div>