Skip to content

Commit

Permalink
Refine object store templates backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Apr 25, 2024
1 parent e7e58aa commit 1bee224
Show file tree
Hide file tree
Showing 23 changed files with 153 additions and 86 deletions.
8 changes: 5 additions & 3 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12501,7 +12501,7 @@ export interface components {
/** Device */
device?: string | null;
/** Id */
id: number;
id: number | string;
/** Name */
name?: string | null;
/** Object Store Id */
Expand All @@ -12520,6 +12520,8 @@ export interface components {
* @enum {string}
*/
type: "s3" | "azure_blob" | "disk" | "generic_s3";
/** Uuid */
uuid: string;
/** Variables */
variables: {
[key: string]: (string | boolean | number) | undefined;
Expand Down Expand Up @@ -20530,7 +20532,7 @@ export interface operations {
header?: {
"run-as"?: string | null;
};
/** @description The model ID for a persisted UserObjectStore object. */
/** @description The identifier used to index a persisted UserObjectStore object. */
path: {
user_object_store_id: string;
};
Expand All @@ -20557,7 +20559,7 @@ export interface operations {
header?: {
"run-as"?: string | null;
};
/** @description The model ID for a persisted UserObjectStore object. */
/** @description The identifier used to index a persisted UserObjectStore object. */
path: {
user_object_store_id: string;
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ObjectStore/Instances/CreateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface CreateFormProps {
}
const error = ref<string | null>(null);
const props = defineProps<CreateFormProps>();
const title = "Create a new object store for your data";
const title = "Create a new storage location for your data";
const submitTitle = "Submit";
const inputs = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ const props = defineProps<Props>();
const template = computed(() => objectStoreTemplatesStore.getLatestTemplate(props.templateId));
async function onCreated(objectStore: UserConcreteObjectStore) {
const message = `Created object store ${objectStore.name}`;
const message = `Created storage location ${objectStore.name}`;
goToIndex({ message });
}
</script>

<template>
<div>
<LoadingSpan v-if="!template" message="Loading object store templates" />
<LoadingSpan v-if="!template" message="Loading storage location templates" />
<CreateForm v-else :template="template" @created="onCreated"></CreateForm>
</div>
</template>
4 changes: 2 additions & 2 deletions client/src/components/ObjectStore/Instances/EditInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const inputs = computed(() => {
return form;
});
const title = computed(() => `Edit Object Store ${instance.value?.name} Settings`);
const title = computed(() => `Edit Storage Location ${instance.value?.name} Settings`);
const hasSecrets = computed(() => instance.value?.secrets && instance.value?.secrets.length > 0);
const submitTitle = "Update Settings";
Expand All @@ -69,7 +69,7 @@ async function onSubmit(formData: any) {
const { goToIndex } = useInstanceRouting();
async function onUpdate(objectStore: UserConcreteObjectStore) {
const message = `Updated object store ${objectStore.name}`;
const message = `Updated storage location ${objectStore.name}`;
goToIndex({ message });
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface Props {
template: ObjectStoreTemplateSummary;
}
const props = defineProps<Props>();
const title = computed(() => `Update Object Store ${props.objectStore?.name} Secrets`);
const title = computed(() => `Update Storage Location ${props.objectStore?.name} Secrets`);
async function onUpdate(secretName: string, secretValue: string) {
const payload = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function handleSubmit() {
</script>
<template>
<div>
<LoadingSpan v-if="inputs == null" message="Loading object store template and instance information" />
<LoadingSpan v-if="inputs == null" message="Loading storage location template and instance information" />
<div v-else>
<FormCard :title="title">
<template v-slot:body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const INSTANCE: UserConcreteObjectStore = {
quota: { enabled: false },
private: false,
id: 4,
uuid: "112f889f-72d7-4619-a8e8-510a8c685aa7",
};

describe("UpgradeForm", () => {
Expand Down Expand Up @@ -113,7 +114,7 @@ describe("UpgradeForm", () => {
await flushPromises();
const route = wrapper.vm.$route;
expect(route.path).toBe("/object_store_instances/index");
expect(route.query.message).toBe("Upgraded object store moo");
expect(route.query.message).toBe("Upgraded storage location moo");
});

it("should indicate an error on failure", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ async function onSubmit(formData: any) {
const { goToIndex } = useInstanceRouting();
async function onUpgrade(objectStore: UserConcreteObjectStore) {
const message = `Upgraded object store ${objectStore.name}`;
const message = `Upgraded storage location ${objectStore.name}`;
goToIndex({ message });
}
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ const latestTemplate = computed(
);
</script>
<template>
<LoadingSpan v-if="!instance || !latestTemplate" message="Loading object store instance and templates" />
<LoadingSpan v-if="!instance || !latestTemplate" message="Loading storage location instance and templates" />
<UpgradeForm v-else :instance="instance" :latest-template="latestTemplate" />
</template>
4 changes: 0 additions & 4 deletions client/src/components/ObjectStore/Instances/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,3 @@ export function templateSecretFormEntry(secret: ObjectStoreTemplateSecret) {
value: "",
};
}

export function asNumber(x: number | string): number {
return +x;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useObjectStoreTemplatesStore } from "@/stores/objectStoreTemplatesStore
import SelectTemplate from "./SelectTemplate.vue";
import LoadingSpan from "@/components/LoadingSpan.vue";
const loadingTemplatesInfoMessage = "Loading object store templates";
const loadingTemplatesInfoMessage = "Loading storage location templates";
const objectStoreTemplatesStore = useObjectStoreTemplatesStore();
objectStoreTemplatesStore.ensureTemplates();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ interface SelectTemplateProps {
templates: ObjectStoreTemplateSummaries;
}
withDefaults(defineProps<SelectTemplateProps>(), {});
defineProps<SelectTemplateProps>();
const selectText =
"Select storage location template to create new storage location with. These templates are configured by your Galaxy administrator.";
const emit = defineEmits<{
(e: "onSubmit", id: string): void;
Expand Down Expand Up @@ -36,8 +39,7 @@ async function handleSubmit(templateId: string) {
</b-col>
<b-col cols="5">
<p v-localize style="float: right">
Select object store template to create new object store with. These templates are configured by your
Galaxy administrator.
{{ selectText }}
</p>
</b-col>
</b-row>
Expand Down
6 changes: 3 additions & 3 deletions client/src/components/User/UserPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@
:preferred-object-store-id="currentUser.preferred_object_store_id"
:user-id="userId">
</UserPreferredObjectStore>
<UserPreferredObjectStore
<UserPreferencesElement
v-if="hasTemplates"
id="manage-object-stores"
class="manage-object-stores"
icon="fa-hdd"
title="Manage Your Object Stores"
description="Add, remove, or update your personal object store configured."
title="Manage Your Storage Locations"
description="Add, remove, or update your personally configured storage locations."
to="/object_store_instances/index" />
<UserDeletion
v-if="isConfigLoaded && !config.single_user && config.enable_account_interface"
Expand Down
1 change: 1 addition & 0 deletions client/src/stores/objectStoreInstancesStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const TEST_INSTANCE = {
quota: { enabled: false },
private: false,
id: 4,
uuid: "112f889f-72d7-4619-a8e8-510a8c685aa7",
};

describe("Object Store Instances Store", () => {
Expand Down
6 changes: 1 addition & 5 deletions client/src/stores/objectStoreInstancesStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ const getObjectStoreInstances = fetcher.path("/api/object_store_instances").meth

type UserConcreteObjectStoreModel = components["schemas"]["UserConcreteObjectStoreModel"];

function _asNumber(x: number | string): number {
return +x;
}

export const useObjectStoreInstancesStore = defineStore("objectStoreInstances", {
state: () => ({
instances: [] as UserConcreteObjectStoreModel[],
Expand All @@ -26,7 +22,7 @@ export const useObjectStoreInstancesStore = defineStore("objectStoreInstances",
return !state.fetched;
},
getInstance: (state) => {
return (id: number | string) => state.instances.find((i) => i.id == _asNumber(id));
return (id: number | string) => state.instances.find((i) => i.id.toString() == id.toString());
},
},
actions: {
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def _configure_object_store(self, **kwds):
umask=self.config.umask,
object_store_cache_size=self.config.object_store_cache_size,
object_store_cache_path=self.config.object_store_cache_path,
user_object_store_index_by=self.config.user_object_store_index_by,
)
self._register_singleton(UserObjectStoresAppConfig, app_config)
user_object_store_resolver = self._register_abstract_singleton(
Expand Down
13 changes: 13 additions & 0 deletions lib/galaxy/config/schemas/config_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,19 @@ mapping:
desc: |
Configured Object Store templates embedded into Galaxy's config.
user_object_store_index_by:
type: str
default: 'uuid'
required: false
enum: ['uuid', 'id']
desc: |
Configure URIs for user object stores to use either the object ID ('id')
or UUIDs ('uuid'). Either is fine really, Galaxy doesn't typically expose
database objects by 'id' but there isn't any obvious disadvantage to doing
it in this case and it keeps user exposed URIs much smaller. The default of
UUID feels a little more like a typical way to do this within Galaxy though.
Do not change this value once user object stores have been created.
enable_mulled_containers:
type: bool
default: true
Expand Down
Loading

0 comments on commit 1bee224

Please sign in to comment.