Commit 650e0fc6 authored by xuezj's avatar xuezj

实现db同步

parent 968bba5b
......@@ -24,6 +24,14 @@ export function deleteConfig(query) {
})
}
export function getNamespaceTke(query) {
return request({
url: '/k8s/namespace',
method: 'get',
params: query
})
}
export function getNamespace(query) {
return request({
url: '/dbsync/get_name_space',
......@@ -40,6 +48,14 @@ export function getDBName(query) {
})
}
export function dbSyncTke(data) {
return request({
url: '/dbsync/tke',
method: 'post',
data
})
}
export function dbSync(data) {
return request({
url: '/dbsync/db_sync',
......
......@@ -36,7 +36,7 @@
</template>
<script>
import { getNamespace, getDBName, dbSync, dbSyncQuery } from '@/api/dbconfig'
import { getNamespaceTke, getDBName, dbSyncTke, dbSyncQuery } from '@/api/dbconfig'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import JsonEditor from '@/components/JsonEditor'
......@@ -83,8 +83,8 @@ export default {
},
methods: {
getNamespace() {
getNamespace().then(res => {
this.namespaces = res.data.map(item => item.name)
getNamespaceTke().then(res => {
this.namespaces = res.data && res.data.namespaces.map(item => item.name)
})
},
......@@ -136,10 +136,9 @@ export default {
},
sync() {
console.log(1, this)
this.$refs['dataForm'].validate((valid) => {
if (valid) {
dbSync(this.temp).then((res) => {
dbSyncTke(this.temp).then((res) => {
this.dialogFormVisible = false
this.location = res.data.location
this.$notify({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment