summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.html
blob: 8ad98b27f47e7bf11b0e394503dfd7ddf7109efc (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
<!-- Embed dashboard -->
<cd-loading-panel *ngIf="loading && grafanaExist"
                  i18n>Loading panel data...</cd-loading-panel>

<cd-alert-panel type="info"
                *ngIf="!grafanaExist"
                i18n>Please consult the <cd-doc section="grafana"></cd-doc> on
  how to configure and enable the monitoring functionality.</cd-alert-panel>

<cd-alert-panel type="info"
                *ngIf="!dashboardExist"
                i18n>Grafana Dashboard doesn't exist. Please refer to
  <cd-doc section="grafana"></cd-doc> on how to add dashboards to Grafana.</cd-alert-panel>

<ng-container *ngIf="grafanaExist && dashboardExist">
  <div class="row">
    <div class="col">
      <div class="form-inline timepicker">
        <label for="timepicker"
               class="ml-1 my-1"
               i18n>Grafana Time Picker</label>

        <select id="timepicker"
                name="timepicker"
                class="custom-select my-1 mx-3"
                [(ngModel)]="time"
                (ngModelChange)="onTimepickerChange($event)">
          <option *ngFor="let key of grafanaTimes"
                  [ngValue]="key.value">{{ key.name }}
          </option>
        </select>

        <button class="btn btn-light my-1"
                i18n-title
                title="Reset Settings"
                (click)="reset()">
          <i [ngClass]="[icons.undo]"></i>
        </button>
        <button class="btn btn-light my-1 ml-3"
                i18n-title
                title="Show hidden information"
                (click)="showMessage = !showMessage">
          <i [ngClass]="[icons.infoCircle, icons.large]"></i>
        </button>
      </div>
    </div>
  </div>

  <div class="row">
    <div class="col my-3"
         *ngIf="showMessage">
      <cd-alert-panel type="info"
                      class="mb-3"
                      *ngIf="showMessage"
                      dismissible="true"
                      (dismissed)="showMessage = false"
                      i18n>If no embedded Grafana Dashboard appeared below, please follow <a [href]="grafanaSrc"
                      target="_blank"
                      noopener
                      noreferrer>this link </a> to check if Grafana is reachable and there are no HTTPS certificate issues. You may need to reload this page after accepting any Browser certificate exceptions</cd-alert-panel>
    </div>
  </div>

  <div class="row">
    <div class="col">
      <div class="grafana-container">
        <iframe #iframe
                id="iframe"
                [src]="grafanaSrc"
                class="grafana"
                [ngClass]="panelStyle"
                frameborder="0"
                scrolling="no">
        </iframe>
      </div>
    </div>
  </div>
</ng-container>