Skip to content

Commit

Permalink
remove duplicated header definition
Browse files Browse the repository at this point in the history
Signed-off-by: andy.lee <andy.lee@suse.com>
  • Loading branch information
a110605 committed Sep 6, 2024
1 parent a02ff71 commit ecf7bc2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion pkg/harvester/config/harvester.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
CONFIGURED_PROVIDERS,
SUB_TYPE,
ADDRESS,
NS_SNAPSHOT_QUOTA
} from '@shell/config/table-headers';

import {
Expand All @@ -32,7 +33,6 @@ import {
FINGERPRINT,
IMAGE_PROGRESS,
SNAPSHOT_TARGET_VOLUME,
NS_SNAPSHOT_QUOTA,
} from './table-headers';

import { IF_HAVE } from '@shell/store/type-map';
Expand Down
16 changes: 0 additions & 16 deletions pkg/harvester/config/table-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,3 @@ export const SNAPSHOT_TARGET_VOLUME = {
sort: 'spec.source.persistentVolumeClaimName',
formatter: 'SnapshotTargetVolume',
};

// The column of total snapshot quota column on namespace list page
export const NS_SNAPSHOT_QUOTA = {
name: 'NamespaceSnapshotQuota',
labelKey: 'harvester.tableHeaders.totalSnapshotQuota',
value: 'snapshotSizeQuota',
sort: 'snapshotSizeQuota',
align: 'center',
formatter: 'Si',
formatterOpts: {
opts: {
increment: 1024, addSuffix: true, suffix: 'i',
},
needParseSi: false
},
};
37 changes: 25 additions & 12 deletions shell/components/ExplorerProjectsNamespaces.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { defaultTableSortGenerationFn } from '@shell/components/ResourceTable.vu
import { NAMESPACE_FILTER_ALL_ORPHANS } from '@shell/utils/namespace-filter';
import ResourceFetch from '@shell/mixins/resource-fetch';
import DOMPurify from 'dompurify';
import { HARVESTER_NAME as HARVESTER } from '@shell/config/features';
export default {
name: 'ListProjectNamespace',
Expand Down Expand Up @@ -84,21 +85,33 @@ export default {
isNamespaceCreatable() {
return (this.schema?.collectionMethods || []).includes('POST');
},
isHarvester() {
return this.$store.getters['currentProduct'].inStore === HARVESTER;
},
headers() {
const project = {
name: 'project',
label: this.t('tableHeaders.project'),
value: 'project.nameDisplay',
sort: ['projectNameSort', 'nameSort'],
};
return [
const headers = [
STATE,
NAME,
this.groupPreference === 'none' ? project : null,
NS_SNAPSHOT_QUOTA,
AGE
].filter(h => h);
];
if (this.groupPreference === 'none') {
const projectHeader = {
name: 'project',
label: this.t('tableHeaders.project'),
value: 'project.nameDisplay',
sort: ['projectNameSort', 'nameSort'],
};
headers.push(projectHeader);
}
if (this.isHarvester) {
headers.push(NS_SNAPSHOT_QUOTA);
}
headers.push(AGE);
return headers;
},
projectIdsWithNamespaces() {
const ids = this.rows
Expand Down

0 comments on commit ecf7bc2

Please sign in to comment.