|
@@ -3,9 +3,9 @@
|
|
|
<el-form ref="form" :model="form">
|
|
|
<div style="padding-left: 10px;padding-top: 20px;">
|
|
|
<el-form-item>
|
|
|
- canal.properties
|
|
|
+ {{ form.name }}
|
|
|
<el-button type="primary" @click="onSubmit">修改</el-button>
|
|
|
- <el-button @click="onCancel">取消</el-button>
|
|
|
+ <el-button @click="onCancel">重置</el-button>
|
|
|
</el-form-item>
|
|
|
</div>
|
|
|
<editor v-model="form.content" lang="properties" theme="chrome" width="100%" :height="800" @init="editorInit" />
|
|
@@ -14,7 +14,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getCanalConfig } from '@/api/canalConfig'
|
|
|
+import { getCanalConfig, updateCanalConfig } from '@/api/canalConfig'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -23,6 +23,7 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
form: {
|
|
|
+ id: null,
|
|
|
name: '',
|
|
|
content: ''
|
|
|
}
|
|
@@ -44,17 +45,40 @@ export default {
|
|
|
},
|
|
|
loadCanalConfig() {
|
|
|
getCanalConfig().then(response => {
|
|
|
- this.form.content = response.data.content
|
|
|
+ const data = response.data
|
|
|
+ this.form.id = data.id
|
|
|
+ this.form.name = data.name
|
|
|
+ this.form.content = data.content
|
|
|
})
|
|
|
},
|
|
|
onSubmit() {
|
|
|
- this.$message('submit!')
|
|
|
+ this.$confirm(
|
|
|
+ '修改Canal主配置可能会导致Server重启,是否继续?',
|
|
|
+ '确定修改',
|
|
|
+ {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }
|
|
|
+ ).then(() => {
|
|
|
+ updateCanalConfig(this.form).then(response => {
|
|
|
+ if (response.data === 'success') {
|
|
|
+ this.$message({
|
|
|
+ message: '修改成功',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ this.loadCanalConfig()
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: '修改失败',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
onCancel() {
|
|
|
- this.$message({
|
|
|
- message: 'cancel!',
|
|
|
- type: 'warning'
|
|
|
- })
|
|
|
+ this.loadCanalConfig()
|
|
|
}
|
|
|
}
|
|
|
}
|