From eea27c8af4949064ae86e6edf56afd35a6a265ea Mon Sep 17 00:00:00 2001 From: Jacky Zhang Date: Mon, 29 May 2023 16:25:05 -0400 Subject: [PATCH] Only resources whose files exist are available as job inputs --- .../code/src/js/Controllers/ControllerWorkflowBuilder.js | 2 +- rodan-main/code/rodan/views/resource.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/rodan-client/code/src/js/Controllers/ControllerWorkflowBuilder.js b/rodan-client/code/src/js/Controllers/ControllerWorkflowBuilder.js index c7cddf7b8..4fe6f41b3 100644 --- a/rodan-client/code/src/js/Controllers/ControllerWorkflowBuilder.js +++ b/rodan-client/code/src/js/Controllers/ControllerWorkflowBuilder.js @@ -839,7 +839,7 @@ export default class ControllerWorkflowBuilder extends BaseController { var project = Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__PROJECT_GET_ACTIVE); var resourceTypeURLs = this._getCompatibleResourceTypeURLs([inputPort]); - var data = {project: project.id, resource_type__in: ''}; + var data = {project: project.id, resource_type__in: '', file_exists: 'True'}; var globalResourceTypes = Radio.channel('rodan').request(RODAN_EVENTS.REQUEST__GLOBAL_RESOURCETYPE_COLLECTION); var first = true; for (var index in resourceTypeURLs) diff --git a/rodan-main/code/rodan/views/resource.py b/rodan-main/code/rodan/views/resource.py index 65dd0b72c..8a4bf4d05 100644 --- a/rodan-main/code/rodan/views/resource.py +++ b/rodan-main/code/rodan/views/resource.py @@ -122,6 +122,12 @@ def get_queryset(self): elif uploaded == u'False': condition &= Q(origin__isnull=False) + file_exists = self.request.query_params.get('file_exists', None) + if file_exists == u'True': + condition &= ~Q(resource_file="") + elif file_exists == u'False': + condition &= Q(resource_file="") + # finding the resourcelist query parameter and adding it to the condition resource_list_param = self.request.query_params.get('resource_list', None) if resource_list_param is not None: