]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Add telemetry link in dashboard
authorcloudbehl <cloudbehl@gmail.com>
Wed, 9 Aug 2023 18:05:08 +0000 (23:35 +0530)
committercloudbehl <cloudbehl@gmail.com>
Fri, 11 Aug 2023 08:07:59 +0000 (13:37 +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 3aace282c0476c1f1b3e78729096c72983897be1..e5ddb0b1c13448089cc7beec9a1f10e7c3f5aa4c 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 63f9e1e8026ec790c51a934599f6541367f5ccbd..ad11a0e464d45c31b3dc680d259cebd6a9a22ffe 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;
+    });
+  }
 }