Commit 150f8df5 authored by zhouzihao's avatar zhouzihao

dev-添加了项目构建的前端功能

parent fc8e18c5
...@@ -62,7 +62,7 @@ export default { ...@@ -62,7 +62,7 @@ export default {
{ {
title: "项目名称", title: "项目名称",
key: "project_name", key: "project_name",
width: 100 width: 300
}, },
{ {
title: "构建环境", title: "构建环境",
...@@ -125,7 +125,7 @@ export default { ...@@ -125,7 +125,7 @@ export default {
{ {
title: "镜像名称", title: "镜像名称",
key: "image_name", key: "image_name",
width: 100 width: 400
}, },
{ {
title: "报错地址", title: "报错地址",
......
...@@ -71,7 +71,32 @@ ...@@ -71,7 +71,32 @@
<Button type="primary" @click="save">保存</Button> <Button type="primary" @click="save">保存</Button>
</div> </div>
</Drawer> </Drawer>
<Drawer title="构建项目" :closable="false" v-model="showBuild" width="720">
<div>
<Form :model="buildData" label-position="left" :label-width="100">
<FormItem label="构建分支">
<Input v-model="buildData.branch"></Input>
</FormItem>
<FormItem label="构建版本">
<Input v-model="buildData.version"></Input>
</FormItem>
<FormItem label="构建环境类型">
<Select v-model="buildData.env_id" style="width:200px">
<Option
v-for="item in envlist"
:value="item.env_id"
:key="item.env_id"
>{{ item.name }}</Option>
</Select>
</FormItem>
</Form>
</div>
<div class="demo-drawer-footer">
<Button style="margin-right: 8px" @click="showBuild= false">取消</Button>
<Button type="primary" @click="build">保存</Button>
</div>
<Spin size="large" fix v-if="spinShow"></Spin>
</Drawer>
</section> </section>
</template> </template>
<script> <script>
...@@ -160,6 +185,11 @@ export default { ...@@ -160,6 +185,11 @@ export default {
}, },
style: { style: {
marginRight: "5px" marginRight: "5px"
},
on: {
click: () => {
this.showBuildDraw(params.index);
}
} }
}, },
"build" "build"
...@@ -191,10 +221,26 @@ export default { ...@@ -191,10 +221,26 @@ export default {
isShow: false, isShow: false,
isAdd: false, isAdd: false,
showData: {}, showData: {},
typeList: [] typeList: [],
showBuild: false,
buildData: {},
envlist: [],
spinShow: false
}; };
}, },
methods: { methods: {
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));
});
},
getList: function() { getList: function() {
axios axios
.get( .get(
...@@ -222,9 +268,6 @@ export default { ...@@ -222,9 +268,6 @@ export default {
this.isShow = true; this.isShow = true;
this.showData = this.data1[index]; this.showData = this.data1[index];
}, },
build: function() {
//
},
goConfigs: function(index) { goConfigs: function(index) {
this.$router.push({ path: "/configList", query: this.data1[index] }); this.$router.push({ path: "/configList", query: this.data1[index] });
}, },
...@@ -257,13 +300,42 @@ export default { ...@@ -257,13 +300,42 @@ export default {
console.log(JSON.stringify(err)); console.log(JSON.stringify(err));
}); });
}, },
getType(type_id) { getType: function(type_id) {
return _.find(this.typeList, { type_id: type_id }).name; return _.find(this.typeList, { type_id: type_id }).name;
},
showBuildDraw: function(index) {
this.buildData["p_id"] = this.data1[index].p_id;
this.buildData["branch"] = "master";
console.log(this.buildData);
this.showBuild = true;
},
build: function() {
this.spinShow = true;
axios
.post(config.serve_url + "/project/build/", this.buildData)
.then(rs => {
var rr = JSON.parse(rs.data);
if (rr.success) {
this.spinShow = false;
this.showBuild = false;
this.$Message.success("构建成功!");
} else {
this.spinShow = false;
// this.showBuild = false;
this.$Message.error("构建失败请联系管理员处理");
}
})
.catch(err => {
this.spinShow = false;
// this.showBuild = false;
this.$Message.error(err + "构建失败请联系管理员处理");
});
} }
}, },
mounted: function() { mounted: function() {
this.getList(); this.getList();
this.getTypeList(); this.getTypeList();
this.getEnvList();
} }
}; };
</script> </script>
\ No newline at end of file
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