debian-mirror-gitlab/app/assets/javascripts/releases/components/app_show.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

70 lines
1.6 KiB
Vue
Raw Normal View History

2020-04-08 14:13:33 +05:30
<script>
2021-04-29 21:17:54 +05:30
import createFlash from '~/flash';
import { s__ } from '~/locale';
2021-06-08 01:23:25 +05:30
import oneReleaseQuery from '../graphql/queries/one_release.query.graphql';
2021-04-29 21:17:54 +05:30
import { convertGraphQLRelease } from '../util';
2020-04-08 14:13:33 +05:30
import ReleaseBlock from './release_block.vue';
2021-01-03 14:25:43 +05:30
import ReleaseSkeletonLoader from './release_skeleton_loader.vue';
2020-04-08 14:13:33 +05:30
export default {
name: 'ReleaseShowApp',
components: {
ReleaseBlock,
2021-01-03 14:25:43 +05:30
ReleaseSkeletonLoader,
2020-04-08 14:13:33 +05:30
},
2021-04-29 21:17:54 +05:30
inject: {
fullPath: {
default: '',
},
tagName: {
default: '',
},
2020-04-08 14:13:33 +05:30
},
2021-04-29 21:17:54 +05:30
apollo: {
release: {
query: oneReleaseQuery,
variables() {
return {
fullPath: this.fullPath,
tagName: this.tagName,
};
},
update(data) {
if (data.project?.release) {
return convertGraphQLRelease(data.project.release);
}
return null;
},
result(result) {
// Handle the case where the query succeeded but didn't return any data
if (!result.error && !this.release) {
this.showFlash(
new Error(`No release found in project "${this.fullPath}" with tag "${this.tagName}"`),
);
}
},
error(error) {
this.showFlash(error);
},
},
2020-04-08 14:13:33 +05:30
},
methods: {
2021-04-29 21:17:54 +05:30
showFlash(error) {
createFlash({
message: s__('Release|Something went wrong while getting the release details.'),
captureError: true,
error,
});
},
2020-04-08 14:13:33 +05:30
},
};
</script>
<template>
2020-07-28 23:09:34 +05:30
<div class="gl-mt-3">
2021-04-29 21:17:54 +05:30
<release-skeleton-loader v-if="$apollo.queries.release.loading" />
2020-04-08 14:13:33 +05:30
2021-04-29 21:17:54 +05:30
<release-block v-else-if="release" :release="release" />
2020-04-08 14:13:33 +05:30
</div>
</template>