import * as _ from 'lodash';
import { Subscription } from 'rxjs';
import { MultiClusterService } from '~/app/shared/api/multi-cluster.service';
+import { SettingsService } from '~/app/shared/api/settings.service';
import { Icons } from '~/app/shared/enum/icons.enum';
import { MultiCluster } from '~/app/shared/models/multi-cluster';
private telemetryNotificationService: TelemetryNotificationService,
public prometheusAlertService: PrometheusAlertService,
private motdNotificationService: MotdNotificationService,
- private cookieService: CookiesService
+ private cookieService: CookiesService,
+ private settingsService: SettingsService
) {
this.permissions = this.authStorageService.getPermissions();
this.enabledFeature$ = this.featureToggles.get();
() => {
this.multiClusterService.refresh();
this.summaryService.refresh();
+
+ // force refresh grafana api url to get the correct url for the selected cluster
+ this.settingsService.ifSettingConfigured(
+ 'api/grafana/url',
+ () => {},
+ () => {},
+ true
+ );
const currentRoute = this.router.url.split('?')[0];
if (currentRoute.includes('dashboard')) {
this.router.navigateByUrl('/pool', { skipLocationChange: true }).then(() => {
);
}
- ifSettingConfigured(url: string, fn: (value?: string) => void, elseFn?: () => void): void {
+ ifSettingConfigured(
+ url: string,
+ fn: (value?: string) => void,
+ elseFn?: () => void,
+ forceRefresh = false
+ ): void {
const setting = this.settings[url];
- if (setting === undefined) {
+ if (forceRefresh || setting === undefined) {
this.http.get(url).subscribe(
(data: any) => {
this.settings[url] = this.getSettingsValue(data);