From 4f731296522b680bfb2838b5d833448e46d55581 Mon Sep 17 00:00:00 2001 From: Alexandre Alves Date: Tue, 26 May 2026 18:13:58 +0100 Subject: [PATCH] convert Apps and Marketplace prod reg --- shell/config/product/apps.js | 150 ---------------------------------- shell/config/product/apps.ts | 106 ++++++++++++++++++++++++ shell/config/table-headers.js | 45 ++++++++++ shell/core/types.ts | 2 +- 4 files changed, 152 insertions(+), 151 deletions(-) delete mode 100644 shell/config/product/apps.js create mode 100644 shell/config/product/apps.ts diff --git a/shell/config/product/apps.js b/shell/config/product/apps.js deleted file mode 100644 index f75758ede30..00000000000 --- a/shell/config/product/apps.js +++ /dev/null @@ -1,150 +0,0 @@ -import { - AGE, - STATE, - CHART, - CHART_UPGRADE, - NAMESPACE, - NAME as NAME_COL, - APP_SUMMARY, -} from '@shell/config/table-headers'; - -import { CATALOG } from '@shell/config/types'; -import { DSL } from '@shell/store/type-map'; -import { STEVE_AGE_COL, STEVE_NAMESPACE_COL, STEVE_NAME_COL, STEVE_STATE_COL } from '@shell/config/pagination-table-headers'; - -export const NAME = 'apps'; - -export function init(store) { - const { - product, - basicType, - headers, - virtualType, - weightType, - configureType, - } = DSL(store, NAME); - - product({ - removable: false, - weight: 97, - ifHaveGroup: 'catalog.cattle.io', - icon: 'marketplace', - showNamespaceFilter: true, - extendable: true, - }); - - virtualType({ - labelKey: 'catalog.charts.header', - icon: 'compass', - namespaced: false, - name: 'charts', - weight: 100, - route: { name: 'c-cluster-apps-charts' }, - }); - - weightType(CATALOG.APP, 99, true); - - basicType([ - 'charts', - CATALOG.APP, - CATALOG.OPERATION, - CATALOG.CLUSTER_REPO, - CATALOG.REPO, - ]); - - configureType(CATALOG.APP, { isCreatable: false, isEditable: false }); - configureType(CATALOG.OPERATION, { isCreatable: false, isEditable: false }); - configureType(CATALOG.CLUSTER_REPO, { listCreateButtonLabelKey: 'catalog.repo.add' }); - - const repoType = { - name: 'type', - labelKey: 'tableHeaders.type', - sort: 'typeDisplay', - value: 'typeDisplay' - }; - - const repoUrl = { - name: 'url', - labelKey: 'tableHeaders.url', - sort: 'urlDisplay', - value: 'urlDisplay' - }; - - const repoBranch = { - name: 'branch', - labelKey: 'tableHeaders.branch', - sort: 'spec.gitBranch', - value: 'spec.gitBranch', - dashIfEmpty: true, - }; - - headers(CATALOG.APP, - [STATE, NAME_COL, NAMESPACE, CHART, CHART_UPGRADE, APP_SUMMARY, AGE], - [STEVE_STATE_COL, STEVE_NAME_COL, STEVE_NAMESPACE_COL, { - ...CHART, - sort: ['spec.chart.metadata.name'], - search: ['spec.chart.metadata.name'], - }, { - ...CHART_UPGRADE, - sort: false, - search: false, - }, - APP_SUMMARY, - STEVE_AGE_COL] - ); - headers(CATALOG.REPO, [STATE, NAME_COL, NAMESPACE, repoType, repoUrl, repoBranch, AGE]); - headers(CATALOG.CLUSTER_REPO, - [STATE, NAME_COL, repoType, repoUrl, repoBranch, AGE], - [STEVE_STATE_COL, STEVE_NAME_COL, { - ...repoType, - sort: false, - search: false, - }, { - ...repoUrl, - sort: false, - search: false, - }, - repoBranch] - ); - - const opAction = { - name: 'action', - label: 'Action', - sort: 'status.action', - value: 'status.action', - labelKey: 'catalog.operation.tableHeaders.action', - }; - const opReleaseNs = { - name: 'releaseNamespace', - label: 'Tgt Namespace', - sort: 'status.namespace', - value: 'status.namespace', - labelKey: 'catalog.operation.tableHeaders.releaseNamespace', - }; - const opReleaseName = { - name: 'releaseName', - label: 'Tgt Release', - sort: 'status.releaseName', - value: 'status.releaseName', - labelKey: 'catalog.operation.tableHeaders.releaseName', - }; - - headers(CATALOG.OPERATION, [ - STATE, - NAME_COL, - NAMESPACE, - opAction, - opReleaseNs, - opReleaseName, - AGE - ], - [ - STEVE_STATE_COL, - STEVE_NAME_COL, - STEVE_NAMESPACE_COL, - opAction, - opReleaseNs, - opReleaseName, - STEVE_AGE_COL - ]); -} diff --git a/shell/config/product/apps.ts b/shell/config/product/apps.ts new file mode 100644 index 00000000000..6c3ebbb29e0 --- /dev/null +++ b/shell/config/product/apps.ts @@ -0,0 +1,106 @@ +import { IExtension } from '@shell/core/types'; +import { + ProductChildCustomPage, + ProductChildResourcePage, + ProductChildGroup +} from '@shell/core/plugin-types'; + +import { + AGE, + STATE, + CHART, + CHART_UPGRADE, + NAMESPACE, + NAME as NAME_COL, + APP_SUMMARY, + APPS_REPO_TYPE, + APPS_REPO_URL, + APPS_REPO_BRANCH, + APPS_OP_ACTION, + APPS_OP_RELEASE_NS, + APPS_OP_RELEASE_NAME +} from '@shell/config/table-headers'; + +import { CATALOG } from '@shell/config/types'; +import { STEVE_AGE_COL, STEVE_NAMESPACE_COL, STEVE_NAME_COL, STEVE_STATE_COL } from '@shell/config/pagination-table-headers'; + +export const NAME = 'apps'; + +export function $init(prodReg: IExtension) { + const appsChartsPage: ProductChildCustomPage = { + labelKey: 'catalog.charts.header', + name: 'charts', + component: () => import('@shell/pages/c/_cluster/apps/charts/index.vue'), + config: { namespaced: false }, + }; + + const appsInstalledAppsPage: ProductChildResourcePage = { + type: CATALOG.APP, + config: { isCreatable: false, isEditable: false }, + headers: [STATE, NAME_COL, NAMESPACE, CHART, CHART_UPGRADE, APP_SUMMARY, AGE], + sspHeaders: [STEVE_STATE_COL, STEVE_NAME_COL, STEVE_NAMESPACE_COL, { + ...CHART, + sort: ['spec.chart.metadata.name'], + search: ['spec.chart.metadata.name'], + }, { + ...CHART_UPGRADE, + sort: false, + search: false, + }, + APP_SUMMARY, + STEVE_AGE_COL] + }; + + const appsReposPage: ProductChildResourcePage = { + type: CATALOG.CLUSTER_REPO, + config: { listCreateButtonLabelKey: 'catalog.repo.add' }, + headers: [STATE, NAME_COL, APPS_REPO_TYPE, APPS_REPO_URL, APPS_REPO_BRANCH, AGE], + sspHeaders: [STEVE_STATE_COL, STEVE_NAME_COL, { + ...APPS_REPO_TYPE, + sort: false, + search: false, + }, { + ...APPS_REPO_URL, + sort: false, + search: false, + }, + APPS_REPO_BRANCH] + }; + + const appsOperationsPage: ProductChildResourcePage = { + type: CATALOG.OPERATION, + config: { isCreatable: false, isEditable: false }, + headers: [ + STATE, + NAME_COL, + NAMESPACE, + APPS_OP_ACTION, + APPS_OP_RELEASE_NS, + APPS_OP_RELEASE_NAME, + AGE + ], + sspHeaders: [ + STEVE_STATE_COL, + STEVE_NAME_COL, + STEVE_NAMESPACE_COL, + APPS_OP_ACTION, + APPS_OP_RELEASE_NS, + APPS_OP_RELEASE_NAME, + STEVE_AGE_COL + ] + }; + + const resourcesGroup: ProductChildGroup = { + name: 'apps', + labelKey: 'product.apps', + weight: 97, + children: [ + appsChartsPage, + appsInstalledAppsPage, + appsReposPage, + appsOperationsPage + ], + }; + + prodReg.extendProduct('explorer', [resourcesGroup]); +} diff --git a/shell/config/table-headers.js b/shell/config/table-headers.js index 600aa00ef97..c65b97c18c2 100644 --- a/shell/config/table-headers.js +++ b/shell/config/table-headers.js @@ -1207,3 +1207,48 @@ export const MGMT_CLUSTER_KUBE_VERSION = { search: 'statusInfo.kubernetesVersion', formatter: 'ClusterKubeVersion', }; + +// Apps & Marketplace +export const APPS_REPO_TYPE = { + name: 'type', + labelKey: 'tableHeaders.type', + sort: 'typeDisplay', + value: 'typeDisplay' +}; + +export const APPS_REPO_URL = { + name: 'url', + labelKey: 'tableHeaders.url', + sort: 'urlDisplay', + value: 'urlDisplay' +}; + +export const APPS_REPO_BRANCH = { + name: 'branch', + labelKey: 'tableHeaders.branch', + sort: 'spec.gitBranch', + value: 'spec.gitBranch', + dashIfEmpty: true, +}; + +export const APPS_OP_ACTION = { + name: 'action', + label: 'Action', + sort: 'status.action', + value: 'status.action', + labelKey: 'catalog.operation.tableHeaders.action', +}; +export const APPS_OP_RELEASE_NS = { + name: 'releaseNamespace', + label: 'Tgt Namespace', + sort: 'status.namespace', + value: 'status.namespace', + labelKey: 'catalog.operation.tableHeaders.releaseNamespace', +}; +export const APPS_OP_RELEASE_NAME = { + name: 'releaseName', + label: 'Tgt Release', + sort: 'status.releaseName', + value: 'status.releaseName', + labelKey: 'catalog.operation.tableHeaders.releaseName', +}; diff --git a/shell/core/types.ts b/shell/core/types.ts index d7b81ff5e09..dcd1aad4c76 100644 --- a/shell/core/types.ts +++ b/shell/core/types.ts @@ -361,7 +361,7 @@ export interface HeaderOptions { * A string which represents the path to access the value from the row object which we'll use to search i.e. `row.meta.value`. * It can be false to disable searching on this field */ - search?: string | boolean; + search?: string | boolean | string[]; /** * Number of pixels the column should be in the table