Skip to content

Commit

Permalink
Clean up filters and searching text
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas ONeil <[email protected]>
  • Loading branch information
loneil committed Jul 18, 2023
1 parent 8254a59 commit 74771b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
20 changes: 9 additions & 11 deletions frontend/src/components/object/ObjectFilters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@ objectStore.$onAction(
// Computed
const metadataValues = computed(() => {
// Filter out any tags that don't have an objectID that exist in getObjects
// Filter out any tags that don't have an objectID that exist in getUnfilteredObjectIds
const filteredVals = getMetadataSearchResults.value.filter((searchRes) =>
getUnfilteredObjectIds.value.some((obj) => obj === searchRes.objectId)
);
// Take the metadata for the objects, and flatten them into a single array
const metadataVals = [
...new Set(filteredVals.flatMap((obj) => obj.metadata)),
];
return metadataVals
return filteredVals
// Take the metadata for the objects, and flatten them into a single array
.flatMap((obj) => obj.metadata)
// Add a display property to each tag to be used by the multiselect
.map((val) => ({ ...val, display: `${val.key}:${val.value}` }))
// Unique by display property
Expand All @@ -74,11 +72,9 @@ const tagsetValues = computed(() => {
getUnfilteredObjectIds.value.some((obj) => obj === searchRes.objectId)
);
// Take the tags for the objects, and flatten them into a single array
const taggingVals = [
...new Set(filteredVals.flatMap((obj) => obj.tagset)),
];
return taggingVals
return filteredVals
// Take the tags for the objects, and flatten them into a single array
.flatMap((obj) => obj.tagset)
// Add a display property to each tag to be used by the multiselect
.map((val) => ({ ...val, display: `${val.key}=${val.value}` }))
// coms-id not allowed as a tag to filter on by COMS
Expand Down Expand Up @@ -139,6 +135,7 @@ const searchTagging = async () => {
placeholder="Metadata"
filter
filter-placeholder="Search metadata"
:empty-message="searching ? 'Loading...' : 'No available options'"
:show-toggle-all="false"
@show="searchMetadata"
@update:model-value="selectedFilterValuesChanged"
Expand All @@ -155,6 +152,7 @@ const searchTagging = async () => {
placeholder="Tags"
filter
filter-placeholder="Search tags"
:empty-message="searching ? 'Loading...' : 'No available options'"
:show-toggle-all="false"
@show="searchTagging"
@update:model-value="selectedFilterValuesChanged"
Expand Down
1 change: 0 additions & 1 deletion frontend/src/store/metadataStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export const useMetadataStore = defineStore('metadata', () => {
) {
try {
state.metadataSearchResults.value = [];
// await new Promise((resolve) => setTimeout(resolve, 4000));
const response = (await objectService.searchMetadata({ metadata: metadataSet })).data;
state.metadataSearchResults.value = response;
}
Expand Down

0 comments on commit 74771b7

Please sign in to comment.