Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 1.10.0 webank #698

Merged
merged 13 commits into from
Dec 31, 2024
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
@@ -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"
}
}
}
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
@@ -89,7 +89,8 @@
"XGHS": "修改函数",
"XG": "修改",
"QPZS": "全屏展示",
"QXQP": "取消全屏"
"QXQP": "取消全屏",
"XZHS": "选择函数"
}
}
}
Original file line number Diff line number Diff line change
@@ -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')"
@@ -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')"
@@ -268,6 +283,7 @@ export default {
isCommon: false,
isCustom: true,
},
registerFunctions: [],
TYPELIB: {
jar: 0,
Spark: {
@@ -308,6 +324,8 @@ export default {
directory: ''
},
isShareLoading: false,

registerFunctionEditable: true,
rules: {
name: [
{ required: true, message: this.$t('message.linkis.udf.QSRMC'), trigger: 'blur' },
@@ -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')];
@@ -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'
@@ -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;
// }
});
},

@@ -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() {
@@ -697,6 +751,8 @@ export default {
};
this.showScalaRF = '';
this.showScalaUF = '';
this.registerFunctions = [];
this.registerFunctionEditable = true;
},

getDir() {