summaryrefslogtreecommitdiffstats
path: root/public/src/app/home/home.component.html
blob: 3c23385194ada8295090ed588c20280dfb8a1a07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<div class="home-container">
  <div style="display: flex;
    padding-bottom:7px;
    justify-content: space-between;">
    <div style="font-size: 22px; display: flex; align-items: center;">Monitoring</div>

    <div style="display: flex;">
      <button mat-icon-button [disabled]="!checkCanCreate()" style="margin-right: 10px;" data-tests-id="btn-import-mc"
        (click)="importScreen()">
        <span style="width: 100%;
                  height: 100%;
                  display: flex;
                  justify-content: center;
                  align-items: center;"
          [innerHTML]="'download' | feather:20"></span>
      </button>

      <button mat-raised-button color="primary" (click)="createScreen()" data-tests-id="btn-create-mc" class="btn-create"
        [disabled]="!checkCanCreate()">
        Create New MC
      </button>
    </div>
  </div>

  <div *ngIf="showTable===true; then thenBlock else elseBlock"></div>

  <ng-template #thenBlock>

    <div *ngIf="unavailableMonitoringComponents.length > 0" data-tests-id="unavailableArea" style="color: white; background: red; padding: 1rem; border-radius: 5px; font-weight: bold; margin: 1em 0;">
      <div *ngFor="let item of unavailableMonitoringComponents">
        {{item.uuid}}
      </div>
    </div>

    <ngx-datatable data-tests-id="monitoringComponentTable" class="material" [rows]="store.monitoringComponents"
      [loadingIndicator]="loadingIndicator" [columnMode]="'flex'" [headerHeight]="40" [footerHeight]="40" [limit]="12"
      [rowHeight]="45" (selected)="onTableSelectItem($event)" [selectionType]="'single'" [selected]="selectedLine"
      (activate)="onTableActivate($event)">

      <ngx-datatable-column name="Monitoring Configuration" prop="name" [flexGrow]="3">
        <ng-template let-row="row" let-value="value" ngx-datatable-cell-template>
          <div>
            <span> {{value}} </span>
          </div>
        </ng-template>

      </ngx-datatable-column>
      <ngx-datatable-column name="VNFI Name" prop="vfiName" [flexGrow]="3">
        <ng-template let-value="value" ngx-datatable-cell-template>

          <div pTooltip="{{value}}" tooltipPosition="bottom">{{value}}</div>

        </ng-template>


      </ngx-datatable-column>
      <ngx-datatable-column name="Version" prop="version" [flexGrow]="1"></ngx-datatable-column>
      <ngx-datatable-column name="Status" prop="status" [flexGrow]="2"></ngx-datatable-column>
      <ngx-datatable-column name="Last Updated by" prop="lastUpdaterUserId" [flexGrow]="2"></ngx-datatable-column>
      <ngx-datatable-column name="Actions" sortable="false" prop="id" [flexGrow]="2">
        <ng-template let-row="row" let-rowIndex="rowIndex"  ngx-datatable-cell-template>

          <div *ngIf="hoveredIndex == rowIndex" style="margin-top:-5px; display: flex; justify-content: flex-start; align-items: center;">

            <button mat-icon-button *ngIf="row.submittedUuid" pTooltip="View submitted" tooltipPosition="top" (click)="viewSubmitted(row)" data-tests-id="viewSubmitted">
              <img src="{{imgBase}}/icon_submitted.svg" style="object-fit: contain; width:18px; height: 18px;" alt="icon_submitted">
            </button>

            <button *ngIf="checkCanCreate();" mat-icon-button data-tests-id="editMC" (click)="checkTableItemHoverCondition(row) && editTableItem(row)"
              [ngClass]="{'ngx-datatable-monitoring-name': checkTableItemHoverCondition(row)}" pTooltip="Edit"
              tooltipPosition="top">
              <span style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; color:#5A5A5A;"
                [innerHTML]="'edit-3' | feather:18"></span>
            </button>

            <div *ngIf="checkCanCreate();">
            <button mat-icon-button *ngIf="row.submittedUuid != null && checkReverted(row)" pTooltip="Revert" data-tests-id="revertMC"
              tooltipPosition="top" (click)="checkTableItemHoverCondition(row) && revertMcDialog(row)">
              <img src="{{imgBase}}/icon_revert.svg" style="object-fit: contain; width:18px; height: 18px;" alt="icon_revert">
            </button>
          </div>

            <button *ngIf="checkCanCreate();" mat-icon-button data-tests-id="tableItemsButtonDelete"
              pTooltip="Delete" tooltipPosition="top" (click)="deleteTableItem(row, rowIndex)">
              <span style="width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; color:#5A5A5A;"
                [innerHTML]="'trash-2' | feather:18"></span>
            </button>

          </div>

        </ng-template>
      </ngx-datatable-column>

    </ngx-datatable>


  </ng-template>

  <ng-template #elseBlock>
    <div style="display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex:1;">
      <div style="font-size: 18px;">
        Monitoring Configuration does not Exist
      </div>
      <div style="padding: 0.5em; padding-top: 1em; font-size: 13px;" data-tests-id="new-monitoring-title">
        A Monitoring Configuration (MC) was not yet created
      </div>
      <div style="font-size: 13px;">
        Please create a new MC to monitor the service
      </div>
      <div class="wrapper-btn-add-mc">
        <button mat-mini-fab color="primary" (click)="createScreen()" data-tests-id="btn-fab-create-mc" [disabled]="!checkCanCreate()">
          <span [innerHTML]="'plus' | feather:24"></span>
        </button>
        <span style="margin-top: 10px; font-size: 14px; " [style.color]="!checkCanCreate() ? '#ebebe4' : '#009FDB'">
          <p data-tests-id="btn-span-create-mc">Add First MC</p>
        </span>
      </div>
    </div>
  </ng-template>
</div>