fixes / updates

This commit is contained in:
Richard Cox 2024-12-04 11:54:28 +00:00
parent 0054f40948
commit 66f73dab5b
16 changed files with 74 additions and 204 deletions

View File

@ -7547,6 +7547,7 @@ performance:
resources: resources:
generic: most resources in the cluster's 'More Resources' section generic: most resources in the cluster's 'More Resources' section
all: All Resources all: All Resources
populateDefaults: Populate with latest pagination defaults
banner: banner:
label: Fixed Banners label: Fixed Banners
settingName: Banners settingName: Banners

View File

@ -116,6 +116,7 @@ export default defineComponent({
<template <template
v-for="(_, slot) of $slots" v-for="(_, slot) of $slots"
v-slot:[slot]="scope" v-slot:[slot]="scope"
:key="slot"
> >
<slot <slot
:name="slot" :name="slot"

View File

@ -96,8 +96,8 @@ export default {
const hasListComponent = getters['type-map/hasCustomList'](resource); const hasListComponent = getters['type-map/hasCustomList'](resource);
const derpinStore = getters['currentStore'](resource); // TODO: RC fix in parent commit (dupe inStore props) const inStore = getters['currentStore'](resource);
const schema = getters[`${ derpinStore }/schemaFor`](resource); const schema = getters[`${ inStore }/schemaFor`](resource);
const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead; const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead;
@ -105,6 +105,7 @@ export default {
schema, schema,
hasListComponent, hasListComponent,
showMasthead: showMasthead === undefined ? true : showMasthead, showMasthead: showMasthead === undefined ? true : showMasthead,
resource,
extensionType: ExtensionPoint.PANEL, extensionType: ExtensionPoint.PANEL,
extensionLocation: PanelLocation.RESOURCE_LIST, extensionLocation: PanelLocation.RESOURCE_LIST,
loadResources: [resource], // List of resources that will be loaded, this could be many (`Workloads`) loadResources: [resource], // List of resources that will be loaded, this could be many (`Workloads`)
@ -270,13 +271,6 @@ export default {
v-bind="$data" v-bind="$data"
/> />
</div> </div>
<!-- TODO: RC throw exception in findX that are no longer supported.. or will all be supported with tweak? should they use findPage? -->
<!-- this.uiServices = await this.$store.dispatch('cluster/findMatching', {
type: SERVICE,
selector: 'app=longhorn-ui'
}); -->
<!-- // TODO: RC BUG. Switching between lists can show the 'no rows to show' message before populating with existing rows. only happens for below and not custom? -->
<!-- ||{{ hasListComponent }}||{{ canPaginate }}|| TODO: track if canPaginate is first brielfy false. block on it being populated? -->
<ResourceTable <ResourceTable
v-else v-else
:schema="schema" :schema="schema"

View File

@ -23,7 +23,6 @@ import LabeledSelect from '@shell/components/form/LabeledSelect';
import { getParent } from '@shell/utils/dom'; import { getParent } from '@shell/utils/dom';
import { FORMATTERS } from '@shell/components/SortableTable/sortable-config'; import { FORMATTERS } from '@shell/components/SortableTable/sortable-config';
import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue'; import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
import devConsole from 'utils/dev-console';
// Uncomment for table performance debugging // Uncomment for table performance debugging
// import tableDebug from './debug'; // import tableDebug from './debug';
@ -497,7 +496,6 @@ export default {
loading: { loading: {
handler(neu, old) { handler(neu, old) {
devConsole.warn('SS', 'watch', 'loading', neu, old);
// Always ensure the Refresh button phase aligns with loading state (to ensure external phase changes which can then reset the internal phase changed by click) // Always ensure the Refresh button phase aligns with loading state (to ensure external phase changes which can then reset the internal phase changed by click)
this.refreshButtonPhase = neu ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION; this.refreshButtonPhase = neu ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION;

View File

@ -80,10 +80,12 @@ export function init(store) {
[STATE, NAME_COL, NAMESPACE, CHART, CHART_UPGRADE, APP_SUMMARY, AGE], [STATE, NAME_COL, NAMESPACE, CHART, CHART_UPGRADE, APP_SUMMARY, AGE],
[STEVE_STATE_COL, STEVE_NAME_COL, STEVE_NAMESPACE_COL, { [STEVE_STATE_COL, STEVE_NAME_COL, STEVE_NAMESPACE_COL, {
...CHART, ...CHART,
sort: false, // 'spec.chart.metadata.name' // TODO: RC works at moment, won't soon? // TODO: RC REGRESSION
search: false, sort: ['spec.chart.metadata.name'],
search: ['spec.chart.metadata.name'],
}, { }, {
...CHART_UPGRADE, ...CHART_UPGRADE,
// TODO: RC REGRESSION
sort: false, sort: false,
search: false, search: false,
}, },
@ -95,12 +97,12 @@ export function init(store) {
[STATE, NAME_COL, repoType, repoUrl, repoBranch, AGE], [STATE, NAME_COL, repoType, repoUrl, repoBranch, AGE],
[STEVE_STATE_COL, STEVE_NAME_COL, { [STEVE_STATE_COL, STEVE_NAME_COL, {
...repoType, ...repoType,
// spec.gitRepo 'git || spec.url oci | http || ? // TODO: RC // TODO: RC REGRESSION Either 'git' (spec.gitRepo), 'oci' (spec.url && isOciType), 'http' (spec.url)
sort: ['spec.gitRepo'], sort: false,
search: false, search: false,
}, { }, {
...repoUrl, ...repoUrl,
// urlDisplay --> status.url || spec.gitRepo || spec.url // TODO: RC // TODO: RC REGRESSION Either status.url || spec.gitRepo || spec.url
sort: false, sort: false,
search: false, search: false,
}, },

View File

@ -184,7 +184,7 @@ export function init(store) {
configureType(SNAPSHOT, { depaginate: true }); configureType(SNAPSHOT, { depaginate: true });
configureType(NORMAN.ETCD_BACKUP, { depaginate: true }); configureType(NORMAN.ETCD_BACKUP, { depaginate: true });
// configureType(EVENT, { limit: 500 }); // TODO: RC search for where EVENT is requested configureType(EVENT, { limit: 500 });
weightType(EVENT, -1, true); weightType(EVENT, -1, true);
configureType(POD, { configureType(POD, {
@ -225,7 +225,7 @@ export function init(store) {
STEVE_NAME_COL, STEVE_NAME_COL,
{ ...RECLAIM_POLICY }, { ...RECLAIM_POLICY },
{ {
// TODO: RC Regression // TODO: RC TEST once 48103
...PERSISTENT_VOLUME_CLAIM, ...PERSISTENT_VOLUME_CLAIM,
sort: ['metadata.fields.5'], // TODO: RC should be spec.volumeName of PVC --> PV, this is PV --> PVC sort: ['metadata.fields.5'], // TODO: RC should be spec.volumeName of PVC --> PV, this is PV --> PVC
search: ['metadata.fields.5'], search: ['metadata.fields.5'],
@ -338,7 +338,7 @@ export function init(store) {
}, { }, {
...EVENT_TYPE, ...EVENT_TYPE,
value: '_type', value: '_type',
sort: '_type', // TODO: RC API request sort: '_type',
}, },
REASON, REASON,
STEVE_EVENT_OBJECT, STEVE_EVENT_OBJECT,

View File

@ -1,7 +1,6 @@
import { CATTLE_PUBLIC_ENDPOINTS, STORAGE } from '@shell/config/labels-annotations'; import { CATTLE_PUBLIC_ENDPOINTS, STORAGE } from '@shell/config/labels-annotations';
import { NODE as NODE_TYPE } from '@shell/config/types'; import { NODE as NODE_TYPE } from '@shell/config/types';
import { COLUMN_BREAKPOINTS } from '@shell/types/store/type-map'; import { COLUMN_BREAKPOINTS } from '@shell/types/store/type-map';
import devConsole from 'utils/dev-console';
// Note: 'id' is always the last sort, so you don't have to specify it here. // Note: 'id' is always the last sort, so you don't have to specify it here.

View File

@ -11,22 +11,10 @@ export default defineComponent({
components: { PaginatedResourceTable }, components: { PaginatedResourceTable },
props: { props: {
resource: {
type: String,
required: true,
},
schema: { schema: {
type: Object, type: Object,
required: true, required: true,
}, },
rows: {
type: Array,
required: true,
},
loading: {
type: Boolean,
required: false,
},
useQueryParamsForSimpleFiltering: { useQueryParamsForSimpleFiltering: {
type: Boolean, type: Boolean,
default: false default: false
@ -34,24 +22,24 @@ export default defineComponent({
}, },
methods: { methods: {
/**
* Filter out hidden repos from list of all repos
*/
filterRowsLocal(rows: ClusterRepo[]) { filterRowsLocal(rows: ClusterRepo[]) {
// TODO: RC Test // TODO: RC Test - no-vai
return rows.filter((repo) => !(repo?.metadata?.annotations?.[CATALOG_ANNOTATIONS.HIDDEN_REPO] === 'true')); return rows.filter((repo) => !(repo?.metadata?.annotations?.[CATALOG_ANNOTATIONS.HIDDEN_REPO] === 'true'));
}, },
/**
* Filter out hidden repos via api
*/
filterRowsApi(pagination: PaginationArgs): PaginationArgs { filterRowsApi(pagination: PaginationArgs): PaginationArgs {
// TODO: RC Test once API updated
if (!pagination.filters) { if (!pagination.filters) {
pagination.filters = []; pagination.filters = [];
} }
const field = `metadata.annotations."${ CATALOG_ANNOTATIONS.HIDDEN_REPO }"`; const field = `metadata.annotations[${ CATALOG_ANNOTATIONS.HIDDEN_REPO }]`;
const required = PaginationParamFilter.createSingleField({
field,
exact: true,
value: 'true',
equals: true
});
let existing: PaginationParamFilter | null = null; let existing: PaginationParamFilter | null = null;
for (let i = 0; i < pagination.filters.length; i++) { for (let i = 0; i < pagination.filters.length; i++) {
@ -63,6 +51,13 @@ export default defineComponent({
} }
} }
const required = PaginationParamFilter.createSingleField({
field,
exact: true,
value: 'true',
equals: false
});
if (!!existing) { if (!!existing) {
Object.assign(existing, required); Object.assign(existing, required);
} else { } else {

View File

@ -186,8 +186,6 @@ export default defineComponent({
}, },
fetchSecondaryResources(): { [key: string]: Promise<any>} { fetchSecondaryResources(): { [key: string]: Promise<any>} {
devConsole.warn('node', 'methods', 'fetchSecondaryResources');
const hash: { [key: string]: Promise<any>} = {}; const hash: { [key: string]: Promise<any>} = {};
if (this.canViewMgmtNodes) { if (this.canViewMgmtNodes) {
@ -315,7 +313,6 @@ export default defineComponent({
data-testid="cluster-node-list" data-testid="cluster-node-list"
> >
<template #sub-row="{fullColspan, row, onRowMouseEnter, onRowMouseLeave}"> <template #sub-row="{fullColspan, row, onRowMouseEnter, onRowMouseLeave}">
<!-- TODO: RC TEST -->
<tr <tr
class="taints sub-row" class="taints sub-row"
:class="{'empty-taints': ! row.displayTaintsAndLabels}" :class="{'empty-taints': ! row.displayTaintsAndLabels}"

View File

@ -48,7 +48,7 @@ export default defineComponent({
filters: [], filters: [],
// Pending API support https://github.com/rancher/rancher/issues/48103 // Pending API support https://github.com/rancher/rancher/issues/48103
// filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({ // filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({
// field: 'spec.volumeName', // TODO: RC id?? // field: 'spec.volumeName',
// value: r.metadata.name // value: r.metadata.name
// }))), // }))),
}) })

View File

@ -326,12 +326,9 @@ export default {
return; return;
} }
// TODO: RC fix in parent commit (make calls to fetchPageX null safe) await this.fetchPageSecondaryResources({
if (this.fetchPageSecondaryResources) { canPaginate: this.canPaginate, force: false, page: this.rows, pagResult: this.paginationResult
await this.fetchPageSecondaryResources({ });
canPaginate: this.canPaginate, force: false, page: this.rows, pagResult: this.paginationResult
});
}
} }
}, },
}; };

View File

@ -102,7 +102,7 @@ export default {
return rows; return rows;
} }
} else { } else {
return this.localFilter ? this.localFilter(rows) : rows; // TODO: RC test after merge return this.localFilter ? this.localFilter(rows) : rows; // TODO: RC Test - no-vai
} }
return []; return [];

View File

@ -87,8 +87,7 @@ export default {
</script> </script>
<template> <template>
<!-- TODO: RC test paging (create events) --> <!-- TODO: RC TEST - no-vai -->
<!-- TODO: RC test no-vai again -->
<PaginatedResourceTable <PaginatedResourceTable
:schema="schema" :schema="schema"
:headers="eventHeaders" :headers="eventHeaders"
@ -101,7 +100,7 @@ export default {
:groupable="false" :groupable="false"
:rows-per-page="10" :rows-per-page="10"
> >
<template slot="header-right"> <template v-slot:header-right>
<router-link <router-link
:to="allEventsLink" :to="allEventsLink"
class="events-link" class="events-link"

View File

@ -190,8 +190,11 @@ export default {
}); });
}, },
setDefaults() { setPaginationDefaults() {
this.value = { ...DEFAULT_PERF_SETTING }; this.value = {
...this.value,
serverPagination: { ...DEFAULT_PERF_SETTING.serverPagination }
};
} }
}, },
}; };
@ -203,14 +206,6 @@ export default {
<h1 class="mb-20"> <h1 class="mb-20">
{{ t('performance.label') }} {{ t('performance.label') }}
</h1> </h1>
<button
class="btn btn-sm role-primary"
style="width: fit-content;"
@click.prevent="setDefaults()"
>
<!-- TODO: RC tidy -->
Populate with Defaults
</button>
<div> <div>
<div class="ui-perf-setting"> <div class="ui-perf-setting">
<!-- Server Side Pagination --> <!-- Server Side Pagination -->
@ -242,6 +237,13 @@ export default {
v-clean-html="steveCacheApplicableResources" v-clean-html="steveCacheApplicableResources"
:class="{ 'text-muted': !value.serverPagination.enabled }" :class="{ 'text-muted': !value.serverPagination.enabled }"
/> />
<button
class="btn btn-sm role-primary"
style="width: fit-content;"
@click.prevent="setPaginationDefaults()"
>
{{ t('performance.serverPagination.populateDefaults') }}
</button>
</div> </div>
<!-- Inactivity --> <!-- Inactivity -->
<div class="mt-20"> <div class="mt-20">

View File

@ -239,116 +239,6 @@ export default defineComponent({
}, },
methods: { methods: {
fetchSecondaryResources(opts: FetchSecondaryResourcesOpts) {
// TODO: RC TEST with pagination off and on
if ( this.canViewMgmtClusters ) {
this.$store.dispatch('management/findAll', { type: MANAGEMENT.CLUSTER });
}
if ( this.canViewMachine ) {
this.$store.dispatch('management/findAll', { type: CAPI.MACHINE });
}
if ( this.canViewMgmtNodes ) {
this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE });
}
// We need to fetch node pools and node templates in order to correctly show the provider for RKE1 clusters
if ( this.canViewMgmtPools ) {
this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE_POOL });
}
if ( this.canViewMgmtTemplates ) {
this.$store.dispatch('management/findAll', { type: MANAGEMENT.NODE_TEMPLATE });
}
},
async fetchPageSecondaryResources({
canPaginate, force, page, pagResult
}: FetchPageSecondaryResourcesOpts) {
if (!canPaginate || !page?.length) {
this.clusterCount = 0;
return;
}
this.clusterCount = pagResult.count;
if ( this.canViewMgmtClusters ) {
const opt: ActionFindPageArgs = {
force,
pagination: new FilterArgs({
filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({
field: 'id',
value: r.mgmtClusterId
}))),
})
};
this.$store.dispatch(`management/findPage`, { type: MANAGEMENT.CLUSTER, opt });
}
if ( this.canViewMachine ) {
const opt: ActionFindPageArgs = {
force,
// TODO: RC Validate
pagination: new FilterArgs({
filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({
field: 'spec.clusterName',
value: r.metadata.name
}))),
})
};
this.$store.dispatch(`management/findPage`, { type: CAPI.MACHINE, opt });
}
if ( this.canViewMgmtNodes ) {
const opt: ActionFindPageArgs = {
force,
// TODO: RC Validate
pagination: new FilterArgs({
filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({
field: 'id',
value: r.mgmtClusterId
}))),
})
};
this.$store.dispatch(`management/findPage`, { type: MANAGEMENT.NODE, opt });
}
// We need to fetch node pools and node templates in order to correctly show the provider for RKE1 clusters
if ( this.canViewMgmtPools && this.canViewMgmtTemplates) {
const poolOpt: ActionFindPageArgs = {
force,
// TODO: RC Validate
pagination: new FilterArgs({
filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({
field: 'spec.clusterName',
value: r.status?.clusterName// TODO: handle empty spec
}))),
})
};
this.$store.dispatch(`management/findPage`, { type: MANAGEMENT.NODE_POOL, opt: poolOpt });
const templateOpt: ActionFindPageArgs = {
force,
// pagination: new FilterArgs({}),
// TODO: RC Validate
pagination: new FilterArgs({
filters: PaginationParamFilter.createMultipleFields(page.map((r: any) => new PaginationFilterField({
field: 'spec.clusterName',
value: r.status?.clusterName// TODO: handle empty spec
}))),
})
};
this.$store.dispatch(`management/findPage`, { type: MANAGEMENT.NODE_TEMPLATE, opt: templateOpt });
}
},
/** /**
* Of type FetchSecondaryResources * Of type FetchSecondaryResources
*/ */

View File

@ -105,7 +105,6 @@ class NamespaceProjectFilters {
* Helper functions for steve pagination * Helper functions for steve pagination
*/ */
class StevePaginationUtils extends NamespaceProjectFilters { class StevePaginationUtils extends NamespaceProjectFilters {
// TODO: RC how to extensions add to this list?!
/** /**
* Filtering with the vai cache supports specific fields * Filtering with the vai cache supports specific fields
* 1) Those listed here * 1) Those listed here
@ -149,28 +148,21 @@ class StevePaginationUtils extends NamespaceProjectFilters {
[CAPI.MACHINE]: [ [CAPI.MACHINE]: [
{ field: 'spec.clusterName' } // TODO: RC (home page/side bar) TEST { field: 'spec.clusterName' } // TODO: RC (home page/side bar) TEST
], ],
[CAPI.RANCHER_CLUSTER]: [
// { field: `metadata.labels."${ CAPI.PROVIDER }"` } // Pending API support // TODO: RC
// { field: `status.provider` } // Pending API support // TODO: RC
// { field: 'status.allocatable.cpu' } // Pending API support // TODO: RC
// { field: 'status.allocatable.memory' } // Pending API support // TODO: RC
// { field: 'status.allocatable.pods' } // Pending API support // TODO: RC
],
[EVENT]: [ [EVENT]: [
// { field: '_type' }, // Pending API support // TODO: RC { field: '_type' },
// { field: 'reason' }, // Pending API support // TODO: RC { field: 'reason' },
// { field: 'involvedObject.kind' }, // Pending API support // TODO: RC { field: 'involvedObject.kind' },
// { field: 'message' }, // Pending API support // TODO: RC { field: 'message' },
], ],
[CATALOG.CLUSTER_REPO]: [ [CATALOG.CLUSTER_REPO]: [
// { field: 'spec.gitRepo' }, // Pending API support // TODO: RC { field: 'spec.gitRepo' },
// { field: 'spec.gitBranch' }, // Pending API support // TODO: RC { field: 'spec.gitBranch' },
// { field: `metadata.annotations.\"clusterrepo.cattle.io/hidden\"` } // Pending API support // TODO: RC { field: `metadata.annotations[clusterrepo.cattle.io/hidden]` }
], ],
[CATALOG.OPERATION]: [ [CATALOG.OPERATION]: [
// { field: 'status.action' }, // Pending API support // TODO: RC { field: 'status.action' },
// { field: 'status.namespace' }, // Pending API support // TODO: RC { field: 'status.namespace' },
// { field: 'status.releaseName' }, // Pending API support // TODO: RC { field: 'status.releaseName' },
], ],
[CAPI.RANCHER_CLUSTER]: [ [CAPI.RANCHER_CLUSTER]: [
{ field: `metadata.labels."${ CAPI_LABELS.PROVIDER }"` }, // TODO: RC (home page/side bar) TEST { field: `metadata.labels."${ CAPI_LABELS.PROVIDER }"` }, // TODO: RC (home page/side bar) TEST
@ -370,18 +362,21 @@ class StevePaginationUtils extends NamespaceProjectFilters {
state.checked.push(field); state.checked.push(field);
// First check in our hardcoded list of supported filters // First check in our hardcoded list of supported filters
if ([ if (
StevePaginationUtils.VALID_FIELDS[''], // Global process.env.NODE_ENV === 'dev' &&
StevePaginationUtils.VALID_FIELDS[schema.id], // Type specific [
].find((fields) => fields?.find((f) => { StevePaginationUtils.VALID_FIELDS[''], // Global
if (f.startsWith) { StevePaginationUtils.VALID_FIELDS[schema.id], // Type specific
if (field.startsWith(f.field)) { ].find((fields) => fields?.find((f) => {
return true; if (f.startsWith) {
if (field.startsWith(f.field)) {
return true;
}
} else {
return field === f.field;
} }
} else { }))
return field === f.field; ) {
}
}))) {
return; return;
} }