From c36bfd538a1605cea95ae2a9b296c5d1d17ae15d Mon Sep 17 00:00:00 2001 From: keeshii Date: Thu, 31 Oct 2024 22:02:33 +0100 Subject: [PATCH] script editor - ask for file name, wizard step number validation --- interface/resources/serverless/Scripts/Wizard.qml | 4 ++-- scripts/system/create/scriptEditor/scriptEditor.js | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/interface/resources/serverless/Scripts/Wizard.qml b/interface/resources/serverless/Scripts/Wizard.qml index f258de9247b..b6650a48ea3 100644 --- a/interface/resources/serverless/Scripts/Wizard.qml +++ b/interface/resources/serverless/Scripts/Wizard.qml @@ -31,7 +31,6 @@ Rectangle { property bool keyboardRaised: false function setStep(stepNum) { - stepList.completed = stepNum switch (stepNum) { case 0: loader.sourceComponent = step1; @@ -49,8 +48,9 @@ Rectangle { loader.sourceComponent = step5; break; default: - loader.setSource(undefined); + return; } + stepList.completed = stepNum; } function completeWizard() { diff --git a/scripts/system/create/scriptEditor/scriptEditor.js b/scripts/system/create/scriptEditor/scriptEditor.js index 313b6f08741..82c9a3bcf59 100644 --- a/scripts/system/create/scriptEditor/scriptEditor.js +++ b/scripts/system/create/scriptEditor/scriptEditor.js @@ -430,16 +430,21 @@ return; } + if (url.match(/(file|https?):\/\//)) { + fileName = this.getFileNameFromUrl(url); + } + // Script will be copied to the Asset Server - var proceed = Window.confirm("The script will be copied to the Asset Server and may overwrite some other files. Say YES if you want to proceed."); - if (!proceed) { + var answer = Window.prompt( + "The script will be copied to the Asset Server " + + "and may overwrite some other files. Enter file name.", fileName); + if (!answer) { return; } + fileName = answer; var content = url || ' '; if (url.match(/(file|https?):\/\//)) { - fileName = this.getFileNameFromUrl(url); - content = this.downloadFileFromUrl(url); if (content === undefined) { Window.alert("Unable to download the file.");