Skip to content

Commit

Permalink
Dev 1.10.0 webank (#696)
Browse files Browse the repository at this point in the history
* chore: 1.9.0

* feat: 1.10.0

* fix

* upd: 新增loading展示

* fix: udf类型判断条件修复

* fix: 注册函数展示逻辑修复

* upd: 函数管理新增/编辑支持kill引擎

* upd: license缩进调整

* upd: 函数管理交互更新
  • Loading branch information
mayinrain authored Dec 31, 2024
1 parent a732908 commit f2710b4
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 8 deletions.
3 changes: 2 additions & 1 deletion linkis-web/src/apps/URM/i18n/common/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"XGHS": "Update Funtion",
"XG": "Update",
"QPZS": "View in Full Screen",
"QXQP": "Cancel Full Screen"
"QXQP": "Cancel Full Screen",
"XZHS": "Select Function"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion linkis-web/src/apps/URM/i18n/common/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"XGHS": "修改函数",
"XG": "修改",
"QPZS": "全屏展示",
"QXQP": "取消全屏"
"QXQP": "取消全屏",
"XZHS": "选择函数"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-->

<template>
<Modal
Expand All @@ -39,7 +39,7 @@
<FormItem
:label="$t('message.linkis.udf.functionName')"
prop="name">
<Input v-model="setting.name" :disabled="model === 1" />
<Input v-model="setting.name" :disabled="model === 1 || !registerFunctionEditable" />
</FormItem>
<FormItem
:label="$t('message.linkis.udf.functionType')"
Expand Down Expand Up @@ -95,6 +95,21 @@
fs-type="share"
@set-node="setNodePath"/>
</FormItem>
<FormItem
v-if="registerFunctions.length > 0 && model !== 1"
:label="$t('message.linkis.udf.XZHS')"
prop="name">
<Select
v-model="setting.name"
@on-change="handleFuncChange"
filterable>
<Option
v-for="(item) in registerFunctions"
:label="item"
:value="item"
:key="item"/>
</Select>
</FormItem>
<!-- <FormItem
v-if="fnType === 0 && fnCategory.isCommon"
:label="$t('message.linkis.udf.registerFormat')"
Expand Down Expand Up @@ -268,6 +283,7 @@ export default {
isCommon: false,
isCustom: true,
},
registerFunctions: [],
TYPELIB: {
jar: 0,
Spark: {
Expand Down Expand Up @@ -308,6 +324,8 @@ export default {
directory: ''
},
isShareLoading: false,

registerFunctionEditable: true,
rules: {
name: [
{ required: true, message: this.$t('message.linkis.udf.QSRMC'), trigger: 'blur' },
Expand Down Expand Up @@ -514,6 +532,11 @@ export default {
getHeight() {
this.resize(window.innerHeight);
},
handleFuncChange(val) {
if(this.model !== 1) {
this.setting.name = val;
}
},
open(node) {
this.resetData();
const titleMap = [this.$t('message.linkis.udf.addFunction'), this.$t('message.linkis.udf.updateFunction')];
Expand All @@ -531,7 +554,10 @@ export default {
this.title = titleMap[this.model];
this.btnLabel = btnLabelMap[this.model];
},

async getRegisterFunction(path) {
const res = await api.fetch('/udf/get-register-functions', { path }, 'get');
return res.functions
},
init() {
let { name, shared, description, path, udfName, directory, udfType, registerFormat, load, useFormat } = this.node;
let fnType = 'Spark'
Expand All @@ -556,6 +582,18 @@ export default {
});
this.$nextTick(() => {
this.$set(this.setting, this.getTypes(), path);
// try {
// this.registerFunctions = await this.getRegisterFunction(path);
// if(this.registerFunctions.length !== 0) {
// this.registerFunctionEditable = false;
// } else {
// this.registerFunctionEditable = true;
// }
// } catch (err) {
// window.console.error(err);
// this.registerFunctions = [];
// this.registerFunctionEditable = true;
// }
});
},

Expand Down Expand Up @@ -631,7 +669,7 @@ export default {
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 });
Expand Down Expand Up @@ -659,8 +697,24 @@ export default {
this.modalHeight = h - 380 + 'px';
},

setNodePath(node) {
async setNodePath(node) {
this.$set(this.setting, this.getTypes(), node.path);
if(this.model !== 1) {
try {
this.registerFunctions = await this.getRegisterFunction(node.path);
if(this.registerFunctions.length !== 0) {
this.registerFunctionEditable = false;
this.setting.name = '';
} else {
this.registerFunctionEditable = true;
}
} catch (err) {
window.console.error(err);
this.registerFunctions = [];
this.registerFunctionEditable = true;
}
}

},

getTypes() {
Expand Down Expand Up @@ -697,6 +751,8 @@ export default {
};
this.showScalaRF = '';
this.showScalaUF = '';
this.registerFunctions = [];
this.registerFunctionEditable = true;
},

getDir() {
Expand Down
24 changes: 23 additions & 1 deletion linkis-web/src/apps/URM/module/functionManagement/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-->

<template>
<div class="function-management">
Expand Down Expand Up @@ -389,6 +389,9 @@ export default {
this.search()
this.isLoading = false
this.loading = false
if (data.defaultLoad) {
this.confirmKillIdle(data)
}
})
.catch(() => {
// this.list = [{}]
Expand Down Expand Up @@ -422,6 +425,9 @@ export default {
this.loading = false
this.search()
this.$Message.success(this.$t('message.linkis.udf.success'));
if (data.defaultLoad) {
this.confirmKillIdle(data)
}
})
.catch(() => {
this.isLoading = false
Expand Down Expand Up @@ -663,6 +669,22 @@ export default {
})
}
},
confirmKillIdle(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: [1, 2].includes(data.udfType) ? 'spark' : '*'
})
} catch (err) {
window.console.warn(err)
}
}
})
},
getShareUsers() {
return api.fetch('/udf/getSharedUsers', {udfId: this.handleRow.id}, 'post')
},
Expand Down

0 comments on commit f2710b4

Please sign in to comment.