-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,5 @@ | ||||||||||||||||||||||||||||||||
<script> | ||||||||||||||||||||||||||||||||
import { mapGetters } from 'vuex'; | ||||||||||||||||||||||||||||||||
import ResourceTable, { defaultTableSortGenerationFn } from '@shell/components/ResourceTable'; | ||||||||||||||||||||||||||||||||
import { STATE, AGE, NAME, NS_SNAPSHOT_QUOTA } from '@shell/config/table-headers'; | ||||||||||||||||||||||||||||||||
import { uniq } from '@shell/utils/array'; | ||||||||||||||||||||||||||||||||
import { MANAGEMENT, NAMESPACE, VIRTUAL_TYPES, HCI } from '@shell/config/types'; | ||||||||||||||||||||||||||||||||
|
@@ -16,14 +15,15 @@ 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'; | ||||||||||||||||||||||||||||||||
import PaginatedResourceTable from '@shell/components/PaginatedResourceTable.vue'; | ||||||||||||||||||||||||||||||||
export default { | ||||||||||||||||||||||||||||||||
name: 'ListProjectNamespace', | ||||||||||||||||||||||||||||||||
components: { | ||||||||||||||||||||||||||||||||
ExtensionPanel, | ||||||||||||||||||||||||||||||||
Masthead, | ||||||||||||||||||||||||||||||||
MoveModal, | ||||||||||||||||||||||||||||||||
ResourceTable, | ||||||||||||||||||||||||||||||||
PaginatedResourceTable, | ||||||||||||||||||||||||||||||||
ButtonMultiAction, | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
mixins: [ResourceFetch], | ||||||||||||||||||||||||||||||||
|
@@ -46,18 +46,7 @@ export default { | |||||||||||||||||||||||||||||||
this.harvesterResourceQuotaSchema = this.$store.getters[`${ inStore }/schemaFor`](HCI.RESOURCE_QUOTA); | ||||||||||||||||||||||||||||||||
this.schema = this.$store.getters[`${ inStore }/schemaFor`](NAMESPACE); | ||||||||||||||||||||||||||||||||
this.projectSchema = this.$store.getters[`management/schemaFor`](MANAGEMENT.PROJECT); | ||||||||||||||||||||||||||||||||
if ( !this.schema ) { | ||||||||||||||||||||||||||||||||
// clusterReady: When switching routes, it will cause clusterReady to change, causing itself to repeat rendering。 | ||||||||||||||||||||||||||||||||
// this.$store.dispatch('loadingError', `Type ${ NAMESPACE } not found`); | ||||||||||||||||||||||||||||||||
return; | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
await this.$fetchType(NAMESPACE); | ||||||||||||||||||||||||||||||||
This comment has been minimized.
Sorry, something went wrong. |
||||||||||||||||||||||||||||||||
this.projects = await this.$store.dispatch('management/findAll', { type: MANAGEMENT.PROJECT, opt: { force: true } }); | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
data() { | ||||||||||||||||||||||||||||||||
return { | ||||||||||||||||||||||||||||||||
loadResources: [NAMESPACE], | ||||||||||||||||||||||||||||||||
|
@@ -276,6 +265,21 @@ export default { | |||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||
methods: { | ||||||||||||||||||||||||||||||||
filterRowsApi(existing) { | ||||||||||||||||||||||||||||||||
// We should add sorting by the projectId so we can group our namespaces by projects without the namespaces interleaving. | ||||||||||||||||||||||||||||||||
// I can't do that right now because the server side sorting is broken on my instance | ||||||||||||||||||||||||||||||||
return { ...existing, sort: undefined }; | ||||||||||||||||||||||||||||||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
richard-cox
Member
|
configureType(POD, { | |
listGroups: [ | |
...STEVE_LIST_GROUPS, | |
// Allow Pods to be grouped by node | |
{ | |
icon: 'icon-cluster', | |
value: 'role', | |
field: 'spec.nodeName', | |
hideColumn: NODE_COL.name, | |
groupLabelKey: 'groupByNode', | |
tooltipKey: 'resourceTable.groupBy.node' | |
} | |
], | |
listGroupsWillOverride: true, | |
}); |
That somehow needs to work alongside the SSP-disabled world (ExplorerProjectNamespace's ResourceTable provides a custom name for the group by component, namespace model provides a groupByLabel which determines which project group it appears in).
Think this could work with something like the pods in nodes type config, but using the metadata.annotations["field.cattle.io/projectId"] value. However groups would be sorted on the project id rather than project name. Let's discuss before/at PR review time
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
richard-cox
Jan 2, 2025
Member
we might want to only fetch project applicable to the page (there should be a fetchPageSEcondaryResources hook for that).
however... i'm not sure how many projects we're expected to scale up to
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,14 @@ export default defineComponent({ | |
default: null, // Automatic from schema | ||
}, | ||
/** | ||
This comment has been minimized.
Sorry, something went wrong.
codyrancher
Author
Contributor
|
||
* This just forwards the prop to the resource table. It allows you to pass a string's key which will show the referenced string as the group by tooltip | ||
*/ | ||
groupTooltip: { | ||
type: String, | ||
default: null, // Automatic from schema | ||
}, | ||
/** | ||
* Information may be required from resources other than the primary one shown per row | ||
* | ||
|
@@ -98,6 +106,16 @@ export default defineComponent({ | |
return customHeaders || this.$store.getters['type-map/headersFor'](this.schema, this.canPaginate); | ||
} | ||
}, | ||
methods: { | ||
refreshTableData() { | ||
this.$refs.table.refreshTableData(); | ||
}, | ||
clearSelection() { | ||
this.$refs.table.clearSelection(); | ||
} | ||
} | ||
}); | ||
|
@@ -106,12 +124,14 @@ export default defineComponent({ | |
<template> | ||
<div> | ||
<ResourceTable | ||
ref="table" | ||
v-bind="$attrs" | ||
:schema="schema" | ||
:rows="rows" | ||
:alt-loading="canPaginate" | ||
:loading="loading" | ||
:groupable="groupable" | ||
:group-tooltip="groupTooltip" | ||
|
||
:headers="safeHeaders" | ||
:namespaced="namespaced" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,11 +176,11 @@ export default { | |
const opt = { | ||
hasManualRefresh: this.hasManualRefresh, | ||
pagination: { ...this.pagination }, | ||
force: this.paginating !== null // Fix for manual refresh (before ripped out). | ||
force: true | ||
}; | ||
|
||
if (this.apiFilter) { | ||
opt.paginating = this.apiFilter(opt.pagination); | ||
opt.pagination = this.apiFilter(opt.pagination); | ||
This comment has been minimized.
Sorry, something went wrong.
codyrancher
Author
Contributor
|
||
} | ||
|
||
this['paginating'] = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,5 +104,9 @@ export const getPerformanceSetting = (rootGetters: Record<string, (arg0: string, | |
// Start with the default and overwrite the values from the setting - ensures we have defaults for newly added options | ||
const safeDefaults = Object.assign({}, DEFAULT_PERF_SETTING); | ||
|
||
return Object.assign(safeDefaults, perfSetting || {}); | ||
const r = Object.assign(safeDefaults, perfSetting || {}); | ||
|
||
r.serverPagination.stores.cluster.resources.enableSome.enabled.push('namespace'); | ||
This comment has been minimized.
Sorry, something went wrong.
codyrancher
Author
Contributor
|
||
|
||
return r; | ||
}; |
This should fetching should now be handled by the PaginatedResourceTable