|
|
@@ -94,7 +94,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import {
|
|
|
- getDeployDetail,
|
|
|
+ // getDeployDetail,
|
|
|
getDeployLogInfo,
|
|
|
getLatestBuildInfoList,
|
|
|
makeDeploy,
|
|
|
@@ -108,14 +108,15 @@ export default {
|
|
|
isRunning: false,
|
|
|
deployStatus: "",
|
|
|
deployInfo: {},
|
|
|
- haveDeployRecord: false,
|
|
|
+ // haveDeployRecord: false,
|
|
|
deployLog: "",
|
|
|
unfoldDeployLogInfo: false,
|
|
|
latestBuildList: [],
|
|
|
latestDeployList: [],
|
|
|
latestMirrorIdList: [],
|
|
|
radio: -1,
|
|
|
- isfetchLog: false
|
|
|
+ isfetchLog: false,
|
|
|
+ latestDeployId: 0
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
@@ -129,46 +130,42 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- projectDetail: function(newVal) {
|
|
|
- console.log(newVal);
|
|
|
+ projectDetail: function() {
|
|
|
+ // console.log(newVal);
|
|
|
//获取最新一次部署详细信息
|
|
|
- if (newVal.latestDeploy && newVal.latestDeploy.id) {
|
|
|
- this.haveDeployRecord = true;
|
|
|
- this.getLatestDeployInfo(newVal.latestDeploy.id);
|
|
|
- // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
|
|
|
- }
|
|
|
+ // if (newVal.latestDeploy && newVal.latestDeploy.id) {
|
|
|
+ // // this.haveDeployRecord = true;
|
|
|
+ //
|
|
|
+ // // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
|
|
|
+ // }
|
|
|
+ this.getLatestDeployInfo();
|
|
|
this.getLatestBuildInfo(this.projectDetail && this.projectDetail.id, 5);
|
|
|
this.getLastNDeployInfoList(
|
|
|
this.projectDetail && this.projectDetail.id,
|
|
|
- 5
|
|
|
+ 5,
|
|
|
+ 1
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
- if (this.projectDetail.latestDeploy) {
|
|
|
- this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
|
|
|
- // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
|
|
|
- }
|
|
|
if (this.projectDetail.id) {
|
|
|
this.getLatestBuildInfo(this.projectDetail.id, 5);
|
|
|
- this.getLastNDeployInfoList(this.projectDetail.id, 5);
|
|
|
+ this.getLastNDeployInfoList(this.projectDetail.id, 5, 1);
|
|
|
+ this.getLatestDeployInfo();
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- //获取部署日志
|
|
|
- // checkDeployLog(){
|
|
|
- // if(this.projectDetail.latestDeploy){
|
|
|
- // this.getDeployLogInfo(this.projectDetail.latestDeploy.id);
|
|
|
- // }
|
|
|
- // },
|
|
|
- //获取最新一次部署详细信息
|
|
|
- getLatestDeployInfo(deployId) {
|
|
|
- getDeployDetail(deployId)
|
|
|
+ //获取最新一次部署信息
|
|
|
+ getLatestDeployInfo() {
|
|
|
+ getLatestDeployInfoList(this.projectDetail.id, 1, 0)
|
|
|
.then(res => {
|
|
|
- this.deployInfo = res.data;
|
|
|
- this.deployStatus = res.data.status;
|
|
|
- let isRunning = this.deployStatus == "RUNNING" ? true : false;
|
|
|
- this.isRunning = isRunning;
|
|
|
+ if (res.data && res.data.length > 0) {
|
|
|
+ this.latestDeployId = res.data[0].id;
|
|
|
+ this.deployInfo = res.data[0];
|
|
|
+ this.deployStatus = res.data[0].status;
|
|
|
+ let isRunning = this.deployStatus == "RUNNING" ? true : false;
|
|
|
+ this.isRunning = isRunning;
|
|
|
+ }
|
|
|
})
|
|
|
.catch(e => {
|
|
|
this.$toast.open({
|
|
|
@@ -177,6 +174,22 @@ export default {
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
+ //获取最新一次部署详细信息
|
|
|
+ // getLatestDeployInfo(deployId) {
|
|
|
+ // getDeployDetail(deployId)
|
|
|
+ // .then(res => {
|
|
|
+ // this.deployInfo = res.data;
|
|
|
+ // this.deployStatus = res.data.status;
|
|
|
+ // let isRunning = this.deployStatus == "RUNNING" ? true : false;
|
|
|
+ // this.isRunning = isRunning;
|
|
|
+ // })
|
|
|
+ // .catch(e => {
|
|
|
+ // this.$toast.open({
|
|
|
+ // message: e.message || "服务器未知错误",
|
|
|
+ // type: "is-danger"
|
|
|
+ // });
|
|
|
+ // });
|
|
|
+ // },
|
|
|
//处理时间格式
|
|
|
handleTime(time) {
|
|
|
if (!time) {
|
|
|
@@ -201,12 +214,20 @@ export default {
|
|
|
replicas: 1
|
|
|
})
|
|
|
.then(res => {
|
|
|
- console.log(res);
|
|
|
+ if (res.data.status == "SUCCESS") {
|
|
|
+ this.$toast.open({
|
|
|
+ message: "不要重复部署哦~",
|
|
|
+ type: "is-warning"
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // console.log(res);
|
|
|
this.$toast.open({
|
|
|
message: "开始部署",
|
|
|
type: "is-success"
|
|
|
});
|
|
|
this.isRunning = true;
|
|
|
+ this.deployInfo = res.data;
|
|
|
// setTimeout(() => {
|
|
|
// this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
|
|
|
// }, 1000);
|
|
|
@@ -220,8 +241,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
//获取最近n次部署成功记录
|
|
|
- getLastNDeployInfoList(projectId, limit) {
|
|
|
- getLatestDeployInfoList(projectId, limit)
|
|
|
+ getLastNDeployInfoList(projectId, limit, success) {
|
|
|
+ getLatestDeployInfoList(projectId, limit, success)
|
|
|
.then(res => {
|
|
|
this.latestDeployList = res.data;
|
|
|
// this.latestMirrorIdList = this.latestMirrorIdList.concat(res.data);
|
|
|
@@ -252,7 +273,7 @@ export default {
|
|
|
if (this.unfoldDeployLogInfo) {
|
|
|
this.unfoldDeployLogInfo = false;
|
|
|
} else {
|
|
|
- let deployId = this.projectDetail.latestDeploy.id;
|
|
|
+ let deployId = this.latestDeployId;
|
|
|
this.isfetchLog = true;
|
|
|
getDeployLogInfo(deployId)
|
|
|
.then(res => {
|