2018-09-26 04:28:50 -04:00
|
|
|
<script>
|
|
|
|
import tooltip from '~/vue_shared/directives/tooltip';
|
|
|
|
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';
|
2018-10-03 05:08:00 -04:00
|
|
|
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
|
2018-09-26 04:28:50 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 {
|
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
|
|
|
components: {
|
|
|
|
UserAvatarLink,
|
|
|
|
Icon,
|
|
|
|
ClipboardButton,
|
|
|
|
CIIcon,
|
|
|
|
TimeAgoTooltip,
|
2018-10-03 05:08:00 -04:00
|
|
|
CommitPipelineStatus,
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
commit: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
authorName() {
|
2018-11-09 14:48:41 -05:00
|
|
|
return (this.commit.author && this.commit.author.name) || this.commit.author_name;
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
|
|
|
authorUrl() {
|
2018-10-10 02:15:56 -04:00
|
|
|
return (
|
2018-11-09 14:48:41 -05:00
|
|
|
(this.commit.author && this.commit.author.web_url) || `mailto:${this.commit.author_email}`
|
2018-10-10 02:15:56 -04:00
|
|
|
);
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
|
|
|
authorAvatar() {
|
2018-11-09 14:48:41 -05:00
|
|
|
return (
|
|
|
|
(this.commit.author && this.commit.author.avatar_url) || this.commit.author_gravatar_url
|
|
|
|
);
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</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
|
2018-11-09 14:48:41 -05:00
|
|
|
:href="commit.commit_url"
|
2018-09-26 04:28:50 -04:00
|
|
|
class="commit-row-message item-title"
|
2018-11-09 14:48:41 -05:00
|
|
|
v-html="commit.title_html"
|
2018-09-26 04:28:50 -04:00
|
|
|
></a>
|
|
|
|
|
|
|
|
<span class="commit-row-message d-block d-sm-none">
|
|
|
|
·
|
2018-11-09 14:48:41 -05:00
|
|
|
{{ commit.short_id }}
|
2018-09-26 04:28:50 -04:00
|
|
|
</span>
|
|
|
|
|
|
|
|
<button
|
2018-11-09 14:48:41 -05:00
|
|
|
v-if="commit.description_html"
|
2018-09-26 04:28:50 -04:00
|
|
|
class="text-expander js-toggle-button"
|
|
|
|
type="button"
|
|
|
|
:aria-label="__('Toggle commit description')"
|
|
|
|
>
|
|
|
|
<icon
|
|
|
|
:size="12"
|
|
|
|
name="ellipsis_h"
|
|
|
|
/>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<div class="commiter">
|
|
|
|
<a
|
|
|
|
:href="authorUrl"
|
|
|
|
v-text="authorName"
|
|
|
|
></a>
|
|
|
|
{{ s__('CommitWidget|authored') }}
|
|
|
|
<time-ago-tooltip
|
2018-11-09 14:48:41 -05:00
|
|
|
:time="commit.authored_date"
|
2018-09-26 04:28:50 -04:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<pre
|
2018-11-09 14:48:41 -05:00
|
|
|
v-if="commit.description_html"
|
2018-09-26 04:28:50 -04:00
|
|
|
class="commit-row-description js-toggle-content append-bottom-8"
|
2018-11-09 14:48:41 -05:00
|
|
|
v-html="commit.description_html"
|
2018-09-26 04:28:50 -04:00
|
|
|
></pre>
|
|
|
|
</div>
|
|
|
|
<div class="commit-actions flex-row d-none d-sm-flex">
|
2018-10-03 02:44:18 -04:00
|
|
|
<div
|
2018-11-09 14:48:41 -05:00
|
|
|
v-if="commit.signature_html"
|
|
|
|
v-html="commit.signature_html"
|
2018-10-03 02:44:18 -04:00
|
|
|
></div>
|
2018-10-03 05:08:00 -04:00
|
|
|
<commit-pipeline-status
|
2018-11-09 14:48:41 -05:00
|
|
|
v-if="commit.pipeline_status_path"
|
|
|
|
:endpoint="commit.pipeline_status_path"
|
2018-10-03 05:08:00 -04:00
|
|
|
/>
|
2018-09-26 04:28:50 -04:00
|
|
|
<div class="commit-sha-group">
|
|
|
|
<div
|
|
|
|
class="label label-monospace"
|
2018-11-09 14:48:41 -05:00
|
|
|
v-text="commit.short_id"
|
2018-09-26 04:28:50 -04:00
|
|
|
></div>
|
|
|
|
<clipboard-button
|
|
|
|
:text="commit.id"
|
|
|
|
:title="__('Copy commit SHA to clipboard')"
|
|
|
|
class="btn btn-default"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</template>
|