Skip to content

Commit

Permalink
Merge pull request #110 from sampsonye/feature-jenkins-log
Browse files Browse the repository at this point in the history
feat: mv jenkins log dialog to components directory
  • Loading branch information
colynn committed Apr 2, 2022
2 parents 413e388 + 3290820 commit 574f23c
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 53 deletions.
73 changes: 73 additions & 0 deletions web/src/views/project/components/JenkinsLog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<template>
<el-dialog
ref="atomciDialog"
class="atomciDialog"
title="详细日志"
:fullscreen="viewLog.fullscreen"
:visible.sync="viewLog.visible"
:append-to-body="true"
:close-on-click-modal="false"
:show-close="false"
width="90%"
center
>
<div slot="title" class="medium">
<div class="selftitle">
<span>详细日志</span>
<div class="icons">
<i :class="viewLog.fullscreen ? 'el-icon-bottom-left' : 'el-icon-full-screen'" @click="viewLog.fullscreen=!viewLog.fullscreen"></i>
<i class="el-icon-close" @click="viewLog.visible=false"></i>
</div>
</div>
</div>
<div class="dialogBody">
<slot>
<iframe :src="viewLog.url" frameborder="0" width="100%" scrolling="auto" class="viewlog" />
</slot>
</div>
</el-dialog>
</template>

<script>
import backend from "@/api/backend";
export default {
name: "JenkinsLog",
data(){
return {
viewLog:{
visible: false,
fullscreen: false,
url: null,
}
}
},
methods:{
doCreate(jobName,runId,stageId){
backend.getJenkinsServer((data) => {
let jenkinsURL = data.jenkins;
if (jenkinsURL.endsWith('/')) {
jenkinsURL = jenkinsURL.slice(0, -1);
}
this.viewLog.url = `${jenkinsURL}/blue/organizations/jenkins/${jobName}/detail/${jobName}/${runId}/pipeline/`;
this.viewLog.visible = true;
}, stageId);
},
}
}
</script>

<style scoped>
.viewlog {
width: 100%;
height: 100%;
min-height: 600px;
}
.selftitle>.icons{
display: flex;
float: right;
font-size:24px
}
</style>
59 changes: 6 additions & 53 deletions web/src/views/project/detail/ProjectCIDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -144,34 +144,7 @@
<to-build v-on:getprojectReleaseList="getVersionInfo" ref="goToBuild"></to-build>
<version-add v-on:getlist="getVersionInfo" ref="versionAdd"></version-add>
<publish-edit v-on:getPublishBaseInfo="getVersionBaseInfo" ref="publishEdit"></publish-edit>
<el-dialog
v-dialogDrag
ref="atomciDialog"
class="atomciDialog"
title="详细日志"
:fullscreen="viewLog.fullscreen"
:visible.sync="viewLog.visiable"
:append-to-body="true"
:close-on-click-modal="false"
:show-close="false"
width="90%"
center
>
<div slot="title" class="medium">
<div class="selftitle">
<span>详细日志</span>
<div class="icons">
<i :class="viewLog.fullscreen ? 'el-icon-bottom-left' : 'el-icon-full-screen'" @click="viewLog.fullscreen=!viewLog.fullscreen"></i>
<i class="el-icon-close" @click="viewLog.visiable=false"></i>
</div>
</div>
</div>
<div class="dialogBody">
<slot>
<iframe :src="viewLog.url" frameborder="0" width="100%" scrolling="auto" class="viewlog" />
</slot>
</div>
</el-dialog>
<jenkins-log ref="jenkinsLog"></jenkins-log>
</div>
</template>

Expand Down Expand Up @@ -297,16 +270,6 @@
.env-run {
background-image: url(../../../assets/env_run.png);
}
.viewlog {
width: 100%;
height: 100%;
min-height: 600px;
}
.selftitle>.icons{
display: flex;
float: right;
font-size:24px
}
</style>
<script>
Expand All @@ -322,6 +285,7 @@
import ProjectDeploy from '../dialogCI/ProjectDeploy'; // 部署
import versionAdd from '../dialogCI/ProjectVersionAdd'; //添加应用
import PublishEdit from '../dialogCI/PublishEdit'; // 编辑版本
import JenkinsLog from "../components/JenkinsLog"; //查看Jenkins运行日志
Expand All @@ -337,14 +301,10 @@ export default {
],
iconClass: ['env-error', 'env-done', 'env-run', 'env-next', 'env-done', 'env-done', 'env-next', 'env-done', 'env-error', 'env-error', 'env-error'],
statusCheck: false,
viewLog: {
visiable: false,
fullscreen: false,
url: null,
},
};
},
components: {
JenkinsLog,
BackTo,
NextStage,
ToBuild,
Expand Down Expand Up @@ -446,15 +406,8 @@ export default {
this.$refs.pages.total = data.total;
});
},
viewFile(item) {
backend.getJenkinsServer((data) => {
let jenkinsURL = data.jenkins;
if (jenkinsURL.endsWith('/')) {
jenkinsURL = jenkinsURL.slice(0, -1);
}
this.viewLog.url = `${jenkinsURL}/blue/organizations/jenkins/${item.job_name}/detail/${item.job_name}/${item.run_id}/pipeline/`;
this.viewLog.visiable = true;
}, item.stage_id);
viewFile(item){
this.$refs.jenkinsLog.doCreate(item.job_name,item.run_id,item.stage_id)
},
// 移除应用
removeApp(id) {
Expand All @@ -469,4 +422,4 @@ export default {
},
}
}
</script>
</script>

0 comments on commit 574f23c

Please sign in to comment.