<!--
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="btn-group list action" role="group">
    <button routerLink="/instances/operational-view/{{instanceID}}" type="button" class="btn btn-primary" placement="top" container="body" [disabled]="isShowOperationalDashboard" ngbTooltip="{{'PAGE.OPERATIONALDASHBOARD.TITLE' | translate}}">
        <i class="fas fa-tachometer-alt"></i>
    </button>
    <button type="button" class="btn btn-primary" (click)="metrics()" placement="top" container="body" [disabled]="operationalStatus == 'failed' || configStatus == 'failed'" ngbTooltip="{{'METRICS' | translate}}">
        <i class="fas fa-chart-bar icons"></i>
    </button>
    <button type="button" class="btn btn-primary" [disabled]="operationalStatus != 'running'" (click)="nsTopology()" placement="top" container="body" ngbTooltip="{{'TOPOLOGY' | translate}}">
        <i class="fa fa-sitemap fa-fw icons"></i>
    </button>
    <button type="button" class="btn btn-primary" (click)="deleteNSInstance(false)" placement="top" container="body" ngbTooltip="{{'DELETE' | translate}}">
        <i class="far fa-trash-alt icons"></i>
    </button>
    <div class="btn-group" placement="bottom-right" ngbDropdown display="dynamic" container="body">
        <button type="button" class="btn btn-primary" ngbDropdownToggle placement="top" container="body" [disabled]="operationalStatus === 'failed' || configStatus === 'failed'" ngbTooltip="{{'VIMACTION' | translate}}">
            <i class="fas fa-desktop"></i>
        </button>
        <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
            <button type="button" class="btn btn-primary dropdown-item" (click)="openStart('start')" placement="left"
                data-container="body" ngbTooltip="{{'START' | translate}}">
                <i class="fas fa-toggle-on"></i> {{'START' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="openStart('stop')" placement="left"
                data-container="body" ngbTooltip="{{'STOP' | translate}}">
                <i class="fas fa-toggle-off"></i> {{'STOP' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="openStart('rebuild')" placement="left"
                data-container="body" ngbTooltip="{{'REBUILD' | translate}}">
                <i class="fas fa-arrows-alt"></i> {{'REBUILD' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="openVerticalScaling()" placement="left"
                data-container="body" ngbTooltip="{{'VERTICALSCALING' | translate}}">
                <i class="fas fa-grip-vertical"></i> {{'VERTICALSCALING' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="openVmMigration()" placement="left" data-container="body"
                [disabled]="operationalStatus === 'failed' || configStatus === 'failed'" ngbTooltip="{{'VMMIGRATION' | translate}}">
                <i class="fas fa-angle-double-left"></i> {{'VMMIGRATION' | translate}}
            </button>
        </div>
    </div>
    <div class="btn-group" placement="bottom-right" ngbDropdown display="dynamic" container="body">
        <button type="button" class="btn btn-primary dropdown-toggle action-button" ngbDropdownToggle>
            {{'ACTION' | translate}}
        </button>
        <div class="dropdown-menu list-action-dropdown" ngbDropdownMenu>
            <button type="button" class="btn btn-primary dropdown-item" (click)="infoNs()" placement="left" container="body" ngbTooltip="{{'INFO' | translate}}">
                <i class="fas fa-info icons list" title="info"></i> {{'INFO' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="execNSPrimitiveModal()" placement="left" container="body" ngbTooltip="{{'EXECPRIMITIVE' | translate}}" [disabled]="operationalStatus == 'failed' || configStatus == 'failed'">
                <i class="fas fa-magic"></i> {{'EXECPRIMITIVE' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" [disabled]="operationalStatus === 'scaling' || operationalStatus === 'failed' || configStatus === 'failed'" (click)="manualScaling()"
                placement="left" data-container="body" ngbTooltip="{{'SCALING' | translate}}">
                <i class="fas fa-cubes"></i> {{'SCALING' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="openNsUpdate()" placement="left" data-container="body"
                [disabled]="operationalStatus === 'failed' || configStatus === 'failed'" ngbTooltip="{{'NSUPDATE' | translate}}">
                <i class="fas fa-arrow-alt-circle-up"></i> {{'NSUPDATE' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item" (click)="historyOfOperations()" placement="left" container="body" ngbTooltip="{{'HISTORYOFOPERATIONS' | translate}}">
                <i class="fas fa-history"></i> {{'HISTORYOFOPERATIONS' | translate}}
            </button>
            <button type="button" class="btn btn-primary dropdown-item text-danger" (click)="deleteNSInstance(true)" placement="left" container="body" ngbTooltip="{{'FORCEDELETE' | translate}}">
                <i class="fas fa-trash-alt icons text-danger"></i> {{'FORCEDELETE' | translate}}
            </button>
        </div>
    </div>
</div>
<app-loader [waitingMessage]="message" *ngIf="isLoadingNSInstanceAction"></app-loader>