Exemple #1
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(PluginDetail, self).retrieve(request, *args, **kwargs)
     template_data = {'dock_image': '', 'public_repo': '', 'owner': ''}
     return services.append_collection_template(response, template_data)
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin. A document-level
     link relation and a collection+json template are also added to the response.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     # append document-level link relations
     links = {
         'plugin':
         reverse('plugin-detail', request=request, kwargs={"pk": plugin.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     param_names = plugin.get_plugin_parameter_names()
     template_data = {
         'title': "",
         'previous_id': "",
         'cpu_limit': "",
         'memory_limit': "",
         'number_of_workers': "",
         'gpu_limit': ""
     }
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Exemple #3
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations, query list and a
     collection+json template to the response.
     """
     response = super(PluginList, self).list(request, *args, **kwargs)
     # append document-level link relations
     links = {
         'plugin_stars': reverse('pluginmetastar-list', request=request),
         'pipelines': reverse('pipeline-list', request=request)
     }
     user = self.request.user
     if user.is_authenticated:
         links['user'] = reverse('user-detail',
                                 request=request,
                                 kwargs={"pk": user.id})
     response = services.append_collection_links(response, links)
     # append query list
     query_list = [reverse('plugin-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {
         'name': '',
         'dock_image': '',
         'public_repo': '',
         'descriptor_file': ''
     }
     return services.append_collection_template(response, template_data)
Exemple #4
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin.
     A collection+json template is also added to the response.
     """
     queryset = self.get_plugin_instances_queryset()
     response = services.get_list_response(self, queryset)
     plugin = self.get_object()
     # append query list
     query_list = [
         reverse('plugininstance-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'plugin':
         reverse('plugin-detail', request=request, kwargs={"pk": plugin.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     param_names = plugin.get_plugin_parameter_names()
     template_data = {'previous_id': ""}
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Exemple #5
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json
     template to the response.
     """
     response = super(PACSFileList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('pacsfile-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {
         'path': "",
         'PatientID': "",
         'PatientName': "",
         'PatientBirthDate': "",
         'PatientAge': "",
         'PatientSex': "",
         'Modality': "",
         'StudyInstanceUID': "",
         'StudyDescription': "",
         'SeriesInstanceUID': "",
         'SeriesDescription': "",
         'pacs_name': ""
     }
     return services.append_collection_template(response, template_data)
Exemple #6
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json write template.
     """
     response = services.get_list_response(self, [])
     template_data = {"username": "", "password": "", "email": ""}
     return services.append_collection_template(response, template_data)
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(TagDetail, self).retrieve(request, *args, **kwargs)
     template_data = {"name": "", "color": ""}
     return services.append_collection_template(response, template_data)
Exemple #8
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json write template.
     """
     response = services.get_list_response(self, [])
     template_data = {"username": "", "password": "", "email": ""}
     return services.append_collection_template(response, template_data)
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template to the response.
     """
     response = super(PipelineInstanceDetail, self).retrieve(request, *args, **kwargs)
     template_data = {'title': '', 'description': ''}
     return services.append_collection_template(response, template_data)
Exemple #10
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(RecipeDetail, self).retrieve(request, *args, **kwargs)
     template_data = {'name': ''}
     return services.append_collection_template(response, template_data)
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the comments for the queried feed.
     A collection+json write template and document-level link relation are also
     added to the response.
     """
     queryset = self.get_comments_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     # append query list
     query_list = [
         reverse('comment-list-query-search',
                 request=request,
                 kwargs={"pk": feed.id})
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {"title": "", "content": ""}
     return services.append_collection_template(response, template_data)
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of pipeline instances for the queried pipeline.
     A document-level link relation, query list and a collection+json template are
     also added to the response.
     """
     queryset = self.get_pipeline_instances_queryset()
     response = services.get_list_response(self, queryset)
     pipeline = self.get_object()
     # append query list
     query_list = [
         reverse('pipelineinstance-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {
         'pipeline':
         reverse('pipeline-detail',
                 request=request,
                 kwargs={"pk": pipeline.id})
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {
         'previous_plugin_inst_id': "",
         'title': "",
         'description': ""
     }
     param_names = pipeline.get_pipings_parameters_names()
     for name in param_names:
         template_data[name] = ""
     return services.append_collection_template(response, template_data)
Exemple #13
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(TagDetail, self).retrieve(request, *args, **kwargs)
     template_data = {"name": "", "color": ""}
     return services.append_collection_template(response, template_data)
Exemple #14
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(DefaultPipingPathParameterDetail, self).retrieve(
         request, *args, **kwargs)
     template_data = {"value": ""}
     return services.append_collection_template(response, template_data)
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(UploadedFileDetail,
                      self).retrieve(request, *args, **kwargs)
     template_data = {"upload_path": ""}
     return services.append_collection_template(response, template_data)
Exemple #16
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(PluginMetaCollaboratorDetail, self).retrieve(request, *args,
                                                                   **kwargs)
     template_data = {'role': ''}
     return services.append_collection_template(response, template_data)
Exemple #17
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(DefaultPipingPathParameterDetail,
                      self).retrieve(request, *args, **kwargs)
     template_data = {"value": ""}
     return services.append_collection_template(response, template_data)
Exemple #18
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json template.
     """
     response = super(TagList, self).list(request, *args, **kwargs)
     links = {'feeds': reverse('feed-list', request=request)}
     response = services.append_collection_links(response, links)
     template_data = {"name": "", "color": ""}
     return services.append_collection_template(response, template_data)
Exemple #19
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     instance = self.get_object()
     serializer = self.get_serializer(instance)
     response = Response(serializer.data)
     template_data = {"password": "", "email": ""}
     return services.append_collection_template(response, template_data)
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of instances for the queried plugin.
     A collection+json template is also added to the response.
     """
     response = super(UploadedFileList, self).list(request, *args, **kwargs)
     # append write template
     template_data = {'upload_path': "", 'fname': ""}
     return services.append_collection_template(response, template_data)
 def test_append_collection_template(self):
     """
     Test whether services.append_collection_template() appends a collection+json 
     template to its response argument
     """
     response = self.response
     template_data = {"name": ""} 
     response = services.append_collection_template(response, template_data)
     self.assertEqual(response.data['template'],
                      {'data': [{'name': 'name', 'value': ''}]})
Exemple #22
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template.
     """
     response = super(PipelineDetail, self).retrieve(request, *args, **kwargs)
     template_data = {'name': "", 'authors': "", 'category': "", 'description': ""}
     pipeline = self.get_object()
     if pipeline.locked:
         template_data['locked'] = ""
     return services.append_collection_template(response, template_data)
Exemple #23
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to check a plugin's instance status.
     """
     instance = self.get_object()
     instance.check_exec_status()
     response = super(PluginInstanceDetail,
                      self).retrieve(request, *args, **kwargs)
     template_data = {'title': '', 'status': ''}
     return services.append_collection_template(response, template_data)
Exemple #24
0
 def retrieve(self, request, *args, **kwargs):
     """
     Overriden to check a plugin's instance status.
     """
     plg_inst = self.get_object()
     if plg_inst.status == 'started':
         # check execution status of plugin's app
         check_plugin_instance_exec_status.delay(
             plg_inst.id)  # call async task
     response = super(PluginInstanceDetail,
                      self).retrieve(request, *args, **kwargs)
     template_data = {'title': '', 'status': ''}
     return services.append_collection_template(response, template_data)
Exemple #25
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the taggings for the queried tag.
     Document-level link relations and a collection+json template are also
     added to the response.
     """
     queryset = self.get_taggings_queryset()
     response = services.get_list_response(self, queryset)
     tag = self.get_object()
     links = {'tag': reverse('tag-detail', request=request,
                                kwargs={"pk": tag.id})}
     response = services.append_collection_links(response, links)
     template_data = {"feed_id": ""}
     return services.append_collection_template(response, template_data)
Exemple #26
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append a collection+json template to the response.
     """
     response = super(ComputeResourceAdminList,
                      self).list(request, *args, **kwargs)
     # append write template
     template_data = {
         'name': '',
         'compute_url': '',
         'description': '',
         'max_job_exec_seconds': ''
     }
     return services.append_collection_template(response, template_data)
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json
     template to the response.
     """
     response = super(ServiceFileList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [
         reverse('servicefile-list-query-search', request=request)
     ]
     response = services.append_collection_querylist(response, query_list)
     # append write template
     template_data = {'path': "", 'service_name': ""}
     return services.append_collection_template(response, template_data)
Exemple #28
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json template
     to the response.
     """
     response = super(PluginAdminList, self).list(request, *args, **kwargs)
     # append document-level link relations
     links = {
         'compute_resources':
         reverse('admin-computeresource-list', request=request)
     }
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'plugin_store_url': '', 'compute_name': ''}
     return services.append_collection_template(response, template_data)
Exemple #29
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json template
     to the response.
     """
     queryset = self.get_plugin_meta_collaborators_queryset()
     response = services.get_list_response(self, queryset)
     plg_meta = self.get_object()
     # append document-level link relations
     links = {'meta': reverse('pluginmeta-detail', request=request,
                              kwargs={"pk": plg_meta.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'username': '', 'role': ''}
     return services.append_collection_template(response, template_data)
Exemple #30
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to append document-level link relations and a collection+json template
     to the response.
     """
     response = super(UserPluginList, self).list(request, *args, **kwargs)
     user = self.request.user
     # append document-level link relations
     links = {'plugins': reverse('plugin-list', request=request),
              'user': reverse('user-detail', request=request, kwargs={"pk": user.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'name': '', 'dock_image': '', 'public_repo': '',
                      'descriptor_file': ''}
     return services.append_collection_template(response, template_data)
Exemple #31
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to add document-level link relations, query list and a collection+json
     template to the response.
     """
     response = super(PipelineList, self).list(request, *args, **kwargs)
     # append query list
     query_list = [reverse('pipeline-list-query-search', request=request)]
     response = services.append_collection_querylist(response, query_list)
     # append document-level link relations
     links = {'plugins': reverse('plugin-list', request=request)}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'name': "", 'authors': "", 'category': "", 'description': "",
                      'locked': "", 'plugin_tree': "", 'plugin_inst_id': ""}
     return services.append_collection_template(response, template_data)
Exemple #32
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return the list of splits for the queried plugin instance.
     A document-level link relation and a collection+json template are also added
     to the response.
     """
     queryset = self.get_splits_queryset()
     response = services.get_list_response(self, queryset)
     instance = self.get_object()
     # append document-level link relations
     links = {'plugin_inst': reverse('plugininstance-detail', request=request,
                                     kwargs={"pk": instance.id})}
     response = services.append_collection_links(response, links)
     # append write template
     template_data = {'filter': '', 'compute_resource_name': ''}
     return services.append_collection_template(response, template_data)
Exemple #33
0
 def list(self, request, *args, **kwargs):
     """
     Overriden to return a list of the comments for the queried feed.
     A collection+json template is also added to the response.
     """
     queryset = self.get_comments_queryset()
     response = services.get_list_response(self, queryset)
     feed = self.get_object()
     links = {
         'feed': reverse('feed-detail',
                         request=request,
                         kwargs={"pk": feed.id})
     }
     response = services.append_collection_links(response, links)
     template_data = {"title": "", "content": ""}
     return services.append_collection_template(response, template_data)