]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add telemetry link in dashboard 53142/head
authorcloudbehl <cloudbehl@gmail.com>
Wed, 9 Aug 2023 18:05:08 +0000 (23:35 +0530)
committercloudbehl <cloudbehl@gmail.com>
Thu, 24 Aug 2023 15:04:47 +0000 (20:34 +0530)
Fixes: https://tracker.ceph.com/issues/62380
Signed-off-by: cloudbehl <cloudbehl@gmail.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.ts

index bb1080d21f64348aff82a2f07e3e1d10716252bc..972a861549fc5a2381015bbfeba18e21193bff55 100644 (file)
             <i class="fa fa-external-link"></i>
           </a>
         </dd>
+        <ng-container>
+          <dt>Telemetry Dashboard
+            <span
+              class="badge"
+              [ngClass]="telemetryEnabled ? 'badge-success' : 'badge-secondary'"
+              [ngbTooltip]="getTelemetryText()" >
+              {{ telemetryEnabled ? 'Active' : 'Inactive' }}
+            </span>
+          </dt>
+          <dd>
+            <a target="_blank"
+               [href]="telemetryURL">
+               {{ telemetryURL }}
+              <i class="fa fa-external-link"></i>
+            </a>
+          </dd>
+        </ng-container>
       </dl>
     </cd-card>
 
index 82b70d4b0d702f812681e079f4a5fac63f138d63..01bd621d35ae289c75856bbc416aa06d4b4805f9 100644 (file)
@@ -23,6 +23,7 @@ import { SummaryService } from '~/app/shared/services/summary.service';
 import { PrometheusListHelper } from '~/app/shared/helpers/prometheus-list-helper';
 import { PrometheusAlertService } from '~/app/shared/services/prometheus-alert.service';
 import { OrchestratorService } from '~/app/shared/api/orchestrator.service';
+import { MgrModuleService } from '~/app/shared/api/mgr-module.service';
 
 @Component({
   selector: 'cd-dashboard-v3',
@@ -65,6 +66,8 @@ export class DashboardV3Component extends PrometheusListHelper implements OnInit
     WRITECLIENTTHROUGHPUT: '',
     RECOVERYBYTES: ''
   };
+  telemetryEnabled: boolean;
+  telemetryURL = 'https://telemetry-public.ceph.com/';
   timerGetPrometheusDataSub: Subscription;
   timerTime = 30000;
   readonly lastHourDateObject = {
@@ -82,6 +85,7 @@ export class DashboardV3Component extends PrometheusListHelper implements OnInit
     private featureToggles: FeatureTogglesService,
     private healthService: HealthService,
     public prometheusService: PrometheusService,
+    private mgrModuleService: MgrModuleService,
     private refreshIntervalService: RefreshIntervalService,
     public prometheusAlertService: PrometheusAlertService
   ) {
@@ -98,8 +102,16 @@ export class DashboardV3Component extends PrometheusListHelper implements OnInit
     });
     this.getPrometheusData(this.lastHourDateObject);
     this.getDetailsCardData();
+    this.getTelemetryReport();
   }
 
+  getTelemetryText(): string {
+    return this.telemetryEnabled
+      ? 'Cluster telemetry is active'
+      : 'Cluster telemetry is inactive. To Activate the Telemetry, \
+       click settings icon on top navigation bar and select \
+       Telemetry configration.';
+  }
   ngOnDestroy() {
     this.interval.unsubscribe();
     if (this.timerGetPrometheusDataSub) {
@@ -173,4 +185,10 @@ export class DashboardV3Component extends PrometheusListHelper implements OnInit
       this.queriesResults
     );
   }
+
+  private getTelemetryReport() {
+    this.mgrModuleService.getConfig('telemetry').subscribe((resp: any) => {
+      this.telemetryEnabled = resp?.enabled;
+    });
+  }
 }