diff --git a/linkis-web/package.json b/linkis-web/package.json index 12f4ca8b33..30481a2c1a 100644 --- a/linkis-web/package.json +++ b/linkis-web/package.json @@ -1,6 +1,6 @@ { "name": "linkis", - "version": "1.4.0", + "version": "1.10.0", "private": true, "scripts": { "serve": "vue-cli-service serve", @@ -25,7 +25,7 @@ }, "dependencies": { "@form-create/iview": "2.5.27", - "axios": "0.28.1", + "axios": "1.7.4", "dexie": "3.2.3", "dt-sql-parser": "3.0.5", "highlight.js": "10.7.0", @@ -49,7 +49,9 @@ "vue-router": "3.4.8", "vuedraggable": "2.24.3", "vuescroll": "4.16.1", - "worker-loader": "3.0.8" + "worker-loader": "3.0.8", + "xterm": "5.3.0", + "xterm-addon-fit": "0.8.0" }, "devDependencies": { "@intlify/vue-i18n-loader": "1.0.0", diff --git a/linkis-web/src/apps/PythonModule/.npmrc b/linkis-web/src/apps/PythonModule/.npmrc deleted file mode 100644 index dd4617f0fa..0000000000 --- a/linkis-web/src/apps/PythonModule/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -registry=http://wnpm.weoa.com:8001 -shamefully-hoist=true \ No newline at end of file diff --git a/linkis-web/src/apps/URM/i18n/common/en.json b/linkis-web/src/apps/URM/i18n/common/en.json index f6f8319cc8..5b4c887a00 100644 --- a/linkis-web/src/apps/URM/i18n/common/en.json +++ b/linkis-web/src/apps/URM/i18n/common/en.json @@ -60,6 +60,7 @@ "no": "No", "sprak": "sprak", "jarPackage": "jar Package", + "registerFunc": "Register Function", "scriptPath": "Script Path", "registerFunction": "Register Function", "registerFormat": "Register Format", diff --git a/linkis-web/src/apps/URM/i18n/common/zh.json b/linkis-web/src/apps/URM/i18n/common/zh.json index 942c66a7e2..2c6896869a 100644 --- a/linkis-web/src/apps/URM/i18n/common/zh.json +++ b/linkis-web/src/apps/URM/i18n/common/zh.json @@ -60,6 +60,7 @@ "no": "否", "sprak": "sprak", "jarPackage": "jar包", + "registerFunc": "注册函数", "scriptPath": "脚本路径", "registerFunction": "注册的函数", "registerFormat": "注册格式", diff --git a/linkis-web/src/apps/URM/module/udfManagement/addFunctionModal.vue b/linkis-web/src/apps/URM/module/udfManagement/addFunctionModal.vue index 8f12aee69e..1dd8b22966 100644 --- a/linkis-web/src/apps/URM/module/udfManagement/addFunctionModal.vue +++ b/linkis-web/src/apps/URM/module/udfManagement/addFunctionModal.vue @@ -96,6 +96,38 @@ fs-type="share" @set-node="setNodePath"/> + + + + + + + + + + @@ -288,6 +322,8 @@ export default { }, }, title: '', + registerFunctions: [], + registerFunctionEditable: true, show: false, btnLabel: this.$t('message.common.ok'), modalHeight: '', @@ -552,7 +588,11 @@ export default { }; } }, - + handleFuncChange(val) { + if(this.model !== 1) { + this.setting.name = val; + } + }, init() { let { name, shared, description, path, udfName, directory, udfType, registerFormat, load, useFormat } = this.node; let fnType = 'Spark' @@ -575,9 +615,26 @@ export default { fnType, defaultLoad: !!load }); - this.$nextTick(() => { + this.$nextTick(async () => { this.$set(this.setting, this.getTypes(), path); + this.registerFunctionEditable = false; + if(this.getTypes() !== 'jarPath') { + if (/^[\w\u4e00-\u9fa5:.\\/]*(py|scala)$/.test(path)) { + try { + this.registerFunctions = await this.getRegisterFunction(path); + if(this.registerFunctions.length !== 0) { + this.registerFunctionEditable = false; + } + } catch (err) { + window.console.error(err); + this.registerFunctions = []; + this.registerFunctionEditable = true; + } + } + + } }); + }, close() { @@ -594,27 +651,31 @@ export default { } else if (this.node.udfType === 1) { this.setting.pyPara = conver(',', ')', 'indexOf', 'lastIndexOf'); } else { - const type = rf.slice(rf.indexOf('[') + 1, rf.indexOf(']')); + const typeStart = rf.indexOf('[') + 1; + const typeEnd = rf.lastIndexOf(']'); + const type = rf.slice(typeStart, typeEnd); window.console.log(type, rf, '====='); - // 如果存在多个逗号,就只用使用格式来截取,否则会出现多个类型填入input异常的问题 - if (type.indexOf(',') !== type.lastIndexOf(',')) { - // there are 2 case: - // 1. tuple, return params in (); - // 2. multi params, the first params is return params - if (type.indexOf('(') !== -1) { - // tuple - this.setting.scalaTypeL = type.slice(type.indexOf('('), type.indexOf(')') + 1) - this.setting.scalaTypeR = type.slice(type.indexOf(')')+2) - } else { - // multi params - this.setting.scalaTypeL = type.split(',')[0]; - this.setting.scalaTypeR = type.split(',').slice(1).toString(); + const findFirstValidComma = (str) => { + let brackets = 0; + for (let i = 0; i < str.length; i++) { + const char = str[i]; + // 计算所有类型的括号 + if (char === '[' || char === '(') brackets++; + if (char === ']' || char === ')') brackets--; + // 只在最外层找逗号 + if (char === ',' && brackets === 0) return i; } + return -1; + }; - this.showScalaRF = this.node.registerFormat; + const commaPos = findFirstValidComma(type); + + if (commaPos !== -1) { + this.setting.scalaTypeL = type.slice(0, commaPos).trim(); + this.setting.scalaTypeR = type.slice(commaPos + 1).trim(); } else { - this.setting.scalaTypeL = conver('[', ',', 'indexOf', 'indexOf'); - this.setting.scalaTypeR = conver(',', ']', 'indexOf', 'indexOf'); + this.setting.scalaTypeL = type.trim(); + this.setting.scalaTypeR = ''; } this.setting.scalapara = conver(',', ')', 'lastIndexOf', 'lastIndexOf'); } @@ -635,7 +696,6 @@ export default { this.$set(this.setting, `${type}R`, right); } }, - handleShareChange() { if (!this.isShareLoading) { this.isShareLoading = true; @@ -662,10 +722,10 @@ export default { udfType: this.fnType, isLeaf: true, directory, - clusterName + clusterName, }; if (this.model) { - postData = Object.assign(postData, { shared: false }); + postData = Object.assign(postData, { shared: false, defaultLoad }); this.$emit('update', postData); } else { postData = Object.assign(postData, { defaultLoad }); @@ -692,12 +752,36 @@ export default { resize(h) { this.modalHeight = h - 380 + 'px'; }, + // 获取注册函数 + async getRegisterFunction(path) { + const res = await api.fetch('/udf/get-register-functions', { path }, 'get'); + return res.functions + }, - setNodePath(node) { + async setNodePath(node) { ['jarPath', 'sparkPath', 'customPath'].forEach(item => { const temp = item === this.getTypes() ? node.path : ''; this.$set(this.setting, item, temp); }) + if(this.getTypes() !== 'jarPath') { + + + if (/^[\w\u4e00-\u9fa5:.\\/]*(py|scala)$/.test(node.path)) { + try { + this.registerFunctions = await this.getRegisterFunction(node.path); + if(this.registerFunctions.length !== 0) { + this.registerFunctionEditable = false; + } + } catch (err) { + window.console.error(err); + this.registerFunctions = []; + this.registerFunctionEditable = true; + } + } + + + } + }, getTypes() { diff --git a/linkis-web/src/apps/URM/module/udfManagement/index.vue b/linkis-web/src/apps/URM/module/udfManagement/index.vue index 870b6ddf2c..fc28df901a 100644 --- a/linkis-web/src/apps/URM/module/udfManagement/index.vue +++ b/linkis-web/src/apps/URM/module/udfManagement/index.vue @@ -360,7 +360,7 @@ export default { } }, // 新增函数 - addFunction(data) { + async addFunction(data) { if (this.loading) return this.loading = true; const params = { @@ -377,19 +377,24 @@ export default { clusterName: data.clusterName, directory: data.directory } - api + await api .fetch('/udf/add', {udfAddVo: params}, 'post') .then(() => { this.showAddModal(false) this.search() this.isLoading = false this.loading = false + if (data.defaultLoad) { + this.confirmKillIdle(data) + } }) .catch(() => { // this.list = [{}] this.loading = false this.isLoading = false + }) + }, // 更新 updateFunction(data) { @@ -417,12 +422,34 @@ export default { this.loading = false this.search() this.$Message.success(this.$t('message.linkis.udf.success')); + + console.log(data); + if (data.defaultLoad) { + this.confirmKillIdle(data) + } }) .catch(() => { this.isLoading = false this.loading = false }) }, + confirmKillIdle(data) { + console.log(data); + this.$Modal.confirm({ + title: this.$t('message.linkis.setting.killEngineTitle'), + content: this.$t('message.linkis.setting.killEngine'), + onOk: async () => { + try { + api.fetch("/linkisManager/rm/killEngineByCreatorEngineType", { + creator: '*', + engineType: data.udfType === 1 ? 'spark' : '*' + }) + } catch (err) { + window.console.warn(err) + } + } + }) + }, checkChange(v) { this.list = this.list.map(it => { it.checked = !it.disabled && v diff --git a/linkis-web/src/apps/linkis/i18n/common/en.json b/linkis-web/src/apps/linkis/i18n/common/en.json index 0f036dfeda..d65c595d6e 100644 --- a/linkis-web/src/apps/linkis/i18n/common/en.json +++ b/linkis-web/src/apps/linkis/i18n/common/en.json @@ -1,6 +1,7 @@ { "message": { "linkis": { + "diagnosticLog": "Diagnostic Log", "refresh": "Refresh", "tableSetting": "Table Setting", "downloadLog": "Download", diff --git a/linkis-web/src/apps/linkis/i18n/common/zh.json b/linkis-web/src/apps/linkis/i18n/common/zh.json index 1207ff676c..d8949eead2 100644 --- a/linkis-web/src/apps/linkis/i18n/common/zh.json +++ b/linkis-web/src/apps/linkis/i18n/common/zh.json @@ -1,6 +1,7 @@ { "message": { "linkis": { + "diagnosticLog": "诊断日志", "refresh": "刷新", "findNewVer": "检测到新版本", "whetherUpdateNow": "是否立即更新?", diff --git a/linkis-web/src/apps/linkis/module/globalHistoryManagement/viewHistory.vue b/linkis-web/src/apps/linkis/module/globalHistoryManagement/viewHistory.vue index 56725cbf15..83e62d0002 100644 --- a/linkis-web/src/apps/linkis/module/globalHistoryManagement/viewHistory.vue +++ b/linkis-web/src/apps/linkis/module/globalHistoryManagement/viewHistory.vue @@ -1,3 +1,4 @@ + + @@ -22,7 +24,8 @@ - + + {{foldFlag ? $t('message.linkis.unfold') : $t('message.linkis.fold')}} @@ -46,11 +49,13 @@ :visualParams="visualParams" /> + + + \ No newline at end of file