diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /app/assets/javascripts/environments/components/commit.vue | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'app/assets/javascripts/environments/components/commit.vue')
-rw-r--r-- | app/assets/javascripts/environments/components/commit.vue | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/app/assets/javascripts/environments/components/commit.vue b/app/assets/javascripts/environments/components/commit.vue new file mode 100644 index 00000000000..54b94480685 --- /dev/null +++ b/app/assets/javascripts/environments/components/commit.vue @@ -0,0 +1,54 @@ +<script> +import { GlAvatar, GlAvatarLink, GlLink, GlTooltipDirective as GlTooltip } from '@gitlab/ui'; +import { escape } from 'lodash'; + +export default { + components: { + GlAvatar, + GlAvatarLink, + GlLink, + }, + directives: { + GlTooltip, + }, + props: { + commit: { + required: true, + type: Object, + }, + }, + computed: { + commitMessage() { + return this.commit?.message; + }, + commitAuthorPath() { + // eslint-disable-next-line @gitlab/require-i18n-strings + return this.commit?.author?.path || `mailto:${escape(this.commit?.authorEmail)}`; + }, + commitAuthorAvatar() { + return this.commit?.author?.avatarUrl || this.commit?.authorGravatarUrl; + }, + commitAuthor() { + return this.commit?.author?.name || this.commit?.authorName; + }, + commitPath() { + return this.commit?.commitPath; + }, + }, +}; +</script> +<template> + <div data-testid="deployment-commit" class="gl-display-flex gl-align-items-center"> + <gl-avatar-link v-gl-tooltip :title="commitAuthor" :href="commitAuthorPath"> + <gl-avatar :size="16" :src="commitAuthorAvatar" /> + </gl-avatar-link> + <gl-link + v-gl-tooltip + :title="commitMessage" + :href="commitPath" + class="gl-ml-3 gl-str-truncated" + > + {{ commitMessage }} + </gl-link> + </div> +</template> |