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

Resolving some issues around rendering pagination loading on resource list pages #12884

Merged
merged 1 commit into from
Jan 9, 2025
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/components/PaginatedResourceTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default defineComponent({
v-bind="$attrs"
:schema="schema"
:rows="rows"
:alt-loading="canPaginate"
:alt-loading="canPaginate && !isFirstLoad"
:loading="loading"
:groupable="groupable"

Expand Down
2 changes: 1 addition & 1 deletion shell/components/ResourceList/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export default {
v-else
:schema="schema"
:rows="rows"
:alt-loading="canPaginate"
:alt-loading="canPaginate && !isFirstLoad"
richard-cox marked this conversation as resolved.
Show resolved Hide resolved
:loading="loading"
:headers="headers"
:group-by="groupBy"
Expand Down
5 changes: 1 addition & 4 deletions shell/components/SortableTable/THead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -428,10 +428,7 @@ export default {
background-color: var(--sortable-table-header-bg);
color: var(--body-text);
text-align: left;

&:not(.loading) {
border-bottom: 1px solid var(--sortable-table-top-divider);
}
border-bottom: 1px solid var(--sortable-table-top-divider);
richard-cox marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
9 changes: 4 additions & 5 deletions shell/components/SortableTable/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,10 @@ export default {
eventualSearchQuery = this.$route.query?.q;
}

const isLoading = this.loading || false;
richard-cox marked this conversation as resolved.
Show resolved Hide resolved

return {
refreshButtonPhase: ASYNC_BUTTON_STATES.WAITING,
refreshButtonPhase: isLoading ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION,
expanded: {},
searchQuery,
eventualSearchQuery,
Expand All @@ -392,7 +394,7 @@ export default {
/**
* The is the bool the DOM uses to show loading state. it's proxied from `loading` to avoid blipping the indicator (see usages)
*/
isLoading: false,
isLoading
};
},

Expand Down Expand Up @@ -536,9 +538,6 @@ export default {
manualRefreshLoadingFinished() {
const res = !!(!this.isLoading && this._didinit && this.rows?.length && !this.isManualRefreshLoading);

// Always ensure the Refresh button phase aligns with loading state (regardless of if manualRefreshLoadingFinished has changed or not)
this.refreshButtonPhase = !res || this.loading ? ASYNC_BUTTON_STATES.WAITING : ASYNC_BUTTON_STATES.ACTION;

richard-cox marked this conversation as resolved.
Show resolved Hide resolved
return res;
},

Expand Down
9 changes: 8 additions & 1 deletion shell/mixins/resource-fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export default {
incremental: false,
fetchedResourceType: [],
paginating: null,
isFirstLoad: true,
};
},

Expand Down Expand Up @@ -110,7 +111,7 @@ export default {

loading() {
if (this.canPaginate) {
return this.paginating;
return this.paginating === null ? true : this.paginating;
}

return this.rows.length ? false : this.$fetchState.pending;
Expand All @@ -128,6 +129,12 @@ export default {
});
}
}
},

loading(newValue, oldValue) {
if (oldValue && !newValue) {
this.isFirstLoad = false;
}
}
},

Expand Down
Loading