2018-09-26 04:28:50 -04:00
|
|
|
<script>
|
2021-10-26 05:09:57 -04:00
|
|
|
import { GlButtonGroup, GlButton, GlTooltipDirective, GlSafeHtmlDirective } from '@gitlab/ui';
|
2020-05-13 14:08:47 -04:00
|
|
|
|
2021-02-14 13:09:20 -05:00
|
|
|
import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue';
|
2021-01-08 10:10:26 -05:00
|
|
|
import ModalCopyButton from '~/vue_shared/components/modal_copy_button.vue';
|
2018-09-26 04:28:50 -04:00
|
|
|
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
|
2021-02-14 13:09:20 -05:00
|
|
|
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
|
|
|
|
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
|
2020-05-13 14:08:47 -04:00
|
|
|
|
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.
|
2019-09-18 10:02:45 -04:00
|
|
|
* https://gitlab.com/gitlab-org/gitlab-foss/issues/51613
|
2018-09-26 04:28:50 -04:00
|
|
|
*
|
|
|
|
*/
|
2020-05-13 14:08:47 -04:00
|
|
|
|
2018-09-26 04:28:50 -04:00
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
UserAvatarLink,
|
2021-01-08 10:10:26 -05:00
|
|
|
ModalCopyButton,
|
2018-09-26 04:28:50 -04:00
|
|
|
TimeAgoTooltip,
|
2018-10-03 05:08:00 -04:00
|
|
|
CommitPipelineStatus,
|
2020-05-13 14:08:47 -04:00
|
|
|
GlButtonGroup,
|
|
|
|
GlButton,
|
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
2021-10-26 05:09:57 -04:00
|
|
|
SafeHtml: GlSafeHtmlDirective,
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
2020-05-13 14:08:47 -04:00
|
|
|
mixins: [glFeatureFlagsMixin()],
|
2018-09-26 04:28:50 -04:00
|
|
|
props: {
|
2020-08-04 14:09:49 -04:00
|
|
|
isSelectable: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2018-09-26 04:28:50 -04:00
|
|
|
commit: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-08-04 14:09:49 -04:00
|
|
|
checked: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
2020-07-20 05:09:22 -04:00
|
|
|
collapsible: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
|
|
|
computed: {
|
2019-01-07 05:04:59 -05:00
|
|
|
author() {
|
|
|
|
return this.commit.author || {};
|
|
|
|
},
|
2018-09-26 04:28:50 -04:00
|
|
|
authorName() {
|
2019-01-07 05:04:59 -05:00
|
|
|
return this.author.name || this.commit.author_name;
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
2019-01-04 10:34:01 -05:00
|
|
|
authorClass() {
|
2019-01-07 05:04:59 -05:00
|
|
|
return this.author.name ? 'js-user-link' : '';
|
2019-01-04 10:34:01 -05:00
|
|
|
},
|
|
|
|
authorId() {
|
2019-01-07 05:04:59 -05:00
|
|
|
return this.author.id ? this.author.id : '';
|
2019-01-04 10:34:01 -05:00
|
|
|
},
|
2018-09-26 04:28:50 -04:00
|
|
|
authorUrl() {
|
2019-01-07 05:04:59 -05:00
|
|
|
return this.author.web_url || `mailto:${this.commit.author_email}`;
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
|
|
|
authorAvatar() {
|
2019-01-07 05:04:59 -05:00
|
|
|
return this.author.avatar_url || this.commit.author_gravatar_url;
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
2020-08-04 14:09:49 -04:00
|
|
|
commitDescription() {
|
|
|
|
// Strip the newline at the beginning
|
|
|
|
return this.commit.description_html.replace(/^
/, '');
|
|
|
|
},
|
2018-09-26 04:28:50 -04:00
|
|
|
},
|
2021-10-26 05:09:57 -04:00
|
|
|
safeHtmlConfig: {
|
|
|
|
ADD_TAGS: ['gl-emoji'],
|
|
|
|
},
|
2018-09-26 04:28:50 -04:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2020-10-13 08:08:41 -04:00
|
|
|
<li :class="{ 'js-toggle-container': collapsible }" class="commit">
|
|
|
|
<div
|
|
|
|
class="d-block d-sm-flex flex-row-reverse justify-content-between align-items-start flex-lg-row-reverse"
|
|
|
|
>
|
|
|
|
<div
|
|
|
|
class="commit-actions flex-row d-none d-sm-flex align-items-start flex-wrap justify-content-end"
|
|
|
|
>
|
2021-09-02 05:11:35 -04:00
|
|
|
<div
|
|
|
|
v-if="commit.signature_html"
|
2021-10-26 05:09:57 -04:00
|
|
|
v-safe-html:[$options.safeHtmlConfig]="commit.signature_html"
|
2021-09-02 05:11:35 -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"
|
2020-10-13 08:08:41 -04:00
|
|
|
class="d-inline-flex mb-2"
|
2018-10-03 05:08:00 -04:00
|
|
|
/>
|
2020-10-13 08:08:41 -04:00
|
|
|
<gl-button-group class="gl-ml-4 gl-mb-4" data-testid="commit-sha-group">
|
2020-11-23 10:09:37 -05:00
|
|
|
<gl-button
|
|
|
|
label
|
|
|
|
class="gl-font-monospace"
|
|
|
|
data-testid="commit-sha-short-id"
|
|
|
|
v-text="commit.short_id"
|
|
|
|
/>
|
2021-01-08 10:10:26 -05:00
|
|
|
<modal-copy-button
|
2018-09-26 04:28:50 -04:00
|
|
|
:text="commit.id"
|
2019-10-09 08:06:13 -04:00
|
|
|
:title="__('Copy commit SHA')"
|
2020-10-02 20:08:46 -04:00
|
|
|
class="input-group-text"
|
2018-09-26 04:28:50 -04:00
|
|
|
/>
|
2020-10-02 20:08:46 -04:00
|
|
|
</gl-button-group>
|
2018-09-26 04:28:50 -04:00
|
|
|
</div>
|
2020-10-13 08:08:41 -04:00
|
|
|
<div>
|
|
|
|
<div class="d-flex float-left align-items-center align-self-start">
|
|
|
|
<input
|
|
|
|
v-if="isSelectable"
|
|
|
|
class="mr-2"
|
|
|
|
type="checkbox"
|
|
|
|
:checked="checked"
|
|
|
|
@change="$emit('handleCheckboxChange', $event.target.checked)"
|
|
|
|
/>
|
|
|
|
<user-avatar-link
|
|
|
|
:link-href="authorUrl"
|
|
|
|
:img-src="authorAvatar"
|
|
|
|
:img-alt="authorName"
|
2022-04-07 14:08:29 -04:00
|
|
|
:img-size="32"
|
2020-10-13 08:08:41 -04:00
|
|
|
class="avatar-cell d-none d-sm-block"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="commit-detail flex-list">
|
2021-05-13 14:10:32 -04:00
|
|
|
<div class="commit-content" data-qa-selector="commit_content">
|
2020-10-13 08:08:41 -04:00
|
|
|
<a
|
2021-10-26 05:09:57 -04:00
|
|
|
v-safe-html:[$options.safeHtmlConfig]="commit.title_html"
|
2020-10-13 08:08:41 -04:00
|
|
|
:href="commit.commit_url"
|
|
|
|
class="commit-row-message item-title"
|
|
|
|
></a>
|
|
|
|
|
|
|
|
<span class="commit-row-message d-block d-sm-none">· {{ commit.short_id }}</span>
|
|
|
|
|
|
|
|
<gl-button
|
|
|
|
v-if="commit.description_html && collapsible"
|
2022-01-25 01:16:04 -05:00
|
|
|
v-gl-tooltip
|
2020-10-13 08:08:41 -04:00
|
|
|
class="js-toggle-button"
|
|
|
|
size="small"
|
|
|
|
icon="ellipsis_h"
|
2022-01-25 01:16:04 -05:00
|
|
|
:title="__('Toggle commit description')"
|
2020-10-13 08:08:41 -04:00
|
|
|
:aria-label="__('Toggle commit description')"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div class="committer">
|
|
|
|
<a
|
|
|
|
:href="authorUrl"
|
|
|
|
:class="authorClass"
|
|
|
|
:data-user-id="authorId"
|
|
|
|
v-text="authorName"
|
|
|
|
></a>
|
|
|
|
{{ s__('CommitWidget|authored') }}
|
|
|
|
<time-ago-tooltip :time="commit.authored_date" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<pre
|
|
|
|
v-if="commit.description_html"
|
2021-10-26 05:09:57 -04:00
|
|
|
v-safe-html:[$options.safeHtmlConfig]="commitDescription"
|
2020-10-13 08:08:41 -04:00
|
|
|
:class="{ 'js-toggle-content': collapsible, 'd-block': !collapsible }"
|
2021-05-07 11:10:39 -04:00
|
|
|
class="commit-row-description gl-mb-3 gl-text-body"
|
2020-10-13 08:08:41 -04:00
|
|
|
></pre>
|
2018-09-26 04:28:50 -04:00
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</template>
|