2 ========================LICENSE_START=================================
5 Copyright (C) 2019 Nordix Foundation
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ========================LICENSE_END===================================
22 <div class="nrcp-global-page-title">Policy Control</div>
23 <div class="refresh-button">
24 <button mat-icon-button color="primary" aria-label="Button with a refresh icon" (click)="refreshTables()">
25 <mat-icon>refresh</mat-icon>
30 <table mat-table [dataSource]="policyTypesDataSource" matSort multiTemplateDataRows
31 class="policy-type-table mat-elevation-z8">
33 <ng-container matColumnDef="name">
34 <mat-header-cell *matHeaderCellDef>Policy Type</mat-header-cell>
35 <mat-cell *matCellDef="let policyTypeSchema">
36 <mat-icon matTooltip="Properties">{{isInstancesShown(policyTypeSchema) ? 'expand_less' : 'expand_more'}}
38 {{this.getDisplayName(policyTypeSchema)}}
42 <ng-container matColumnDef="description">
43 <mat-header-cell *matHeaderCellDef> Description </mat-header-cell>
44 <mat-cell *matCellDef="let policyTypeSchema"> {{policyTypeSchema.schemaObject.description}}
48 <ng-container matColumnDef="action">
49 <mat-header-cell class="action-cell" *matHeaderCellDef>Action </mat-header-cell>
50 <mat-cell class="action-cell" *matCellDef="let policyTypeSchema" (click)="$event.stopPropagation()">
51 <button mat-icon-button (click)="createPolicyInstance(policyTypeSchema)">
52 <mat-icon matTooltip="Create instance">add_box</mat-icon>
57 <!-- =================== Policy instances for one type ======================== -->
58 <ng-container matColumnDef="instanceTableContainer">
59 <mat-cell *matCellDef="let policyTypeSchema">
60 <nrcp-policy-instance [policyTypeSchema]=policyTypeSchema [expanded]=this.getExpandedObserver(policyTypeSchema)>
61 </nrcp-policy-instance>
66 <ng-container matColumnDef="noRecordsFound">
67 <mat-footer-cell *matFooterCellDef>No records found.</mat-footer-cell>
70 <mat-header-row *matHeaderRowDef="['name', 'description', 'action']"></mat-header-row>
71 <mat-row *matRowDef="let policyTypeSchema; columns: ['name', 'description', 'action']"
72 (click)="toggleListInstances(policyTypeSchema)">
75 <mat-row *matRowDef="let policyTypeSchema; columns: ['instanceTableContainer'];"
76 [@detailExpand]="isInstancesShown(policyTypeSchema) ? 'expanded' : 'collapsed'" style="overflow: hidden">
79 <mat-footer-row *matFooterRowDef="['noRecordsFound']"
80 [ngClass]="{'display-none': policyTypesDataSource.rowCount > 0}">
85 <div class="spinner-container" *ngIf="policyTypesDataSource.loading$ | async">
86 <mat-spinner diameter="50"></mat-spinner>