Skip to content

Commit f0ad237

Browse files
authored
Merge pull request galaxyproject#20957 from mvdbeek/landing_request_tracking
Allow sending and tracking landing request origin
2 parents 8c61eb6 + 77f2802 commit f0ad237

7 files changed

Lines changed: 84 additions & 0 deletions

File tree

client/src/api/schema/schema.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7913,6 +7913,8 @@ export interface components {
79137913
CreateDataLandingPayload: {
79147914
/** Client Secret */
79157915
client_secret?: string | null;
7916+
/** Origin */
7917+
origin?: string | null;
79167918
/**
79177919
* Public
79187920
* @default false
@@ -8362,6 +8364,11 @@ export interface components {
83628364
CreateToolLandingRequestPayload: {
83638365
/** Client Secret */
83648366
client_secret?: string | null;
8367+
/**
8368+
* Origin
8369+
* @description The origin of the landing request.
8370+
*/
8371+
origin?: string | null;
83658372
/**
83668373
* Public
83678374
* @default false
@@ -8429,6 +8436,11 @@ export interface components {
84298436
CreateWorkflowLandingRequestPayload: {
84308437
/** Client Secret */
84318438
client_secret?: string | null;
8439+
/**
8440+
* Origin
8441+
* @description The origin of the landing request.
8442+
*/
8443+
origin?: string | null;
84328444
/**
84338445
* Public
84348446
* @description If workflow landing request is public anyone with the uuid can use the landing request. If not public the request must be claimed before use and additional verification might occur.
@@ -20937,6 +20949,8 @@ export interface components {
2093720949
};
2093820950
/** ToolLandingRequest */
2093920951
ToolLandingRequest: {
20952+
/** Origin */
20953+
origin?: string | null;
2094020954
/** Request State */
2094120955
request_state?: {
2094220956
[key: string]: unknown;
@@ -23085,6 +23099,8 @@ export interface components {
2308523099
};
2308623100
/** WorkflowLandingRequest */
2308723101
WorkflowLandingRequest: {
23102+
/** Origin */
23103+
origin?: string | null;
2308823104
/** Request State */
2308923105
request_state: {
2309023106
[key: string]: unknown;

lib/galaxy/managers/landing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def create_tool_landing_request(self, payload: CreateToolLandingRequestPayload,
8989
model.uuid = uuid4()
9090
model.client_secret = payload.client_secret
9191
model.public = payload.public
92+
model.origin = str(payload.origin) if payload.origin else None
9293
if user_id:
9394
model.user_id = user_id
9495
self._save(model)
@@ -194,6 +195,7 @@ def _tool_response(self, model: ToolLandingRequestModel) -> ToolLandingRequest:
194195
request_state=model.request_state,
195196
uuid=model.uuid,
196197
state=self._state(model),
198+
origin=model.origin,
197199
)
198200
return response_model
199201

@@ -216,6 +218,7 @@ def _workflow_response(self, model: WorkflowLandingRequestModel) -> WorkflowLand
216218
request_state=model.request_state,
217219
uuid=model.uuid,
218220
state=self._state(model),
221+
origin=model.origin,
219222
)
220223
return response_model
221224

lib/galaxy/model/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11900,6 +11900,7 @@ class ToolLandingRequest(Base):
1190011900
request_state: Mapped[Optional[dict]] = mapped_column(JSONType)
1190111901
client_secret: Mapped[Optional[str]] = mapped_column(String(255), default=None)
1190211902
public: Mapped[bool] = mapped_column(Boolean)
11903+
origin: Mapped[Optional[str]] = mapped_column(String(255), default=None)
1190311904

1190411905
user: Mapped[Optional["User"]] = relationship()
1190511906

@@ -11925,6 +11926,7 @@ class WorkflowLandingRequest(Base):
1192511926
user: Mapped[Optional["User"]] = relationship()
1192611927
stored_workflow: Mapped[Optional["StoredWorkflow"]] = relationship()
1192711928
workflow: Mapped[Optional["Workflow"]] = relationship()
11929+
origin: Mapped[Optional[str]] = mapped_column(String(255), default=None)
1192811930

1192911931

1193011932
class UserAction(Base, RepresentById):
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Add origin column to landing request tables
2+
3+
Revision ID: 81362686fd64
4+
Revises: c0959ad462b2
5+
Create Date: 2025-09-26 12:39:25.000000
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
11+
from galaxy.model.migrations.util import (
12+
add_column,
13+
drop_column,
14+
)
15+
16+
# revision identifiers, used by Alembic.
17+
revision = "81362686fd64"
18+
down_revision = "c0959ad462b2"
19+
branch_labels = None
20+
depends_on = None
21+
22+
# database object names used in this revision
23+
tool_table_name = "tool_landing_request"
24+
workflow_table_name = "workflow_landing_request"
25+
column_name = "origin"
26+
27+
28+
def upgrade():
29+
# Add origin column to tool_landing_request table
30+
column = sa.Column(
31+
column_name,
32+
sa.String(255),
33+
nullable=True,
34+
default=None,
35+
)
36+
add_column(tool_table_name, column)
37+
38+
# Add origin column to workflow_landing_request table
39+
column = sa.Column(
40+
column_name,
41+
sa.String(255),
42+
nullable=True,
43+
default=None,
44+
)
45+
add_column(workflow_table_name, column)
46+
47+
48+
def downgrade():
49+
# Drop origin column from both tables
50+
drop_column(tool_table_name, column_name)
51+
drop_column(workflow_table_name, column_name)

lib/galaxy/schema/fetch_data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
ConfigDict,
1313
Field,
1414
field_validator,
15+
HttpUrl,
1516
Json,
1617
TypeAdapter,
1718
)
@@ -310,5 +311,6 @@ class CreateDataLandingPayload(Model):
310311
request_state: DataLandingRequestState
311312
client_secret: Optional[str] = None
312313
public: bool = False
314+
origin: Optional[HttpUrl] = None
313315

314316
model_config = ConfigDict(extra="forbid")

lib/galaxy/schema/schema.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
BeforeValidator,
2222
ConfigDict,
2323
Field,
24+
HttpUrl,
2425
Json,
2526
model_validator,
2627
RootModel,
@@ -4102,6 +4103,7 @@ class CreateToolLandingRequestPayload(Model):
41024103
request_state: Optional[dict[str, Any]] = None
41034104
client_secret: Optional[str] = None
41044105
public: bool = False
4106+
origin: Optional[HttpUrl] = Field(None, description="The origin of the landing request.")
41054107

41064108

41074109
class CreateWorkflowLandingRequestPayload(Model):
@@ -4113,6 +4115,7 @@ class CreateWorkflowLandingRequestPayload(Model):
41134115
False,
41144116
description="If workflow landing request is public anyone with the uuid can use the landing request. If not public the request must be claimed before use and additional verification might occur.",
41154117
)
4118+
origin: Optional[HttpUrl] = Field(None, description="The origin of the landing request.")
41164119

41174120

41184121
class ClaimLandingPayload(Model):
@@ -4125,6 +4128,7 @@ class ToolLandingRequest(Model):
41254128
tool_version: Optional[str] = None
41264129
request_state: Optional[dict[str, Any]] = None
41274130
state: LandingRequestState
4131+
origin: Optional[HttpUrl] = None
41284132

41294133

41304134
class WorkflowLandingRequest(Model):
@@ -4133,6 +4137,7 @@ class WorkflowLandingRequest(Model):
41334137
workflow_target_type: Literal["stored_workflow", "workflow", "trs_url"]
41344138
request_state: dict[str, Any]
41354139
state: LandingRequestState
4140+
origin: Optional[HttpUrl] = None
41364141

41374142

41384143
class MessageExceptionModel(BaseModel):

lib/galaxy_test/api/test_landing.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Any,
44
)
55

6+
from pydantic import HttpUrl
7+
68
from galaxy.schema.fetch_data import (
79
CreateDataLandingPayload,
810
DataLandingRequestState,
@@ -39,13 +41,16 @@ def test_tool_landing(self):
3941
tool_id="create_2",
4042
tool_version=None,
4143
request_state={"sleep_time": 0},
44+
origin=HttpUrl("http://example.localhost/"),
4245
)
4346
response = self.dataset_populator.create_tool_landing(request)
4447
assert response.tool_id == "create_2"
4548
assert response.state == "unclaimed"
49+
assert str(response.origin) == "http://example.localhost/"
4650
response = self.dataset_populator.claim_tool_landing(response.uuid)
4751
assert response.tool_id == "create_2"
4852
assert response.state == "claimed"
53+
assert str(response.origin) == "http://example.localhost/"
4954

5055
@skip_without_tool("gx_int")
5156
def test_tool_landing_invalid(self):

0 commit comments

Comments
 (0)