debian-mirror-gitlab/app/assets/javascripts/whats_new/components/app.vue

102 lines
3 KiB
Vue
Raw Normal View History

2020-10-24 23:57:45 +05:30
<script>
import { mapState, mapActions } from 'vuex';
2020-11-24 15:15:51 +05:30
import { GlDrawer, GlBadge, GlIcon, GlLink } from '@gitlab/ui';
2021-01-03 14:25:43 +05:30
import SkeletonLoader from './skeleton_loader.vue';
import Tracking from '~/tracking';
const trackingMixin = Tracking.mixin();
2020-10-24 23:57:45 +05:30
export default {
components: {
GlDrawer,
2020-11-24 15:15:51 +05:30
GlBadge,
GlIcon,
GlLink,
2021-01-03 14:25:43 +05:30
SkeletonLoader,
2020-11-24 15:15:51 +05:30
},
2021-01-03 14:25:43 +05:30
mixins: [trackingMixin],
2020-11-24 15:15:51 +05:30
props: {
2021-01-03 14:25:43 +05:30
storageKey: {
2020-11-24 15:15:51 +05:30
type: String,
2021-01-03 14:25:43 +05:30
required: true,
2020-11-24 15:15:51 +05:30
default: null,
},
2020-10-24 23:57:45 +05:30
},
computed: {
2021-01-03 14:25:43 +05:30
...mapState(['open', 'features']),
2020-11-24 15:15:51 +05:30
},
mounted() {
2021-01-03 14:25:43 +05:30
this.openDrawer(this.storageKey);
this.fetchItems();
const body = document.querySelector('body');
const namespaceId = body.getAttribute('data-namespace-id');
this.track('click_whats_new_drawer', { label: 'namespace_id', value: namespaceId });
2020-10-24 23:57:45 +05:30
},
methods: {
2021-01-03 14:25:43 +05:30
...mapActions(['openDrawer', 'closeDrawer', 'fetchItems']),
2020-10-24 23:57:45 +05:30
},
};
</script>
<template>
<div>
2021-01-03 14:25:43 +05:30
<gl-drawer class="whats-new-drawer" :open="open" @close="closeDrawer">
2020-10-24 23:57:45 +05:30
<template #header>
2020-11-24 15:15:51 +05:30
<h4 class="page-title my-2">{{ __("What's new at GitLab") }}</h4>
2020-10-24 23:57:45 +05:30
</template>
2020-11-24 15:15:51 +05:30
<div class="pb-6">
2021-01-03 14:25:43 +05:30
<template v-if="features">
<div v-for="feature in features" :key="feature.title" class="mb-6">
<gl-link
:href="feature.url"
target="_blank"
data-testid="whats-new-title-link"
data-track-event="click_whats_new_item"
:data-track-label="feature.title"
:data-track-property="feature.url"
>
<h5 class="gl-font-base">{{ feature.title }}</h5>
</gl-link>
<div v-if="feature.packages" class="gl-mb-3">
<template v-for="package_name in feature.packages">
<gl-badge :key="package_name" size="sm" class="whats-new-item-badge gl-mr-2">
<gl-icon name="license" />{{ package_name }}
</gl-badge>
</template>
</div>
<gl-link
:href="feature.url"
target="_blank"
data-track-event="click_whats_new_item"
:data-track-label="feature.title"
:data-track-property="feature.url"
>
<img
:alt="feature.title"
:src="feature.image_url"
class="img-thumbnail px-6 gl-py-3 whats-new-item-image"
/>
</gl-link>
<p class="gl-pt-3">{{ feature.body }}</p>
<gl-link
:href="feature.url"
target="_blank"
data-track-event="click_whats_new_item"
:data-track-label="feature.title"
:data-track-property="feature.url"
>{{ __('Learn more') }}</gl-link
>
2020-11-24 15:15:51 +05:30
</div>
2021-01-03 14:25:43 +05:30
</template>
<div v-else class="gl-mt-5">
<skeleton-loader />
<skeleton-loader />
2020-11-24 15:15:51 +05:30
</div>
</div>
2020-10-24 23:57:45 +05:30
</gl-drawer>
2021-01-03 14:25:43 +05:30
<div v-if="open" class="whats-new-modal-backdrop modal-backdrop"></div>
2020-10-24 23:57:45 +05:30
</div>
</template>