Commit 66ab6798 authored by 智勇's avatar 智勇

Merge branch 'ns' into 'master'

Ns



See merge request !10
parents 57a72942 18bea402
module.exports = {
NODE_ENV: '"development"',
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"',
PIPELINE_API:'"http://pipes.liangkebang.com"'
}
......@@ -116,3 +116,25 @@ export function modifyIngressHost(data) {
data
})
}
export function getNamespaceTemplate() {
return request({
url: '/docker/get_namespace_template_new',
method: 'get'
})
}
export function getSystemByType() {
return request({
url: '/docker/get_systems_by_type_new',
method: 'get'
})
}
export function initNamespace(data) {
return request({
url: '/k8s/namespace/init',
method: 'post',
data
})
}
......@@ -114,10 +114,8 @@ export default {
getConfig() {
getConfig(this.listQuery).then(res => {
this.configs = res.data.data
})
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
})
},
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="preset_name" style="width:100%" @change="refershTemplateSelect">
<el-option v-for="item in templateArray" :value="item" :label="item.preset_name" :key="item.preset_name" />
</el-select>
</el-form-item>
<el-form-item v-for="(systemValue,systemKey) in system" :label="systemKey | upper" :key="systemKey">
<el-card >
<el-button v-for="item in systemValue" :key="item" :type="templateSystem[systemKey].includes(item) ?'success':''" style="margin:3px" @click="selectSystem(systemKey,item)">
{{ item }}
</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]
},
upper: function(value) {
if (!value) return ''
value = value.toString()
return value[0].toUpperCase() + value.slice(1)
}
},
data() {
return {
rules: {
dbname: [{ required: true, message: '请输入', trigger: 'change' }]
},
namespace: '',
code: undefined,
templateArray: [],
currentTemplate: undefined,
system: [],
templateSystem: {}
}
},
created() {
this.getNamespaceTemplate()
this.getSystem()
},
methods: {
getNamespaceTemplate() {
getNamespaceTemplate().then(res => {
this.templateArray = res.data.data
})
},
getSystem() {
getSystemByType().then(res => {
this.system = res.data.data
for (const index in this.system) {
this.templateSystem[index] = []
}
})
},
refershTemplateSelect(template) {
for (const index in template.details) {
this.templateSystem[index] = template.details[index]
}
},
selectSystem(key, value) {
const temp = this.templateSystem
const index = this.templateSystem[key].indexOf(value)
this.templateSystem = {}
if (index >= 0) {
temp[key].splice(index, 1)
this.templateSystem = temp
} else {
temp[key].push(value)
this.templateSystem = temp
}
},
createData() {
const obj = {
code: this.code,
namespace: this.namespace,
systems: this.templateSystem
}
initNamespace(obj).then(res => {
if (res.data.code === '0000') {
this.$message({
message: res.data.data,
type: 'success',
duration: 1000
})
} else {
this.$message({
message: res.data.msg,
type: 'error'
})
}
})
}
}
}
</script>
......@@ -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>
</el-card>
</el-row>
</div>
</template>
......
......@@ -177,9 +177,6 @@ export default {
this.applications = res.data.data
this.listLoading = false
})
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
},
getRefs(repo) {
......
......@@ -219,9 +219,6 @@ export default {
this.proconfigs = res.data.data
this.listLoading = false
})
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
},
handleFilter() {
this.getProjects()
......
......@@ -120,9 +120,6 @@ export default {
this.logs = res.data.data
this.listLoading = false
})
setTimeout(() => {
this.listLoading = false
}, 0.5 * 1000)
},
getLogCount() {
......
......@@ -116,9 +116,7 @@ export default {
getAll(query).then(res => {
this.peopleInfo = res.data.data
this.total = res.data.count
setTimeout(() => {
this.listLoading = false
}, 0.3 * 1000)
})
},
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