Commit fa4d7d4e authored by 智勇's avatar 智勇

创建ns

parent 57a72942
module.exports = { module.exports = {
NODE_ENV: '"development"', NODE_ENV: '"development"',
ENV_CONFIG: '"dev"', ENV_CONFIG: '"dev"',
QA_API: '"http://172.30.220.22:3003"', // QA_API: '"http://172.30.220.22:3003"',
QA_API: '"http://127.0.0.1:3003"',
TESTDATA_API: '"http://172.30.220.22:3333"', TESTDATA_API: '"http://172.30.220.22:3333"',
PIPELINE_API:'"http://pipes.liangkebang.com"' PIPELINE_API:'"http://pipes.liangkebang.com"'
} }
...@@ -116,3 +116,25 @@ export function modifyIngressHost(data) { ...@@ -116,3 +116,25 @@ export function modifyIngressHost(data) {
data data
}) })
} }
export function getNamespaceTemplate() {
return request({
url: '/docker/get_namespace_template',
method: 'get'
})
}
export function getSystemByType() {
return request({
url: '/docker/get_systems_by_type',
method: 'get'
})
}
export function initNamespace(data) {
return request({
url: '/k8s/namespace/init',
method: 'post',
data
})
}
...@@ -114,10 +114,8 @@ export default { ...@@ -114,10 +114,8 @@ export default {
getConfig() { getConfig() {
getConfig(this.listQuery).then(res => { getConfig(this.listQuery).then(res => {
this.configs = res.data.data this.configs = res.data.data
})
setTimeout(() => {
this.listLoading = false this.listLoading = false
}, 0.5 * 1000) })
}, },
resetTemp() { resetTemp() {
......
<template>
<div class="app-container" style="">
<el-form ref="dataForm" :rules="rules" label-position="left" label-width="130px" style="width: 95%; margin-left:20px;">
<el-form-item label="Namespace名称">
<el-input v-model="namespace" placeholder="请输入"/>
</el-form-item>
<el-form-item label="创建环境确认码">
<el-input v-model="code" placeholder="请输入"/>
</el-form-item>
<el-form-item label="选择模板" >
<el-select v-model="currentTemplate" value-key="label" style="width:100%" @change="refershTemplateSelect">
<el-option v-for="item in templateArray" :value="item" :label="item.label" :key="item.label" />
</el-select>
</el-form-item>
<el-form-item v-for="(value,key) in system" :label="key | serviceType" :key="key">
<el-card >
<el-button v-for="item in value" :key="item.label" :type="item.select?'success':''" style="margin:3px" @click="item.select=!item.select">
{{ item.label }}
</el-button>
</el-card>
</el-form-item>
</el-form>
<!-- <el-button @click="dialogFormVisible = false">{{ $t('table.cancel') }}</el-button> -->
<el-button style="margin-right:40px;margin-bottom:40px;float:right" type="primary" @click="createData()">{{ $t('table.confirm') }}</el-button>
</div>
</template>
<script>
import { getNamespaceTemplate, getSystemByType, initNamespace } from '@/api/docker'
export default {
filters: {
serviceType(service) {
const serviceObj = {
common: '基础服务',
backend: '后端服务',
frontend: '前端服务'
}
return serviceObj[service]
}
},
data() {
return {
rules: {
dbname: [{ required: true, message: '请输入', trigger: 'change' }]
},
namespace: '',
code: undefined,
templateArray: [],
currentTemplate: undefined,
system: []
}
},
created() {
this.getNamespaceTemplate()
this.getSystem()
},
methods: {
getNamespaceTemplate() {
getNamespaceTemplate().then(res => {
this.templateArray = res.data.data
})
},
getSystem() {
getSystemByType().then(res => {
this.system = res.data.data
})
},
refershTemplateSelect(template) {
const keys = Object.keys(template.template)
for (const k of keys) {
for (const o of this.system[k]) {
if (template.template[k][o.label]) {
o.select = true
} else {
o.select = false
}
}
}
},
fullshTemplate(template) {
const keys = Object.keys(template)
for (const k of keys) {
for (const o of this.systems[k]) {
if (template[k][o.label]) {
o.select = true
} else {
o.select = false
}
}
}
},
createData() {
const data = {
code: this.code,
namespace: this.namespace,
systems: this.system
}
console.log(1, data)
initNamespace(data).then(res => {
if (res.data.code === '0000') {
this.$message({
message: res.data.msg,
type: 'success',
duration: 1000
})
} else {
this.$message({
message: res.data.msg,
type: 'error'
})
}
})
}
}
}
</script>
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<Button v-for="data in item.data" :key="data.remark" :class="`pan-btn ${item.color}-btn`" style="padding:10px;margin:5px" @click="openNewWindow(data.url)">{{ data.remark }}</Button> <Button v-for="data in item.data" :key="data.remark" :class="`pan-btn ${item.color}-btn`" style="padding:10px;margin:5px" @click="openNewWindow(data.url)">{{ data.remark }}</Button>
</el-card> </el-card>
</el-row> </el-row>
</div> </div>
</template> </template>
......
...@@ -177,9 +177,6 @@ export default { ...@@ -177,9 +177,6 @@ export default {
this.applications = res.data.data this.applications = res.data.data
this.listLoading = false this.listLoading = false
}) })
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
}, },
getRefs(repo) { getRefs(repo) {
......
...@@ -219,9 +219,6 @@ export default { ...@@ -219,9 +219,6 @@ export default {
this.proconfigs = res.data.data this.proconfigs = res.data.data
this.listLoading = false this.listLoading = false
}) })
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
}, },
handleFilter() { handleFilter() {
this.getProjects() this.getProjects()
......
...@@ -120,9 +120,6 @@ export default { ...@@ -120,9 +120,6 @@ export default {
this.logs = res.data.data this.logs = res.data.data
this.listLoading = false this.listLoading = false
}) })
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
}, },
getLogCount() { getLogCount() {
......
...@@ -116,9 +116,7 @@ export default { ...@@ -116,9 +116,7 @@ export default {
getAll(query).then(res => { getAll(query).then(res => {
this.peopleInfo = res.data.data this.peopleInfo = res.data.data
this.total = res.data.count this.total = res.data.count
setTimeout(() => { this.listLoading = false
this.listLoading = false
}, 0.3 * 1000)
}) })
}, },
generate() { generate() {
......
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