Merge pull request #32 from torchiaf/fix-virt-management-page

Define Virtualization Management table headers
This commit is contained in:
Andy Lee 2024-11-12 21:54:55 +08:00 committed by GitHub
commit b4bfcee057
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 43 additions and 37 deletions

View File

@ -1,6 +1,5 @@
import { HCI, MANAGEMENT, CAPI } from '@shell/config/types'; import { HCI, MANAGEMENT, CAPI } from '@shell/config/types';
import { HARVESTER, MULTI_CLUSTER } from '@shell/store/features'; import { HARVESTER, MULTI_CLUSTER } from '@shell/store/features';
import { STATE, NAME as NAME_COL, AGE, VERSION } from '@shell/config/table-headers';
import { allHash } from '@shell/utils/promise'; import { allHash } from '@shell/utils/promise';
import { BLANK_CLUSTER } from '@shell/store/store-types.js'; import { BLANK_CLUSTER } from '@shell/store/store-types.js';
@ -8,16 +7,6 @@ export const PRODUCT_NAME = 'harvester-manager';
export const NAME = 'harvesterManager'; export const NAME = 'harvesterManager';
const MACHINE_POOLS = {
name: 'summary',
labelKey: 'tableHeaders.machines',
sort: false,
search: false,
value: 'nodes.length',
align: 'center',
width: 100,
};
const harvesterClustersLocation = { const harvesterClustersLocation = {
name: 'c-cluster-product-resource', name: 'c-cluster-product-resource',
params: { params: {
@ -31,7 +20,6 @@ export function init($plugin, store) {
const { const {
product, product,
basicType, basicType,
headers,
spoofedType, spoofedType,
configureType configureType
} = $plugin.DSL(store, NAME); } = $plugin.DSL(store, NAME);
@ -49,31 +37,7 @@ export function init($plugin, store) {
}); });
configureType(HCI.CLUSTER, { showListMasthead: false }); configureType(HCI.CLUSTER, { showListMasthead: false });
headers(HCI.CLUSTER, [
STATE,
NAME_COL,
{
name: 'harvesterVersion',
sort: 'harvesterVersion',
labelKey: 'harvesterManager.tableHeaders.harvesterVersion',
value: 'HarvesterVersion',
getValue: (row) => row.harvesterVersion
},
{
...VERSION,
labelKey: 'harvesterManager.tableHeaders.kubernetesVersion',
value: 'kubernetesVersion',
getValue: (row) => row.kubernetesVersion
},
MACHINE_POOLS,
AGE,
{
name: 'harvester',
label: ' ',
align: 'right',
width: 65,
},
]);
basicType([HCI.CLUSTER]); basicType([HCI.CLUSTER]);
spoofedType({ spoofedType({
labelKey: 'harvesterManager.cluster.label', labelKey: 'harvesterManager.cluster.label',

View File

@ -77,3 +77,14 @@ export const VM_SCHEDULE_TYPE = {
sort: 'spec.vmbackup.type', sort: 'spec.vmbackup.type',
align: 'center', align: 'center',
}; };
// The MACHINE_POOLS column in Virtualization Management list page
export const MACHINE_POOLS = {
name: 'summary',
labelKey: 'tableHeaders.machines',
sort: false,
search: false,
value: 'nodes.length',
align: 'center',
width: 100,
};

View File

@ -8,6 +8,8 @@ import { HARVESTER_NAME as VIRTUAL } from '@shell/config/features';
import { CAPI, HCI, MANAGEMENT } from '@shell/config/types'; import { CAPI, HCI, MANAGEMENT } from '@shell/config/types';
import { isHarvesterCluster } from '@shell/utils/cluster'; import { isHarvesterCluster } from '@shell/utils/cluster';
import { allHash } from '@shell/utils/promise'; import { allHash } from '@shell/utils/promise';
import { STATE, NAME as NAME_COL, AGE, VERSION } from '@shell/config/table-headers';
import { MACHINE_POOLS } from '../config/table-headers';
export default { export default {
components: { components: {
@ -56,6 +58,34 @@ export default {
}, },
computed: { computed: {
headers() {
return [
STATE,
NAME_COL,
{
name: 'harvesterVersion',
sort: 'harvesterVersion',
labelKey: 'harvesterManager.tableHeaders.harvesterVersion',
value: 'harvesterVersion',
getValue: (row) => row.harvesterVersion
},
{
...VERSION,
labelKey: 'harvesterManager.tableHeaders.kubernetesVersion',
value: 'kubernetesVersion',
getValue: (row) => row.kubernetesVersion
},
MACHINE_POOLS,
AGE,
{
name: 'harvester',
label: ' ',
align: 'right',
width: 65,
},
];
},
importLocation() { importLocation() {
return { return {
name: 'c-cluster-product-resource-create', name: 'c-cluster-product-resource-create',
@ -144,6 +174,7 @@ export default {
<ResourceTable <ResourceTable
v-if="rows && rows.length" v-if="rows && rows.length"
:schema="schema" :schema="schema"
:headers="headers"
:rows="rows" :rows="rows"
:is-creatable="true" :is-creatable="true"
:namespaced="false" :namespaced="false"