Skip to content

Commit

Permalink
Tmp extra
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinugu committed Oct 27, 2023
1 parent 7970c45 commit 31f6171
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 71 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,8 @@ involucro
.DS_Store
*.rej
*~

# Syncthing
.stignore
.stfolder
.stversions
7 changes: 7 additions & 0 deletions client/src/components/Tool/ToolInteractiveClient.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
@onSetError="onSetError"
@updatePreferredObjectStoreId="onUpdatePreferredObjectStoreId">
<template v-slot:extra-tool-options-items>
<b-dropdown-item @click="openClientTool">
<FontAwesomeIcon icon="fa-table-list" /><span v-localize>Open Client tool form</span>
</b-dropdown-item>
<b-dropdown-item :disabled="!serviceToolExists" @click="openServiceTool">
<FontAwesomeIcon icon="fa-wrench" /><span v-localize>Open Service tool</span>
</b-dropdown-item>
Expand Down Expand Up @@ -428,6 +431,10 @@ export default {
}
return iframeSrc;
},
openClientTool() {
// const { data } = await axios.post(this.serviceToolEntryPointTarget, this.clientToolParams);
this.$router.push(`/root?tool_id=${this.toolConfig.id}&tool_version=${this.toolConfig.version}`);
},
openServiceTool() {
this.$router.push(`/root?tool_id=${this.serviceToolId}&tool_version=${this.serviceToolVersion}`);
},
Expand Down
3 changes: 3 additions & 0 deletions lib/galaxy/managers/interactivetool.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ def create_entry_points(self, job, tool, entry_points=None, flush=True):
tool_port=entry["port"],
entry_url=entry["url"],
name=entry["name"],
label=entry["label"],
requires_domain=entry["requires_domain"],
requires_path_in_url=entry["requires_path_in_url"],
requires_path_in_header_named=entry["requires_path_in_header_named"],
short_token=self.app.config.interactivetools_shorten_url,
)
self.sa_session.add(ep)
Expand Down
16 changes: 15 additions & 1 deletion lib/galaxy/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2663,17 +2663,21 @@ class InteractiveToolEntryPoint(Base, Dictifiable, RepresentById):
protocol = Column(TEXT)
entry_url = Column(TEXT)
requires_domain = Column(Boolean, default=True)
requires_path_in_url = Column(Boolean, default=False)
requires_path_in_header_named = Column(TEXT)
info = Column(MutableJSONType, nullable=True)
configured = Column(Boolean, default=False)
deleted = Column(Boolean, default=False)
created_time = Column(DateTime, default=now)
modified_time = Column(DateTime, default=now, onupdate=now)
label = Column(TEXT)
job = relationship("Job", back_populates="interactivetool_entry_points", uselist=False)

dict_collection_visible_keys = [
"id",
"job_id",
"name",
"label",
"active",
"created_time",
"modified_time",
Expand All @@ -2683,15 +2687,25 @@ class InteractiveToolEntryPoint(Base, Dictifiable, RepresentById):
"id",
"job_id",
"name",
"label",
"active",
"created_time",
"modified_time",
"output_datasets_ids",
]

def __init__(self, requires_domain=True, configured=False, deleted=False, short_token=False, **kwd):
def __init__(
self,
requires_domain=True,
requires_path_in_url=False,
configured=False,
deleted=False,
short_token=False,
**kwd,
):
super().__init__(**kwd)
self.requires_domain = requires_domain
self.requires_path_in_url = requires_path_in_url
self.configured = configured
self.deleted = deleted
if short_token:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
"""add label, requires_path_in_url and requires_path_in_header_named columns to interactivetool_entry_point

Check failure on line 1 in lib/galaxy/model/migrations/alembic/versions_gxy/8a19186a6ee7_add_columns_to_interactivetool_entry_point.py

View workflow job for this annotation

GitHub Actions / Test (3.7)

Imports are incorrectly sorted and/or formatted.

Check failure on line 1 in lib/galaxy/model/migrations/alembic/versions_gxy/8a19186a6ee7_add_columns_to_interactivetool_entry_point.py

View workflow job for this annotation

GitHub Actions / Test (3.11)

Imports are incorrectly sorted and/or formatted.
Revision ID: 8a19186a6ee7
Revises: 92fb564c7095
Create Date: 2023-10-15 22:09:32.888292
"""
from sqlalchemy import Column, Text, Boolean

from galaxy.model.migrations.util import (
add_column,
drop_column,
)

# revision identifiers, used by Alembic.
revision = "8a19186a6ee7"
down_revision = "92fb564c7095"
branch_labels = None
depends_on = None

# database object names used in this revision
table_name = "interactivetool_entry_point"
label_column_name = "label"
requires_path_in_url_colname = "requires_path_in_url"
requires_path_in_header_named_colname = "requires_path_in_header_named"


def upgrade():
add_column(table_name, Column(label_column_name, Text()))
add_column(table_name, Column(requires_path_in_url_colname, Boolean(), default=False))
add_column(table_name, Column(requires_path_in_header_named_colname, Text()))


def downgrade():
drop_column(table_name, requires_path_in_header_named_colname)
drop_column(table_name, requires_path_in_url_colname)
drop_column(table_name, label_column_name)
19 changes: 18 additions & 1 deletion lib/galaxy/tool_util/parser/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,25 @@ def parse_interactivetool(self):
name = ep_el.get("name", None)
if name:
name = name.strip()
label = ep_el.get("label", None)
if label:
label = label.strip()
requires_domain = string_as_bool(ep_el.attrib.get("requires_domain", False))
rtt.append(dict(port=port, url=url, name=name, requires_domain=requires_domain))
requires_path_in_url = string_as_bool(ep_el.attrib.get("requires_path_in_url", False))
requires_path_in_header_named = ep_el.get("requires_path_in_header_named", None)
if requires_path_in_header_named:
requires_path_in_header_named = requires_path_in_header_named.strip()
rtt.append(
dict(
port=port,
url=url,
name=name,
label=label,
requires_domain=requires_domain,
requires_path_in_url=requires_path_in_url,
requires_path_in_header_named=requires_path_in_header_named,
)
)
return rtt

def parse_hidden(self):
Expand Down
39 changes: 35 additions & 4 deletions lib/galaxy/tool_util/xsd/galaxy.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ to provide access to graphical tools in real-time.
```xml
<entry_points>
<entry_point name="Example name">
<entry_point name="Example name" label="example">
<port>80</port>
<url>landing/${template_enabled}/index.html</url>
</entry_point>
Expand All @@ -385,12 +385,43 @@ to provide access to graphical tools in real-time.
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation xml:lang="en">This value defines the name of the entry point.</xs:documentation>
<xs:documentation xml:lang="en">The name of the entry point.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="requires_domain" type="PermissiveBoolean" default="false">
<xs:attribute name="label" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation xml:lang="en">This value declares if domain-based proxying is required. Default is False. Currently only works when True.</xs:documentation>
<xs:documentation xml:lang="en">A unique label to identify the entry point. Used by interactive client tools to connect.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="requires_domain" type="PermissiveBoolean" default="true">
<xs:annotation>
<xs:documentation xml:lang="en">Whether domain-based proxying is required for the entry point. Default is True.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="requires_path_in_url" type="PermissiveBoolean" default="false">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
Whether the InteractiveTool proxy will add the entry point path to the URL provided to the interactive tool. Only
relevant when path-based proxying is configured (``requires_domain=False``). A value of False implies that the web service
for the interactive tool fully operates with relative links. A value of True implies that the unique entry point path,
which is autogenerated each run, must be somehow provided to the web service. This can be done by injecting the path
into an environment variable by setting the attribute ``inject="entry_point_path"`` in the tool XML.
Alternatively, the attribute ``requires_path_in_header_named`` can be set to provide the path in the specified HTTP header.
The entry point path should in any case be used to configure the web service in the interactive tool to serve the content
from the provided URL path. Default value of ``requires_path_in_url`` is False.
]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="requires_path_in_header_named" type="xs:string" default="">
<xs:annotation>
<xs:documentation xml:lang="en"><![CDATA[
Whether the InteractiveTool proxy will add the entry point path to an HTTP header. An empty string as value (default) means
that the path will not be provided in an HTTP header. Any other string value will define the name of the HTTP header
where the path will be injected by the proxy. See the documentation of ``requires_path_in_url`` for more information.
Default value of ``requires_path_in_header_named`` is False.
]]>
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
Expand Down
10 changes: 9 additions & 1 deletion lib/galaxy/tools/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,15 @@ def populate_interactivetools(self):
it = []
for ep in getattr(self.tool, "ports", []):
ep_dict = {}
for key in "port", "name", "url", "requires_domain":
for key in (
"port",
"name",
"label",
"url",
"requires_domain",
"requires_path_in_url",
"requires_path_in_header_named",
):
val = ep.get(key, None)
if val is not None and not isinstance(val, bool):
val = fill_template(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
#EMBOSS format corrector
# EMBOSS format corrector

import operator
#from galaxy import datatypes

#Properly set file formats after job run
def exec_after_process( app, inp_data, out_data, param_dict,tool, stdout, stderr):
#Properly set file formats before job run
#def exec_before_job(trans, inp_data, out_data, param_dict,tool):
#why isn't items an ordered list?
# from galaxy import datatypes


# Properly set file formats after job run
def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
# Properly set file formats before job run
# def exec_before_job(trans, inp_data, out_data, param_dict,tool):
# why isn't items an ordered list?
items = out_data.items()
#lets sort it ourselves....
# lets sort it ourselves....
items = sorted(items, key=operator.itemgetter(0))
#items is now sorted...
#normal filetype correction
data_count=1
# items is now sorted...

# normal filetype correction
data_count = 1
for name, data in items:
outputType = param_dict.get( 'out_format'+str(data_count), None )
#print "data_count",data_count, "name", name, "outputType", outputType
if outputType !=None:
if outputType == 'ncbi':
outputType = param_dict.get("out_format" + str(data_count), None)
# print "data_count",data_count, "name", name, "outputType", outputType
if outputType != None:
if outputType == "ncbi":
outputType = "fasta"
elif outputType == 'excel':
elif outputType == "excel":
outputType = "tabular"
elif outputType == 'text':
elif outputType == "text":
outputType = "txt"
data = app.datatypes_registry.change_datatype(data, outputType)
app.model.context.add( data )
app.model.context.add(data)
app.model.context.flush()
data_count+=1
#html filetype correction
data_count=1
data_count += 1

# html filetype correction
data_count = 1
for name, data in items:
wants_plot = param_dict.get( 'html_out'+str(data_count), None )
wants_plot = param_dict.get("html_out" + str(data_count), None)
ext = "html"
if wants_plot == "yes":
data = app.datatypes_registry.change_datatype(data, ext)
app.model.context.add( data )
app.model.context.add(data)
app.model.context.flush()
data_count+=1
#png file correction
data_count=1
data_count += 1

# png file correction
data_count = 1
for name, data in items:
wants_plot = param_dict.get( 'plot'+str(data_count), None )
wants_plot = param_dict.get("plot" + str(data_count), None)
ext = "png"
if wants_plot == "yes":
data = app.datatypes_registry.change_datatype(data, ext)
app.model.context.add( data )
app.model.context.add(data)
app.model.context.flush()
data_count+=1
data_count += 1
Loading

0 comments on commit 31f6171

Please sign in to comment.