<!--
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)
-->
<ng-sidebar-container class="vnf-topology-sidebar-container">
  <!-- A sidebar -->
  <ng-sidebar [(opened)]="sideBarOpened" position="left">
    <div class="sidebar-header">
      <span class="topology_title" *ngIf="showRightSideInfo === 'vnfdInfo'">{{'PAGE.TOPOLOGY.VNFD' | translate}}</span>
      <span class="topology_title" *ngIf="showRightSideInfo === 'vduInfo'">{{'PAGE.TOPOLOGY.VDU' | translate}}</span>
      <span class="topology_title" *ngIf="showRightSideInfo === 'intvlInfo'">{{'PAGE.TOPOLOGY.VIRTUALLINK' |
        translate}}</span>
      <span class="topology_title" *ngIf="showRightSideInfo === 'cpInfo'">{{'PAGE.TOPOLOGY.CONNECTIONPOINT' |
        translate}}</span>
      <span class="topology_title" *ngIf="showRightSideInfo === 'intcpInfo'">{{'PAGE.TOPOLOGY.INTCONNECTIONPOINT' |
        translate}}</span>
      <button (click)="toggleSidebar()" class="close" type="button">
        <i class="fas fa-times-circle text-danger" aria-hidden="true"></i>
      </button>
    </div>
    <div class="sidebar-body">
      <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="showRightSideInfo === 'vnfdInfo'">
        <div class="row">
          <div class="col-12 p-0">
            <form>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'ID' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'ID' | translate }}" name="id"
                    [(ngModel)]="vnfdInfo.id">
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'PRODUCTNAME' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'PRODUCTNAME' | translate }}"
                    name="product-name" [(ngModel)]="vnfdInfo['product-name']">
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'DESCRIPTION' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <textarea rows="5" cols="50" class="form-control" placeholder="{{ 'DESCRIPTION' | translate }}"
                    name="description" [(ngModel)]="vnfdInfo.description"></textarea>
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'VERSION' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'VERSION' | translate }}" name="version"
                    [(ngModel)]="vnfdInfo.version">
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'PROVIDER' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'PROVIDER' | translate }}" name="provider"
                    [(ngModel)]="vnfdInfo.provider">
                </div>
              </div>
              <button type="button" class="btn btn-primary btn-sm pull-right" (click)="saveVNFD()" placement="top"
                ngbTooltip="Save">
                <i class="fas fa-save"></i> {{'SAVE' | translate}}
              </button>
            </form>
          </div>
        </div>
      </div>
      <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="showRightSideInfo === 'vduInfo'">
        <div class="row">
          <div class="col-12 p-0">
            <form>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'ID' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'ID' | translate }}" name="id"
                    [(ngModel)]="vduInfo.id">
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'NAME' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'NAME' | translate }}" name="name"
                    [(ngModel)]="vduInfo.name">
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'DESCRIPTION' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <textarea rows="5" cols="50" class="form-control" placeholder="{{ 'DESCRIPTION' | translate }}"
                    name="description" [(ngModel)]="vduInfo.description"></textarea>
                </div>
              </div>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'IMAGE' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'IMAGE' | translate }}" name="sw-image-desc"
                    [(ngModel)]="vduInfo['sw-image-desc']">
                </div>
              </div>
              <button type="button" class="btn btn-primary btn-sm pull-right" (click)="saveVDU(vduInfo.id)"
                placement="top" ngbTooltip="Save">
                <i class="fas fa-save"></i> {{'SAVE' | translate}}
              </button>
            </form>
          </div>
        </div>
      </div>
      <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="showRightSideInfo === 'cpInfo'">
        <div class="row">
          <div class="col-12 p-0">
            <form>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'ID' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'ID' | translate }}" name="id"
                    [(ngModel)]="cpInfo.id">
                </div>
              </div>
              <button type="button" class="btn btn-primary btn-sm pull-right" (click)="saveCP(cpInfo.id)"
                placement="top" ngbTooltip="Save">
                <i class="fas fa-save"></i> {{'SAVE' | translate}}
              </button>
            </form>
          </div>
        </div>
      </div>
      <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="showRightSideInfo === 'intvlInfo'">
        <div class="row">
          <div class="col-12 p-0">
            <form>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'ID' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" placeholder="{{ 'ID' | translate }}" name="id"
                    [(ngModel)]="intvlInfo.id">
                </div>
              </div>
              <button type="button" class="btn btn-primary btn-sm pull-right" (click)="saveIntVL(intvlInfo.id)"
                placement="top" ngbTooltip="Save">
                <i class="fas fa-save"></i> {{'SAVE' | translate}}
              </button>
            </form>
          </div>
        </div>
      </div>
      <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2" *ngIf="showRightSideInfo === 'intcpInfo'">
        <div class="row">
          <div class="col-12 p-0">
            <form>
              <div class="form-group row">
                <label class="col-sm-4 col-form-label">{{ 'ID' | translate }}</label>
                <div class="col-sm-8 p-0">
                  <input type="text" class="form-control" name="id" [(ngModel)]="intcpInfo.name" disabled>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </ng-sidebar>
  <!-- Page content -->
  <div ng-sidebar-content>
    <button (click)="toggleSidebar()" class="btn btn-default" placement="right" ngbTooltip="{{'OPEN' | translate }}">
      <i class="fa fa-arrow-right detail-sidebar" aria-hidden="true"></i>
    </button>
  </div>
</ng-sidebar-container>
<div class="container-fluid text-dark">
  <div class="row bg-white vnf-composer-form">
    <div class="col-xs-3 col-sm-3 col-md-3 col-lg-3 pl-0 px-0">
      <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 mb-2">
          <fieldset class="p-2">
            <legend class="element-legend">
              {{'PAGE.TOPOLOGY.SELECTELEMENT' | translate}}
            </legend>
            <ul class="list-group list-group-flush dragable">
              <li class="list-group-item" draggable="true" (dragstart)="drag($event)" id="vdu">
                <img src="assets/images/VDU.svg" class="vnf-svg" draggable="false" />
                &nbsp;<span class="span-overflow-text font-weight-bold">{{'PAGE.TOPOLOGY.VDU' | translate}}</span>
                <span class="drag-icon pull-right"><i class="fas fa-arrows-alt"></i></span>
              </li>
              <li class="list-group-item" draggable="true" (dragstart)="drag($event)" id="cp">
                <img src="assets/images/CP-VNF.svg" class="vnf-svg" draggable="false" />
                &nbsp;<span class="span-overflow-text font-weight-bold">{{'PAGE.TOPOLOGY.CP' | translate}}</span>
                <span class="drag-icon pull-right"><i class="fas fa-arrows-alt"></i></span>
              </li>
              <li class="list-group-item" draggable="true" (dragstart)="drag($event)" id="intvl">
                <img src="assets/images/INTVL.svg" class="vnf-svg" draggable="false" />
                &nbsp;<span class="span-overflow-text font-weight-bold">{{'PAGE.TOPOLOGY.INTVL' | translate}}</span>
                <span class="drag-icon pull-right"><i class="fas fa-arrows-alt"></i></span>
              </li>
            </ul>
          </fieldset>
        </div>
      </div>
    </div>
    <div class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
      <div class="row">
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 pl-0">
          <div class="btn-group list" role="group" aria-label="Basic example">
            <button type="button" class="btn btn-primary topology-btn" (click)="onFreeze()"
              [class.pinned]="classApplied" placement="top" container="body"
              ngbTooltip="{{(classApplied ? 'UNFREEZE' : 'FREEZE') | translate}}">
              <i class="fas fa-thumbtack"></i>
            </button>
            <button type="button" class="btn btn-primary topology-btn" (click)="onEdit()" placement="top"
              container="body" ngbTooltip="{{'EDIT' | translate}}">
              <i class="fas fa-edit"></i>
            </button>
            <button type="button" class="btn btn-primary topology-btn" (click)="showInfo()" placement="top"
              container="body" ngbTooltip="{{'PAGE.TOPOLOGY.HELP' | translate}}">
              <i class="fas fa-info"></i>
            </button>
          </div>
        </div>
        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 text-right pr-0 badgegroup">
          <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
            <img src="assets/images/VDU.svg" class="vnf-svg" draggable="false" />
            <br>{{'PAGE.TOPOLOGY.VDU' | translate}}</span>
          <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
            <img src="assets/images/CP-VNF.svg" class="vnf-svg" draggable="false" />
            <br>{{'PAGE.TOPOLOGY.CP' | translate}}</span>
          <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
            <img src="assets/images/INTVL.svg" class="vnf-svg" draggable="false" />
            <br>{{'PAGE.TOPOLOGY.INTVL' | translate}}</span>
          <span class="badge badge-primary badge-pill bg-white text-body font-weight-bold">
            <img src="assets/images/INTCP.svg" class="vnf-svg" draggable="false" />
            <br>{{'PAGE.TOPOLOGY.INTCP' | translate}}</span>
        </div>
      </div>
      <div class="row border-all">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 svg-container">
          <svg preserveAspectRatio="xMidYMin slice" (drop)="drop($event)" (dragover)="allowDrop($event)"
            id="graphContainer" #graphContainer>
          </svg>
        </div>
      </div>
    </div>
  </div>
</div>
<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>