<!--
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: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
-->
<div class="form-group row">
  <div class="d-flex align-items-center header-style">{{'EDIT' | translate}}&nbsp;<span
      class="text-uppercase">{{pacakgeType}}&nbsp;</span>{{'DESCRIPTOR' | translate}}</div>
</div>
<form *ngIf="defaults[mode]">
  <div class="row">
    <div class="col-2">
      <div class="form-group">
        <select class="form-control custom-select" name="state" [(ngModel)]="mode" (ngModelChange)="changeMode()">
          <option *ngFor="let types of fileTypes;" [value]="types.value">
            {{types.viewValue}}</option>
        </select>
      </div>
    </div>
    <div class="col-4">
      <div class="btn-group-toggle mb-1 mr-1 float-left">
        <label class="btn btn-light" [class.active]="readOnly">
          <input type="checkbox" [(ngModel)]="readOnly" name="readOnly" autocomplete="off">
          {{'READONLYMODE' | translate}} ({{'CURRENTLY' | translate}} {{ (readOnly ? 'ON' : 'OFF') | translate }})
        </label>
      </div>
    </div>
    <div class="col-6 text-right">
      <button type="button" class="btn btn-primary mr-2" routerLink="/packages/{{navigatePath}}/compose/{{paramsID}}"
        [hidden]="navigatePath==='netslice'">
        <i class="fa fa-sitemap" aria-hidden="true"></i>&nbsp;{{'SHOWGRAPH' | translate}}
      </button>
      <button type="button" class="btn btn-primary mr-2" (click)="update(true)" [hidden]="navigatePath==='netslice'">
        <i class="fa fa-save" aria-hidden="true"></i>&nbsp;{{'UPDATESHOWGRAPH' | translate}}
      </button>
      <button type="button" class="btn btn-primary" (click)="update(false)">
        <i class="fa fa-save" aria-hidden="true"></i>&nbsp;{{'UPDATE' | translate}}
      </button>
    </div>
  </div>
</form>
<div class="ngx-codemirror edit-packages" *ngIf="defaults[mode] else noData">
  <ngx-codemirror [options]="options" [ngModel]="defaults[mode]" [disabled]="readOnly" [autoFocus]="true"
    (ngModelChange)="handleChange($event)"></ngx-codemirror>
</div>
<ng-template #noData>
  {{'NODATAERROR' | translate}}
</ng-template>
<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>