Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
fit2cloud-chenyw 2021-05-12 16:59:00 +08:00
commit b637b77812
3 changed files with 47 additions and 28 deletions

View File

@ -112,7 +112,7 @@ public class DataSetTableService {
return datasetTable; return datasetTable;
} }
public void delete(String id) throws Exception{ public void delete(String id) throws Exception {
datasetTableMapper.deleteByPrimaryKey(id); datasetTableMapper.deleteByPrimaryKey(id);
dataSetTableFieldsService.deleteByTableId(id); dataSetTableFieldsService.deleteByTableId(id);
// 删除同步任务 // 删除同步任务
@ -120,10 +120,11 @@ public class DataSetTableService {
deleteDorisTable(id); deleteDorisTable(id);
} }
private void deleteDorisTable(String datasetId) throws Exception{ private void deleteDorisTable(String datasetId) throws Exception {
String dorisTableName = DorisTableUtils.dorisName(datasetId); String dorisTableName = DorisTableUtils.dorisName(datasetId);
Datasource dorisDatasource = (Datasource)CommonBeanFactory.getBean("DorisDatasource"); Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);; JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
;
DatasourceRequest datasourceRequest = new DatasourceRequest(); DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource); datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery("drop table if exists " + dorisTableName); datasourceRequest.setQuery("drop table if exists " + dorisTableName);
@ -548,7 +549,10 @@ public class DataSetTableService {
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class); JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
DatasourceRequest datasourceRequest = new DatasourceRequest(); DatasourceRequest datasourceRequest = new DatasourceRequest();
datasourceRequest.setDatasource(dorisDatasource); datasourceRequest.setDatasource(dorisDatasource);
datasourceRequest.setQuery("CREATE VIEW " + dorisTableName + " AS (" + customSql + ")"); // 先删除表
datasourceRequest.setQuery("DROP VIEW IF EXISTS " + dorisTableName);
jdbcProvider.exec(datasourceRequest);
datasourceRequest.setQuery("CREATE VIEW IF NOT EXISTS" + dorisTableName + " AS (" + customSql + ")");
jdbcProvider.exec(datasourceRequest); jdbcProvider.exec(datasourceRequest);
} }

View File

@ -5,6 +5,8 @@
<el-table <el-table
size="mini" size="mini"
:data="unionData" :data="unionData"
:height="height"
border
style="width: 100%;margin-top: 10px;" style="width: 100%;margin-top: 10px;"
> >
<el-table-column <el-table-column
@ -28,8 +30,8 @@
:label="$t('dataset.target_field')" :label="$t('dataset.target_field')"
/> />
<el-table-column <el-table-column
fixed="right" align="left"
width="100" :label="$t('dataset.operate')"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button type="text" size="mini" @click="edit(scope.row)">{{ $t('dataset.edit') }}</el-button> <el-button type="text" size="mini" @click="edit(scope.row)">{{ $t('dataset.edit') }}</el-button>
@ -143,6 +145,7 @@ export default {
}, },
data() { data() {
return { return {
height: 500,
union: { union: {
id: null, id: null,
sourceTableId: this.table.id, sourceTableId: this.table.id,
@ -165,9 +168,17 @@ export default {
} }
}, },
mounted() { mounted() {
this.calHeight()
this.initUnion() this.initUnion()
}, },
methods: { methods: {
calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 55 - 38 - 28 - 10
}, 10)
},
initUnion() { initUnion() {
if (this.table.id) { if (this.table.id) {
post('dataset/union/listByTableId/' + this.table.id, {}).then(response => { post('dataset/union/listByTableId/' + this.table.id, {}).then(response => {

View File

@ -13,6 +13,7 @@
size="mini" size="mini"
:data="taskLogData" :data="taskLogData"
border border
:height="height"
style="width: 100%" style="width: 100%"
> >
<el-table-column <el-table-column
@ -32,18 +33,18 @@
:label="$t('dataset.end_time')" :label="$t('dataset.end_time')"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.endTime | timestampFormatDate }}</span> <span>{{ scope.row.endTime | timestampFormatDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="status" :label="$t('dataset.status')" > <el-table-column prop="status" :label="$t('dataset.status')">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.status === 'Completed'" style="color: green">{{ $t('dataset.completed') }}</span> <span v-if="scope.row.status === 'Completed'" style="color: green">{{ $t('dataset.completed') }}</span>
<span v-if="scope.row.status === 'Underway'" style="color: blue"> <span v-if="scope.row.status === 'Underway'" style="color: blue">
<i class="el-icon-loading"></i> <i class="el-icon-loading" />
{{ $t('dataset.underway') }} {{ $t('dataset.underway') }}
</span> </span>
<span v-if="scope.row.status === 'Error'" style="color: red" > <span v-if="scope.row.status === 'Error'" style="color: red">
<el-link type="danger" style="font-size: 12px" @click="showErrorMassage(scope.row.info)">{{ $t('dataset.error') }}</el-link> <el-link type="danger" style="font-size: 12px" @click="showErrorMassage(scope.row.info)">{{ $t('dataset.error') }}</el-link>
</span> </span>
</template> </template>
@ -67,8 +68,9 @@
:visible="show_error_massage" :visible="show_error_massage"
:show-close="false" :show-close="false"
width="50%" width="50%"
class="dialog-css"> class="dialog-css"
<span>{{error_massage}}</span> >
<span>{{ error_massage }}</span>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="mini" @click="show_error_massage = false">{{ $t('dataset.close') }}</el-button> <el-button size="mini" @click="show_error_massage = false">{{ $t('dataset.close') }}</el-button>
</span> </span>
@ -161,7 +163,7 @@
<el-button type="primary" size="mini" @click="saveTask(taskForm)">{{ $t('dataset.confirm') }}</el-button> <el-button type="primary" size="mini" @click="saveTask(taskForm)">{{ $t('dataset.confirm') }}</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-row > <el-row>
<el-button icon="el-icon-plus" size="mini" @click="addTask(undefined)"> <el-button icon="el-icon-plus" size="mini" @click="addTask(undefined)">
{{ $t('dataset.add_task') }} {{ $t('dataset.add_task') }}
</el-button> </el-button>
@ -295,6 +297,7 @@ export default {
}, },
data() { data() {
return { return {
height: 500,
update_setting: false, update_setting: false,
update_task: false, update_task: false,
show_error_massage: false, show_error_massage: false,
@ -355,8 +358,7 @@ export default {
}, },
watch: { watch: {
table: { table: {
handler() handler() {
{
this.listTask() this.listTask()
this.listTaskLog() this.listTaskLog()
}, },
@ -364,21 +366,23 @@ export default {
} }
}, },
mounted() { mounted() {
window.onresize = () => { this.calHeight()
return (() => {
this.height = window.innerHeight / 2
})()
}
this.height = window.innerHeight / 2
}, },
methods: { methods: {
cellStyle ({row, column}) { calHeight() {
const that = this
setTimeout(function() {
const currentHeight = document.documentElement.clientHeight
that.height = currentHeight - 56 - 30 - 26 - 25 - 55 - 38 - 28 - 10
}, 10)
},
cellStyle({ row, column }) {
// //
if (row.status === 'Underway' && column === 'status') { if (row.status === 'Underway' && column === 'status') {
return 'color: blue' return 'color: blue'
} else if (row.status === 'Completed' && column === 'status') { } else if (row.status === 'Completed' && column === 'status') {
return 'color: green' return 'color: green'
}else if (row.status === 'Error' && column === 'status') { } else if (row.status === 'Error' && column === 'status') {
return 'color: red' return 'color: red'
} }
}, },
@ -414,10 +418,10 @@ export default {
this.listTask() this.listTask()
this.getIncrementalConfig() this.getIncrementalConfig()
}, },
refreshLog(){ refreshLog() {
this.listTaskLog() this.listTaskLog()
}, },
showErrorMassage(massage){ showErrorMassage(massage) {
this.show_error_massage = true this.show_error_massage = true
this.error_massage = massage this.error_massage = massage
}, },