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
|
<script>
import { __ } from '~/locale';
import { createAlert } from '~/alert';
import LabelsSelect from './labels_select.vue';
import abuseReportQuery from './graphql/abuse_report.query.graphql';
export default {
name: 'ReportDetails',
components: {
LabelsSelect,
},
props: {
reportId: {
type: String,
required: true,
},
},
data() {
return {
report: { labels: [] },
};
},
apollo: {
report: {
query() {
return abuseReportQuery;
},
variables() {
return { id: this.reportId };
},
update({ abuseReport }) {
return {
labels: abuseReport.labels?.nodes,
};
},
error() {
createAlert({ message: this.$options.i18n.fetchError });
},
},
},
i18n: {
fetchError: __('An error occurred while fetching labels, please try again.'),
},
};
</script>
<template>
<labels-select :report="report" />
</template>
|