def get_data_uploader_overlay(self, project_id): """ Returns the html which displays a dialog which allows the user to upload certain data into the application. """ upload_algorithms = self.algorithm_service.get_upload_algorithms() algorithms_interface = {} tabs = [] for algorithm in upload_algorithms: adapter_template = self.flow_controller.get_adapter_template( project_id, algorithm.id, True, None) algorithms_interface['template_for_algo_' + str(algorithm.id)] = adapter_template tabs.append( OverlayTabDefinition(algorithm.displayname, algorithm.subsection_name, description=algorithm.description)) template_specification = self.fill_overlay_attributes( None, "Upload", "Upload data for this project", "project/upload_data_overlay", "dialog-upload", tabs_vertical=tabs) template_specification['uploadAlgorithms'] = upload_algorithms template_specification['projectId'] = project_id template_specification['algorithmsInterface'] = algorithms_interface return self.flow_controller.fill_default_attributes( template_specification)
def get_datatype_details(self, entity_gid, back_page='burst', exclude_tabs=None): """ Returns the HTML which contains the details for the given dataType. """ if exclude_tabs is None: exclude_tabs = [] selected_project = bc.get_current_project() datatype_details, states, entity = self.project_service.get_datatype_details( entity_gid) ### Load DataType categories current_type = datatype_details.data_type datatype_gid = datatype_details.gid categories = {} if not entity.invalid: categories = self.getalgorithmsfordatatype(str(current_type), str(datatype_gid)) categories = json.loads(categories) datatype_id = datatype_details.data_type_id is_group = False if datatype_details.operation_group_id is not None: ## Is a DataTypeGroup datatype_id = datatype_details.operation_group_id is_group = True ### Retrieve links linkable_projects_dict = self._get_linkable_projects_dict(datatype_id) ### Load all exporters exporters = {} if not entity.invalid: exporters = ExportManager().get_exporters_for_data(entity) is_relevant = entity.visible template_specification = dict() template_specification["entity_gid"] = entity_gid template_specification["nodeFields"] = datatype_details.get_ui_fields() template_specification["allStates"] = states template_specification["project"] = selected_project template_specification["categories"] = categories template_specification["exporters"] = exporters template_specification["datatype_id"] = datatype_id template_specification["isGroup"] = is_group template_specification["isRelevant"] = is_relevant template_specification["nodeType"] = 'datatype' template_specification["backPageIdentifier"] = back_page template_specification.update(linkable_projects_dict) overlay_class = "can-browse editor-node node-type-" + str( current_type).lower() if is_relevant: overlay_class += " node-relevant" else: overlay_class += " node_irrelevant" overlay_title = current_type if datatype_details.datatype_tag_1: overlay_title += " " + datatype_details.datatype_tag_1 tabs = [] overlay_indexes = [] if "Metadata" not in exclude_tabs: tabs.append(OverlayTabDefinition("Metadata", "metadata")) overlay_indexes.append(0) if "Analyzers" not in exclude_tabs: tabs.append( OverlayTabDefinition("Analyzers", "analyzers", enabled=categories and 'Analyze' in categories)) overlay_indexes.append(1) if "Visualizers" not in exclude_tabs: tabs.append( OverlayTabDefinition("Visualizers", "visualizers", enabled=categories and 'View' in categories)) overlay_indexes.append(2) enable_link_tab = False if (not entity.invalid) and (linkable_projects_dict is not None): if self.PRROJECTS_FOR_LINK_KEY in linkable_projects_dict: projects_for_link = linkable_projects_dict[ self.PRROJECTS_FOR_LINK_KEY] if projects_for_link is not None and len( projects_for_link) > 0: enable_link_tab = True if self.PRROJECTS_LINKED_KEY in linkable_projects_dict: projects_linked = linkable_projects_dict[ self.PRROJECTS_LINKED_KEY] if projects_linked is not None and len(projects_linked) > 0: enable_link_tab = True if "Links" not in exclude_tabs: tabs.append( OverlayTabDefinition("Links", "link_to", enabled=enable_link_tab)) overlay_indexes.append(3) if "Export" not in exclude_tabs: tabs.append( OverlayTabDefinition("Export", "export", enabled=(exporters and len(exporters) > 0))) overlay_indexes.append(4) if "Resulted Datatypes" not in exclude_tabs: tabs.append( OverlayTabDefinition( "Resulted Datatypes", "result_dts", enabled=self.project_service. count_datatypes_generated_from(entity_gid))) overlay_indexes.append(5) template_specification = self.fill_overlay_attributes( template_specification, "DataType Details", overlay_title, "project/details_datatype_overlay", overlay_class, tabs, overlay_indexes) template_specification['baseUrl'] = cfg.BASE_URL #template_specification[bc.KEY_OVERLAY_PAGINATION] = True #template_specification[bc.KEY_OVERLAY_PREVIOUS] = "alert(1);" #template_specification[bc.KEY_OVERLAY_NEXT] = "alert(2);" return FlowController().fill_default_attributes(template_specification)
def get_datatype_details(self, entity_gid, back_page='null', exclude_tabs=None): """ Returns the HTML which contains the details for the given dataType. :param back_page: if different from 'null' (the default) it will redirect to it after saving metedata changes """ if exclude_tabs is None: exclude_tabs = [] selected_project = common.get_current_project() datatype_details, states, entity = self.project_service.get_datatype_details( entity_gid) # Load DataType categories current_type = datatype_details.data_type datatype_gid = datatype_details.gid categories, has_operations_warning = {}, False if not entity.invalid: categories, has_operations_warning = self.algorithm_service.get_launchable_algorithms( datatype_gid) is_group = False if datatype_details.operation_group_id is not None: is_group = True # Retrieve links linkable_projects_dict = self._get_linkable_projects_dict(entity.id) # Load all exporters exporters = {} if not entity.invalid: exporters = ExportManager().get_exporters_for_data(entity) is_relevant = entity.visible template_specification = { "entity_gid": entity_gid, "nodeFields": datatype_details.get_ui_fields(), "allStates": states, "project": selected_project, "categories": categories, "exporters": exporters, "datatype_id": entity.id, "isGroup": is_group, "isRelevant": is_relevant, "nodeType": 'datatype', "backPageIdentifier": back_page } template_specification.update(linkable_projects_dict) overlay_class = "can-browse editor-node node-type-" + str( current_type).lower() if is_relevant: overlay_class += " node-relevant" else: overlay_class += " node_irrelevant" overlay_title = current_type if datatype_details.datatype_tag_1: overlay_title += " " + datatype_details.datatype_tag_1 tabs = [] overlay_indexes = [] if "Metadata" not in exclude_tabs: tabs.append(OverlayTabDefinition("Metadata", "metadata")) overlay_indexes.append(0) if "Analyzers" not in exclude_tabs: tabs.append( OverlayTabDefinition("Analyzers", "analyzers", enabled=categories and 'Analyze' in categories)) overlay_indexes.append(1) if "Visualizers" not in exclude_tabs: tabs.append( OverlayTabDefinition("Visualizers", "visualizers", enabled=categories and 'View' in categories)) overlay_indexes.append(2) enable_link_tab = False if (not entity.invalid) and (linkable_projects_dict is not None): projects_for_link = linkable_projects_dict.get( self.PRROJECTS_FOR_LINK_KEY) if projects_for_link is not None and len(projects_for_link) > 0: enable_link_tab = True projects_linked = linkable_projects_dict.get( self.PRROJECTS_LINKED_KEY) if projects_linked is not None and len(projects_linked) > 0: enable_link_tab = True if "Links" not in exclude_tabs: tabs.append( OverlayTabDefinition("Links", "link_to", enabled=enable_link_tab)) overlay_indexes.append(3) if "Export" not in exclude_tabs: tabs.append( OverlayTabDefinition("Export", "export", enabled=(exporters and len(exporters) > 0))) overlay_indexes.append(4) template_specification = self.fill_overlay_attributes( template_specification, "DataType Details", overlay_title, "project/details_datatype_overlay", overlay_class, tabs, overlay_indexes) template_specification = self.flow_controller.fill_default_attributes( template_specification) if has_operations_warning: template_specification[common.KEY_MESSAGE] = 'Not all operations could be loaded for this input DataType.' \ ' Contact the admin to check the logs!' template_specification[common.KEY_MESSAGE_TYPE] = "warningMessage" return template_specification
def get_datatype_details(self, entity_gid, back_page='null', exclude_tabs=None): """ Returns the HTML which contains the details for the given dataType. :param back_page: if different from 'null' (the default) it will redirect to it after saving metedata changes """ if exclude_tabs is None: exclude_tabs = [] selected_project = common.get_current_project() datatype_details, states, entity = self.project_service.get_datatype_details( entity_gid) ### Load DataType categories current_type = datatype_details.data_type datatype_gid = datatype_details.gid categories = {} if not entity.invalid: categories = self._get_algorithms_for_datatype(str(datatype_gid)) is_group = False if datatype_details.operation_group_id is not None: ## Is a DataTypeGroup is_group = True ### Retrieve links linkable_projects_dict = self._get_linkable_projects_dict(entity.id) ### Load all exporters exporters = {} if not entity.invalid: exporters = ExportManager().get_exporters_for_data(entity) is_relevant = entity.visible template_specification = { "entity_gid": entity_gid, "nodeFields": datatype_details.get_ui_fields(), "allStates": states, "project": selected_project, "categories": categories, "exporters": exporters, "datatype_id": entity.id, "isGroup": is_group, "isRelevant": is_relevant, "nodeType": 'datatype', "backPageIdentifier": back_page } template_specification.update(linkable_projects_dict) overlay_class = "can-browse editor-node node-type-" + str( current_type).lower() if is_relevant: overlay_class += " node-relevant" else: overlay_class += " node_irrelevant" overlay_title = current_type if datatype_details.datatype_tag_1: overlay_title += " " + datatype_details.datatype_tag_1 tabs = [] overlay_indexes = [] if "Metadata" not in exclude_tabs: tabs.append(OverlayTabDefinition("Metadata", "metadata")) overlay_indexes.append(0) if "Analyzers" not in exclude_tabs: tabs.append( OverlayTabDefinition("Analyzers", "analyzers", enabled=categories and 'Analyze' in categories)) overlay_indexes.append(1) if "Visualizers" not in exclude_tabs: tabs.append( OverlayTabDefinition("Visualizers", "visualizers", enabled=categories and 'View' in categories)) overlay_indexes.append(2) enable_link_tab = False if (not entity.invalid) and (linkable_projects_dict is not None): projects_for_link = linkable_projects_dict.get( self.PRROJECTS_FOR_LINK_KEY) if projects_for_link is not None and len(projects_for_link) > 0: enable_link_tab = True projects_linked = linkable_projects_dict.get( self.PRROJECTS_LINKED_KEY) if projects_linked is not None and len(projects_linked) > 0: enable_link_tab = True if "Links" not in exclude_tabs: tabs.append( OverlayTabDefinition("Links", "link_to", enabled=enable_link_tab)) overlay_indexes.append(3) if "Export" not in exclude_tabs: tabs.append( OverlayTabDefinition("Export", "export", enabled=(exporters and len(exporters) > 0))) overlay_indexes.append(4) if "Derived DataTypes" not in exclude_tabs: tabs.append( OverlayTabDefinition( "Derived DataTypes", "result_dts", enabled=self.project_service. count_datatypes_generated_from(entity_gid))) overlay_indexes.append(5) template_specification = self.fill_overlay_attributes( template_specification, "DataType Details", overlay_title, "project/details_datatype_overlay", overlay_class, tabs, overlay_indexes) template_specification['baseUrl'] = TvbProfile.current.web.BASE_URL #template_specification[c.KEY_OVERLAY_PAGINATION] = True #template_specification[c.KEY_OVERLAY_PREVIOUS] = "alert(1);" #template_specification[c.KEY_OVERLAY_NEXT] = "alert(2);" return FlowController().fill_default_attributes(template_specification)