Commit 650e0fc6 authored by xuezj's avatar xuezj

实现db同步

parent 968bba5b
...@@ -24,6 +24,14 @@ export function deleteConfig(query) { ...@@ -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) { export function getNamespace(query) {
return request({ return request({
url: '/dbsync/get_name_space', url: '/dbsync/get_name_space',
...@@ -40,6 +48,14 @@ export function getDBName(query) { ...@@ -40,6 +48,14 @@ export function getDBName(query) {
}) })
} }
export function dbSyncTke(data) {
return request({
url: '/dbsync/tke',
method: 'post',
data
})
}
export function dbSync(data) { export function dbSync(data) {
return request({ return request({
url: '/dbsync/db_sync', url: '/dbsync/db_sync',
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
</template> </template>
<script> <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 Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import JsonEditor from '@/components/JsonEditor' import JsonEditor from '@/components/JsonEditor'
...@@ -83,8 +83,8 @@ export default { ...@@ -83,8 +83,8 @@ export default {
}, },
methods: { methods: {
getNamespace() { getNamespace() {
getNamespace().then(res => { getNamespaceTke().then(res => {
this.namespaces = res.data.map(item => item.name) this.namespaces = res.data && res.data.namespaces.map(item => item.name)
}) })
}, },
...@@ -136,10 +136,9 @@ export default { ...@@ -136,10 +136,9 @@ export default {
}, },
sync() { sync() {
console.log(1, this)
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
dbSync(this.temp).then((res) => { dbSyncTke(this.temp).then((res) => {
this.dialogFormVisible = false this.dialogFormVisible = false
this.location = res.data.location this.location = res.data.location
this.$notify({ 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