Commit 218f03e7 authored by zhouzihao's avatar zhouzihao

dev-添加配置和环境列表OC

parent 485ce0f5
......@@ -491,22 +491,22 @@ export default {
},
]
},
{
title:'配置管理',
name:'configMange',
icon:'ios-cash',
children:[
{
title:'配置列表',
name:'configList',
href:'/configList',
closable:true,
showInTags:false,
showInMenus:true,
choosed:false
},
]
},
// {
// title:'配置管理',
// name:'configMange',
// icon:'ios-cash',
// children:[
// {
// title:'配置列表',
// name:'configList',
// href:'/configList',
// closable:true,
// showInTags:false,
// showInMenus:true,
// choosed:false
// },
// ]
// },
{
title:'构建管理',
name:'buildManage',
......
......@@ -29,7 +29,17 @@ export default new Router({
component: () => import('@/views/ProjectList')
},
// 环境列表
{
path: 'envlist',
name: 'envlist',
component: () => import('@/views/EnvList')
},
// 配置列表
{
path: 'configList',
name: 'configList',
component: () => import('@/views/ConfigList')
},
// 构建日志列表
// 源数据
]
......
<style lang="postcss" scoped>
.home-container {
}
.demo-drawer-footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
</style>
<template>
<section class="home-container">
<MasterPage :title="project_name">
<div slot="title-icon">
<Icon type="md-settings" />
</div>
<div slot="title-toolbar">
<!-- title工具栏 -->
</div>
<div slot="searchContent" class="search-content-slot">
<Select v-model="env_id" style="width:200px">
<Option v-for="item in envlist" :value="item.env_id" :key="item.env_id">{{ item.name }}</Option>
</Select>
</div>
<div slot="search">
<Button type="info" icon="ios-search" @click="getList">查询</Button>
</div>
<div slot="btns">
<Button type="primary" icon="md-add" @click="addShow">添加</Button>
</div>
<div slot="paddingContent">
<Table :columns="columns1" :data="data1"></Table>
</div>
<div slot="pager"></div>
</MasterPage>
<Drawer title="配置详情" :closable="false" v-model="isShow" width="720">
<div>
<Form :model="showData" label-position="left" :label-width="100">
<h1>{{project_name}}在环境{{env_name}}({{env_id}})内的配置</h1>
<FormItem label="配置类型">
<Select v-model="showData.type" style="width:200px">
<Option
v-for="item in typeList"
:value="item.value"
:key="item.value"
>{{ item.label }}</Option>
</Select>
</FormItem>
<FormItem label="配置文件地址">
<Input v-model="showData.path"></Input>
</FormItem>
<FormItem label="配置内容">
<Input v-model="showData.content" type="textarea" :autosize="true"></Input>
</FormItem>
</Form>
</div>
<div class="demo-drawer-footer">
<Button style="margin-right: 8px" @click="isShow= false">取消</Button>
<Button type="primary" @click="save">保存</Button>
</div>
</Drawer>
</section>
</template>
<script>
import MasterPage from "@/components/Master";
import axios from "axios";
import config from "@/config/configs";
export default {
components: {
MasterPage
},
data() {
return {
typeList: [
{
value: 1,
label: "替换"
},
{
value: 2,
label: "覆盖"
}
],
columns1: [
{
title: "配置id",
key: "config_id",
width: 100,
fixed: "left"
},
{
title: "环境名",
key: "env_id",
width: 100,
fixed: "left"
},
{
title: "项目id",
key: "p_id",
width: 100
},
{
title: "配置地址",
key: "path",
width: 200
},
{
title: "配置内容",
key: "content",
// width: 300
},
{
title: "配置方式",
key: "type",
width: 100
},
{
title: "操作",
key: "action",
fixed: "right",
width: 150,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.show(params.index);
}
}
},
"显示/修改"
)
]);
}
}
],
data1: [],
isShow: false,
isAdd: false,
showData: {},
env_id: 1,
env_name: "",
p_id: 1,
envlist: [],
project_name: ""
};
},
methods: {
getList: function() {
// todo 添加选项
axios
.get(
config.serve_url +
"/config/?p_id= " +
this.p_id +
"&env_id=" +
this.env_id
)
.then(rs => {
if (rs.status == 200) {
console.log(JSON.stringify(rs.data));
this.data1 = rs.data;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
getEnvList: function() {
axios
.get(config.serve_url + "/env/")
.then(rs => {
if (rs.status == 200) {
this.envlist = rs.data;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
addShow: function() {
this.isShow = true;
// 这里正好名字可以对上
this.showData = {
p_id: this.p_id,
env_id: this.env_id
};
},
show: function(index) {
this.isShow = true;
this.showData = this.data1[index];
},
build: function() {
//
},
save: function() {
//保存或者新建
this.isShow = false;
axios
.post(config.serve_url + "/config/", this.showData)
.then(res => {
console.info(JSON.stringify(this.showData));
console.info(JSON.stringify(res));
this.$Message.success("操作成功");
this.getList();
})
.catch(err => {
this.$Message.error(err);
});
}
},
mounted: function() {
this.getEnvList();
// console.log(JSON.stringify(this.$route.query.p_id));
this.p_id = this.$route.query.p_id;
this.project_name = this.$route.query.name;
this.getList();
// this.search.project_name = this.$route.query.name;
}
};
</script>
\ No newline at end of file
<style lang="postcss" scoped>
.home-container {
}
.demo-drawer-footer {
width: 100%;
position: absolute;
bottom: 0;
left: 0;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
background: #fff;
}
</style>
<template>
<section class="home-container">
<MasterPage title="环境列表">
<div slot="title-icon">
<Icon type="ios-albums" />
</div>
<div slot="title-toolbar">
<!-- title工具栏 -->
</div>
<div slot="searchContent" class="search-content-slot">
<!-- 表单位置 -->
</div>
<div slot="search">
<Button type="info" icon="ios-search" @click="getList">查询</Button>
</div>
<div slot="btns">
<Button type="primary" icon="md-add" @click="addShow">添加</Button>
</div>
<div slot="paddingContent">
<Table :columns="columns1" :data="data1"></Table>
</div>
<div slot="pager"></div>
</MasterPage>
<Drawer title="项目详情" :closable="false" v-model="isShow" width="720">
<div>
<Form :model="showData" label-position="left" :label-width="100">
<FormItem label="环境名称">
<Input v-model="showData.name"></Input>
</FormItem>
<FormItem label="目标geilab地址">
<Input v-model="showData.target_git_url"></Input>
</FormItem>
<FormItem label="gitlab令牌">
<Input v-model="showData.target_git_token"></Input>
</FormItem>
<FormItem label="Docker仓库地址">
<Input v-model="showData.registry_url"></Input>
</FormItem>
<FormItem label="Docker仓库组群">
<Input v-model="showData.registry_group"></Input>
</FormItem>
<FormItem label="docker仓库账号">
<Input v-model="showData.registry_username" ></Input>
</FormItem>
<FormItem label="docker仓库密码">
<Input v-model="showData.registry_password" ></Input>
</FormItem>
</Form>
</div>
<div class="demo-drawer-footer">
<Button style="margin-right: 8px" @click="isShow= false">取消</Button>
<Button type="primary" @click="save">保存</Button>
</div>
</Drawer>
</section>
</template>
<script>
import MasterPage from "@/components/Master";
import axios from "axios";
import config from "@/config/configs";
export default {
components: {
MasterPage
},
data() {
return {
columns1: [
{
title: "环境id",
key: "env_id",
width: 100,
fixed: "left"
},
{
title: "环境名",
key: "name",
width: 300,
fixed: "left"
},
{
title: "目标gitlab地址",
key: "target_git_url",
width: 300
},
{
title: "目标gitlab令牌",
key: "target_git_token",
width: 100
},
{
title: "目标docker仓库地址",
key: "registry_url",
width: 200
},
{
title: "目标镜像组群",
key: "registry_group",
width: 100
},
{
title: "镜像仓库账号",
key: "registry_username",
width: 100
},
{
title: "镜像仓库密码",
key: "registry_password",
width: 100
},
{
title: "操作",
key: "action",
fixed: "right",
width: 150,
render: (h, params) => {
return h("div", [
h(
"Button",
{
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
},
on: {
click: () => {
this.show(params.index);
}
}
},
"显示/修改"
)
]);
}
}
],
data1: [],
isShow: false,
isAdd: false,
showData: {}
};
},
methods: {
getList: function() {
axios
.get(config.serve_url + "/env/")
.then(rs => {
if (rs.status == 200) {
this.data1 = rs.data;
// this.total = rs.data.paged.total;
}
})
.catch(err => {
console.log(JSON.stringify(err));
});
},
addShow: function() {
this.isShow = true;
this.showData = {};
},
show: function(index) {
this.isShow = true;
this.showData = this.data1[index];
},
build: function() {
//
},
save: function() {
//保存或者新建
this.isShow = false;
axios
.post(config.serve_url + "/env/", this.showData)
.then(res => {
this.$Message.success("操作成功");
this.getList();
})
.catch(err => {
this.$Message.error(err);
});
},
pageChange: function(i) {
this.page = i;
this.getList();
}
},
mounted: function() {
this.getList();
}
};
</script>
\ No newline at end of file
......@@ -70,7 +70,7 @@
<script>
import MasterPage from "@/components/Master";
import axios from "axios";
import config from "@/config/configs"
import config from "@/config/configs";
export default {
components: {
......@@ -119,7 +119,7 @@ export default {
title: "操作",
key: "action",
fixed: "right",
width: 150,
width: 200,
render: (h, params) => {
return h("div", [
h(
......@@ -146,9 +146,28 @@ export default {
props: {
type: "primary",
size: "small"
},
style: {
marginRight: "5px"
}
},
"build"
),
h(
"Button",
{
props: {
type: "primary",
size: "small",
icon: "md-settings"
},
on: {
click: () => {
this.goConfigs(params.index);
}
}
},
""
)
]);
}
......@@ -167,7 +186,8 @@ export default {
getList: function() {
axios
.get(
config.serve_url+"/project/page?page=" +
config.serve_url +
"/project/page?page=" +
this.page +
"&pageSize=" +
this.pageSize
......@@ -193,11 +213,14 @@ export default {
build: function() {
//
},
goConfigs: function(index) {
this.$router.push({ path: "/configList", query: this.data1[index] });
},
save: function() {
//保存或者新建
this.isShow = false;
axios
.post( config.serve_url+"/project/", this.showData)
.post(config.serve_url + "/project/", this.showData)
.then(res => {
this.$Message.success("操作成功");
this.getList();
......
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