From bbd27c32cbee00ede787f0de9e7ab24d271bd140 Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Fri, 7 Mar 2025 15:50:45 +0000 Subject: [PATCH] lab: open log files in Jupyter Lab * Offers an "open in Jupyter Lab" button in the Log view (when Jupyter Lab is installed). * Works with https://github.com/oliver-sanders/cylc-jupyterlab-extension --- src/components/Markdown.vue | 5 +- src/components/core/Alert.vue | 16 ++++- src/components/cylc/JupyterLauncher.vue | 93 +++++++++++++++++++++++++ src/model/Alert.model.js | 3 +- src/views/Log.vue | 8 +++ 5 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 src/components/cylc/JupyterLauncher.vue diff --git a/src/components/Markdown.vue b/src/components/Markdown.vue index 87799da48..4c973e87c 100644 --- a/src/components/Markdown.vue +++ b/src/components/Markdown.vue @@ -26,7 +26,10 @@ diff --git a/src/model/Alert.model.js b/src/model/Alert.model.js index 6b609e7fb..e16c1fcef 100644 --- a/src/model/Alert.model.js +++ b/src/model/Alert.model.js @@ -22,9 +22,10 @@ export class Alert { * @param {string} color - color of the displayed alert. * @param {?string} msg - a custom message to display in the alert instead of err. */ - constructor (err, color, msg = null) { + constructor (err, color, msg = null, timeout = 10000) { this.err = err this.text = msg || err this.color = color + this.timeout = timeout } } diff --git a/src/views/Log.vue b/src/views/Log.vue index 9a0e81ed6..09901439a 100644 --- a/src/views/Log.vue +++ b/src/views/Log.vue @@ -125,6 +125,7 @@ along with this program. If not, see . > {{ results.connected ? 'Connected' : 'Reconnect' }} +
results.value.path?.substring(0, results.value.path.length - file.value.length - 1) ) + const urlSafePath = computed( + () => encodeURIComponent(`${parentPath.value}/${file.value}`) + ) + whenever( () => store.state.offline, () => { results.value.connected = false } @@ -406,6 +413,7 @@ export default { debouncedUpdateRelativeID, toolbarBtnSize, toolbarBtnProps: btnProps(toolbarBtnSize), + urlSafePath, } },