in src/SfxWeb/src/app/Utils/healthUtils.ts [62:164]
public static getViewPathUrl(healthEval: IRawHealthEvaluation, data: DataService, parentUrl: string = ''): IViewPathData {
let viewPathUrl = '';
let name = '';
switch (healthEval.Kind) {
case 'Nodes' : {
viewPathUrl = RoutesService.getNodesViewPath();
name = 'Nodes';
break;
}
case 'Node' : {
const nodeName = (healthEval as IRawNodeHealthEvluation).NodeName;
name = nodeName;
viewPathUrl = RoutesService.getNodeViewPath(nodeName);
break;
}
case 'Applications' : {
viewPathUrl = RoutesService.getAppsViewPath();
name = 'applications';
break;
}
case 'Application' : {
const applicationName = (healthEval as IRawApplicationHealthEvluation).ApplicationName;
const appName = applicationName.replace('fabric:/', ''); // remove fabric:/
name = appName;
const app = data.apps.find(appName);
if (app) {
const appType = app.raw.TypeName;
viewPathUrl += `/apptype/${RoutesService.doubleEncode(appType)}/app/${RoutesService.doubleEncode(appName)}`;
}
break;
}
case 'Service' : {
const exactServiceName = (healthEval as IRawServiceHealthEvaluation).ServiceName.replace('fabric:/', '');
name = exactServiceName;
// Handle system services slightly different by setting their exact path
if ((healthEval as IRawServiceHealthEvaluation).ServiceName.startsWith('fabric:/System')) {
viewPathUrl = `/apptype/System/app/System/service/${RoutesService.doubleEncode(exactServiceName)}`;
}else {
parentUrl += `/service/${RoutesService.doubleEncode(exactServiceName)}`;
viewPathUrl = parentUrl;
}
break;
}
case 'Partition' : {
const partitionId = (healthEval as IRawPartitionHealthEvaluation).PartitionId;
name = partitionId;
parentUrl += `/partition/${RoutesService.doubleEncode(partitionId)}`;
viewPathUrl = parentUrl;
break;
}
case 'Replica' : {
const replicaId = (healthEval as IRawReplicaHealthEvaluation).ReplicaOrInstanceId;
name = replicaId;
parentUrl += `/replica/${RoutesService.doubleEncode(replicaId)}`;
viewPathUrl = parentUrl;
break;
}
case 'Event' : {
if (parentUrl) {
viewPathUrl = parentUrl;
}
name = 'Event';
break;
}
case 'DeployedApplication' : {
const nodeName = (healthEval as IRawDeployedApplicationHealthEvaluation).NodeName;
const applicationName = (healthEval as IRawDeployedApplicationHealthEvaluation).NodeName;
const appName = applicationName.replace('fabric:/', '');
name = appName;
viewPathUrl += `/node/${RoutesService.doubleEncode(nodeName)}/deployedapp/${RoutesService.doubleEncode(appName)}`;
break;
}
case 'DeployedServicePackage' : {
const serviceManifestName = (healthEval as IRawDeployedServicePackageHealthEvaluation).ServiceManifestName;
const activationId = (healthEval as IRawDeployedServicePackageHealthEvaluation).ServicePackageActivationId;
const activationIdUrlInfo = activationId ? 'activationid/' + RoutesService.doubleEncode(activationId) : '';
name = serviceManifestName;
viewPathUrl = parentUrl + `/deployedservice/${activationIdUrlInfo}${serviceManifestName}`;
break;
}
// case: "DeployedServicePackages"
// case: "Services"
// case: "Partitions"
// case: "Replicas"
default: {
name = healthEval.Kind;
viewPathUrl = parentUrl;
break;
}
}
return {viewPathUrl,
displayName: name };
}