Skip to content

Commit

Permalink
Merge pull request #415 from MetRonnie/fix-route
Browse files Browse the repository at this point in the history
Fix URL for `cylc gui <workflow-id>`
  • Loading branch information
MetRonnie authored Jan 30, 2023
2 parents a8aa020 + 19797df commit c42857b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ creating a new release entry be sure to copy & paste the span tag with the
updated. Only the first match gets replaced, so it's fine to leave the old
ones in. -->
-------------------------------------------------------------------------------
## __cylc-uiserver-1.3.0 (<span actions:bind='release-date'>Pending</span>)__
## __cylc-uiserver-1.2.1 (<span actions:bind='release-date'>Pending</span>)__

<!-- [Updated cylc-ui to x.y.z](https://github.com/cylc/cylc-ui/blob/master/CHANGES.md) -->
[Updated cylc-ui to 1.5.0](https://github.com/cylc/cylc-ui/blob/master/CHANGES.md)

### Enhancements

Expand Down
2 changes: 1 addition & 1 deletion cylc/uiserver/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ def initialize_templates(self):
@classmethod
def launch_instance(cls, argv=None, workflow_id=None, **kwargs):
if workflow_id:
cls.default_url = f"/cylc/#/workflows/{workflow_id}"
cls.default_url = f"/cylc/#/workspace/{workflow_id}"
else:
cls.default_url = "/cylc"
if argv is None:
Expand Down
4 changes: 2 additions & 2 deletions cylc/uiserver/scripts/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def update_html_file(gui_file, workflow_id):
if not url_string:
return
url = url_string.group(1)
split_url = url.split('/workflows/')
split_url = url.split('/workspace/')
if not workflow_id:
# new url should point to dashboard
if len(split_url) == 1:
Expand All @@ -165,7 +165,7 @@ def update_html_file(gui_file, workflow_id):
replacement_url_string = url.replace(old_workflow, workflow_id)
else:
# current url points to dashboard, update to point to workflow
replacement_url_string = f"{url}/workflows/{workflow_id}"
replacement_url_string = f"{url}/workspace/{workflow_id}"
update_url_string(gui_file, url, replacement_url_string)


Expand Down
8 changes: 4 additions & 4 deletions cylc/uiserver/tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
pytest.param(
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#" /> ',
'some/workflow',
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workflows/some/workflow" /> ',
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workspace/some/workflow" /> ',
id='existing_no_workflow_new_workflow'
),
pytest.param(
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workflows/some/workflow" /> ',
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workspace/some/workflow" /> ',
'another/flow',
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workflows/another/flow" /> ',
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workspace/another/flow" /> ',
id='existing_workflow_new_workflow'
),
pytest.param(
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workflows/some/workflow" /> ',
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#/workspace/some/workflow" /> ',
None,
'content="1;url=http://localhost:8892/cylc/?token=1234567890some_big_long_token1234567890#" /> ',
id='existing_workflow_no_new_workflow'
Expand Down

0 comments on commit c42857b

Please sign in to comment.