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

增加分区信息map&问题修复 #150

Merged
merged 2 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions web/src/common/service.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// 服务端接口管理
import { request } from "@fesjs/fes";
import { BASE_URL } from "@/common/constants";
////////////////////////////////////////////////////////////////////
export const getProjectList = (name) => {
return request("/projects", { name }, { method: "POST" });
Expand Down Expand Up @@ -378,4 +379,17 @@ export const getTaskExecLog = (params) => {
method: "GET",
}
);
}

// 获取分区信息
export const getPartitionInfo = (params) => {
if (!params.source) return
const url = params.source.split(BASE_URL)[1]
return request(
`${url}?dataSourceId=${params.dataSourceId}&database=${params.database}&table=${params.table}&_=${Math.random()}`,
{},
{
method: "GET",
}
);
}
4 changes: 2 additions & 2 deletions web/src/pages/dataSourceManage/components/editModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default {
dataSourceName: formState.dataSourceName,
dataSourceDesc: formState.dataSourceDesc || "",
labels: formState.labels || "",
comment: formState.comment || "",
comment: formState.comment || "更新",
connectParams: {
...connectParams
}
Expand All @@ -187,7 +187,7 @@ export default {
dataSourceName: formState.dataSourceName,
dataSourceDesc: formState.dataSourceDesc || "",
labels: formState.labels || "",
comment: formState.comment || "",
comment: formState.comment || "更新",
connectParams: {
...connectParams
}
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/jobManagement/components/dataSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
v-bind:param="item"
@updateInfo="updateSourceParams"
:style="styleObject"
:data="dataSource.dataSourceIds.source"
/>
</a-form-item>
</a-form>
Expand Down Expand Up @@ -108,6 +109,7 @@
v-bind:param="item"
@updateInfo="updateSinkParams"
:style="styleObject"
:data="dataSource.dataSourceIds.sink"
/>
</a-form-item>
</a-form>
Expand Down
110 changes: 103 additions & 7 deletions web/src/pages/jobManagement/components/dyncRender.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,31 @@
:style="style"
>
</a-select>
<template v-else>
<template v-if="type === 'MAP'">
<div style="margin-bottom: 5px" v-for="item in partitionArr">
<a-input
style="width: 100px"
disabled
v-model:value = item.label
/>
<a-input
v-if="item.type === 'INPUT'"
v-model:value="item.value"
@change="handleChange"
style="margin-left: 10px;width: 220px"
/>
<a-select
v-if="item.type === 'OPTION'"
mode="tags"
v-model:value="item.value"
:maxTagCount="1"
@change="handleChange(item.value, item)"
:options="item.options"
style="margin-left: 10px;width: 220px"
/>
</div>
</template>
<template v-if="type === 'INPUT'">
<a-input
v-model:value="value"
@change="emitData(value)"
Expand All @@ -22,20 +46,23 @@
</template>
<script>
import { defineComponent, h, toRaw, watch, computed, reactive, ref } from "vue";
import { getPartitionInfo } from "@/common/service";
import { message } from "ant-design-vue";
export default defineComponent({
props: {
param: Object,
style: {
type: Object,
default: () => {
return { width: '200px', }
return { width: '200px' }
}
}
},
data: Object
},
emits: ["updateInfo"],
setup(props, context) {
let { type, field, value, unit} = props.param;
let { type, field, value, unit, source} = props.param;
let tmlName = field.split(".").pop();
const newProps = computed(() => JSON.parse(JSON.stringify(props.param)));
watch(newProps, (val, oldVal) => {
Expand All @@ -50,18 +77,87 @@ export default defineComponent({
})
})
}
let partitionArr = ref([])
if (type === 'MAP') {
let url = source.split('?')[0]
getPartitionInfo({
source: url,
dataSourceId: props.data.id,
database: props.data.db,
table: props.data.table
})
.then(res => {
for (let i in res.render) {
if (typeof(res.render[i]) === 'string') {
partitionArr.value.push({
type: 'INPUT',
label: i,
value: value && value[i] ? value[i] : ''//res.render[i]
})
} else {
let checkOptions = []
res.render[i].map((item) => {
checkOptions.push({
value: item,
label: item
})
})
partitionArr.value.push({
type: 'OPTION',
label: i,
options: checkOptions,
value: value && value[i] ? [value[i]] : []
})
}
}
})
.catch(err => {
message.error("或许分区信息失败");
})
}
const emitData = (value) => {
let res = toRaw(props.param)
res.value = value
context.emit("updateInfo", res);
};
context.emit("updateInfo", res)
}
const handleChange = (value, item) => {
if (item.type === 'OPTION') {
if (value) {
item.value = [value.pop()]
}
}
let res = toRaw(props.param)
if (!res.value) {
res.value = {}
}
partitionArr.value.map(part => {
if (part.type === 'OPTION') {
if (part.value && part.value.length) {
res.value[part.label] = part.value.join()
} else {
delete res.value[part.label]
}
} else {
if (part.value) {
res.value[part.label] = part.value
} else {
delete res.value[part.label]
}
}
})
context.emit("updateInfo", res)
}
return {
checkOptions: ref(checkOptions),
type,
value: ref(value),
emitData,
unit
unit,
source,
partitionArr,
handleChange
}
/*if (type === "OPTION") {
Expand Down
8 changes: 6 additions & 2 deletions web/src/pages/jobManagement/components/executionLog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@ export default defineComponent({
logs.logs = res.logs
logs.isEnd = res.isEnd
const buildLog = (key) => {
let arr = logs.logs[key].split('\n')
let arr = logs.logs[key] ? logs.logs[key].split('\n') : []
for (let i = 0; i < arr.length; i++) {
arr[i] = `${logs.endLine + i + 1}. ${arr[i]}`
}
return curLog[key] ? curLog[key] + '\n' + arr.join('\n') : arr.join('\n')
if (logs.logs[key]) {
return curLog[key] ? curLog[key] + '\n' + arr.join('\n') : arr.join('\n')
} else {
return curLog[key] ? curLog[key] : ''
}
}
curLog.all = buildLog('all')
curLog.error = buildLog('error')
Expand Down
3 changes: 3 additions & 0 deletions web/src/pages/jobManagement/components/jobDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,9 @@ export default {
display: flex;
flex-wrap: wrap;
padding-bottom: 30px;
:deep(.ant-spin-nested-loading) {
width: 100%;
}
.emptyTab {
font-size: 16px;
height: calc(100vh - 130px);
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/jobManagement/components/selectDataSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<span>搜索库表</span>
<a-input
placeholder="按回车搜库表"
style="width: 300px;margin-top: 10px;margin-left:10px"
style="width: 300px;margin-top: 10px;margin-left:0"
v-model:value="searchWord"
@keyup.enter="filterTree(dsId)"
></a-input>
Expand Down Expand Up @@ -406,7 +406,7 @@ export default defineComponent({
}
.sds-wrap-b {
min-height: 300px;
max-height: 500px;
max-height: 400px;
overflow-y: auto;
}
Expand Down