@ -101,12 +101,21 @@ export interface IotHubInstalledItem extends BaseData<{id: string}> {
}
}
export const getInstalledItemUrl = ( descriptor? : IotHubInstalledItemDescriptor ) : string | null = > {
export const getInstalledItemUrl = ( descriptor? : IotHubInstalledItemDescriptor ) : string | null = > {
if ( ! descriptor ) {
return null ;
}
let entityId : string | null = null ;
let entityId : string | null = null ;
let entityType : EntityType | null = null ;
let entityType : EntityType | null = null ;
let query : string | null = null ;
let query : string | null = null ;
switch ( descriptor . type ) {
switch ( descriptor . type ) {
case 'WIDGET' : entityId = descriptor . widgetTypeId ? . id ; entityType = EntityType . WIDGET_TYPE ; break ;
case 'WIDGET' :
case 'DASHBOARD' : entityId = descriptor . dashboardId ? . id ; entityType = EntityType . DASHBOARD ; break ;
entityId = descriptor . widgetTypeId ? . id ;
entityType = EntityType . WIDGET_TYPE ;
break ;
case 'DASHBOARD' :
entityId = descriptor . dashboardId ? . id ;
entityType = EntityType . DASHBOARD ;
break ;
case 'CALCULATED_FIELD' :
case 'CALCULATED_FIELD' :
case 'ALARM_RULE' :
case 'ALARM_RULE' :
entityId = descriptor . entityId ? . id ;
entityId = descriptor . entityId ? . id ;
@ -115,8 +124,14 @@ export const getInstalledItemUrl = (descriptor?: IotHubInstalledItemDescriptor):
query = 'selectedTab=cf' ;
query = 'selectedTab=cf' ;
}
}
break ;
break ;
case 'RULE_CHAIN' : entityId = descriptor . ruleChainId ? . id ; entityType = EntityType . RULE_CHAIN ; break ;
case 'RULE_CHAIN' :
case 'SOLUTION_TEMPLATE' : entityId = descriptor . dashboardId ? . id ; entityType = EntityType . DASHBOARD ; break ;
entityId = descriptor . ruleChainId ? . id ;
entityType = EntityType . RULE_CHAIN ;
break ;
case 'SOLUTION_TEMPLATE' :
entityId = descriptor . dashboardId ? . id ;
entityType = EntityType . DASHBOARD ;
break ;
}
}
if ( entityType && entityId ) {
if ( entityType && entityId ) {
let url = getEntityDetailsPageURL ( entityId , entityType ) ;
let url = getEntityDetailsPageURL ( entityId , entityType ) ;