Skip to content

Commit 5be1f88

Browse files
z275748353张龙彬
andauthored
fix bugs (#1523)
* 迁移任务至argo * Migrate computing power values for CSGHUB * Migrate computing power values for CSGHUB * Migrate computing power values for CSGHUB * 数据处理修改执行按钮操作方式 * fix issues bugs * fix issues bugs * The program uses the browser's local time. * Switch authentication from JWT to Access Token for task operations Add delete permission for organization administrators * 1.数据处理页面数据集跳转问题 2.去掉定时执行 3.数据处理页面UI优化 * fix bugs dataflow #203 #204 * fix bugs dataflow 1.数据工具-新建任务问题 去掉不必要的堆栈错误信息 2.文件上传功能优化,去掉file类型的过滤、在跳转前增提示说明,些行为跳转到csghub dataset进行文件上传。 3.dataflow数据格式转换 数据源问题 --------- Co-authored-by: 张龙彬 <bin@sxcfx.cn>
1 parent 48f0811 commit 5be1f88

8 files changed

Lines changed: 318 additions & 66 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
@change="valueChange"
2929
>
3030
<el-option
31-
v-for="item in dataList"
31+
v-for="item in typeFilterOptions"
3232
:key="item.id"
3333
:label="item.name"
3434
:value="item.id"
@@ -338,7 +338,7 @@
338338

339339
<script setup>
340340
import { useRouter } from "vue-router";
341-
import { ref, reactive, onMounted, provide } from "vue";
341+
import { ref, reactive, onMounted, provide, computed } from "vue";
342342
import { ElMessage, ElLoading } from "element-plus";
343343
import useFetchApi from "../../../../packs/useFetchApi";
344344
import { useI18n } from "vue-i18n";
@@ -358,8 +358,12 @@ const formInline = reactive({
358358
});
359359
// 总数
360360
const total = ref(0);
361-
// 数据源类型列表
361+
// 数据源类型列表(用于表格图标/名称映射,保持完整)
362362
const dataList = ref([]);
363+
// 类型筛选下拉选项:去掉 File(id=3)
364+
const typeFilterOptions = computed(() =>
365+
dataList.value.filter((item) => item.id !== 3)
366+
);
363367
// 详情数据
364368
const dataSource = ref([]);
365369
provide("dataSource", dataSource);

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,14 @@
550550
{{ t("dataPipelines.fileUpload") }}
551551
</p>
552552

553+
<el-alert
554+
class="mt-[12px]"
555+
type="info"
556+
:closable="false"
557+
show-icon
558+
:title="t('dataPipelines.fileUploadHint')"
559+
/>
560+
553561
<el-form label-position="top" :model="formInline">
554562
<el-row :gutter="20" class="mt-[16px]">
555563
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
@@ -643,7 +651,7 @@
643651

644652
<script setup>
645653
import { useRouter, useRoute } from "vue-router";
646-
import { ref, onMounted, reactive, computed } from "vue";
654+
import { ref, onMounted, reactive, computed, watch } from "vue";
647655
import { ElMessage, ElLoading } from "element-plus";
648656
import useUserStore from "@/stores/UserStore";
649657
import useFetchApi from "../../../../packs/useFetchApi";
@@ -979,6 +987,14 @@ onMounted(() => {
979987
changeTaskType();
980988
});
981989
990+
// 用户名就绪/变化后,重新加载当前用户个人数据集(数据流向候选)
991+
watch(
992+
() => userStore.username,
993+
(name) => {
994+
if (name) getSelListData();
995+
}
996+
);
997+
982998
/**
983999
* 测试链接接口
9841000
*/
@@ -1129,10 +1145,11 @@ const testSql = async () => {
11291145
};
11301146
11311147
const getSelListData = async (type) => {
1132-
// let url = `/user/${form.value.owner}/datasets?per=50&page=1`;
1133-
// if (form.value.owner !== userStore.username) {
1134-
// url = `/organization/${form.value.owner}/datasets?current_user=${userStore.username}&per=50&page=1`;
1135-
// }
1148+
// 数据流向固定为当前登录用户的个人数据集(不含组织数据集)
1149+
if (!userStore.username) {
1150+
selListData.value = [];
1151+
return;
1152+
}
11361153
let options = {
11371154
headers: {
11381155
Authorization: `Bearer ${cookies.get("user_token")}`,
@@ -1147,8 +1164,7 @@ const getSelListData = async (type) => {
11471164
)
11481165
.get()
11491166
.json();
1150-
console.log(data, "datadatadatadatadatadata");
1151-
selListData.value = data.value.data;
1167+
selListData.value = data.value && data.value.data ? data.value.data : [];
11521168
};
11531169
11541170
/**

frontend/src/components/dataflow_config/dataAcquisition/formatConversion/newFormatConversion.vue

Lines changed: 111 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,26 @@
5050
</el-form-item>
5151
</el-col>
5252
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
53-
<el-form-item prop="des" class="mt-[12px]">
53+
<el-form-item prop="owner" class="mt-[12px]">
5454
<template #label>
5555
<p class="text-gray-500 text-xs">
56-
{{ t("dataPipelines.taskDescription") }}
56+
{{ t("dataPipelines.dataOwner") }}
5757
</p>
5858
</template>
59-
<el-input
60-
v-model="form.des"
61-
:placeholder="`${t('dataPipelines.toInput')}${t(
62-
'dataPipelines.taskDescription'
59+
<el-select
60+
v-model="form.owner"
61+
:placeholder="`${t('dataPipelines.toSel')}${t(
62+
'dataPipelines.dataOwner'
6363
)}`"
64-
clearable
64+
@change="getSelListData(true)"
6565
>
66-
</el-input>
66+
<el-option
67+
v-for="item in ownerPathOptions"
68+
:key="item"
69+
:label="item"
70+
:value="item"
71+
/>
72+
</el-select>
6773
</el-form-item>
6874
</el-col>
6975

@@ -110,6 +116,24 @@
110116
</el-select>
111117
</el-form-item>
112118
</el-col>
119+
120+
<el-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
121+
<el-form-item prop="des" class="mt-[12px]">
122+
<template #label>
123+
<p class="text-gray-500 text-xs">
124+
{{ t("dataPipelines.taskDescription") }}
125+
</p>
126+
</template>
127+
<el-input
128+
v-model="form.des"
129+
:placeholder="`${t('dataPipelines.toInput')}${t(
130+
'dataPipelines.taskDescription'
131+
)}`"
132+
clearable
133+
>
134+
</el-input>
135+
</el-form-item>
136+
</el-col>
113137
</el-row>
114138

115139
<p class="text-gray-900 text-2xl font-medium my-4">
@@ -219,7 +243,7 @@
219243
@change="selListDataChange"
220244
>
221245
<el-option
222-
v-for="item in selListData"
246+
v-for="item in dataFlowList"
223247
:label="item.name"
224248
:value="item.path"
225249
/>
@@ -326,13 +350,22 @@ const userStore = useUserStore();
326350
const spaceResourceFieldsRef = ref(null);
327351
const taskNamespaceFieldsRef = ref(null);
328352
353+
// 数据所有者可选项(个人 + 所属组织),借鉴数据处理任务创建
354+
const ownerPathOptions = ref([]);
355+
329356
const onNamespacesLoaded = (payload) => {
330357
applyNamespaceFromLoaded(form, payload);
358+
ownerPathOptions.value = payload?.ownerPathOptions || [];
359+
if (!form.value.owner && ownerPathOptions.value.length) {
360+
form.value.owner = ownerPathOptions.value[0];
361+
getSelListData(true);
362+
}
331363
};
332364
333365
// 表单
334366
const form = ref({
335367
skip_meta: false,
368+
owner: "",
336369
namespace_type: "personal",
337370
namespace_uuid: "",
338371
cluster_id: "",
@@ -360,6 +393,13 @@ const rules = ref({
360393
trigger: "blur",
361394
},
362395
],
396+
owner: [
397+
{
398+
required: true,
399+
message: `${t("dataPipelines.toSel")}${t("dataPipelines.dataOwner")}`,
400+
trigger: "change",
401+
},
402+
],
363403
from_csg_hub_repo_id: [
364404
{
365405
required: true,
@@ -408,8 +448,10 @@ const rules = ref({
408448
],
409449
});
410450
411-
// 数据源下拉框列表
451+
// 数据源下拉框列表(数据来源,按 owner 加载,可含组织)
412452
const selListData = ref([]);
453+
// 数据流向下拉框列表(固定为当前用户的个人数据集,不含组织)
454+
const dataFlowList = ref([]);
413455
const csg_hub_dataset_info = ref({});
414456
// 格式转换
415457
const dataObj = ref([]);
@@ -464,17 +506,22 @@ const handleSourceChange = (groupKey) => {
464506
};
465507
466508
onMounted(() => {
467-
getSelListData();
509+
updateOwner();
510+
loadDataFlowList();
468511
getFormatTypeList();
469512
fetchUserToken();
470513
});
471514
515+
watch([() => userStore.username, () => route.query.datasetPath], () => {
516+
updateOwner();
517+
loadDataFlowList();
518+
});
519+
472520
const fetchUserToken = async () => {
473-
// if (!userStore.username) return
521+
if (!userStore.username) return;
474522
475523
const { data } = await useFetchApi(
476-
// ${userStore.username}
477-
`/user/${userStore.username}/tokens?app=git`
524+
`/user/${userStore.username}/tokens?app=git`
478525
).json();
479526
if (data.value) {
480527
const body = data.value;
@@ -517,18 +564,27 @@ const fetchBranchList = async (val) => {
517564
* 查询数据流向分支
518565
* @param val
519566
*/
520-
const selListDataChange = async (val) => {
567+
const selListDataChange = (val) => {
521568
if (val) {
522-
let params = selListData.value.find((item) => item.path === val);
523-
form.value.to_csg_hub_dataset_name = params.name;
524-
form.value.to_csg_hub_dataset_id = params.id;
569+
let params = dataFlowList.value.find((item) => item.path === val);
570+
form.value.to_csg_hub_dataset_name = params ? params.name : "";
571+
form.value.to_csg_hub_dataset_id = params ? params.id : "";
572+
// 数据流向分支取所选数据集默认分支(后端上传时自动版本化 v1/v2)
573+
form.value.to_csg_hub_dataset_default_branch = params
574+
? params.default_branch || "main"
575+
: "";
525576
} else {
526577
form.value.to_csg_hub_dataset_name = "";
527578
form.value.to_csg_hub_dataset_id = "";
579+
form.value.to_csg_hub_dataset_default_branch = "";
528580
}
529-
form.value.to_csg_hub_dataset_default_branch = "";
581+
};
530582
531-
const url = `/datasets/${form.value.to_csg_hub_repo_id}/branches`;
583+
/**
584+
* 加载当前用户个人数据集,作为数据流向候选(不含组织,与来源 owner 解耦)
585+
*/
586+
const loadDataFlowList = async () => {
587+
if (!userStore.username) return;
532588
let options = {
533589
headers: {
534590
Authorization: `Bearer ${cookies.get("user_token")}`,
@@ -537,17 +593,20 @@ const selListDataChange = async (val) => {
537593
)};user_token=${cookies.get("user_token")};`,
538594
},
539595
};
596+
const url = `/user/${userStore.username}/datasets?per=50&page=1`;
540597
const { data } = await useFetchApi(url, options).get().json();
541-
if (data.value && data.value.data) {
542-
to_branchList.value = data.value.data;
543-
}
598+
dataFlowList.value = data.value && data.value.data ? data.value.data : [];
544599
};
545600
546601
/**
547-
* 获取数据流向
548-
* @param type
602+
* 根据数据所有者获取数据集列表(数据来源 / 数据流向共用),借鉴数据处理任务创建
603+
* @param type 为真时表示所有者切换,需清空已选数据来源
549604
*/
550605
const getSelListData = async (type) => {
606+
if (!form.value.owner) {
607+
selListData.value = [];
608+
return;
609+
}
551610
let options = {
552611
headers: {
553612
Authorization: `Bearer ${cookies.get("user_token")}`,
@@ -556,14 +615,33 @@ const getSelListData = async (type) => {
556615
)};user_token=${cookies.get("user_token")};`,
557616
},
558617
};
559-
const { data } = await useFetchApi(
560-
`/user/${userStore.username}/datasets?per=50&page=1`,
561-
options
562-
)
563-
.get()
564-
.json();
565-
console.log(data, "datadatadatadatadatadata");
566-
selListData.value = data.value.data;
618+
let url = `/user/${form.value.owner}/datasets?per=50&page=1`;
619+
if (form.value.owner !== userStore.username) {
620+
url = `/organization/${form.value.owner}/datasets?current_user=${userStore.username}&per=50&page=1`;
621+
}
622+
const { data } = await useFetchApi(url, options).get().json();
623+
if (data.value && data.value.data) {
624+
selListData.value = data.value.data;
625+
} else {
626+
selListData.value = [];
627+
}
628+
if (type) {
629+
form.value.from_csg_hub_repo_id = "";
630+
form.value.from_csg_hub_dataset_branch = "";
631+
branchList.value = [];
632+
}
633+
};
634+
635+
/**
636+
* 初始化数据所有者(默认当前用户 / 路由携带的数据集归属)
637+
*/
638+
const updateOwner = () => {
639+
form.value.owner = route.query.datasetPath
640+
? route.query.datasetPath.split("/")[0]
641+
: userStore.username;
642+
if (form.value.owner) {
643+
getSelListData();
644+
}
567645
};
568646
569647
/**

0 commit comments

Comments
 (0)