2018-05-09 12:01:36 +05:30
|
|
|
<script>
|
2018-11-08 19:23:39 +05:30
|
|
|
import { mapActions, mapState, mapGetters } from 'vuex';
|
2018-05-09 12:01:36 +05:30
|
|
|
import icon from '~/vue_shared/components/icon.vue';
|
|
|
|
import tooltip from '~/vue_shared/directives/tooltip';
|
|
|
|
import timeAgoMixin from '~/vue_shared/mixins/timeago';
|
2018-11-08 19:23:39 +05:30
|
|
|
import CiIcon from '../../vue_shared/components/ci_icon.vue';
|
2018-10-15 14:42:47 +05:30
|
|
|
import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue';
|
2018-11-18 11:00:15 +05:30
|
|
|
import { rightSidebarViews } from '../constants';
|
2018-05-09 12:01:36 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
icon,
|
2018-10-15 14:42:47 +05:30
|
|
|
userAvatarImage,
|
2018-11-08 19:23:39 +05:30
|
|
|
CiIcon,
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
|
|
|
mixins: [timeAgoMixin],
|
|
|
|
props: {
|
|
|
|
file: {
|
|
|
|
type: Object,
|
2018-10-15 14:42:47 +05:30
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
lastCommitFormatedAge: null,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
2018-11-08 19:23:39 +05:30
|
|
|
...mapState(['currentBranchId', 'currentProjectId']),
|
2018-10-15 14:42:47 +05:30
|
|
|
...mapGetters(['currentProject', 'lastCommit']),
|
2018-11-08 19:23:39 +05:30
|
|
|
...mapState('pipelines', ['latestPipeline']),
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
lastCommit() {
|
|
|
|
this.initPipelinePolling();
|
|
|
|
},
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.startTimer();
|
|
|
|
},
|
|
|
|
beforeDestroy() {
|
|
|
|
if (this.intervalId) {
|
|
|
|
clearInterval(this.intervalId);
|
|
|
|
}
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
this.stopPipelinePolling();
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
methods: {
|
2018-11-18 11:00:15 +05:30
|
|
|
...mapActions(['setRightPane']),
|
2018-11-08 19:23:39 +05:30
|
|
|
...mapActions('pipelines', ['fetchLatestPipeline', 'stopPipelinePolling']),
|
2018-10-15 14:42:47 +05:30
|
|
|
startTimer() {
|
|
|
|
this.intervalId = setInterval(() => {
|
|
|
|
this.commitAgeUpdate();
|
|
|
|
}, 1000);
|
|
|
|
},
|
2018-11-08 19:23:39 +05:30
|
|
|
initPipelinePolling() {
|
|
|
|
if (this.lastCommit) {
|
|
|
|
this.fetchLatestPipeline();
|
|
|
|
}
|
|
|
|
},
|
2018-10-15 14:42:47 +05:30
|
|
|
commitAgeUpdate() {
|
|
|
|
if (this.lastCommit) {
|
|
|
|
this.lastCommitFormatedAge = this.timeFormated(this.lastCommit.committed_date);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
getCommitPath(shortSha) {
|
|
|
|
return `${this.currentProject.web_url}/commit/${shortSha}`;
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
rightSidebarViews,
|
2018-05-09 12:01:36 +05:30
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2018-10-15 14:42:47 +05:30
|
|
|
<footer class="ide-status-bar">
|
|
|
|
<div
|
2018-11-18 11:00:15 +05:30
|
|
|
v-if="lastCommit"
|
2018-11-08 19:23:39 +05:30
|
|
|
class="ide-status-branch"
|
2018-10-15 14:42:47 +05:30
|
|
|
>
|
2018-11-08 19:23:39 +05:30
|
|
|
<span
|
|
|
|
v-if="latestPipeline && latestPipeline.details"
|
|
|
|
class="ide-status-pipeline"
|
|
|
|
>
|
2018-11-18 11:00:15 +05:30
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
class="p-0 border-0 h-50"
|
|
|
|
@click="setRightPane($options.rightSidebarViews.pipelines)"
|
|
|
|
>
|
|
|
|
<ci-icon
|
|
|
|
v-tooltip
|
|
|
|
:status="latestPipeline.details.status"
|
|
|
|
:title="latestPipeline.details.status.text"
|
|
|
|
/>
|
|
|
|
</button>
|
2018-11-08 19:23:39 +05:30
|
|
|
Pipeline
|
|
|
|
<a
|
|
|
|
:href="latestPipeline.details.status.details_path"
|
|
|
|
class="monospace">#{{ latestPipeline.id }}</a>
|
|
|
|
{{ latestPipeline.details.status.text }}
|
|
|
|
for
|
|
|
|
</span>
|
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
<icon
|
2018-10-15 14:42:47 +05:30
|
|
|
name="commit"
|
2018-05-09 12:01:36 +05:30
|
|
|
/>
|
2018-10-15 14:42:47 +05:30
|
|
|
<a
|
|
|
|
v-tooltip
|
|
|
|
:title="lastCommit.message"
|
|
|
|
:href="getCommitPath(lastCommit.short_id)"
|
2018-11-08 19:23:39 +05:30
|
|
|
class="commit-sha"
|
2018-10-15 14:42:47 +05:30
|
|
|
>{{ lastCommit.short_id }}</a>
|
|
|
|
by
|
|
|
|
{{ lastCommit.author_name }}
|
|
|
|
<time
|
|
|
|
v-tooltip
|
|
|
|
:datetime="lastCommit.committed_date"
|
|
|
|
:title="tooltipTitle(lastCommit.committed_date)"
|
2018-11-08 19:23:39 +05:30
|
|
|
data-placement="top"
|
|
|
|
data-container="body"
|
2018-10-15 14:42:47 +05:30
|
|
|
>
|
|
|
|
{{ lastCommitFormatedAge }}
|
|
|
|
</time>
|
2018-05-09 12:01:36 +05:30
|
|
|
</div>
|
2018-10-15 14:42:47 +05:30
|
|
|
<div
|
|
|
|
v-if="file"
|
|
|
|
class="ide-status-file"
|
|
|
|
>
|
2018-05-09 12:01:36 +05:30
|
|
|
{{ file.name }}
|
|
|
|
</div>
|
2018-10-15 14:42:47 +05:30
|
|
|
<div
|
|
|
|
v-if="file"
|
|
|
|
class="ide-status-file"
|
|
|
|
>
|
2018-05-09 12:01:36 +05:30
|
|
|
{{ file.eol }}
|
|
|
|
</div>
|
|
|
|
<div
|
2018-11-08 19:23:39 +05:30
|
|
|
v-if="file && !file.binary"
|
|
|
|
class="ide-status-file">
|
2018-05-09 12:01:36 +05:30
|
|
|
{{ file.editorRow }}:{{ file.editorColumn }}
|
|
|
|
</div>
|
2018-10-15 14:42:47 +05:30
|
|
|
<div
|
|
|
|
v-if="file"
|
|
|
|
class="ide-status-file"
|
|
|
|
>
|
2018-05-09 12:01:36 +05:30
|
|
|
{{ file.fileLanguage }}
|
|
|
|
</div>
|
2018-10-15 14:42:47 +05:30
|
|
|
</footer>
|
2018-05-09 12:01:36 +05:30
|
|
|
</template>
|