|
|
|
@@ -1,35 +1,64 @@
|
|
|
|
|
<cnsl-refresh-table [loading]="loading$ | async" (refreshed)="refreshPage()" [dataSize]="totalResult"
|
|
|
|
|
[hideRefresh]="true" [timestamp]="viewTimestamp" [selection]="selection"
|
|
|
|
|
[emitRefreshOnPreviousRoutes]="refreshOnPreviousRoutes" [showBorder]="true">
|
|
|
|
|
|
|
|
|
|
<cnsl-refresh-table
|
|
|
|
|
[loading]="loading$ | async"
|
|
|
|
|
(refreshed)="refreshPage()"
|
|
|
|
|
[dataSize]="totalResult"
|
|
|
|
|
[hideRefresh]="true"
|
|
|
|
|
[timestamp]="viewTimestamp"
|
|
|
|
|
[selection]="selection"
|
|
|
|
|
[emitRefreshOnPreviousRoutes]="refreshOnPreviousRoutes"
|
|
|
|
|
[showBorder]="true"
|
|
|
|
|
>
|
|
|
|
|
<div leftActions class="user-table-left-actions">
|
|
|
|
|
<button class="type-button" [ngClass]="{'active': type === Type.TYPE_HUMAN}"
|
|
|
|
|
(click)="setType(Type.TYPE_HUMAN)">{{'USER.TABLE.TYPES.HUMAN' | translate}}</button>
|
|
|
|
|
<button class="type-button" [ngClass]="{'active': type === Type.TYPE_MACHINE}"
|
|
|
|
|
(click)="setType(Type.TYPE_MACHINE)">{{'USER.TABLE.TYPES.MACHINE' | translate}}</button>
|
|
|
|
|
<button class="type-button" [ngClass]="{ active: type === Type.TYPE_HUMAN }" (click)="setType(Type.TYPE_HUMAN)">
|
|
|
|
|
{{ 'USER.TABLE.TYPES.HUMAN' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
<button class="type-button" [ngClass]="{ active: type === Type.TYPE_MACHINE }" (click)="setType(Type.TYPE_MACHINE)">
|
|
|
|
|
{{ 'USER.TABLE.TYPES.MACHINE' | translate }}
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<ng-template cnslHasRole [hasRole]="['user.write']" actions>
|
|
|
|
|
<button (click)="deactivateSelectedUsers()" class="cnsl-action-button bg-state inactive" mat-raised-button
|
|
|
|
|
*ngIf="selection.hasValue() && multipleDeactivatePossible" [disabled]="disabled" color="primary">
|
|
|
|
|
<span class="">{{'USER.TABLE.DEACTIVATE' | translate}}</span>
|
|
|
|
|
<cnsl-action-keys (actionTriggered)="deactivateSelectedUsers()" [type]="ActionKeysType.DEACTIVATE">
|
|
|
|
|
</cnsl-action-keys>
|
|
|
|
|
<button
|
|
|
|
|
(click)="deactivateSelectedUsers()"
|
|
|
|
|
class="cnsl-action-button bg-state inactive"
|
|
|
|
|
mat-raised-button
|
|
|
|
|
*ngIf="selection.hasValue() && multipleDeactivatePossible"
|
|
|
|
|
[disabled]="!canWrite"
|
|
|
|
|
color="primary"
|
|
|
|
|
>
|
|
|
|
|
<span class="">{{ 'USER.TABLE.DEACTIVATE' | translate }}</span>
|
|
|
|
|
<cnsl-action-keys (actionTriggered)="deactivateSelectedUsers()" [type]="ActionKeysType.DEACTIVATE"> </cnsl-action-keys>
|
|
|
|
|
</button>
|
|
|
|
|
<button (click)="reactivateSelectedUsers()" class="cnsl-action-button bg-state active margin-left" mat-raised-button
|
|
|
|
|
*ngIf="selection.hasValue() && multipleActivatePossible" [disabled]="disabled" color="primary">
|
|
|
|
|
<span class="">{{'USER.TABLE.ACTIVATE' | translate}}</span>
|
|
|
|
|
<cnsl-action-keys (actionTriggered)="reactivateSelectedUsers()" [type]="ActionKeysType.REACTIVATE">
|
|
|
|
|
</cnsl-action-keys>
|
|
|
|
|
<button
|
|
|
|
|
(click)="reactivateSelectedUsers()"
|
|
|
|
|
class="cnsl-action-button bg-state active margin-left"
|
|
|
|
|
mat-raised-button
|
|
|
|
|
*ngIf="selection.hasValue() && multipleActivatePossible"
|
|
|
|
|
[disabled]="!canWrite"
|
|
|
|
|
color="primary"
|
|
|
|
|
>
|
|
|
|
|
<span class="">{{ 'USER.TABLE.ACTIVATE' | translate }}</span>
|
|
|
|
|
<cnsl-action-keys (actionTriggered)="reactivateSelectedUsers()" [type]="ActionKeysType.REACTIVATE"> </cnsl-action-keys>
|
|
|
|
|
</button>
|
|
|
|
|
<cnsl-filter-user *ngIf="!selection.hasValue()" (filterChanged)="applySearchQuery($any($event))"
|
|
|
|
|
(filterOpen)="filterOpen = $event"></cnsl-filter-user>
|
|
|
|
|
<a *ngIf="!selection.hasValue()" [routerLink]="[ '/users',type === Type.TYPE_HUMAN ? 'create' : 'create-machine']"
|
|
|
|
|
color="primary" mat-raised-button [disabled]="disabled" class="cnsl-action-button">
|
|
|
|
|
<cnsl-filter-user
|
|
|
|
|
*ngIf="!selection.hasValue()"
|
|
|
|
|
(filterChanged)="applySearchQuery($any($event))"
|
|
|
|
|
(filterOpen)="filterOpen = $event"
|
|
|
|
|
></cnsl-filter-user>
|
|
|
|
|
<a
|
|
|
|
|
*ngIf="!selection.hasValue()"
|
|
|
|
|
[routerLink]="['/users', type === Type.TYPE_HUMAN ? 'create' : 'create-machine']"
|
|
|
|
|
color="primary"
|
|
|
|
|
mat-raised-button
|
|
|
|
|
[disabled]="!canWrite"
|
|
|
|
|
class="cnsl-action-button"
|
|
|
|
|
>
|
|
|
|
|
<mat-icon class="icon">add</mat-icon>
|
|
|
|
|
<span>{{ 'ACTIONS.NEW' | translate }}</span>
|
|
|
|
|
<cnsl-action-keys *ngIf="!filterOpen"
|
|
|
|
|
(actionTriggered)="gotoRouterLink([ '/users',type === Type.TYPE_HUMAN ? 'create' : 'create-machine'])">
|
|
|
|
|
<cnsl-action-keys
|
|
|
|
|
*ngIf="!filterOpen"
|
|
|
|
|
(actionTriggered)="gotoRouterLink(['/users', type === Type.TYPE_HUMAN ? 'create' : 'create-machine'])"
|
|
|
|
|
>
|
|
|
|
|
</cnsl-action-keys>
|
|
|
|
|
</a>
|
|
|
|
|
</ng-template>
|
|
|
|
@@ -38,19 +67,37 @@
|
|
|
|
|
<table class="table" mat-table [dataSource]="dataSource" matSort (matSortChange)="sortChange($event)">
|
|
|
|
|
<ng-container matColumnDef="select">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef class="selection">
|
|
|
|
|
<mat-checkbox [disabled]="disabled" color="primary" (change)="$event ? masterToggle() : null"
|
|
|
|
|
<mat-checkbox
|
|
|
|
|
[disabled]="!canWrite"
|
|
|
|
|
color="primary"
|
|
|
|
|
(change)="$event ? masterToggle() : null"
|
|
|
|
|
[checked]="selection.hasValue() && isAllSelected()"
|
|
|
|
|
[indeterminate]="selection.hasValue() && !isAllSelected()">
|
|
|
|
|
[indeterminate]="selection.hasValue() && !isAllSelected()"
|
|
|
|
|
>
|
|
|
|
|
</mat-checkbox>
|
|
|
|
|
</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" class="selection">
|
|
|
|
|
<mat-checkbox [disabled]="disabled" color="primary" (click)="$event.stopPropagation()"
|
|
|
|
|
(change)="$event ? selection.toggle(user) : null" [checked]="selection.isSelected(user)">
|
|
|
|
|
|
|
|
|
|
<mat-checkbox
|
|
|
|
|
[disabled]="!canWrite"
|
|
|
|
|
color="primary"
|
|
|
|
|
(click)="$event.stopPropagation()"
|
|
|
|
|
(change)="$event ? selection.toggle(user) : null"
|
|
|
|
|
[checked]="selection.isSelected(user)"
|
|
|
|
|
>
|
|
|
|
|
<cnsl-avatar
|
|
|
|
|
*ngIf="user.human && user.human.profile.displayName && user.human?.profile.firstName && user.human?.profile.lastName; else cog"
|
|
|
|
|
class="avatar" [name]="user.human.profile.displayName" [avatarUrl]="user.human?.profile?.avatarUrl || ''"
|
|
|
|
|
[forColor]="user?.preferredLoginName" [size]="32">
|
|
|
|
|
*ngIf="
|
|
|
|
|
user.human &&
|
|
|
|
|
user.human.profile.displayName &&
|
|
|
|
|
user.human?.profile.firstName &&
|
|
|
|
|
user.human?.profile.lastName;
|
|
|
|
|
else cog
|
|
|
|
|
"
|
|
|
|
|
class="avatar"
|
|
|
|
|
[name]="user.human.profile.displayName"
|
|
|
|
|
[avatarUrl]="user.human?.profile?.avatarUrl || ''"
|
|
|
|
|
[forColor]="user?.preferredLoginName"
|
|
|
|
|
[size]="32"
|
|
|
|
|
>
|
|
|
|
|
</cnsl-avatar>
|
|
|
|
|
<ng-template #cog>
|
|
|
|
|
<cnsl-avatar [forColor]="user?.preferredLoginName" [isMachine]="true">
|
|
|
|
@@ -62,58 +109,74 @@
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container matColumnDef="displayName">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
|
|
|
|
[ngClass]="{'search-active': this.userSearchKey === UserListSearchKey.DISPLAY_NAME}">
|
|
|
|
|
<th
|
|
|
|
|
mat-header-cell
|
|
|
|
|
*matHeaderCellDef
|
|
|
|
|
mat-sort-header
|
|
|
|
|
[ngClass]="{ 'search-active': this.userSearchKey === UserListSearchKey.DISPLAY_NAME }"
|
|
|
|
|
>
|
|
|
|
|
{{ 'USER.PROFILE.DISPLAYNAME' | translate }}
|
|
|
|
|
</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id ]: null">
|
|
|
|
|
<span *ngIf="user.human">{{user.human.profile?.displayName}}</span>
|
|
|
|
|
<span *ngIf="user.machine">{{user.machine.name}}</span>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id] : null">
|
|
|
|
|
<span *ngIf="user.human">{{ user.human.profile?.displayName }}</span>
|
|
|
|
|
<span *ngIf="user.machine">{{ user.machine.name }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container matColumnDef="username">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
|
|
|
|
[ngClass]="{'search-active': this.userSearchKey === UserListSearchKey.USER_NAME}">
|
|
|
|
|
<th
|
|
|
|
|
mat-header-cell
|
|
|
|
|
*matHeaderCellDef
|
|
|
|
|
mat-sort-header
|
|
|
|
|
[ngClass]="{ 'search-active': this.userSearchKey === UserListSearchKey.USER_NAME }"
|
|
|
|
|
>
|
|
|
|
|
{{ 'USER.PROFILE.USERNAME' | translate }}
|
|
|
|
|
</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id ]: null">
|
|
|
|
|
{{user.userName}} </td>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id] : null">
|
|
|
|
|
{{ user.userName }}
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container matColumnDef="email">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef mat-sort-header
|
|
|
|
|
[ngClass]="{'search-active': this.UserListSearchKey === UserListSearchKey.EMAIL}">
|
|
|
|
|
<th
|
|
|
|
|
mat-header-cell
|
|
|
|
|
*matHeaderCellDef
|
|
|
|
|
mat-sort-header
|
|
|
|
|
[ngClass]="{ 'search-active': this.UserListSearchKey === UserListSearchKey.EMAIL }"
|
|
|
|
|
>
|
|
|
|
|
{{ 'USER.EMAIL' | translate }}
|
|
|
|
|
</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id ]: null">
|
|
|
|
|
<span *ngIf="user.human?.email?.email">{{user.human?.email.email}}</span>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id] : null">
|
|
|
|
|
<span *ngIf="user.human?.email?.email">{{ user.human?.email.email }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container matColumnDef="state">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef mat-sort-header> {{ 'USER.DATA.STATE' | translate }} </th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id ]: null">
|
|
|
|
|
<span class="state"
|
|
|
|
|
[ngClass]="{'active': user.state === UserState.USER_STATE_ACTIVE, 'inactive': user.state === UserState.USER_STATE_INACTIVE}">
|
|
|
|
|
{{ 'USER.DATA.STATE'+user.state | translate }}
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef mat-sort-header>{{ 'USER.DATA.STATE' | translate }}</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id] : null">
|
|
|
|
|
<span
|
|
|
|
|
class="state"
|
|
|
|
|
[ngClass]="{
|
|
|
|
|
active: user.state === UserState.USER_STATE_ACTIVE,
|
|
|
|
|
inactive: user.state === UserState.USER_STATE_INACTIVE
|
|
|
|
|
}"
|
|
|
|
|
>
|
|
|
|
|
{{ 'USER.DATA.STATE' + user.state | translate }}
|
|
|
|
|
</span>
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container matColumnDef="creationDate">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef> {{'USER.TABLE.CREATIONDATE' | translate}} </th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id ]: null">
|
|
|
|
|
<span class="no-break">{{user.details.creationDate | timestampToDate | localizedDate: 'fromNow'
|
|
|
|
|
}}</span>
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef>{{ 'USER.TABLE.CREATIONDATE' | translate }}</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id] : null">
|
|
|
|
|
<span class="no-break">{{ user.details.creationDate | timestampToDate | localizedDate: 'fromNow' }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<ng-container matColumnDef="changeDate">
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef> {{ 'USER.TABLE.CHANGEDATE' | translate }} </th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id ]: null">
|
|
|
|
|
<span class="no-break">{{user.details.changeDate | timestampToDate | localizedDate: 'fromNow'
|
|
|
|
|
}}</span>
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef>{{ 'USER.TABLE.CHANGEDATE' | translate }}</th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" [routerLink]="user.id ? ['/users', user.id] : null">
|
|
|
|
|
<span class="no-break">{{ user.details.changeDate | timestampToDate | localizedDate: 'fromNow' }}</span>
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
@@ -121,28 +184,41 @@
|
|
|
|
|
<th mat-header-cell *matHeaderCellDef class="user-tr-actions"></th>
|
|
|
|
|
<td mat-cell *matCellDef="let user" class="user-tr-actions">
|
|
|
|
|
<cnsl-table-actions>
|
|
|
|
|
<button actions matTooltip="{{'ACTIONS.REMOVE' | translate}}" color="warn" (click)="deleteUser(user)"
|
|
|
|
|
mat-icon-button>
|
|
|
|
|
<button
|
|
|
|
|
actions
|
|
|
|
|
matTooltip="{{ 'ACTIONS.REMOVE' | translate }}"
|
|
|
|
|
color="warn"
|
|
|
|
|
(click)="deleteUser(user)"
|
|
|
|
|
[disabled]="!canWrite || !canDelete"
|
|
|
|
|
mat-icon-button
|
|
|
|
|
>
|
|
|
|
|
<i class="las la-trash"></i>
|
|
|
|
|
</button>
|
|
|
|
|
</cnsl-table-actions>
|
|
|
|
|
</td>
|
|
|
|
|
</ng-container>
|
|
|
|
|
|
|
|
|
|
<tr mat-header-row *matHeaderRowDef="type === Type.TYPE_HUMAN ? displayedColumnsHuman : displayedColumnsMachine">
|
|
|
|
|
</tr>
|
|
|
|
|
<tr class="highlight pointer" mat-row
|
|
|
|
|
*matRowDef="let user; columns: (type === Type.TYPE_HUMAN ? displayedColumnsHuman : displayedColumnsMachine);">
|
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
<tr mat-header-row *matHeaderRowDef="type === Type.TYPE_HUMAN ? displayedColumnsHuman : displayedColumnsMachine"></tr>
|
|
|
|
|
<tr
|
|
|
|
|
class="highlight pointer"
|
|
|
|
|
mat-row
|
|
|
|
|
*matRowDef="let user; columns: type === Type.TYPE_HUMAN ? displayedColumnsHuman : displayedColumnsMachine"
|
|
|
|
|
></tr>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div *ngIf="(loading$ | async) === false && !dataSource?.data?.length" class="no-content-row">
|
|
|
|
|
<i class="las la-exclamation"></i>
|
|
|
|
|
<span>{{'USER.TABLE.EMPTY' | translate}}</span>
|
|
|
|
|
<span>{{ 'USER.TABLE.EMPTY' | translate }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<cnsl-paginator #paginator class="paginator" [timestamp]="viewTimestamp" [length]="totalResult || 0"
|
|
|
|
|
[pageSize]="INITIAL_PAGE_SIZE" [timestamp]="viewTimestamp" [pageSizeOptions]="[10, 20, 50, 100]"
|
|
|
|
|
(page)="changePage($event)"></cnsl-paginator>
|
|
|
|
|
</cnsl-refresh-table>
|
|
|
|
|
<cnsl-paginator
|
|
|
|
|
#paginator
|
|
|
|
|
class="paginator"
|
|
|
|
|
[timestamp]="viewTimestamp"
|
|
|
|
|
[length]="totalResult || 0"
|
|
|
|
|
[pageSize]="INITIAL_PAGE_SIZE"
|
|
|
|
|
[timestamp]="viewTimestamp"
|
|
|
|
|
[pageSizeOptions]="[10, 20, 50, 100]"
|
|
|
|
|
(page)="changePage($event)"
|
|
|
|
|
></cnsl-paginator>
|
|
|
|
|
</cnsl-refresh-table>
|
|
|
|
|