blob: 81d641068a9ef7870506c361c86ea30ab4da690c [file] [log] [blame]
<!--
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.
-->
<!-- TODO: Add tooltip and descriptions -->
<div class="header">
<div class="back-button-label">Device Actions</div>
<h1 class="subtitle">
<button mat-icon-button (click)="back()" #backButton id="back-button"
matTooltip="Return to settings page"
aria-label="Return to settings page">
<mat-icon class="back-button-icon">arrow_back</mat-icon>
</button>
{{getPageTitle(formMode)}}</h1>
</div>
<div class="page">
<!-- Test Information -->
<h2>Device Action Information</h2>
<!-- Name field -->
<mat-form-field appearance="outline" floatLabel="always" fxLayout="column">
<mat-label>Name</mat-label>
<input matInput type="text" [(ngModel)]="data.name" name="name" required #name="ngModel"
[readonly]="!canEdit()">
<mat-error *ngIf="name.invalid && name.touched">Name is required</mat-error>
</mat-form-field>
<!-- Description field -->
<mat-form-field appearance="outline" floatLabel="always" fxLayout="column">
<mat-label>Description</mat-label>
<textarea matInput type="text" [(ngModel)]="data.description" cdkTextareaAutosize
[readonly]="!canEdit()"></textarea>
</mat-form-field>
<!-- Device Spec field -->
<mat-form-field appearance="outline" floatLabel="always" fxLayout="column">
<mat-label>Target Device Spec</mat-label>
<input matInput type="text" [(ngModel)]="data.device_spec"
[readonly]="!canEdit()">
</mat-form-field>
<mat-divider></mat-divider>
<!-- TradeFed Options -->
<div class="margin-bottom">
<h2>TradeFed Options</h2>
<name-multi-value-pair-list-form
[optionTypeName]="'TradeFed Option'"
[optionValues]="data.tradefed_options"
[canEdit]="canEdit()"
(addOption)="onAddOption()"
(removeOption)="onRemoveOption($event)"
(optionValueChange)="onOptionValueChange($event)"
>
</name-multi-value-pair-list-form>
</div>
<mat-divider></mat-divider>
<!-- TradeFed Target Preparers -->
<h2>TradeFed Target Preparers</h2>
<tradefed-config-object-form
[configObjects]="data.tradefed_target_preparers"
[configObjectName]="'Target Preparer'"
[canEdit]="canEdit()"
(addConfigObject)="onAddTargetPreparer()"
(deleteConfigObject)="onDeleteTargetPreparer($event)"
>
</tradefed-config-object-form>
<mat-divider></mat-divider>
<!-- Test Resource Definitions -->
<h2>Test Resource Definitions</h2>
<test-resource-form
[data]="data.test_resource_defs"
[canAdd]="canEdit()" [canDelete]="canEdit()"
(addTestResource)="onAddTestResourceDef()"
(removeTestResource)="onRemoveTestResourceDef($event)"
[buildChannels]="buildChannels"
testResourceClassType="TestResourceDef"
>
</test-resource-form>
<!-- Update/Create Button and Cancel Button-->
<div *ngIf="canEdit()">
<button mat-flat-button color="accent" type="button" (click)="onSubmit()">
{{formMode === FormMode.EDIT ? 'Update' : 'Create'}}
</button>
<button mat-button color="accent" type="button" (click)="back()">
Cancel
</button>
<!-- Error messages after validation -->
<form-error-info [invalidInputs]="invalidInputs"></form-error-info>
</div>
</div>