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:
generic: most resources in the cluster's 'More Resources' section
all: All Resources
populateDefaults: Populate with latest pagination defaults
banner:
label: Fixed Banners
settingName: Banners

View File

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

View File

@ -96,8 +96,8 @@ export default {
const hasListComponent = getters['type-map/hasCustomList'](resource);
const derpinStore = getters['currentStore'](resource); // TODO: RC fix in parent commit (dupe inStore props)
const schema = getters[`${ derpinStore }/schemaFor`](resource);
const inStore = getters['currentStore'](resource);
const schema = getters[`${ inStore }/schemaFor`](resource);
const showMasthead = getters[`type-map/optionsFor`](resource).showListMasthead;
@ -105,6 +105,7 @@ export default {
schema,
hasListComponent,
showMasthead: showMasthead === undefined ? true : showMasthead,
resource,
extensionType: ExtensionPoint.PANEL,
extensionLocation: PanelLocation.RESOURCE_LIST,
loadResources: [resource], // List of resources that will be loaded, this could be many (`Workloads`)
@ -270,13 +271,6 @@ export default {
v-bind="$data"
/>
</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
v-else
:schema="schema"

View File

@ -23,7 +23,6 @@ import LabeledSelect from '@shell/components/form/LabeledSelect';
import { getParent } from '@shell/utils/dom';
import { FORMATTERS } from '@shell/components/SortableTable/sortable-config';
import ButtonMultiAction from '@shell/components/ButtonMultiAction.vue';
import devConsole from 'utils/dev-console';
// Uncomment for table performance debugging
// import tableDebug from './debug';
@ -497,7 +496,6 @@ export default {
loading: {
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)
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],
[STEVE_STATE_COL, STEVE_NAME_COL, STEVE_NAMESPACE_COL, {
...CHART,
sort: false, // 'spec.chart.metadata.name' // TODO: RC works at moment, won't soon?
search: false,
// TODO: RC REGRESSION
sort: ['spec.chart.metadata.name'],
search: ['spec.chart.metadata.name'],
}, {
...CHART_UPGRADE,
// TODO: RC REGRESSION
sort: false,
search: false,
},
@ -95,12 +97,12 @@ export function init(store) {
[STATE, NAME_COL, repoType, repoUrl, repoBranch, AGE],
[STEVE_STATE_COL, STEVE_NAME_COL, {
...repoType,
// spec.gitRepo 'git || spec.url oci | http || ? // TODO: RC
sort: ['spec.gitRepo'],
// TODO: RC REGRESSION Either 'git' (spec.gitRepo), 'oci' (spec.url && isOciType), 'http' (spec.url)
sort: false,
search: false,
}, {
...repoUrl,
// urlDisplay --> status.url || spec.gitRepo || spec.url // TODO: RC
// TODO: RC REGRESSION Either status.url || spec.gitRepo || spec.url
sort: false,
search: false,
},

View File

@ -184,7 +184,7 @@ export function init(store) {
configureType(SNAPSHOT, { 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);
configureType(POD, {
@ -225,7 +225,7 @@ export function init(store) {
STEVE_NAME_COL,
{ ...RECLAIM_POLICY },
{
// TODO: RC Regression
// TODO: RC TEST once 48103
...PERSISTENT_VOLUME_CLAIM,
sort: ['metadata.fields.5'], // TODO: RC should be spec.volumeName of PVC --> PV, this is PV --> PVC
search: ['metadata.fields.5'],
@ -338,7 +338,7 @@ export function init(store) {
}, {
...EVENT_TYPE,
value: '_type',
sort: '_type', // TODO: RC API request
sort: '_type',
},
REASON,
STEVE_EVENT_OBJECT,

View File

@ -1,7 +1,6 @@
import { CATTLE_PUBLIC_ENDPOINTS, STORAGE } from '@shell/config/labels-annotations';
import { NODE as NODE_TYPE } from '@shell/config/types';
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.

View File

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

View File

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

View File

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

View File

@ -326,12 +326,9 @@ export default {
return;
}
// TODO: RC fix in parent commit (make calls to fetchPageX null safe)
if (this.fetchPageSecondaryResources) {
await 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;
}
} 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 [];

View File

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

View File

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

View File

@ -239,116 +239,6 @@ export default defineComponent({
},
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
*/

View File

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