From 0688c295b9392c82d969ac955fe53e49626419c1 Mon Sep 17 00:00:00 2001 From: Fabio Ghirardello Date: Tue, 30 Jan 2024 16:48:02 -0500 Subject: [PATCH] .. --- apiserver/routers/attachments.py | 4 +- webapp/src/components/FabEditableField.vue | 29 +++++++++ webapp/src/layout/AppHeader.vue | 19 ++++-- webapp/src/views/InstanceView.vue | 74 ++++++++++++---------- 4 files changed, 85 insertions(+), 41 deletions(-) diff --git a/apiserver/routers/attachments.py b/apiserver/routers/attachments.py index 43a0626..26b0466 100644 --- a/apiserver/routers/attachments.py +++ b/apiserver/routers/attachments.py @@ -80,7 +80,7 @@ async def get_presigned_put_url( # this should append to the new list... bg_task.add_task( svc.update_documents, - [{"comp_id": model_name + "_" + str(id), "attachments": ", ".join(attachments)}], + [{"comp_id": model_name + "_" + str(id), "attachments": attachments}], ) return HTMLResponse(content=data) @@ -114,5 +114,5 @@ async def delete_attachement( # this should add the new list bg_task.add_task( svc.update_documents, - [{"comp_id": model_name + "_" + str(id), "attachments": ', '.join(attachments)}], + [{"comp_id": model_name + "_" + str(id), "attachments": attachments}], ) diff --git a/webapp/src/components/FabEditableField.vue b/webapp/src/components/FabEditableField.vue index 1d5624c..d70727b 100644 --- a/webapp/src/components/FabEditableField.vue +++ b/webapp/src/components/FabEditableField.vue @@ -99,6 +99,35 @@ /> +
+
+
+
+ {{ tag }} +
+
+ + +
+
+ +
+
+ >
-
- +
+ +
+
- {{ i }}
+
+
+
-
- owned_by: {{ modelStore.instance?.owned_by }} -
-
- permissions: {{ modelStore.instance?.permissions }} -
+ + +
-
- tags: -
-
- {{ tag }} -
-
-
+
{ - showDeleteAttachmentModal.value = false; - - await modelStore.delete_attachment( - instance_type.value, - instance_id.value, - attachment.value, - ); - - // refresh to get updated list of attachments - modelStore.get_instance(instance_type.value, instance_id.value); -}; - const delete_instance = async () => { showDeleteInstanceModal.value = false; @@ -421,7 +406,10 @@ const upload_file = async (e: any) => { body: e.target.files[0], }); - modelStore.get_instance(instance_type.value, instance_id.value); + modelStore.instance = await modelStore.get_instance( + instance_type.value, + instance_id.value, + ); }; const download_file = async (filename: string) => { @@ -439,6 +427,22 @@ const confirm_delete_attachment = async (s: any) => { attachment.value = s; }; +const delete_attachment = async () => { + showDeleteAttachmentModal.value = false; + + await modelStore.delete_attachment( + instance_type.value, + instance_id.value, + attachment.value, + ); + + // refresh to get updated list of attachments + modelStore.instance = await modelStore.get_instance( + instance_type.value, + instance_id.value, + ); +}; + // const ff = computed(() => { // if (modelStore.instance !== undefined) { // return Object.keys(modelStore.instance)