Skip to content

Commit

Permalink
Merge branch 'release_24.1' into release_24.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Feb 11, 2025
2 parents a1c9dc6 + 8c986bc commit 60d02a2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
18 changes: 13 additions & 5 deletions client/src/components/Collections/common/CollectionEditView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,26 @@ const collectionChangeKey = ref(0);
const attributesData = computed(() => {
return collectionAttributesStore.getAttributes(props.collectionId);
});
const attributesLoadError = computed(() =>
errorMessageAsString(collectionAttributesStore.hasItemLoadError(props.collectionId))
);
const attributesLoadError = computed(() => {
const itemLoadError = collectionAttributesStore.getItemLoadError(props.collectionId);
if (itemLoadError) {
return errorMessageAsString(itemLoadError);
}
return undefined;
});
const collection = computed(() => {
return collectionStore.getCollectionById(props.collectionId);
});
const collectionLoadError = computed(() => {
if (collection.value) {
return errorMessageAsString(collectionStore.hasLoadingCollectionElementsError(collection.value));
const collectionElementLoadError = collectionStore.getLoadingCollectionElementsError(collection.value);
if (collectionElementLoadError) {
return errorMessageAsString(collectionElementLoadError);
}
}
return "";
return undefined;
});
watch([attributesLoadError, collectionLoadError], () => {
if (attributesLoadError.value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ watch(

const collectionElements = computed(() => collectionElementsStore.getCollectionElements(dsc.value) ?? []);
const loading = computed(() => collectionElementsStore.isLoadingCollectionElements(dsc.value));
const error = computed(() => collectionElementsStore.hasLoadingCollectionElementsError(dsc.value));
const error = computed(() => collectionElementsStore.getLoadingCollectionElementsError(dsc.value));
const jobState = computed(() => ("job_state_summary" in dsc.value ? dsc.value.job_state_summary : undefined));
const populatedStateMsg = computed(() =>
"populated_state_message" in dsc.value ? dsc.value.populated_state_message : undefined
Expand Down
8 changes: 4 additions & 4 deletions client/src/composables/keyedCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function useKeyedCache<T>(
};
});

const hasItemLoadError = computed(() => {
const getItemLoadError = computed(() => {
return (id: string) => {
return loadingErrors.value[id] ?? null;
};
Expand Down Expand Up @@ -106,11 +106,11 @@ export function useKeyedCache<T>(
*/
getItemById,
/**
* A computed function that returns true if the item with the given id is currently being fetched.
* A computed function holding errors
*/
hasItemLoadError,
getItemLoadError,
/**
* A computed function holding errors
* A computed function that returns true if the item with the given id is currently being fetched.
*/
isLoadingItem,
/**
Expand Down
4 changes: 2 additions & 2 deletions client/src/stores/collectionAttributesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ export const useCollectionAttributesStore = defineStore("collectionAttributesSto
return data;
}

const { storedItems, getItemById, isLoadingItem, hasItemLoadError } =
const { storedItems, getItemById, isLoadingItem, getItemLoadError } =
useKeyedCache<DatasetCollectionAttributes>(fetchAttributes);

return {
storedAttributes: storedItems,
getAttributes: getItemById,
isLoadingAttributes: isLoadingItem,
hasItemLoadError: hasItemLoadError,
getItemLoadError: getItemLoadError,
};
});
4 changes: 2 additions & 2 deletions client/src/stores/collectionElementsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const useCollectionElementsStore = defineStore("collectionElementsStore",
};
});

const hasLoadingCollectionElementsError = computed(() => {
const getLoadingCollectionElementsError = computed(() => {
return (collection: CollectionEntry) => {
return loadingCollectionElementsErrors.value[getCollectionKey(collection)] ?? false;
};
Expand Down Expand Up @@ -213,7 +213,7 @@ export const useCollectionElementsStore = defineStore("collectionElementsStore",
storedCollectionElements,
getCollectionElements,
isLoadingCollectionElements,
hasLoadingCollectionElementsError,
getLoadingCollectionElementsError,
loadingCollectionElementsErrors,
getCollectionById,
fetchCollection,
Expand Down

0 comments on commit 60d02a2

Please sign in to comment.