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
|
<script>
import { convertToGraphQLId } from '~/graphql_shared/utils';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import {
ADD_MUTATION_ACTION,
DELETE_MUTATION_ACTION,
GRAPHQL_PROJECT_TYPE,
UPDATE_MUTATION_ACTION,
} from '../constants';
import getProjectEnvironments from '../graphql/queries/project_environments.query.graphql';
import getProjectVariables from '../graphql/queries/project_variables.query.graphql';
import addProjectVariable from '../graphql/mutations/project_add_variable.mutation.graphql';
import deleteProjectVariable from '../graphql/mutations/project_delete_variable.mutation.graphql';
import updateProjectVariable from '../graphql/mutations/project_update_variable.mutation.graphql';
import CiVariableShared from './ci_variable_shared.vue';
export default {
components: {
CiVariableShared,
},
mixins: [glFeatureFlagsMixin()],
inject: ['projectFullPath', 'projectId'],
computed: {
graphqlId() {
return convertToGraphQLId(GRAPHQL_PROJECT_TYPE, this.projectId);
},
},
mutationData: {
[ADD_MUTATION_ACTION]: addProjectVariable,
[UPDATE_MUTATION_ACTION]: updateProjectVariable,
[DELETE_MUTATION_ACTION]: deleteProjectVariable,
},
queryData: {
ciVariables: {
lookup: (data) => data?.project?.ciVariables,
query: getProjectVariables,
},
environments: {
lookup: (data) => data?.project?.environments,
query: getProjectEnvironments,
},
},
};
</script>
<template>
<ci-variable-shared
:id="graphqlId"
:are-scoped-variables-available="true"
component-name="ProjectVariables"
entity="project"
:full-path="projectFullPath"
:mutation-data="$options.mutationData"
:query-data="$options.queryData"
/>
</template>
|