diff --git a/backend/app/service/runtime.go b/backend/app/service/runtime.go
index c40f01b65..649fbd403 100644
--- a/backend/app/service/runtime.go
+++ b/backend/app/service/runtime.go
@@ -332,6 +332,24 @@ func (r *RuntimeService) Update(req request.RuntimeUpdate) error {
}
}
}
+
+ appDetail, err := appDetailRepo.GetFirst(commonRepo.WithByID(runtime.AppDetailID))
+ if err != nil {
+ return err
+ }
+ app, err := appRepo.GetFirst(commonRepo.WithByID(appDetail.AppId))
+ if err != nil {
+ return err
+ }
+ fileOp := files.NewFileOp()
+ appVersionDir := path.Join(constant.AppResourceDir, app.Resource, app.Key, appDetail.Version)
+ if !fileOp.Stat(appVersionDir) || appDetail.Update {
+ if err := downloadApp(app, appDetail, nil); err != nil {
+ return err
+ }
+ _ = fileOp.Rename(path.Join(runtime.GetPath(), "run.sh"), path.Join(runtime.GetPath(), "run.sh.bak"))
+ _ = fileOp.CopyFile(path.Join(appVersionDir, "run.sh"), runtime.GetPath())
+ }
}
projectDir := path.Join(constant.RuntimeDir, runtime.Type, runtime.Name)
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index b6c3c2405..59d9b78b5 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -1828,6 +1828,8 @@ const message = {
module: 'Module',
nodeOperatorHelper:
'Is {0} {1} module? The operation may cause abnormality in the operating environment, please confirm before proceeding',
+ customScript: 'Custom startup command',
+ customScriptHelper: 'Please fill in the complete startup command, for example: npm run start',
},
process: {
pid: 'Process ID',
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index cb6ed5944..46cc75e59 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -1724,6 +1724,8 @@ const message = {
moduleManager: '模塊管理',
module: '模塊',
nodeOperatorHelper: '是否{0} {1} 模組? 操作可能導致運轉環境異常,請確認後操作',
+ customScript: '自訂啟動指令',
+ customScriptHelper: '請填寫完整的啟動指令,例如:npm run start',
},
process: {
pid: '進程ID',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index 6cdeba110..08a77c5d0 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -1724,6 +1724,8 @@ const message = {
moduleManager: '模块管理',
module: '模块',
nodeOperatorHelper: '是否{0} {1} 模块?操作可能导致运行环境异常,请确认后操作',
+ customScript: '自定义启动命令',
+ customScriptHelper: '请填写完整的启动命令,例如:npm run start',
},
process: {
pid: '进程ID',
diff --git a/frontend/src/views/website/runtime/node/operate/index.vue b/frontend/src/views/website/runtime/node/operate/index.vue
index 3cc7a26b0..b5279fad9 100644
--- a/frontend/src/views/website/runtime/node/operate/index.vue
+++ b/frontend/src/views/website/runtime/node/operate/index.vue
@@ -65,22 +65,45 @@
-
-
-
-
- {{ script.name }}
- {{ ' 【 ' + script.script + ' 】' }}
-
-
-
- {{ $t('runtime.runScriptHelper') }}
-
+
+
+
+
+
+
+ {{ script.name }}
+ {{ ' 【 ' + script.script + ' 】' }}
+
+
+
+
+
+ {{ $t('runtime.runScriptHelper') }}
+
+
+ {{ $t('runtime.customScriptHelper') }}
+
+
+
+
+
+
+
+
+
@@ -94,13 +117,13 @@
{{ $t('runtime.externalPortHelper') }}
-
-
-
-
-
+
@@ -178,6 +201,7 @@ const initData = (type: string) => ({
params: {
PACKAGE_MANAGER: 'npm',
HOST_IP: '0.0.0.0',
+ CUSTOM_SCRIPT: '0',
},
type: type,
resource: 'appstore',
@@ -193,12 +217,14 @@ const rules = ref({
codeDir: [Rules.requiredInput],
port: [Rules.requiredInput, Rules.paramPort, checkNumberRange(1, 65535)],
source: [Rules.requiredSelect],
+
params: {
NODE_APP_PORT: [Rules.requiredInput, Rules.paramPort, checkNumberRange(1, 65535)],
PACKAGE_MANAGER: [Rules.requiredSelect],
HOST_IP: [Rules.requiredSelect],
EXEC_SCRIPT: [Rules.requiredSelect],
CONTAINER_NAME: [Rules.requiredInput, Rules.containerName],
+ CUSTOM_SCRIPT: [Rules.requiredInput],
},
});
const scripts = ref([]);
@@ -250,6 +276,13 @@ const getPath = (codeDir: string) => {
getScripts();
};
+const changeScriptType = () => {
+ runtime.params['EXEC_SCRIPT'] = '';
+ if (runtime.params['CUSTOM_SCRIPT'] == '0') {
+ getScripts();
+ }
+};
+
const getScripts = () => {
GetNodeScripts({ codeDir: runtime.codeDir }).then((res) => {
scripts.value = res.data;
@@ -359,10 +392,11 @@ const getRuntime = async (id: number) => {
port: data.port,
});
editParams.value = data.appParams;
- if (mode.value == 'edit') {
- searchApp(data.appID);
+ searchApp(data.appID);
+ if (data.params['CUSTOM_SCRIPT'] == '0') {
+ getScripts();
}
- getScripts();
+ open.value = true;
} catch (error) {}
};
@@ -372,10 +406,10 @@ const acceptParams = async (props: OperateRrops) => {
if (props.mode === 'create') {
Object.assign(runtime, initData(props.type));
searchApp(null);
+ open.value = true;
} else {
getRuntime(props.id);
}
- open.value = true;
};
defineExpose({