Skip to content

Commit 8f493c0

Browse files
z275748353张龙彬
andauthored
Add template deletion function (#1411)
* add dataflow * add dataflow * remove antv/x6/lib/registry package * Fix bugs * Fix bugs * add package * add package * add zhHantOps * 1.Adjust the image path for operator management 2.Add permission judgment on whether to display the menu in operator management * Operator Management: Modification of dataflow/operator/ interface * 1.Add the cancellation of execution for internationalization and status verification 2.If a user has no organization or no authorized operators, all public operators will be queried by default * 1.Add the cancellation of execution for internationalization and status verification 2.If a user has no organization or no authorized operators, all public operators will be queried by default * 1.Add the cancellation of execution for internationalization and status verification 2.If a user has no organization or no authorized operators, all public operators will be queried by default * Add newly developed operators, internationalize tools, and supplement the internationalization of statistics. * Add newly developed operators, internationalize tools, and supplement the internationalization of statistics. * 1.Add template deletion function 2.Celery node deletion (admin only, offline status) 3.Block the option of creating tool operators, set tools as default 4.Internationalization update * Fix the bug of dataflow with ID #36 --------- Co-authored-by: 张龙彬 <[email protected]>
1 parent 6b60124 commit 8f493c0

File tree

7 files changed

+98
-17
lines changed

7 files changed

+98
-17
lines changed

frontend/src/components/dataflow_config/algTemplate/customTemplate/index.vue

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
{{ t(`dataPipelines.${item.type}`) }}
7373
</div>
7474
<div class="flex">
75+
<div
76+
class="mr-[12px] hover:underline cursor-pointer"
77+
@click="delTemplate(item.name, item.id)"
78+
>
79+
{{ t('prompts.del') }}
80+
</div>
7581
<div
7682
class="mr-[12px] hover:underline cursor-pointer"
7783
@click="router.push(`/datapipelines/createTemplate?url=customize&type=copy&templateId=${item.id}`)"
@@ -109,7 +115,7 @@
109115
<script setup>
110116
import { useRouter } from "vue-router";
111117
import { ref, onMounted } from "vue";
112-
import { ElMessage } from "element-plus";
118+
import { ElMessage, ElMessageBox } from "element-plus";
113119
import useFetchApi from "../../../../packs/useFetchApi";
114120
import { useI18n } from "vue-i18n";
115121
@@ -131,7 +137,7 @@ const router = useRouter();
131137
132138
const searchForm = ref({
133139
page: 1,
134-
page_size: 100,
140+
page_size: 1000,
135141
buildin: false // true 内置
136142
})
137143
@@ -144,7 +150,6 @@ const getTemplatesListFun = async () => {
144150
const url = `/dataflow/algo_templates?${params.toString()}`
145151
146152
const { data } = await useFetchApi(url).get().json();
147-
console.log('data=', data.value.templates)
148153
if (data.value) {
149154
const res = data.value.data.templates;
150155
templateList.value = res;
@@ -175,6 +180,34 @@ const handleDelete = async (id) => {
175180
}
176181
};
177182
183+
const delTemplate = (name, id) => {
184+
ElMessageBox.confirm(
185+
t('dataPipelines.delTemplateTips', { name }),
186+
t("dataPipelines.delTemplateTitle"),
187+
{
188+
confirmButtonText: t("dataPipelines.confirm"),
189+
cancelButtonText: t("dataPipelines.cancel"),
190+
type: 'warning',
191+
}
192+
)
193+
.then(async () => {
194+
const url = `/dataflow/algo_templates/${id}`;
195+
const { data, error } = await useFetchApi(url).delete().json();
196+
if (data.value.code === 200) {
197+
ElMessage({
198+
message: t('dataPipelines.delSuccess'),
199+
type: "success",
200+
});
201+
getTemplatesListFun();
202+
} else {
203+
ElMessage({
204+
message: `${t('dataPipelines.delFailed')}: ${error.value.msg}`,
205+
type: "error",
206+
});
207+
}
208+
})
209+
}
210+
178211
onMounted(() => {
179212
getTemplatesListFun();
180213
});

frontend/src/components/dataflow_config/dataAcquisition/dataSourceManagement/newDataSource.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ const submit = (type) => {
11961196
}
11971197
// Mongodb
11981198
if (typeId.value === 2) {
1199-
params.extra_config.hive = getSelectedData().map(
1199+
params.extra_config.mongo = getSelectedData().map(
12001200
(item) => item.table_name
12011201
);
12021202

frontend/src/components/dataflow_config/newTask/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
v-model="taskUseType"
3434
class="mt-8"
3535
@change="changeTaskType"
36+
v-if="false"
3637
>
3738
<el-radio
3839
label="ops"
@@ -45,7 +46,7 @@
4546
>{{ $t('dataPipelines.taskType2') }}</el-radio
4647
>
4748
</el-radio-group>
48-
<div class="mainOption flex items-center justify-between">
49+
<div class="mainOption flex items-center justify-between mt-[10px]">
4950
<el-form
5051
ref="ruleFormRef"
5152
:model="form"
@@ -571,7 +572,7 @@
571572
route.query.templateId ? route.query.templateId * 1 : 0
572573
)
573574
const selToolName = ref(route.query.selToolName || '')
574-
const taskUseType = ref(route.query.type ? route.query.type : 'ops')
575+
const taskUseType = ref(route.query.type ? route.query.type : 'tool')
575576
const toolListAll = ref([])
576577
const seltool = ref({})
577578
const form = ref({

frontend/src/components/dataflow_config/systemDashboard/celeryNodeService.vue

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -316,28 +316,26 @@
316316
</template>
317317
</el-table-column>
318318

319-
<!-- <el-table-column
319+
<el-table-column
320320
prop="token"
321321
:label="t('dataPipelines.operations')"
322322
min-width="120"
323323
fixed="right"
324+
v-if="userStore.isAdmin"
324325
>
325326
<template #default="scope">
326327
<div class="settingsTableBtn flex items-center justify-start">
327328
<el-button
328329
class="flex items-center justify-start cursor-pointer"
329330
type="text"
330-
@click="
331-
goToNewTask(
332-
`/datapipelines/dataflowInfo?id=${scope.row.job_id}&type=${scope.row.job_source}`
333-
)
334-
"
335-
>
336-
{{ t("dataPipelines.details") }}
331+
@click="delCeleryNode(scope.row.worker_name)"
332+
:disabled="scope.row.status === 'online'"
333+
>
334+
{{ t('prompts.del') }}
337335
</el-button>
338336
</div>
339337
</template>
340-
</el-table-column> -->
338+
</el-table-column>
341339
</el-table>
342340

343341
<div class="flex justify-end mt-4 mr-4 mb-4">
@@ -359,13 +357,15 @@
359357
<script setup>
360358
import { useRouter } from "vue-router";
361359
import { ref, onMounted } from "vue";
362-
import { ElMessage } from "element-plus";
360+
import { ElMessage, ElMessageBox } from "element-plus";
363361
import useFetchApi from "../../../packs/useFetchApi";
364362
import { convertUtcToLocalTime } from "../../../packs/datetimeUtils";
363+
import useUserStore from '../../../stores/UserStore'
365364
import { useI18n } from "vue-i18n";
366365
367366
const { t, locale } = useI18n();
368367
const tableLoading = ref(false);
368+
const userStore = useUserStore();
369369
370370
const form = ref({
371371
searchStr: "",
@@ -515,6 +515,34 @@ const toDatasetPage = (path, branch) => {
515515
}
516516
};
517517
518+
const delCeleryNode = (worker_name) => {
519+
ElMessageBox.confirm(
520+
t('dataPipelines.delCeleryNodeTips', { worker_name }),
521+
t("dataPipelines.delCeleryNodeTitle"),
522+
{
523+
confirmButtonText: t("dataPipelines.confirm"),
524+
cancelButtonText: t("dataPipelines.cancel"),
525+
type: 'warning',
526+
}
527+
)
528+
.then(async () => {
529+
const url = `/dataflow/celery/delete_celery_worker/${worker_name}`;
530+
const { data, error } = await useFetchApi(url).delete().json();
531+
if (data.value.code === 200) {
532+
ElMessage({
533+
message: t('dataPipelines.delSuccess'),
534+
type: "success",
535+
});
536+
getDataFlowListFun();
537+
} else {
538+
ElMessage({
539+
message: `${t('dataPipelines.delFailed')}: ${error.value.msg}`,
540+
type: "error",
541+
});
542+
}
543+
})
544+
}
545+
518546
const router = useRouter();
519547
520548
const goToNewTask = (path) => {

frontend/src/locales/en_js/datapipelines.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ export const dataPipelines = {
198198
"current_number_tasks": "Current Number of Tasks",
199199
"node_status": "Node Status",
200200
"heartbeat_time": "Heartbeat Time",
201+
"delCeleryNodeTitle": "Delete Celery node",
202+
"delCeleryNodeTips": "Are you sure to delete the {worker_name} Celery node?",
203+
201204

202205
"taskType": "Task Type",
203206
"dataCleaning": "Data Cleaning",
@@ -226,7 +229,6 @@ export const dataPipelines = {
226229
"execute": "Execute",
227230
"cancelExecute": "Cancel Execution",
228231
"executeConfirm": "Confirm Execution",
229-
"confirm": "Confirm",
230232
"reset": "Replace",
231233
"details": "Details",
232234
"authorize": "authorize",
@@ -336,6 +338,11 @@ export const dataPipelines = {
336338
"creationCompleted": "Creation Completed",
337339
"updateTemplate": "Update Template",
338340
"cancel": "Cancel",
341+
"confirm": "Confirm",
342+
"delTemplateTitle": "Delete Template",
343+
"delSuccess": "Delete Success",
344+
"delFailed": "Delete Failed",
345+
"delTemplateTips": "Are you sure to delete the {name} template?",
339346
"templateNameExists": "Template name already exists, please use a different name",
340347
"Queued": "Queued",
341348
"Processing": "Processing",

frontend/src/locales/zh_hant_js/datapipelines.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ export const dataPipelines = {
196196
"current_number_tasks": "當前任務數",
197197
"node_status": "節點狀態",
198198
"heartbeat_time": "心跳時間",
199+
"delCeleryNodeTitle": "刪除Celery節點",
200+
"delCeleryNodeTips": "確認刪除 {worker_name} Celery 節點?",
199201

200202
"taskType": "任務類型",
201203
"dataCleaning": "數據清洗",
@@ -336,6 +338,10 @@ export const dataPipelines = {
336338
"creationCompleted": "創建完成",
337339
"updateTemplate": "更新模板",
338340
"cancel": "取消",
341+
"delTemplateTitle": "刪除模板",
342+
"delSuccess": "删除成功",
343+
"delFailed": "刪除失敗",
344+
"delTemplateTips": "確認刪除{name}模板?",
339345
"templateNameExists": "模板名稱已存在,請使用其他名稱",
340346
"Queued": "待處理",
341347
"Processing": "處理中",

frontend/src/locales/zh_js/datapipelines.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ export const dataPipelines = {
196196
"current_number_tasks": "当前任务数",
197197
"node_status": "节点状态",
198198
"heartbeat_time": "心跳时间",
199+
"delCeleryNodeTitle": "删除Celery节点",
200+
"delCeleryNodeTips": "确认删除 {worker_name} Celery 节点?",
199201

200202
"taskType": "任务类型",
201203
"dataCleaning": "数据清洗",
@@ -336,6 +338,10 @@ export const dataPipelines = {
336338
"creationCompleted": "创建完成",
337339
"updateTemplate": "更新模版",
338340
"cancel": "取消",
341+
"delTemplateTitle": "删除模板",
342+
"delSuccess": "删除成功",
343+
"delFailed": "删除失败",
344+
"delTemplateTips": "确认删除{name}模板?",
339345
"templateNameExists": "模板名称已存在,请使用其他名称",
340346
"Queued": "待处理",
341347
"Processing": "处理中",

0 commit comments

Comments
 (0)