2017-05-26 17:31:16 +00:00
|
|
|
<script>
|
2020-04-03 09:09:31 +00:00
|
|
|
import { GlTooltipDirective, GlLink, GlDeprecatedButton } from '@gitlab/ui';
|
2019-07-08 08:26:37 +00:00
|
|
|
import { __, sprintf } from '~/locale';
|
2018-04-19 15:07:11 +00:00
|
|
|
import CiIconBadge from './ci_badge_link.vue';
|
|
|
|
import TimeagoTooltip from './time_ago_tooltip.vue';
|
|
|
|
import UserAvatarImage from './user_avatar/user_avatar_image.vue';
|
2018-01-08 20:01:49 +00:00
|
|
|
|
2018-04-19 15:07:11 +00:00
|
|
|
/**
|
|
|
|
* Renders header component for job and pipeline page based on UI mockups
|
|
|
|
*
|
|
|
|
* Used in:
|
|
|
|
* - job show page
|
|
|
|
* - pipeline show page
|
|
|
|
*/
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
CiIconBadge,
|
|
|
|
TimeagoTooltip,
|
|
|
|
UserAvatarImage,
|
2018-11-12 21:50:35 +00:00
|
|
|
GlLink,
|
2020-04-03 09:09:31 +00:00
|
|
|
GlDeprecatedButton,
|
2018-04-19 15:07:11 +00:00
|
|
|
},
|
|
|
|
directives: {
|
2018-11-12 21:50:35 +00:00
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-04-19 15:07:11 +00:00
|
|
|
},
|
|
|
|
props: {
|
|
|
|
status: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
2017-05-26 17:31:16 +00:00
|
|
|
},
|
2018-04-19 15:07:11 +00:00
|
|
|
itemName: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
2017-05-26 17:31:16 +00:00
|
|
|
},
|
2018-04-19 15:07:11 +00:00
|
|
|
itemId: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
2017-06-12 09:20:19 +00:00
|
|
|
},
|
2018-04-19 15:07:11 +00:00
|
|
|
time: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
|
|
|
hasSidebarButton: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
shouldRenderTriggeredLabel: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
|
|
|
},
|
2017-05-26 17:31:16 +00:00
|
|
|
|
2018-04-19 15:07:11 +00:00
|
|
|
computed: {
|
|
|
|
userAvatarAltText() {
|
2019-07-08 08:26:37 +00:00
|
|
|
return sprintf(__(`%{username}'s avatar`), { username: this.user.name });
|
2017-05-26 17:31:16 +00:00
|
|
|
},
|
2018-04-19 15:07:11 +00:00
|
|
|
},
|
2017-05-26 17:31:16 +00:00
|
|
|
|
2018-04-19 15:07:11 +00:00
|
|
|
methods: {
|
2018-10-17 10:34:19 +00:00
|
|
|
onClickSidebarButton() {
|
|
|
|
this.$emit('clickedSidebarButton');
|
|
|
|
},
|
2018-04-19 15:07:11 +00:00
|
|
|
},
|
|
|
|
};
|
2017-05-26 17:31:16 +00:00
|
|
|
</script>
|
2017-06-12 09:20:19 +00:00
|
|
|
|
2017-05-26 17:31:16 +00:00
|
|
|
<template>
|
2017-06-12 09:20:19 +00:00
|
|
|
<header class="page-content-header ci-header-container">
|
2017-05-26 17:31:16 +00:00
|
|
|
<section class="header-main-content">
|
|
|
|
<ci-icon-badge :status="status" />
|
|
|
|
|
2019-06-14 13:17:18 +00:00
|
|
|
<strong> {{ itemName }} #{{ itemId }} </strong>
|
2017-05-26 17:31:16 +00:00
|
|
|
|
2019-07-08 08:26:37 +00:00
|
|
|
<template v-if="shouldRenderTriggeredLabel">{{ __('triggered') }}</template>
|
|
|
|
<template v-else>{{ __('created') }}</template>
|
2017-05-26 17:31:16 +00:00
|
|
|
|
|
|
|
<timeago-tooltip :time="time" />
|
|
|
|
|
2019-07-08 08:26:37 +00:00
|
|
|
{{ __('by') }}
|
2019-06-14 13:17:18 +00:00
|
|
|
|
2017-06-02 13:24:42 +00:00
|
|
|
<template v-if="user">
|
2018-11-12 21:50:35 +00:00
|
|
|
<gl-link
|
|
|
|
v-gl-tooltip
|
2017-06-02 13:24:42 +00:00
|
|
|
:href="user.path"
|
|
|
|
:title="user.email"
|
2018-01-08 20:01:49 +00:00
|
|
|
class="js-user-link commit-committer-link"
|
|
|
|
>
|
2017-06-02 13:24:42 +00:00
|
|
|
<user-avatar-image
|
|
|
|
:img-src="user.avatar_url"
|
|
|
|
:img-alt="userAvatarAltText"
|
|
|
|
:tooltip-text="user.name"
|
|
|
|
:img-size="24"
|
2018-01-08 20:01:49 +00:00
|
|
|
/>
|
2017-06-02 13:24:42 +00:00
|
|
|
|
2018-01-08 20:01:49 +00:00
|
|
|
{{ user.name }}
|
2018-11-12 21:50:35 +00:00
|
|
|
</gl-link>
|
2018-11-16 20:07:38 +00:00
|
|
|
<span v-if="user.status_tooltip_html" v-html="user.status_tooltip_html"></span>
|
2017-06-02 13:24:42 +00:00
|
|
|
</template>
|
2017-05-26 17:31:16 +00:00
|
|
|
</section>
|
|
|
|
|
2020-01-29 21:09:22 +00:00
|
|
|
<section v-if="$slots.default" class="header-action-buttons">
|
|
|
|
<slot></slot>
|
2018-10-17 10:34:19 +00:00
|
|
|
</section>
|
2020-04-03 09:09:31 +00:00
|
|
|
<gl-deprecated-button
|
2018-10-17 10:34:19 +00:00
|
|
|
v-if="hasSidebarButton"
|
|
|
|
id="toggleSidebar"
|
2018-11-12 21:50:35 +00:00
|
|
|
class="d-block d-sm-none
|
2018-04-09 19:57:00 +00:00
|
|
|
sidebar-toggle-btn js-sidebar-build-toggle js-sidebar-build-toggle-header"
|
2018-10-17 10:34:19 +00:00
|
|
|
@click="onClickSidebarButton"
|
|
|
|
>
|
2018-11-16 20:07:38 +00:00
|
|
|
<i class="fa fa-angle-double-left" aria-hidden="true" aria-labelledby="toggleSidebar"> </i>
|
2020-04-03 09:09:31 +00:00
|
|
|
</gl-deprecated-button>
|
2017-05-26 17:31:16 +00:00
|
|
|
</header>
|
|
|
|
</template>
|