diff --git a/application/Makefile b/application/Makefile index b068a996..2e652610 100644 --- a/application/Makefile +++ b/application/Makefile @@ -2,8 +2,8 @@ VENV_NAME?=venv PYTHON=${PWD}/${VENV_NAME}/bin/python3 -VERSION_APPLICATION=0.0.89 -VERSION_GRPC=0.0.89 +VERSION_APPLICATION=0.0.90 +VERSION_GRPC=0.0.90 .DEFAULT: help help: diff --git a/application/src/tira/data/HybridDatabase.py b/application/src/tira/data/HybridDatabase.py index 2b4e3dbc..41c92da0 100644 --- a/application/src/tira/data/HybridDatabase.py +++ b/application/src/tira/data/HybridDatabase.py @@ -655,17 +655,21 @@ def runs(self, task_id, dataset_id, vm_id, software_id): tira_dockersoftware ON tira_run.docker_software_id = tira_dockersoftware.docker_software_id LEFT JOIN tira_review as tira_run_review ON tira_run.run_id = tira_run_review.run_id + LEFT JOIN + tira_softwareclone AS software_clone ON tira_dockersoftware.docker_software_id = software_clone.docker_software_id + LEFT JOIN + tira_softwareclone AS upload_clone ON tira_run.upload_id = software_clone.upload_id WHERE tira_run_review.published = TRUE AND tira_run_review.blinded = FALSE AND tira_run.input_dataset_id = %s - AND (tira_dockersoftware.task_id = %s OR tira_upload.task_id = %s OR tira_software.task_id = %s) + AND (tira_dockersoftware.task_id = %s OR tira_upload.task_id = %s OR tira_software.task_id = %s or software_clone.task_id = %s or upload_clone.task_id = %s) AND (tira_dockersoftware.vm_id = %s OR tira_upload.vm_id = %s OR tira_software.vm_id = %s) AND (tira_dockersoftware.display_name = %s OR tira_upload.display_name = %s OR tira_software.id = %s) ORDER BY tira_run.run_id ASC; """ - params = [dataset_id, task_id, task_id, task_id, vm_id, vm_id, vm_id, software_id, software_id, software_id] + params = [dataset_id, task_id, task_id, task_id, task_id, task_id, vm_id, vm_id, vm_id, software_id, software_id, software_id] return [i[0] for i in self.execute_raw_sql_statement(prepared_statement, params)] def get_runs_for_vm(self, vm_id, docker_software_id, upload_id, include_unpublished=True, round_floats=True, show_only_unreviewed=False): @@ -765,6 +769,21 @@ def get_docker_softwares(task_id, vm_id, return_only_names=True): else: return ret + def get_public_docker_softwares(self, task_id, return_only_names=True, return_details=True): + ret = modeldb.DockerSoftware.objects.filter(task__task_id=task_id, deleted=False, + public_image_name__isnull=False) + + ret = [i for i in ret if i.public_image_name and i.public_image_size] + + if return_only_names: + return [{'docker_software_id': i.docker_software_id, 'display_name': i.display_name, 'vm_id': i.vm_id + } + for i in ret] + elif return_details: + return [self._docker_software_to_dict(i) for i in ret] + else: + return ret + def delete_docker_software(self, task_id, vm_id, docker_software_id): software_qs = modeldb.DockerSoftware.objects.filter(vm_id=vm_id, task_id=task_id, docker_software_id=docker_software_id) @@ -1551,7 +1570,7 @@ def add_uploaded_run(self, task_id, vm_id, dataset_id, upload_id, uploaded_file) try: upload = modeldb.Upload.objects.get(vm__vm_id=vm_id, task__task_id=task_id, id=upload_id) except: - upload = modeldb.Upload.objects.get(vm__vm_id=vm_id, task__task_id=task_id, id=upload_id) + upload = modeldb.Upload.objects.get(vm__vm_id=vm_id, id=upload_id) upload.last_edit_date = now() upload.save() diff --git a/application/src/tira/endpoints/data_api.py b/application/src/tira/endpoints/data_api.py index bc271547..7d3b6f10 100644 --- a/application/src/tira/endpoints/data_api.py +++ b/application/src/tira/endpoints/data_api.py @@ -363,6 +363,23 @@ def get_running_software(request, context, task_id, user_id, force_cache_refresh return JsonResponse({'status': 0, "context": context}) +@add_context +def public_submissions(request, context, task_id): + context['public_submissions'] = model.model.get_public_docker_softwares(task_id) + + return JsonResponse({'status': 0, "context": context}) + + +@add_context +def public_submission(request, context, task_id, user_id, display_name): + for i in model.model.get_public_docker_softwares(task_id, return_only_names=False, return_details=True): + if i['display_name'] == display_name and i['vm_id'] == user_id: + context['submission'] = i + return JsonResponse({'status': 0, "context": context}) + + return JsonResponse({'status': 1, "messge": "Software '{task_id}/{user_id}/{display_name}' does not exist."}) + + @check_permissions @check_resources_exist("json") @add_context diff --git a/application/src/tira/frontend-vuetify/src/App.vue b/application/src/tira/frontend-vuetify/src/App.vue index 1e6afaea..065f542c 100644 --- a/application/src/tira/frontend-vuetify/src/App.vue +++ b/application/src/tira/frontend-vuetify/src/App.vue @@ -8,6 +8,9 @@