diff --git a/frontend/packages/console-demo-plugin/src/models.ts b/frontend/packages/console-demo-plugin/src/models.ts index 7aff834a701..1b2bf7d94a5 100644 --- a/frontend/packages/console-demo-plugin/src/models.ts +++ b/frontend/packages/console-demo-plugin/src/models.ts @@ -13,3 +13,20 @@ export const FooBarModel: K8sKind = { id: 'foobar', crd: true, }; + +export const MyTemplatesModel: K8sKind = { + label: 'My Specialized Template', + labelPlural: 'My Specialized Templates', + apiVersion: 'v1', + path: 'templates', + apiGroup: 'template.openshift.io', + plural: 'mytemplates', + namespaced: true, + abbr: 'MT', + kind: 'Template', + id: 'mytemplate', + specialized: true, + selector: { + matchLabels: { my: 'yes' }, + }, +}; diff --git a/frontend/public/components/utils/resource-link.jsx b/frontend/public/components/utils/resource-link.jsx index 61604a35081..fe0bfad4642 100644 --- a/frontend/public/components/utils/resource-link.jsx +++ b/frontend/public/components/utils/resource-link.jsx @@ -12,7 +12,7 @@ import { FLAGS } from '../../const'; const unknownKinds = new Set(); export const resourcePathFromModel = (model, name, namespace) => { - const {path, namespaced, crd} = model; + const {plural, namespaced, crd} = model; let url = '/k8s/'; @@ -26,8 +26,8 @@ export const resourcePathFromModel = (model, name, namespace) => { if (crd) { url += referenceForModel(model); - } else if (path) { - url += path; + } else if (plural) { + url += plural; } if (name) { diff --git a/frontend/public/module/k8s/index.ts b/frontend/public/module/k8s/index.ts index 6a3f23be59e..bda266006aa 100644 --- a/frontend/public/module/k8s/index.ts +++ b/frontend/public/module/k8s/index.ts @@ -564,6 +564,7 @@ export type K8sKind = { id?: string; crd?: boolean; + specialized?: boolean; apiVersion: string; apiGroup?: string; namespaced?: boolean; diff --git a/frontend/public/module/k8s/k8s-models.ts b/frontend/public/module/k8s/k8s-models.ts index 3bc3e3ea817..b417aabe371 100644 --- a/frontend/public/module/k8s/k8s-models.ts +++ b/frontend/public/module/k8s/k8s-models.ts @@ -33,7 +33,7 @@ k8sModels = k8sModels.withMutations(map => { const baseModelCount = map.size; const pluginModels = _.flatMap(plugins.registry.getModelDefinitions().map(md => md.properties.models)); - const pluginModelsToAdd = pluginModels.filter(model => !hasModel(model)); + const pluginModelsToAdd = pluginModels.filter(model => (model.specialized || !hasModel(model))); map.merge(modelsToMap(pluginModelsToAdd)); _.difference(pluginModels, pluginModelsToAdd).forEach(model => {