forked from galaxyproject/galaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: history filter by objectstore/quotasource
- Loading branch information
Showing
13 changed files
with
332 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<script setup lang="ts"> | ||
import { computed, type PropType, ref, watch } from "vue"; | ||
import { ValidFilter } from "@/utils/filtering"; | ||
import FilterObjectStoreLink from "./FilterObjectStoreLink.vue"; | ||
const props = defineProps({ | ||
name: { type: String, required: true }, | ||
filter: { type: Object as PropType<ValidFilter<any>>, required: true }, | ||
filters: { type: Object, required: true }, | ||
identifier: { type: String, required: true }, | ||
}); | ||
const emit = defineEmits<{ | ||
(e: "change", name: string, value: string | null): void; | ||
}>(); | ||
const propValue = computed(() => props.filters[props.name]); | ||
const localValue = ref(propValue.value); | ||
watch( | ||
() => localValue.value, | ||
(newFilter: string) => { | ||
emit("change", props.name, newFilter); | ||
} | ||
); | ||
watch( | ||
() => propValue.value, | ||
(newFilter: string) => { | ||
localValue.value = newFilter; | ||
} | ||
); | ||
function onChange(value: string | null) { | ||
localValue.value = value; | ||
} | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<small>Filter by storage source:</small> | ||
<FilterObjectStoreLink :value="localValue" @change="onChange" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<script setup lang="ts"> | ||
import { computed, onMounted, type PropType, ref, watch } from "vue"; | ||
import { QuotaUsage } from "@/components/User/DiskUsage/Quota/model"; | ||
import { fetch } from "@/components/User/DiskUsage/Quota/services"; | ||
import { ValidFilter } from "@/utils/filtering"; | ||
import { errorMessageAsString } from "@/utils/simple-error"; | ||
import QuotaUsageBar from "@/components/User/DiskUsage/Quota/QuotaUsageBar.vue"; | ||
const props = defineProps({ | ||
name: { type: String, required: true }, | ||
filter: { type: Object as PropType<ValidFilter<any>>, required: true }, | ||
filters: { type: Object, required: true }, | ||
identifier: { type: String, required: true }, | ||
}); | ||
const emit = defineEmits<{ | ||
(e: "change", name: string, value: string): void; | ||
}>(); | ||
const propValue = computed(() => props.filters[props.name]); | ||
const localValue = ref(propValue.value); | ||
watch( | ||
() => localValue.value, | ||
(newFilter) => { | ||
emit("change", props.name, newFilter); | ||
} | ||
); | ||
watch( | ||
() => propValue.value, | ||
(newFilter: string) => { | ||
localValue.value = newFilter; | ||
} | ||
); | ||
const quotaUsages = ref<QuotaUsage[]>(); | ||
const errorMessage = ref<string>(); | ||
async function loadQuotaUsages() { | ||
try { | ||
quotaUsages.value = await fetch(); | ||
} catch (e) { | ||
errorMessage.value = errorMessageAsString(e); | ||
} | ||
} | ||
onMounted(async () => { | ||
await loadQuotaUsages(); | ||
}); | ||
const dropDownText = computed(() => { | ||
if (localValue.value == null) { | ||
return "(any)"; | ||
} else { | ||
return localValue.value.sourceLabel; | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<small>Filter by {{ props.filter.placeholder }}:</small> | ||
<b-input-group :id="`${identifier}-advanced-filter-${props.name}`"> | ||
<b-dropdown :text="dropDownText" block class="m-2" size="sm" boundary="window"> | ||
<b-dropdown-item href="#" @click="localValue = null"><i>(any)</i></b-dropdown-item> | ||
|
||
<b-dropdown-item | ||
v-for="quotaUsage in quotaUsages" | ||
:key="quotaUsage.id" | ||
href="#" | ||
@click="localValue = quotaUsage"> | ||
{{ quotaUsage.sourceLabel }} | ||
<QuotaUsageBar :quota-usage="quotaUsage" class="quota-usage-bar" :compact="true" :embedded="true" /> | ||
</b-dropdown-item> | ||
</b-dropdown> | ||
</b-input-group> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script setup lang="ts"> | ||
import { storeToRefs } from "pinia"; | ||
import { computed, ref } from "vue"; | ||
import { useObjectStoreStore } from "@/stores/objectStoreStore"; | ||
import ObjectStoreSelect from "./ObjectStoreSelect.vue"; | ||
import SelectModal from "@/components/Dataset/DatasetStorage/SelectModal.vue"; | ||
interface FilterObjectStoreLinkProps { | ||
value: String | null; | ||
} | ||
const props = defineProps<FilterObjectStoreLinkProps>(); | ||
const showModal = ref(false); | ||
const store = useObjectStoreStore(); | ||
const { selectableObjectStores } = storeToRefs(store); | ||
const hasObjectStores = computed(() => { | ||
return selectableObjectStores.value && selectableObjectStores.value.length > 0; | ||
}); | ||
const emit = defineEmits<{ | ||
(e: "change", objectStoreId: string | null): void; | ||
}>(); | ||
function onSelect(objectStoreId: string | null) { | ||
emit("change", objectStoreId); | ||
showModal.value = false; | ||
} | ||
const selectionText = computed(() => { | ||
if (props.value) { | ||
return props.value; | ||
} else { | ||
return "(any)"; | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<span class="filter-objectstore-link"> | ||
<SelectModal v-model="showModal" title="Select Storage Source"> | ||
<ObjectStoreSelect :object-stores="selectableObjectStores" @select="onSelect" /> | ||
</SelectModal> | ||
<b-link v-if="hasObjectStores" href="#" @click="showModal = true">{{ selectionText }}</b-link> | ||
</span> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import { ConcreteObjectStoreModel } from "@/api"; | ||
import ObjectStoreSelectButton from "@/components/ObjectStore/ObjectStoreSelectButton.vue"; | ||
import ObjectStoreSelectButtonDescribePopover from "@/components/ObjectStore/ObjectStoreSelectButtonDescribePopover.vue"; | ||
interface RelocateProps { | ||
objectStores: ConcreteObjectStoreModel[]; | ||
} | ||
defineProps<RelocateProps>(); | ||
const emit = defineEmits<{ | ||
(e: "select", value: string): void; | ||
}>(); | ||
const toWhat = "Datasets will be filtered to those stored in"; | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<p>Select a storage source to filter by</p> | ||
<b-button-group vertical size="lg" class="select-button-group"> | ||
<ObjectStoreSelectButton | ||
v-for="objectStore in objectStores" | ||
:key="objectStore.object_store_id" | ||
id-prefix="filter-target" | ||
class="filter-target-object-store-select-button" | ||
variant="outline-primary" | ||
:object-store="objectStore" | ||
@click="emit('select', objectStore.object_store_id)" /> | ||
</b-button-group> | ||
<ObjectStoreSelectButtonDescribePopover | ||
v-for="objectStore in objectStores" | ||
:key="objectStore.object_store_id" | ||
id-prefix="filter-target" | ||
:what="toWhat" | ||
:object-store="objectStore" /> | ||
<p></p> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.select-button-group { | ||
display: block; | ||
margin: auto; | ||
width: 400px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { fetchQuotaUsages } from "@/api/users"; | ||
|
||
import { QuotaUsage, UserQuotaUsageData } from "./model/index"; | ||
|
||
export async function fetch() { | ||
const { data } = await fetchQuotaUsages({ user_id: "current" }); | ||
return data.map((u: UserQuotaUsageData) => new QuotaUsage(u)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.