| <!-- |
| Copyright 2020 TATA ELXSI |
| |
| 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. |
| |
| Author: SANDHYA JS (sandhya.j@tataelxsi.co.in) |
| --> |
| <form [formGroup]="KsuForm" (ngSubmit)="KSUAddSubmit();"> |
| <div class="modal-header"> |
| <h4 *ngIf="profileType === 'add'|| profileType === 'card-add'" class="modal-title" id="modal-basic-title">{{'PAGE.K8S.ADDKSU' | translate}}</h4> |
| <h4 *ngIf="profileType === 'edit'"class="modal-title" id="modal-basic-title">{{'PAGE.K8S.EDITKSU' | translate}}</h4> |
| <h4 *ngIf="profileType === 'move'"class="modal-title" id="modal-basic-title">{{'PAGE.K8S.MOVE' | translate}}</h4> |
| <h4 *ngIf="profileType === 'clone'"class="modal-title" id="modal-basic-title">{{'PAGE.K8S.CLONE' | translate}}</h4> |
| <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()"> |
| <i class="fas fa-times-circle text-danger"></i> |
| </button> |
| </div> |
| <div class="modal-body modal-body-custom-height"> |
| <div class="form-group row mb-3" *ngIf="isClone || isKsu"> |
| <label class="col-sm-12 col-form-label mandatory-label" |
| [ngClass]="{'text-danger': KsuForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | |
| translate}}</label> |
| <label class="col-sm-4 col-form-label" for="name">{{'PAGE.K8S.NAME' | translate}}*</label> |
| <div class="col-sm-8"> |
| <input autocomplete="off" class="form-control" placeholder="{{'PAGE.K8S.NAME' | translate}}" type="text" |
| formControlName="name" id="name" [ngClass]="{ 'is-invalid': submitted && f.name.errors }" required> |
| </div> |
| </div> |
| <div class="form-group row mb-3"*ngIf="isKsu"> |
| <label class="col-sm-4 col-form-label" for="description">{{'PAGE.K8S.DESCRIPTION' | translate}}*</label> |
| <div class="col-sm-8"> |
| <textarea class="form-control" placeholder="{{'PAGE.K8S.DESCRIPTION' | translate}}" type="text" |
| formControlName="description" id="description" |
| [ngClass]="{ 'is-invalid': submitted && f.description.errors }" required></textarea> |
| </div> |
| </div> |
| <div class="form-group row mb-3" *ngIf="isClone || isMove || isKsu"> |
| <label class="col-sm-4 col-form-label" for="profile_type">{{'PAGE.K8S.PROFILETYPE' | translate}}*</label> |
| <div class="col-sm-8"> |
| <ng-select (change)="getprofileDetails($event.value)" |
| placeholder="{{'SELECT' | translate}} {{'TYPE' | translate}}" [items]="profileSelect" |
| bindLabel="title" bindValue="value" formControlName="profile_type" id="profile_type" |
| [ngClass]="{ 'is-invalid': submitted && f.profile_type.errors }" required> |
| </ng-select> |
| </div> |
| </div> |
| <div class="form-group row mb-3" *ngIf="isClone || isMove || isKsu"> |
| <label class="col-sm-4 col-form-label" for="id">{{'PAGE.K8S.PROFILENAME' | translate}}*</label> |
| <div class="col-sm-8"> |
| <ng-select placeholder=" {{'SELECT' | translate}} {{'NAME' | |
| translate}}" [items]="profileDetails" bindLabel="name" bindValue="id" formControlName="id" id="id" |
| [ngClass]="{ 'is-invalid': submitted && f.id.errors }" required> |
| </ng-select> |
| </div> |
| </div> |
| <div class="form-group row p-2 bg-light text-white justify-content-end mb-3"*ngIf="isKsu"> |
| <div class="col-4"> |
| <button class="button-xs" type="button" class="btn btn-primary" (click)="addOka()"> |
| <i class="fas fa-plus-circle"></i>{{'PAGE.K8S.SELECTOKA' | translate}}</button> |
| </div> |
| </div> |
| <ng-container *ngIf="isKsu"> |
| <div formArrayName="oka" *ngFor="let params of getControls(); let i = index;"> |
| <div class="form-group row" [formGroupName]="i"> |
| <div class="card bg-light"> |
| <div class="card-body"> |
| <div class="form-group row"> |
| <label class="col-sm-3 col-md-3 col-form-label" for="_id{{i}}">{{'PAGE.K8S.OKA' | |
| translate}}</label> |
| <div class="col-sm-8 col-md-8"> |
| <ng-select |
| placeholder="{{'SELECT' | translate}} {{'PAGE.K8S.OKANAME' | translate}}" [items]="okaDetail" bindLabel="name" |
| bindValue="id" formControlName="_id" id="_id{{i}}" |
| [ngClass]="{ 'is-invalid': submitted && params.controls._id.errors }"> |
| </ng-select> |
| <div class="fileupload-text mt-1 mb-1">or {{'PAGE.K8S.PATH' | translate}}</div> |
| <div class="col-sm-8 col-md-8"> |
| <input autocomplete="off" class="form-control" |
| placeholder="{{'PAGE.K8S.PATH' | translate}}" type="text" formControlName="sw_catalog_path" |
| id="sw_catalog_path" [ngClass]="{ 'is-invalid': submitted && params.controls.sw_catalog_path.errors }"> |
| </div> |
| </div> |
| <label class="col-sm-3 col-md-3 col-form-label" |
| for="transformation{{i}}">{{'PAGE.K8S.TRANSFORMFILE' | |
| translate}}</label> |
| <div class="col-sm-8 col-md-8"> |
| <textarea rows="5" cols="50" class="form-control" placeholder="{{'YAMLCONFIG' | translate}}" |
| formControlName="transformation" id="transformation"></textarea> |
| <div class="fileupload-text mt-1 mb-1">{{'FILEUPLOADLABEL' | translate}}</div> |
| <div class="custom-file"> |
| <input type="file" #fileInputConfig class="fileupload custom-file-input" |
| (change)="configFile($event.target.files)" id="customConfigFile" [ngClass]="{ 'is-invalid': submitted && transformation.errors }"> |
| </div> |
| </div> |
| <div class="col-sm-1"> |
| <button class="button-xs" type="button" class="close" (click)="removeMapping(i)" |
| placement="right" ngbTooltip="{{ 'CANCEL' | translate }}"> |
| <i class="fas fa-minus-circle text-danger"></i> |
| </button> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </div> |
| </ng-container> |
| </div> |
| <div class="modal-footer"> |
| <button type="button" class="btn btn-danger" (click)="activeModal.close()">{{'CANCEL' | translate}}</button> |
| <button *ngIf="profileType === 'add' || profileType === 'card-add'" type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button> |
| <button *ngIf="profileType === 'edit'" type="submit" class="btn btn-primary">{{'Edit' | translate}}</button> |
| <button *ngIf="profileType === 'move'" type="submit" class="btn btn-primary">{{'Move' | translate}}</button> |
| <button *ngIf="profileType === 'clone'" type="submit" class="btn btn-primary">{{'Clone' | translate}}</button> |
| </div> |
| </form> |
| <app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader> |