diff --git a/frontend/packages/gitops-plugin/console-extensions.json b/frontend/packages/gitops-plugin/console-extensions.json index 0cfcd8b674e..b1decd015fa 100644 --- a/frontend/packages/gitops-plugin/console-extensions.json +++ b/frontend/packages/gitops-plugin/console-extensions.json @@ -1,4 +1,31 @@ [ + { + "type": "console.flag/model", + "properties": { + "model": { + "group": "pipelines.openshift.io", + "version": "v1alpha1", + "kind": "GitopsService" + }, + "flag": "OPENSHIFT_GITOPS" + } + }, + { + "type": "console.page/route", + "properties": { + "exact": true, + "path": "/environments", + "component": { "$codeRef": "listPage.default" } + } + }, + { + "type": "console.page/route", + "properties": { + "exact": true, + "path": "/environments/:appName", + "component": { "$codeRef": "detailsPage.default" } + } + }, { "type": "console.navigation/href", "properties": { diff --git a/frontend/packages/gitops-plugin/package.json b/frontend/packages/gitops-plugin/package.json index b1f3180132d..0e6638deed9 100644 --- a/frontend/packages/gitops-plugin/package.json +++ b/frontend/packages/gitops-plugin/package.json @@ -9,6 +9,10 @@ "test": "yarn --cwd ../.. test packages/gitops-plugin" }, "consolePlugin": { - "entry": "src/plugin.tsx" + "entry": "src/plugin.ts", + "exposedModules": { + "listPage": "src/components/GitOpsListPage.tsx", + "detailsPage": "src/components/GitOpsDetailsPage.tsx" + } } } diff --git a/frontend/packages/gitops-plugin/src/plugin.ts b/frontend/packages/gitops-plugin/src/plugin.ts new file mode 100644 index 00000000000..ef8d3ac4f8a --- /dev/null +++ b/frontend/packages/gitops-plugin/src/plugin.ts @@ -0,0 +1,2 @@ +// See console-extensions.json instead +export default []; diff --git a/frontend/packages/gitops-plugin/src/plugin.tsx b/frontend/packages/gitops-plugin/src/plugin.tsx deleted file mode 100644 index ff49b8b7d40..00000000000 --- a/frontend/packages/gitops-plugin/src/plugin.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import * as _ from 'lodash'; -import { ModelDefinition, RoutePage, Plugin, ModelFeatureFlag } from '@console/plugin-sdk'; -import { FLAG_OPENSHIFT_GITOPS } from './const'; -import * as models from './models'; - -type ConsumedExtensions = ModelDefinition | ModelFeatureFlag | RoutePage; - -const plugin: Plugin = [ - { - type: 'ModelDefinition', - properties: { - models: _.values(models), - }, - }, - { - type: 'FeatureFlag/Model', - properties: { - model: models.GitOpsServiceModel, - flag: FLAG_OPENSHIFT_GITOPS, - }, - }, - { - type: 'Page/Route', - properties: { - exact: true, - path: '/environments', - loader: async () => - ( - await import( - './components/GitOpsListPage' /* webpackChunkName: "gitops-plugin-list-page" */ - ) - ).default, - }, - }, - { - type: 'Page/Route', - properties: { - exact: false, - path: '/environments/:appName', - loader: async () => - ( - await import( - './components/GitOpsDetailsPageTabs' /* webpackChunkName: "gitops-plugin-details-page" */ - ) - ).default, - }, - }, -]; - -export default plugin;