提交 a9123035 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat: 完善数据源失效消息

上级 aac751b0
...@@ -272,9 +272,13 @@ public class DatasourceService { ...@@ -272,9 +272,13 @@ public class DatasourceService {
datasource.setStatus("Success"); datasource.setStatus("Success");
datasourceMapper.updateByPrimaryKeySelective(datasource); datasourceMapper.updateByPrimaryKeySelective(datasource);
} catch (Exception e) { } catch (Exception e) {
Datasource temp = datasourceMapper.selectByPrimaryKey(datasource.getId());
datasource.setStatus("Error"); datasource.setStatus("Error");
sendWebMsg(datasource); if (!StringUtils.equals(temp.getStatus(), "Error")) {
datasourceMapper.updateByPrimaryKeySelective(datasource); sendWebMsg(datasource);
datasourceMapper.updateByPrimaryKeySelective(datasource);
}
} }
} }
......
-- ----------------------------
-- Records of sys_msg_type
-- ----------------------------
BEGIN;
INSERT INTO `sys_msg_type` VALUES (7, 0, 'i18n_msg_type_ds_invalid', 'datasource', 'to-msg-ds');
INSERT INTO `sys_msg_type` VALUES (8, 7, 'i18n_msg_type_ds_invalid', 'datasource', 'to-msg-ds');
COMMIT;
\ No newline at end of file
...@@ -1361,6 +1361,7 @@ export default { ...@@ -1361,6 +1361,7 @@ export default {
i18n_msg_type_dataset_sync_success: 'Dataset synchronization successful', i18n_msg_type_dataset_sync_success: 'Dataset synchronization successful',
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed', i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
i18n_msg_type_all: 'All type', i18n_msg_type_all: 'All type',
i18n_msg_type_ds_invalid: 'Datasource invalid',
channel_inner_msg: 'On site news' channel_inner_msg: 'On site news'
}, },
denumberrange: { denumberrange: {
......
...@@ -1359,6 +1359,7 @@ export default { ...@@ -1359,6 +1359,7 @@ export default {
i18n_msg_type_dataset_sync: '數據集同步', i18n_msg_type_dataset_sync: '數據集同步',
i18n_msg_type_dataset_sync_success: '數據集同步成功', i18n_msg_type_dataset_sync_success: '數據集同步成功',
i18n_msg_type_dataset_sync_faild: '數據集同步失敗', i18n_msg_type_dataset_sync_faild: '數據集同步失敗',
i18n_msg_type_ds_invalid: '數據源失效',
i18n_msg_type_all: '全部類型', i18n_msg_type_all: '全部類型',
channel_inner_msg: '站內消息' channel_inner_msg: '站內消息'
}, },
......
...@@ -1362,6 +1362,7 @@ export default { ...@@ -1362,6 +1362,7 @@ export default {
i18n_msg_type_dataset_sync: '数据集同步', i18n_msg_type_dataset_sync: '数据集同步',
i18n_msg_type_dataset_sync_success: '数据集同步成功', i18n_msg_type_dataset_sync_success: '数据集同步成功',
i18n_msg_type_dataset_sync_faild: '数据集同步失败', i18n_msg_type_dataset_sync_faild: '数据集同步失败',
i18n_msg_type_ds_invalid: '数据源失效',
i18n_msg_type_all: '全部类型', i18n_msg_type_all: '全部类型',
channel_inner_msg: '站内消息' channel_inner_msg: '站内消息'
}, },
......
...@@ -55,6 +55,9 @@ export default { ...@@ -55,6 +55,9 @@ export default {
}, },
refreshTree() { refreshTree() {
this.$refs.dsTree && this.$refs.dsTree.queryTreeDatas() this.$refs.dsTree && this.$refs.dsTree.queryTreeDatas()
},
msg2Current(sourceParam) {
this.$refs.dsTree && this.$refs.dsTree.markInvalid(sourceParam)
} }
} }
} }
......
...@@ -41,11 +41,11 @@ ...@@ -41,11 +41,11 @@
<svg-icon icon-class="datasource" class="ds-icon-scene" /> <svg-icon icon-class="datasource" class="ds-icon-scene" />
</span> </span>
<span v-if="data.status === 'Error'"> <span v-if="data.status === 'Error'">
<svg-icon icon-class="exclamationmark" class="ds-icon-scene" /> <svg-icon icon-class="exclamationmark" class="ds-icon-scene" />
<el-tooltip v-if="data.status === 'Error'" style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" effect="dark" :content="$t('datasource.in_valid')" placement="right"> <el-tooltip v-if="data.status === 'Error'" style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" effect="dark" :content="$t('datasource.in_valid')" placement="right">
<el-button type="text" > {{ data.name }} </el-button> <el-button type="text" :style="!!data.msgNode ? {'color': 'red'} : {}"> {{ data.name }} </el-button>
</el-tooltip> </el-tooltip>
</span> </span>
<span v-if="data.type === 'folder'"> <span v-if="data.type === 'folder'">
<i class="el-icon-folder" /> <i class="el-icon-folder" />
</span> </span>
...@@ -129,6 +129,11 @@ export default { ...@@ -129,6 +129,11 @@ export default {
const newArr = [] const newArr = []
for (let index = 0; index < array.length; index++) { for (let index = 0; index < array.length; index++) {
const element = array[index] const element = array[index]
if (this.msgNodeId) {
if (element.id === this.msgNodeId) {
element.msgNode = true
}
}
if (!(element.type in types)) { if (!(element.type in types)) {
types[element.type] = [] types[element.type] = []
// newArr.push(...element, ...{ children: types[element.type] }) // newArr.push(...element, ...{ children: types[element.type] })
...@@ -147,7 +152,7 @@ export default { ...@@ -147,7 +152,7 @@ export default {
return 'SQL Server' return 'SQL Server'
} else if (type === 'oracle') { } else if (type === 'oracle') {
return 'Oracle' return 'Oracle'
}else if (type === 'pg') { } else if (type === 'pg') {
return 'PostgreSQL' return 'PostgreSQL'
} }
}, },
...@@ -208,6 +213,21 @@ export default { ...@@ -208,6 +213,21 @@ export default {
component, component,
componentParam componentParam
}) })
},
markInvalid(msgParam) {
const param = JSON.parse(msgParam)
const msgNodeId = param.id
this.msgNodeId = msgNodeId
this.$nextTick(() => {
this.tData.forEach(folder => {
const nodes = folder.children
nodes.forEach(node => {
if (node.id === msgNodeId) {
node.msgNode = true
}
})
})
})
} }
} }
} }
...@@ -303,4 +323,10 @@ export default { ...@@ -303,4 +323,10 @@ export default {
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
} }
.msg-node-class {
color: red;
>>> i{
color: red;
}
}
</style> </style>
<template> <template>
<de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa"> <de-container v-loading="$store.getters.loadingMap[$store.getters.currentPath]" style="background-color: #f7f8fa">
<de-main-container> <de-main-container>
<ds-main /> <ds-main ref="dsMain" />
</de-main-container> </de-main-container>
</de-container> </de-container>
</template> </template>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
import DeMainContainer from '@/components/dataease/DeMainContainer' import DeMainContainer from '@/components/dataease/DeMainContainer'
import DeContainer from '@/components/dataease/DeContainer' import DeContainer from '@/components/dataease/DeContainer'
import DsMain from './DsMain' import DsMain from './DsMain'
import bus from '@/utils/bus'
export default { export default {
name: 'Panel', name: 'Panel',
components: { DeMainContainer, DeContainer, DsMain }, components: { DeMainContainer, DeContainer, DsMain },
...@@ -22,10 +22,36 @@ export default { ...@@ -22,10 +22,36 @@ export default {
} }
}, },
mounted() { mounted() {
bus.$on('to-msg-ds', params => {
this.toMsgDs(params)
})
},
created() {
this.$store.dispatch('app/toggleSideBarHide', true)
const routerParam = this.$router.currentRoute.params
this.toMsgDs(routerParam)
}, },
methods: { methods: {
toMsgDs(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
const panelShareTypeIds = [7, 8]
// 说明是从消息通知跳转过来的
if (panelShareTypeIds.includes(routerParam.msgType)) { // 是数据集同步
if (routerParam.sourceParam) {
try {
// const msgParam = JSON.parse(routerParam.sourceParam)
// this.param = msgParam.id
// this.component = ViewTable
this.$nextTick(() => {
this.$refs.dsMain && this.$refs.dsMain.msg2Current && this.$refs.dsMain.msg2Current(routerParam.sourceParam)
})
} catch (error) {
console.error(error)
}
}
}
}
}
} }
} }
</script> </script>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论