Skip to content

Commit

Permalink
Fix use object store name instead of id in selector
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Jul 10, 2024
1 parent 3c88ec9 commit 8572bec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions client/src/components/Common/FilterObjectStoreLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,36 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { computed, ref } from "vue";
import { ConcreteObjectStoreModel } from "@/api";
import { useObjectStoreStore } from "@/stores/objectStoreStore";
import ObjectStoreSelect from "./ObjectStoreSelect.vue";
import SelectModal from "@/components/Dataset/DatasetStorage/SelectModal.vue";
library.add(faTimes);
interface FilterObjectStoreLinkProps {
value: String | null;
value?: string;
objectStores: ConcreteObjectStoreModel[];
}
const props = defineProps<FilterObjectStoreLinkProps>();
const { getObjectStoreNameById } = useObjectStoreStore();
const showModal = ref(false);
const emit = defineEmits<{
(e: "change", objectStoreId: string | null): void;
(e: "change", objectStoreId?: string): void;
}>();
function onSelect(objectStoreId: string | null) {
function onSelect(objectStoreId?: string) {
emit("change", objectStoreId);
showModal.value = false;
}
const selectionText = computed(() => {
if (props.value) {
return props.value;
return getObjectStoreNameById(props.value);
} else {
return "(any)";
}
Expand All @@ -45,7 +48,7 @@ const selectionText = computed(() => {
</SelectModal>
<b-link href="#" @click="showModal = true">{{ selectionText }}</b-link>
<span v-if="value" v-b-tooltip.hover title="Remove Filter">
<FontAwesomeIcon icon="times" @click="onSelect(null)" />
<FontAwesomeIcon icon="times" @click="onSelect(undefined)" />
</span>
</span>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ const { isLoading, loadDataOnMount } = useDataLoading();
const { isAdvanced, toggleAdvanced, inputGroupClasses, faAngleDoubleDown, faAngleDoubleUp } = useAdvancedFiltering();
const { selectableObjectStores, hasSelectableObjectStores } = useSelectableObjectStores();
const objectStore = ref<string | null>(null);
const objectStore = ref<string>();
const canEditHistory = computed(() => {
const history = getHistoryById(props.historyId);
return (history && !history.purged && !history.archived) ?? false;
});
function onChangeObjectStore(value: string | null) {
function onChangeObjectStore(value?: string) {
objectStore.value = value;
reloadDataFromServer();
}
Expand Down Expand Up @@ -190,7 +190,7 @@ function onUndelete(datasetId: string) {
</BFormSelect>
</BFormGroup>
<BFormGroup
v-if="hasSelectableObjectStores"
v-if="selectableObjectStores && hasSelectableObjectStores"
id="input-group-object-store"
label="Storage location:"
label-for="input-object-store"
Expand Down

0 comments on commit 8572bec

Please sign in to comment.