This is an automated email from the ASF dual-hosted git repository. machristie pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
commit 742b739e13380f80224a130ded75f8d0dee1bea8 Author: Marcus Christie <[email protected]> AuthorDate: Wed Feb 22 15:18:57 2023 -0500 AIRAVATA-3688 Null output file input when file is no longer available --- .../experiment/input-editors/FileInputEditor.vue | 27 ++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/FileInputEditor.vue b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/FileInputEditor.vue index 0781e90f..7986024b 100644 --- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/FileInputEditor.vue +++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/input-editors/FileInputEditor.vue @@ -36,9 +36,9 @@ </template> <script> -import {models, services, utils} from "django-airavata-api"; -import {InputEditorMixin} from "django-airavata-workspace-plugin-api"; -import {components} from "django-airavata-common-ui"; +import { models, services, utils } from "django-airavata-api"; +import { InputEditorMixin } from "django-airavata-workspace-plugin-api"; +import { components } from "django-airavata-common-ui"; import InputFileSelector from "./InputFileSelector"; import UserStorageLink from "../../storage/storage-edit/UserStorageLink"; @@ -48,7 +48,7 @@ export default { components: { UserStorageLink, "delete-link": components.DeleteLink, - InputFileSelector + InputFileSelector, }, computed: { isDataProductURI() { @@ -90,8 +90,17 @@ export default { }, methods: { loadDataProduct(dataProductURI) { - services.DataProductService.retrieve({lookup: dataProductURI}) - .then((dataProduct) => (this.dataProduct = dataProduct)) + services.DataProductService.retrieve({ lookup: dataProductURI }) + .then((dataProduct) => { + if (dataProduct.downloadURL === null) { + // Null out this field when the file is no longer available. Force + // user to select or upload another file. + this.data = null; + this.valueChanged(); + } else { + this.dataProduct = dataProduct; + } + }) .catch(() => { // If we're unable to load data product, reset data to null this.data = null; @@ -101,7 +110,7 @@ export default { deleteDataProduct() { utils.FetchUtils.delete( "/api/delete-file?data-product-uri=" + encodeURIComponent(this.value), - {ignoreErrors: true} + { ignoreErrors: true } ) .then(() => { this.data = null; @@ -146,8 +155,8 @@ export default { if (this.isDataProductURI && value !== oldValue) { this.loadDataProduct(value); } - } - } + }, + }, }; </script>
