import { URLBuilderService } from '~/app/shared/services/url-builder.service';
import { PlacementPipe } from './placement.pipe';
import { ServiceFormComponent } from './service-form/service-form.component';
+import { SettingsService } from '~/app/shared/api/settings.service';
const BASE_URL = 'services';
table: TableComponent;
@ViewChild('runningTpl', { static: true })
public runningTpl: TemplateRef<any>;
+ @ViewChild('urlTpl', { static: true })
+ public urlTpl: TemplateRef<any>;
@Input() hostname: string;
isLoadingServices = false;
selection: CdTableSelection = new CdTableSelection();
icons = Icons;
+ serviceUrls = { grafana: '', prometheus: '', alertmanager: '' };
+ isMgmtGateway: boolean = false;
constructor(
private actionLabels: ActionLabelsI18n,
private cephServiceService: CephServiceService,
private relativeDatePipe: RelativeDatePipe,
private taskWrapperService: TaskWrapperService,
- private router: Router
+ private router: Router,
+ private settingsService: SettingsService
) {
super();
this.permissions = this.authStorageService.getPermissions();
{
name: $localize`Service`,
prop: 'service_name',
- flexGrow: 1
+ flexGrow: 1,
+ cellTemplate: this.urlTpl
},
{
name: $localize`Placement`,
this.orchStatus = status;
this.showDocPanel = !status.available;
});
+
+ if (!this.isMgmtGateway) {
+ this.configureServiceUrl('api/grafana/url', 'grafana');
+ this.configureServiceUrl('ui-api/prometheus/prometheus-api-host', 'prometheus');
+ this.configureServiceUrl('ui-api/prometheus/alertmanager-api-host', 'alertmanager');
+ }
}
ngOnChanges() {
this.services = services;
this.count = pagination_obs.count;
this.services = this.services.filter((col: any) => {
+ if (col.service_type === 'mgmt-gateway' && col.status.running) {
+ this.isMgmtGateway = true;
+ }
return !this.hiddenServices.includes(col.service_name);
});
this.isLoadingServices = false;
context.error();
}
);
+ if (
+ this.isMgmtGateway &&
+ !this.services.find(
+ (service: CephServiceSpec) =>
+ service.service_type !== 'mgmt-gateway' && service.status.running > 0
+ )
+ ) {
+ this.isMgmtGateway = false;
+ }
}
updateSelection(selection: CdTableSelection) {
)
});
}
+
+ private configureServiceUrl(url: string, serviceType: string) {
+ this.settingsService.ifSettingConfigured(url, (url) => {
+ this.serviceUrls[serviceType] = url;
+ });
+ }
}