| <!-- |
| Copyright 2019 Google LLC |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <mat-spinner class="loading-spinner" color="accent" *ngIf="isLoading"></mat-spinner> |
| |
| <div [class.loading-mask]="isLoading" class="page"> |
| |
| <div class="header-section"> |
| <span class="description" fxFlex> |
| Device actions are scripts that are run on each device before a test run is executed. |
| </span> |
| <button |
| routerLink='/device_actions/new' |
| mat-flat-button |
| aria-label="Add new device action" |
| color="accent"> |
| + New device action |
| </button> |
| </div> |
| |
| <ng-container *ngFor="let actionList of actionNamespaceMap | keyvalue"> |
| <ng-container *ngIf="actionList.value.length"> |
| <h2> |
| {{getNamespaceTitle(actionList.key)}} |
| </h2> |
| <!-- TODO: Add update/remove buttons --> |
| |
| <mat-card *ngFor="let deviceAction of actionList.value" class="hover-mat-card action-card"> |
| <h3> |
| <span>{{deviceAction.name}}</span> |
| <div class="button-group"> |
| <button |
| *ngIf="!isNamespaceSectionEditable(actionList.key)" |
| mat-icon-button |
| aria-label="View" |
| matTooltip="View" |
| [routerLink]="['/device_actions/view', deviceAction.id]" |
| class="view-button"> |
| <mat-icon>info</mat-icon> |
| </button> |
| <button |
| *ngIf="isNamespaceSectionEditable(actionList.key)" |
| mat-icon-button |
| aria-label="Edit" |
| matTooltip="Edit" |
| [routerLink]="['/device_actions', deviceAction.id]" |
| class="update-button"> |
| <mat-icon>edit</mat-icon> |
| </button> |
| <!-- TODO: Make default actions unremovable --> |
| <button |
| *ngIf="isNamespaceSectionEditable(actionList.key)" |
| mat-icon-button |
| aria-label="Delete" |
| matTooltip="Delete" |
| class="delete-button" |
| (click)="deleteDeviceAction(deviceAction)"> |
| <mat-icon>delete</mat-icon> |
| </button> |
| <!-- dropdown --> |
| <button |
| mat-icon-button |
| aria-label="More actions" |
| matTooltip="More actions" |
| [matMenuTriggerFor]="menu"> |
| <mat-icon>more_vert</mat-icon> |
| </button> |
| <mat-menu #menu="matMenu"> |
| <button mat-menu-item |
| [routerLink]="['/device_actions/new', deviceAction.id]"> |
| Copy |
| </button> |
| </mat-menu> |
| </div> |
| </h3> |
| <mat-card-content> |
| {{deviceAction.description}} |
| </mat-card-content> |
| </mat-card> |
| </ng-container> |
| </ng-container> |
| |
| <div class="empty" *ngIf="!(actionNamespaceMap | values).length"> |
| No device actions found. |
| </div> |
| </div> |