debian-mirror-gitlab/app/assets/javascripts/issues/show/components/pinned_links.vue

69 lines
1.5 KiB
Vue
Raw Normal View History

2019-09-04 21:01:54 +05:30
<script>
2020-07-28 23:09:34 +05:30
import { GlButton } from '@gitlab/ui';
import { STATUS_PAGE_PUBLISHED, JOIN_ZOOM_MEETING } from '../constants';
2019-09-04 21:01:54 +05:30
export default {
components: {
2020-07-28 23:09:34 +05:30
GlButton,
2019-09-04 21:01:54 +05:30
},
props: {
2019-09-30 21:07:59 +05:30
zoomMeetingUrl: {
2019-09-04 21:01:54 +05:30
type: String,
2019-09-30 21:07:59 +05:30
required: false,
2020-06-23 00:09:42 +05:30
default: '',
},
publishedIncidentUrl: {
type: String,
required: false,
default: '',
2019-09-04 21:01:54 +05:30
},
},
2020-07-28 23:09:34 +05:30
computed: {
pinnedLinks() {
2020-11-24 15:15:51 +05:30
const links = [];
if (this.publishedIncidentUrl) {
links.push({
2020-07-28 23:09:34 +05:30
id: 'publishedIncidentUrl',
url: this.publishedIncidentUrl,
text: STATUS_PAGE_PUBLISHED,
icon: 'tanuki',
2020-11-24 15:15:51 +05:30
});
}
if (this.zoomMeetingUrl) {
links.push({
2020-07-28 23:09:34 +05:30
id: 'zoomMeetingUrl',
url: this.zoomMeetingUrl,
text: JOIN_ZOOM_MEETING,
icon: 'brand-zoom',
2020-11-24 15:15:51 +05:30
});
}
return links;
2020-07-28 23:09:34 +05:30
},
},
methods: {
needsPaddingClass(i) {
return i < this.pinnedLinks.length - 1;
},
},
2019-09-04 21:01:54 +05:30
};
</script>
<template>
2020-11-24 15:15:51 +05:30
<div v-if="pinnedLinks && pinnedLinks.length" class="gl-display-flex gl-justify-content-start">
2020-07-28 23:09:34 +05:30
<template v-for="(link, i) in pinnedLinks">
<div v-if="link.url" :key="link.id" :class="{ 'gl-pr-3': needsPaddingClass(i) }">
<gl-button
:href="link.url"
target="_blank"
:icon="link.icon"
size="small"
class="gl-font-weight-bold gl-mb-5"
:data-testid="link.id"
>{{ link.text }}</gl-button
>
</div>
</template>
2019-09-04 21:01:54 +05:30
</div>
</template>