1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
<script>
import createFlash from '~/flash';
import { s__ } from '~/locale';
import oneReleaseQuery from '../graphql/queries/one_release.query.graphql';
import { convertGraphQLRelease } from '../util';
import ReleaseBlock from './release_block.vue';
import ReleaseSkeletonLoader from './release_skeleton_loader.vue';
export default {
name: 'ReleaseShowApp',
components: {
ReleaseBlock,
ReleaseSkeletonLoader,
},
inject: {
fullPath: {
default: '',
},
tagName: {
default: '',
},
},
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);
},
},
},
methods: {
showFlash(error) {
createFlash({
message: s__('Release|Something went wrong while getting the release details.'),
captureError: true,
error,
});
},
},
};
</script>
<template>
<div class="gl-mt-3">
<release-skeleton-loader v-if="$apollo.queries.release.loading" />
<release-block v-else-if="release" :release="release" />
</div>
</template>
|