Skip to content

Commit

Permalink
fix(entities-*): hide toolbar on initial load
Browse files Browse the repository at this point in the history
  • Loading branch information
Justineo committed Nov 18, 2024
1 parent a4fb45e commit ad8708b
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
:error-message="errorMessage"
:fetcher="fetcher"
:fetcher-cache-key="fetcherCacheKey"
:hide-toolbar="hideTableToolbar"
pagination-type="offset"
preferences-storage-key="kong-ui-entities-ca-certificates-list"
:query="filterQuery"
Expand Down Expand Up @@ -289,6 +290,8 @@ const resetPagination = (): void => {
* loading, Error, Empty state
*/
const errorMessage = ref<TableErrorMessage>(null)
// hide table toolbar in initial loading state or when no records are found
const hideTableToolbar = ref<boolean>(false)
/**
* Copy ID action
Expand Down Expand Up @@ -430,6 +433,12 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
}
if (state.status === FetcherStatus.Error) {
errorMessage.value = {
title: t('ca-certificates.errors.general'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:error-message="errorMessage"
:fetcher="fetcher"
:fetcher-cache-key="fetcherCacheKey"
:hide-toollbar="hideTableToolbar"
:hide-toolbar="hideTableToolbar"
pagination-type="offset"
preferences-storage-key="kong-ui-entities-key-sets-list"
:query="filterQuery"
Expand Down Expand Up @@ -425,7 +425,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
2 changes: 1 addition & 1 deletion packages/entities/entities-keys/src/components/KeyList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
2 changes: 1 addition & 1 deletion packages/entities/entities-snis/src/components/SniList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
:error-message="errorMessage"
:fetcher="fetcher"
:fetcher-cache-key="fetcherCacheKey"
:hide-toolbar="hideTableToolbar"
pagination-type="offset"
preferences-storage-key="kong-ui-entities-secrets-list"
:query="filterQuery"
Expand Down Expand Up @@ -213,6 +214,8 @@ const clearFilter = (): void => {
* loading, Error, Empty state
*/
const errorMessage = ref<TableErrorMessage>(null)
// hide table toolbar in initial loading state or when no records are found
const hideTableToolbar = ref<boolean>(false)
/**
* Edit action
Expand Down Expand Up @@ -283,6 +286,12 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
}
if (state.status === FetcherStatus.Error) {
errorMessage.value = {
title: t('errors.general'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ watch(fetcherState, (state) => {
hasData.value = state.response!.data.length > 0
}
if (state.status === FetcherStatus.NoRecords) {
if (state.status === FetcherStatus.InitialLoad || state.status === FetcherStatus.NoRecords) {
hideTableToolbar.value = true
} else {
hideTableToolbar.value = false
Expand Down

0 comments on commit ad8708b

Please sign in to comment.