Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination Updates #11218

Merged
merged 6 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shell/assets/translations/en-us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7356,7 +7356,7 @@ performance:
checkboxLabel: Enable Server-side Pagination
applicable: "This applies to the following resource types"
incompatibleDescription: "Server-side Pagination is incomaptible with Manual Refresh and Incremental Loading. Enabling this will disable them."
featureFlag: The&nbsp;<a href="{ffUrl}">Feature Flag</a>&nbsp;`on-disk-steve-cache` must be enabled to use this feature
featureFlag: The&nbsp;<a href="{ffUrl}">Feature Flag</a>&nbsp;`ui-sql-cache` must be enabled to use this feature
resources:
generic: most resources in the cluster's 'More Resources' section
all: All Resources
Expand Down
14 changes: 0 additions & 14 deletions shell/config/product/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
EVENT,
NODE, SECRET, INGRESS,
WORKLOAD, WORKLOAD_TYPES, SERVICE, HPA, NETWORK_POLICY, PV, PVC, STORAGE_CLASS, POD, POD_DISRUPTION_BUDGET, LIMIT_RANGE, RESOURCE_QUOTA,
RBAC,
MANAGEMENT,
NAMESPACE,
NORMAN,
Expand Down Expand Up @@ -341,19 +340,6 @@ export function init(store) {
}, AGE]);
headers(STORAGE_CLASS, [STATE, NAME_COL, STORAGE_CLASS_PROVISIONER, STORAGE_CLASS_DEFAULT, AGE]);

headers(RBAC.ROLE, [
STATE,
NAME_COL,
NAMESPACE_COL,
AGE
]);

headers(RBAC.CLUSTER_ROLE, [
STATE,
NAME_COL,
AGE,
]);

configureType(MANAGEMENT.CLUSTER_ROLE_TEMPLATE_BINDING, {
listGroups: [
{
Expand Down
58 changes: 29 additions & 29 deletions shell/pages/c/_cluster/settings/performance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,35 @@ export default {
</h1>
<div>
<div class="ui-perf-setting">
<!-- Server Side Pagination -->
<div class="mt-40">
<h2>{{ t('performance.serverPagination.label') }}</h2>
<p>{{ t('performance.serverPagination.description') }}</p>
<Banner
color="error"
label-key="performance.experimental"
/>
<Banner
v-if="!steveCacheEnabled"
v-clean-html="t(`performance.serverPagination.featureFlag`, { ffUrl }, true)"
color="warning"
/>
<Checkbox
v-model="value.serverPagination.enabled"
:mode="mode"
:label="t('performance.serverPagination.checkboxLabel')"
class="mt-10 mb-20"
:primary="true"
:disabled="(!steveCacheEnabled && !value.serverPagination.enabled)"
@input="compatibleWarning('serverPagination', $event)"
/>
<p :class="{ 'text-muted': !value.serverPagination.enabled }">
{{ t('performance.serverPagination.applicable') }}
</p>
<p :class="{ 'text-muted': !value.serverPagination.enabled }">
{{ steveCacheApplicableResources }}
</p>
</div>
<!-- Inactivity -->
<div class="mt-20">
<h2>{{ t('performance.inactivity.title') }}</h2>
Expand Down Expand Up @@ -377,35 +406,6 @@ export default {
</div>
</div>
</div>
<!-- Server Side Pagination -->
<div class="mt-40">
<h2>{{ t('performance.serverPagination.label') }}</h2>
<p>{{ t('performance.serverPagination.description') }}</p>
<Banner
color="error"
label-key="performance.experimental"
/>
<Banner
v-if="!steveCacheEnabled"
v-clean-html="t(`performance.serverPagination.featureFlag`, { ffUrl }, true)"
color="warning"
/>
<Checkbox
v-model="value.serverPagination.enabled"
:mode="mode"
:label="t('performance.serverPagination.checkboxLabel')"
class="mt-10 mb-20"
:primary="true"
:disabled="(!steveCacheEnabled && !value.serverPagination.enabled)"
@input="compatibleWarning('serverPagination', $event)"
/>
<p :class="{ 'text-muted': !value.serverPagination.enabled }">
{{ t('performance.serverPagination.applicable') }}
</p>
<p :class="{ 'text-muted': !value.serverPagination.enabled }">
{{ steveCacheApplicableResources }}
</p>
</div>
<!-- Force NS filter -->
<div class="mt-40">
<h2>{{ t('performance.nsFiltering.label') }}</h2>
Expand Down
11 changes: 9 additions & 2 deletions shell/plugins/steve/steve-pagination-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class StevePaginationUtils extends NamespaceProjectFilters {
checked: new Array<string>(),
invalid: new Array<string>(),
};
const res = filters
const filterStrings = filters
.filter((filter) => !!filter.fields.length)
.map((filter) => {
const joined = filter.fields
Expand All @@ -348,7 +348,14 @@ class StevePaginationUtils extends NamespaceProjectFilters {
.join(','); // This means OR

return `${ filter.param }${ filter.equals ? '=' : '!=' }${ joined }`;
}).join('&'); // This means AND
});
const unique = filterStrings.reduce((res, s) => {
res[s] = true;

return res;
}, { } as {[filterString: string] : boolean });

const res = Object.keys(unique).join('&'); // This means AND

if (validateFields.invalid.length) {
console.warn(`Pagination API does not support filtering '${ schema.id }' by the requested fields: ${ uniq(validateFields.invalid).join(', ') }`); // eslint-disable-line no-console
Expand Down
2 changes: 1 addition & 1 deletion shell/store/type-map.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function createHeaders(
}

// Age always goes last
const ageColumnActual = out.find((o) => o.name === 'Age');
const ageColumnActual = out.find((o) => o.name.toLocaleLowerCase() === 'age');

if ( ageColumnActual ) {
removeObject(out, ageColumnActual);
Expand Down
Loading