From cfc64385ab5d04830bbc63b9ffed62f660ec5bb3 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 14 Mar 2023 09:08:23 -0400 Subject: [PATCH 1/3] Fix regression in distinguishing between select and text types. Previously if 'type' was missing but 'options' were present the form input would be rendered as a select box and not a text box. This can be seen as a problem when adding new quota objects in the admin menu. --- client/src/components/Form/FormElement.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Form/FormElement.vue b/client/src/components/Form/FormElement.vue index 4645ad6a5a8..29b2b2b8e8e 100644 --- a/client/src/components/Form/FormElement.vue +++ b/client/src/components/Form/FormElement.vue @@ -272,7 +272,7 @@ const isOptional = computed(() => !isRequired.value && attrs.value["optional"] ! :id="props.id" v-model="currentValue" :data-label="props.title" - :type="props.type ?? 'text'" + :type="props.type ?? (attrs.options ? 'select' : 'text')" :attributes="attrs" /> From 6a165c3093fa99386334fdfb3f2742409a4c51eb Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 14 Mar 2023 09:52:55 -0400 Subject: [PATCH 2/3] Adapt quota creation to form changes. --- lib/galaxy/webapps/galaxy/controllers/admin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index 542b2cc6c53..4562e383a6e 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -699,7 +699,7 @@ class AdminGalaxy(controller.JSAppLauncher): all_users = [] all_groups = [] labels = trans.app.object_store.get_quota_source_map().get_quota_source_labels() - label_options = [("Default Quota", None)] + label_options = [("Default Quota", "__default__")] label_options.extend([(label, label) for label in labels]) for user in ( trans.sa_session.query(trans.app.model.User) @@ -752,6 +752,9 @@ class AdminGalaxy(controller.JSAppLauncher): return rval else: try: + quota_source_label = payload.get("quota_source_label") + if quota_source_label == "__default__": + payload["quota_source_label"] = None quota, message = self.quota_manager.create_quota(payload, decode_id=trans.security.decode_id) return {"message": message} except ActionInputError as e: From e6f8525862a9b71baee2c3b34f7ecd5bbf83ed46 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 14 Mar 2023 10:43:56 -0400 Subject: [PATCH 3/3] Show quota source label in the quota grid (if configured) --- lib/galaxy/webapps/galaxy/controllers/admin.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/galaxy/webapps/galaxy/controllers/admin.py b/lib/galaxy/webapps/galaxy/controllers/admin.py index 4562e383a6e..ed5b4fe9096 100644 --- a/lib/galaxy/webapps/galaxy/controllers/admin.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin.py @@ -408,6 +408,15 @@ class QuotaListGrid(grids.Grid): return len(quota.groups) return 0 + class QuotaSourceLabelColumn(grids.TextColumn): + def get_value(self, trans, grid, quota): + raw_label = quota.quota_source_label + if raw_label is None: + rval = "unlabelled object stores" + else: + rval = raw_label + return rval + # Grid definition title = "Quotas" model_class = model.Quota @@ -427,6 +436,7 @@ class QuotaListGrid(grids.Grid): AmountColumn("Amount", key="amount", model_class=model.Quota, attach_popup=False), UsersColumn("Users", attach_popup=False), GroupsColumn("Groups", attach_popup=False), + QuotaSourceLabelColumn("Source Label", key="quota_source_label", visible=False, filterable="advanced"), StatusColumn("Status", attach_popup=False), # Columns that are valid for filtering but are not visible. grids.DeletedColumn("Deleted", key="deleted", visible=False, filterable="advanced"), @@ -690,6 +700,9 @@ class AdminGalaxy(controller.JSAppLauncher): if message: kwargs["message"] = util.sanitize_text(message) kwargs["status"] = status or "done" + labels = trans.app.object_store.get_quota_source_map().get_quota_source_labels() + if labels: + self.quota_list_grid.columns[5].visible = True return self.quota_list_grid(trans, **kwargs) @web.legacy_expose_api