|
|
@@ -6,7 +6,11 @@
|
|
|
</div>
|
|
|
<div class="select-mirror" v-if="deployStatus != 'RUNNING'">
|
|
|
<div class="latest-build">
|
|
|
- <div class="test-item" :key="item.id" v-for="item in latestBuildList">
|
|
|
+ <div
|
|
|
+ class="test-item"
|
|
|
+ :key="`b${item.id}`"
|
|
|
+ v-for="item in latestBuildList"
|
|
|
+ >
|
|
|
<div>
|
|
|
<b-radio v-model="radio" :native-value="`b${item.id}`"> </b-radio>
|
|
|
<strong>构建ID: #</strong> {{ item.id }}
|
|
|
@@ -18,7 +22,7 @@
|
|
|
</div>
|
|
|
<div
|
|
|
class="test-item"
|
|
|
- :key="item.id"
|
|
|
+ :key="`d${item.id}`"
|
|
|
v-for="item in latestDeployList"
|
|
|
>
|
|
|
<div>
|
|
|
@@ -71,8 +75,13 @@
|
|
|
<div class="deploy-item">
|
|
|
<div class="subtitle">部署输出信息</div>
|
|
|
<a
|
|
|
- class="button is-small is-info"
|
|
|
- @click="unfoldDeployLogInfo = !unfoldDeployLogInfo"
|
|
|
+ :class="[
|
|
|
+ 'button',
|
|
|
+ 'is-small',
|
|
|
+ 'is-info',
|
|
|
+ { 'is-loading': isfetchLog }
|
|
|
+ ]"
|
|
|
+ @click="getDeployLogInfo"
|
|
|
>
|
|
|
{{ unfoldDeployLogInfo ? "收起部署详细信息" : "查看部署详细信息" }}</a
|
|
|
>
|
|
|
@@ -85,7 +94,7 @@
|
|
|
</template>
|
|
|
<script>
|
|
|
import {
|
|
|
- getDeployDetail,
|
|
|
+ // getDeployDetail,
|
|
|
getDeployLogInfo,
|
|
|
getLatestBuildInfoList,
|
|
|
makeDeploy,
|
|
|
@@ -99,13 +108,15 @@ export default {
|
|
|
isRunning: false,
|
|
|
deployStatus: "",
|
|
|
deployInfo: {},
|
|
|
- haveDeployRecord: false,
|
|
|
+ // haveDeployRecord: false,
|
|
|
deployLog: "",
|
|
|
unfoldDeployLogInfo: false,
|
|
|
latestBuildList: [],
|
|
|
latestDeployList: [],
|
|
|
latestMirrorIdList: [],
|
|
|
- radio: -1
|
|
|
+ radio: -1,
|
|
|
+ isfetchLog: false,
|
|
|
+ latestDeployId: 0
|
|
|
};
|
|
|
},
|
|
|
props: {
|
|
|
@@ -119,41 +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.getLatestDeployInfo(17);
|
|
|
- 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: {
|
|
|
- //获取最新一次部署详细信息
|
|
|
- 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({
|
|
|
@@ -162,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) {
|
|
|
@@ -186,17 +214,25 @@ 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;
|
|
|
- setTimeout(() => {
|
|
|
- this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
|
|
|
- }, 1000);
|
|
|
+ this.deployInfo = res.data;
|
|
|
+ // setTimeout(() => {
|
|
|
+ // this.getLatestDeployInfo(this.projectDetail.latestDeploy.id);
|
|
|
+ // }, 1000);
|
|
|
})
|
|
|
- .then(e => {
|
|
|
+ .catch(e => {
|
|
|
this.$toast.open({
|
|
|
message: e.message || "服务器未知错误",
|
|
|
type: "is-danger"
|
|
|
@@ -205,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);
|
|
|
@@ -233,17 +269,26 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
//获取部署日志
|
|
|
- getDeployLogInfo(deployId) {
|
|
|
- getDeployLogInfo(deployId)
|
|
|
- .then(res => {
|
|
|
- this.deployLog = res.data;
|
|
|
- })
|
|
|
- .catch(e => {
|
|
|
- this.$toast.open({
|
|
|
- message: e.message || "服务器未知错误",
|
|
|
- type: "is-danger"
|
|
|
+ getDeployLogInfo() {
|
|
|
+ if (this.unfoldDeployLogInfo) {
|
|
|
+ this.unfoldDeployLogInfo = false;
|
|
|
+ } else {
|
|
|
+ let deployId = this.latestDeployId;
|
|
|
+ this.isfetchLog = true;
|
|
|
+ getDeployLogInfo(deployId)
|
|
|
+ .then(res => {
|
|
|
+ this.deployLog = res.data;
|
|
|
+ this.unfoldDeployLogInfo = true;
|
|
|
+ this.isfetchLog = false;
|
|
|
+ })
|
|
|
+ .catch(e => {
|
|
|
+ this.isfetchLog = false;
|
|
|
+ this.$toast.open({
|
|
|
+ message: e.message || "服务器未知错误",
|
|
|
+ type: "is-danger"
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
},
|
|
|
//部署类型
|
|
|
type(value) {
|