Commit 79912660 authored by xuezj's avatar xuezj

运行中环境增加同步mysql、部署应用服务、同步mq未完成

parent 650e0fc6
...@@ -6,6 +6,18 @@ export function getAllRepos() { ...@@ -6,6 +6,18 @@ export function getAllRepos() {
}) })
} }
export function getBaseRepos() {
return request({
url: '/repo/getBase'
})
}
export function getAppRepos() {
return request({
url: '/repo/getApp'
})
}
export function getAllEnvTemplate() { export function getAllEnvTemplate() {
return request({ return request({
url: '/envTemplate/getAll' url: '/envTemplate/getAll'
......
...@@ -41,6 +41,13 @@ const dockersRouter = { ...@@ -41,6 +41,13 @@ const dockersRouter = {
name: 'Detail', name: 'Detail',
meta: { title: 'detail', noCache: true }, meta: { title: 'detail', noCache: true },
hidden: true hidden: true
},
{
path: 'deployEnv/:name',
component: () => import('@/views/docker/deployEnv'),
name: 'deploy',
meta: { title: '部署应用服务', noCache: true },
hidden: true
} }
] ]
} }
......
...@@ -24,8 +24,9 @@ ...@@ -24,8 +24,9 @@
</el-form> </el-form>
<div style="margin-left:420px"> <div style="margin-left:420px">
<el-button :disabled="disableBool" type="primary" @click="sync()">{{ $t('table.confirm') }}</el-button> <el-button @click="goBack()">{{ $t('table.cancel') }}</el-button>
<el-button :disabled="disableBool" @click="resetTemp()">{{ $t('table.cancel') }}</el-button> <el-button :disabled="disableBool" type="primary" @click="sync()">{{ $t('table.confirm') }}
</el-button>
</div > </div >
</div > </div >
<div style="padding:10px 20px 0px"> <div style="padding:10px 20px 0px">
...@@ -82,6 +83,9 @@ export default { ...@@ -82,6 +83,9 @@ export default {
this.getDBName() this.getDBName()
}, },
methods: { methods: {
goBack() {
this.$router.go(-1)
},
getNamespace() { getNamespace() {
getNamespaceTke().then(res => { getNamespaceTke().then(res => {
this.namespaces = res.data && res.data.namespaces.map(item => item.name) this.namespaces = res.data && res.data.namespaces.map(item => item.name)
......
<template> <template>
<div class="app-container" style=""> <div class="app-container">
<el-form ref="dataForm" label-position="left" label-width="130px" style="width: 95%; margin-left:20px;"> <el-form ref="dataForm" label-position="left" label-width="130px" style="width: 95%; margin-left:20px;">
<el-alert
type="warning"
style="margin-bottom: 20px; font-size: 14px;"
show-icon>
<slot name="description">
<p>环境创建成功后,到运行中环境页面</p>
<p>1. 同步数据库 和 rabbitmq</p>
<p>2. 再部署应用服务</p>
</slot>
</el-alert>
<el-form-item label="Namespace名称"> <el-form-item label="Namespace名称">
<el-input v-model="namespace" placeholder="请输入"/> <el-input v-model="namespace" placeholder="请输入"/>
...@@ -28,7 +38,7 @@ ...@@ -28,7 +38,7 @@
</template> </template>
<script> <script>
import { getAllRepos, getAllEnvTemplate, createEnv } from '@/api/docker' import { getBaseRepos, getAllEnvTemplate, createEnv } from '@/api/docker'
export default { export default {
...@@ -57,8 +67,8 @@ export default { ...@@ -57,8 +67,8 @@ export default {
methods: { methods: {
getAllRepos() { getAllRepos() {
getAllRepos().then(res => { getBaseRepos().then(res => {
this.repoNamespaces = res.data this.repoNamespaces = res.data.filter(item => item.type === 'base')
}) })
}, },
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
更多操作 更多操作
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="syncDb">从线上同步DB</el-dropdown-item> <el-dropdown-item @click.native="syncDb">同步线上MySQL</el-dropdown-item>
<el-dropdown-item @click.native="syncMq">从线上同步MQ</el-dropdown-item> <el-dropdown-item @click.native="syncMq">同步线上MQ</el-dropdown-item>
<el-dropdown-item @click.native="clearRedis">清理Redis缓存</el-dropdown-item> <el-dropdown-item @click.native="clearRedis">清理Redis缓存</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
......
...@@ -18,33 +18,32 @@ ...@@ -18,33 +18,32 @@
<el-table-column <el-table-column
prop="name" prop="name"
label="名称" label="名称"
> width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<span class="link-type" @click="handleDetail(scope.row)">{{ scope.row.name }}</span> <span class="link-type" @click="handleDetail(scope.row.name)">{{ scope.row.name }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="createdAt" prop="createdAt"
label="创建时间" label="创建时间"
/> width="160"/>
<el-table-column <el-table-column
prop="status" prop="status"
label="运行状态" label="运行状态"
> width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.status | formatStatus }} {{ scope.row.status | formatStatus }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="description" prop="operation"
label="描述信息"/> label="操作">
<!--<el-table-column label="操作" min-width="100px">--> <template slot-scope="scope">
<!--<template slot-scope="scope">--> <el-button type="primary" size="mini" @click="syncMySQL(scope.row.name)">同步线上MySQL</el-button>
<!--<el-button type="infos" size="mini">备份</el-button>--> <el-button size="mini" type="primary" @click="syncMQ(scope.row.name)">同步线上MQ</el-button>
<!--<el-button size="mini" type="primary">挂起</el-button>--> <el-button size="mini" type="primary" @click="deploy(scope.row.name)">部署应用服务</el-button>
<!--<el-button size="mini" type="danger">删除</el-button>--> </template>
<!--</template>--> </el-table-column>
<!--</el-table-column>-->
</el-table> </el-table>
</div> </div>
</div> </div>
...@@ -64,6 +63,20 @@ export default { ...@@ -64,6 +63,20 @@ export default {
this.fetchK8sList() this.fetchK8sList()
}, },
methods: { methods: {
syncMySQL(namespace) {
this.$router.push({
path: '/dbsync',
query: { namespace: namespace }
})
},
syncMQ(namespace) {
console.log('todo')
},
deploy(namespace) {
this.$router.push({
path: `/dockers/deployEnv/${namespace}`
})
},
fetchK8sList() { fetchK8sList() {
fetchKubernetesList().then(res => { fetchKubernetesList().then(res => {
const exculde = ['default', 'kube-system'] const exculde = ['default', 'kube-system']
...@@ -80,9 +93,9 @@ export default { ...@@ -80,9 +93,9 @@ export default {
indexMethod(index) { indexMethod(index) {
return index + 1 return index + 1
}, },
handleDetail(scope) { handleDetail(namespace) {
this.$router.push({ this.$router.push({
path: `/dockers/runingEnv/${scope.name}` path: `/dockers/runingEnv/${namespace}`
}) })
}, },
handleEdit() { handleEdit() {
......
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