2018-12-05 23:21:45 +05:30
|
|
|
<script>
|
2019-01-03 12:48:30 +05:30
|
|
|
import tooltip from '~/vue_shared/directives/tooltip';
|
2018-12-05 23:21:45 +05:30
|
|
|
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
|
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
|
|
|
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
|
|
|
|
import CIIcon from '~/vue_shared/components/ci_icon.vue';
|
|
|
|
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
|
|
|
|
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* CommitItem
|
|
|
|
*
|
|
|
|
* -----------------------------------------------------------------
|
|
|
|
* WARNING: Please keep changes up-to-date with the following files:
|
|
|
|
* - `views/projects/commits/_commit.html.haml`
|
|
|
|
* -----------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* This Component was cloned from a HAML view. For the time being they
|
|
|
|
* coexist, but there is an issue to remove the duplication.
|
|
|
|
* https://gitlab.com/gitlab-org/gitlab-ce/issues/51613
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
export default {
|
2019-01-03 12:48:30 +05:30
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
2018-12-05 23:21:45 +05:30
|
|
|
components: {
|
|
|
|
UserAvatarLink,
|
|
|
|
Icon,
|
|
|
|
ClipboardButton,
|
|
|
|
CIIcon,
|
|
|
|
TimeAgoTooltip,
|
|
|
|
CommitPipelineStatus,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
commit: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
authorName() {
|
2019-01-03 12:48:30 +05:30
|
|
|
return (this.commit.author && this.commit.author.name) || this.commit.authorName;
|
2018-12-05 23:21:45 +05:30
|
|
|
},
|
|
|
|
authorUrl() {
|
2018-12-13 13:39:08 +05:30
|
|
|
return (
|
2019-01-03 12:48:30 +05:30
|
|
|
(this.commit.author && this.commit.author.webUrl) || `mailto:${this.commit.authorEmail}`
|
2018-12-13 13:39:08 +05:30
|
|
|
);
|
2018-12-05 23:21:45 +05:30
|
|
|
},
|
|
|
|
authorAvatar() {
|
2019-01-03 12:48:30 +05:30
|
|
|
return (this.commit.author && this.commit.author.avatarUrl) || this.commit.authorGravatarUrl;
|
2018-12-05 23:21:45 +05:30
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<li class="commit flex-row js-toggle-container">
|
|
|
|
<user-avatar-link
|
|
|
|
:link-href="authorUrl"
|
|
|
|
:img-src="authorAvatar"
|
|
|
|
:img-alt="authorName"
|
|
|
|
:img-size="36"
|
|
|
|
class="avatar-cell d-none d-sm-block"
|
|
|
|
/>
|
|
|
|
<div class="commit-detail flex-list">
|
|
|
|
<div class="commit-content qa-commit-content">
|
|
|
|
<a
|
2019-01-03 12:48:30 +05:30
|
|
|
:href="commit.commitUrl"
|
2018-12-05 23:21:45 +05:30
|
|
|
class="commit-row-message item-title"
|
2019-01-03 12:48:30 +05:30
|
|
|
v-html="commit.titleHtml"
|
2018-12-05 23:21:45 +05:30
|
|
|
></a>
|
|
|
|
|
2019-01-03 12:48:30 +05:30
|
|
|
<span class="commit-row-message d-block d-sm-none">
|
|
|
|
·
|
|
|
|
{{ commit.shortId }}
|
|
|
|
</span>
|
2018-12-05 23:21:45 +05:30
|
|
|
|
|
|
|
<button
|
2019-01-03 12:48:30 +05:30
|
|
|
v-if="commit.descriptionHtml"
|
2018-12-05 23:21:45 +05:30
|
|
|
class="text-expander js-toggle-button"
|
|
|
|
type="button"
|
|
|
|
:aria-label="__('Toggle commit description')"
|
|
|
|
>
|
2019-01-03 12:48:30 +05:30
|
|
|
<icon
|
|
|
|
:size="12"
|
|
|
|
name="ellipsis_h"
|
|
|
|
/>
|
2018-12-05 23:21:45 +05:30
|
|
|
</button>
|
|
|
|
|
|
|
|
<div class="commiter">
|
2019-01-03 12:48:30 +05:30
|
|
|
<a
|
|
|
|
:href="authorUrl"
|
|
|
|
v-text="authorName"
|
|
|
|
></a>
|
|
|
|
{{ s__('CommitWidget|authored') }}
|
|
|
|
<time-ago-tooltip
|
|
|
|
:time="commit.authoredDate"
|
|
|
|
/>
|
2018-12-05 23:21:45 +05:30
|
|
|
</div>
|
|
|
|
|
|
|
|
<pre
|
2019-01-03 12:48:30 +05:30
|
|
|
v-if="commit.descriptionHtml"
|
2018-12-05 23:21:45 +05:30
|
|
|
class="commit-row-description js-toggle-content append-bottom-8"
|
2019-01-03 12:48:30 +05:30
|
|
|
v-html="commit.descriptionHtml"
|
2018-12-05 23:21:45 +05:30
|
|
|
></pre>
|
|
|
|
</div>
|
|
|
|
<div class="commit-actions flex-row d-none d-sm-flex">
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
v-if="commit.signatureHtml"
|
|
|
|
v-html="commit.signatureHtml"
|
|
|
|
></div>
|
2018-12-05 23:21:45 +05:30
|
|
|
<commit-pipeline-status
|
2019-01-03 12:48:30 +05:30
|
|
|
v-if="commit.pipelineStatusPath"
|
|
|
|
:endpoint="commit.pipelineStatusPath"
|
2018-12-05 23:21:45 +05:30
|
|
|
/>
|
|
|
|
<div class="commit-sha-group">
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
class="label label-monospace"
|
|
|
|
v-text="commit.shortId"
|
|
|
|
></div>
|
2018-12-05 23:21:45 +05:30
|
|
|
<clipboard-button
|
|
|
|
:text="commit.id"
|
|
|
|
:title="__('Copy commit SHA to clipboard')"
|
|
|
|
class="btn btn-default"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</template>
|