2017-09-10 17:25:29 +05:30
|
|
|
<script>
|
2018-03-17 18:26:18 +05:30
|
|
|
import ciIconBadge from './ci_badge_link.vue';
|
|
|
|
import loadingIcon from './loading_icon.vue';
|
|
|
|
import timeagoTooltip from './time_ago_tooltip.vue';
|
|
|
|
import tooltip from '../directives/tooltip';
|
|
|
|
import userAvatarImage from './user_avatar/user_avatar_image.vue';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Renders header component for job and pipeline page based on UI mockups
|
|
|
|
*
|
|
|
|
* Used in:
|
|
|
|
* - job show page
|
|
|
|
* - pipeline show page
|
|
|
|
*/
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
ciIconBadge,
|
|
|
|
loadingIcon,
|
|
|
|
timeagoTooltip,
|
|
|
|
userAvatarImage,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
directives: {
|
|
|
|
tooltip,
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
props: {
|
|
|
|
status: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
itemName: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
itemId: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
time: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
type: Object,
|
|
|
|
required: false,
|
|
|
|
default: () => ({}),
|
|
|
|
},
|
|
|
|
actions: {
|
|
|
|
type: Array,
|
|
|
|
required: false,
|
|
|
|
default: () => [],
|
|
|
|
},
|
|
|
|
hasSidebarButton: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
shouldRenderTriggeredLabel: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: true,
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
computed: {
|
|
|
|
userAvatarAltText() {
|
|
|
|
return `${this.user.name}'s avatar`;
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
methods: {
|
|
|
|
onClickAction(action) {
|
|
|
|
this.$emit('actionClicked', action);
|
|
|
|
},
|
2017-09-10 17:25:29 +05:30
|
|
|
},
|
2018-03-17 18:26:18 +05:30
|
|
|
};
|
2017-09-10 17:25:29 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<header class="page-content-header ci-header-container">
|
|
|
|
<section class="header-main-content">
|
|
|
|
|
|
|
|
<ci-icon-badge :status="status" />
|
|
|
|
|
|
|
|
<strong>
|
2018-03-17 18:26:18 +05:30
|
|
|
{{ itemName }} #{{ itemId }}
|
2017-09-10 17:25:29 +05:30
|
|
|
</strong>
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
<template v-if="shouldRenderTriggeredLabel">
|
|
|
|
triggered
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
created
|
|
|
|
</template>
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
<timeago-tooltip :time="time" />
|
|
|
|
|
|
|
|
by
|
|
|
|
|
|
|
|
<template v-if="user">
|
|
|
|
<a
|
|
|
|
v-tooltip
|
|
|
|
:href="user.path"
|
|
|
|
:title="user.email"
|
2018-03-17 18:26:18 +05:30
|
|
|
class="js-user-link commit-committer-link"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
<user-avatar-image
|
|
|
|
:img-src="user.avatar_url"
|
|
|
|
:img-alt="userAvatarAltText"
|
|
|
|
:tooltip-text="user.name"
|
|
|
|
:img-size="24"
|
2018-03-17 18:26:18 +05:30
|
|
|
/>
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
{{ user.name }}
|
2017-09-10 17:25:29 +05:30
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
<section
|
|
|
|
class="header-action-buttons"
|
|
|
|
v-if="actions.length">
|
|
|
|
<template
|
2018-03-17 18:26:18 +05:30
|
|
|
v-for="(action, i) in actions"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
<a
|
|
|
|
v-if="action.type === 'link'"
|
|
|
|
:href="action.path"
|
2018-03-17 18:26:18 +05:30
|
|
|
:class="action.cssClass"
|
|
|
|
:key="i"
|
|
|
|
>
|
|
|
|
{{ action.label }}
|
2017-09-10 17:25:29 +05:30
|
|
|
</a>
|
|
|
|
|
|
|
|
<a
|
|
|
|
v-else-if="action.type === 'ujs-link'"
|
|
|
|
:href="action.path"
|
|
|
|
data-method="post"
|
|
|
|
rel="nofollow"
|
2018-03-17 18:26:18 +05:30
|
|
|
:class="action.cssClass"
|
|
|
|
:key="i"
|
|
|
|
>
|
|
|
|
{{ action.label }}
|
2017-09-10 17:25:29 +05:30
|
|
|
</a>
|
|
|
|
|
|
|
|
<button
|
|
|
|
v-else-if="action.type === 'button'"
|
|
|
|
@click="onClickAction(action)"
|
|
|
|
:disabled="action.isLoading"
|
|
|
|
:class="action.cssClass"
|
2018-03-17 18:26:18 +05:30
|
|
|
type="button"
|
|
|
|
:key="i"
|
|
|
|
>
|
|
|
|
{{ action.label }}
|
2017-09-10 17:25:29 +05:30
|
|
|
<i
|
|
|
|
v-show="action.isLoading"
|
|
|
|
class="fa fa-spin fa-spinner"
|
2018-03-17 18:26:18 +05:30
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
</i>
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
<button
|
|
|
|
v-if="hasSidebarButton"
|
|
|
|
type="button"
|
2018-03-17 18:26:18 +05:30
|
|
|
class="btn btn-default visible-xs-block
|
|
|
|
visible-sm-block sidebar-toggle-btn js-sidebar-build-toggle js-sidebar-build-toggle-header"
|
2017-09-10 17:25:29 +05:30
|
|
|
aria-label="Toggle Sidebar"
|
2018-03-17 18:26:18 +05:30
|
|
|
id="toggleSidebar"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
<i
|
|
|
|
class="fa fa-angle-double-left"
|
|
|
|
aria-hidden="true"
|
2018-03-17 18:26:18 +05:30
|
|
|
aria-labelledby="toggleSidebar"
|
|
|
|
>
|
2017-09-10 17:25:29 +05:30
|
|
|
</i>
|
|
|
|
</button>
|
|
|
|
</section>
|
|
|
|
</header>
|
|
|
|
</template>
|