Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/pipeline_editor/graphql')
-rw-r--r--app/assets/javascripts/pipeline_editor/graphql/mutations/update_current_branch.mutation.graphql3
-rw-r--r--app/assets/javascripts/pipeline_editor/graphql/mutations/update_last_commit_branch.mutation.graphql3
-rw-r--r--app/assets/javascripts/pipeline_editor/graphql/queries/client/last_commit_branch.query.graphql3
-rw-r--r--app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql7
-rw-r--r--app/assets/javascripts/pipeline_editor/graphql/resolvers.js19
5 files changed, 35 insertions, 0 deletions
diff --git a/app/assets/javascripts/pipeline_editor/graphql/mutations/update_current_branch.mutation.graphql b/app/assets/javascripts/pipeline_editor/graphql/mutations/update_current_branch.mutation.graphql
new file mode 100644
index 00000000000..b722c147f5f
--- /dev/null
+++ b/app/assets/javascripts/pipeline_editor/graphql/mutations/update_current_branch.mutation.graphql
@@ -0,0 +1,3 @@
+mutation updateCurrentBranch($currentBranch: String) {
+ updateCurrentBranch(currentBranch: $currentBranch) @client
+}
diff --git a/app/assets/javascripts/pipeline_editor/graphql/mutations/update_last_commit_branch.mutation.graphql b/app/assets/javascripts/pipeline_editor/graphql/mutations/update_last_commit_branch.mutation.graphql
new file mode 100644
index 00000000000..9561312f2b6
--- /dev/null
+++ b/app/assets/javascripts/pipeline_editor/graphql/mutations/update_last_commit_branch.mutation.graphql
@@ -0,0 +1,3 @@
+mutation updateLastCommitBranch($lastCommitBranch: String) {
+ updateLastCommitBranch(lastCommitBranch: $lastCommitBranch) @client
+}
diff --git a/app/assets/javascripts/pipeline_editor/graphql/queries/client/last_commit_branch.query.graphql b/app/assets/javascripts/pipeline_editor/graphql/queries/client/last_commit_branch.query.graphql
new file mode 100644
index 00000000000..e8a32d728d5
--- /dev/null
+++ b/app/assets/javascripts/pipeline_editor/graphql/queries/client/last_commit_branch.query.graphql
@@ -0,0 +1,3 @@
+query getLastCommitBranchQuery {
+ lastCommitBranch @client
+}
diff --git a/app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql b/app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql
new file mode 100644
index 00000000000..88825718f7b
--- /dev/null
+++ b/app/assets/javascripts/pipeline_editor/graphql/queries/get_starter_template.query.graphql
@@ -0,0 +1,7 @@
+query getTemplate($projectPath: ID!, $templateName: String!) {
+ project(fullPath: $projectPath) {
+ ciTemplate(name: $templateName) {
+ content
+ }
+ }
+}
diff --git a/app/assets/javascripts/pipeline_editor/graphql/resolvers.js b/app/assets/javascripts/pipeline_editor/graphql/resolvers.js
index 81e75c32846..8cead7f3315 100644
--- a/app/assets/javascripts/pipeline_editor/graphql/resolvers.js
+++ b/app/assets/javascripts/pipeline_editor/graphql/resolvers.js
@@ -1,5 +1,8 @@
+import produce from 'immer';
import Api from '~/api';
import axios from '~/lib/utils/axios_utils';
+import getCurrentBranchQuery from './queries/client/current_branch.graphql';
+import getLastCommitBranchQuery from './queries/client/last_commit_branch.query.graphql';
export const resolvers = {
Query: {
@@ -39,5 +42,21 @@ export const resolvers = {
__typename: 'CiLintContent',
}));
},
+ updateCurrentBranch: (_, { currentBranch = undefined }, { cache }) => {
+ cache.writeQuery({
+ query: getCurrentBranchQuery,
+ data: produce(cache.readQuery({ query: getCurrentBranchQuery }), (draftData) => {
+ draftData.currentBranch = currentBranch;
+ }),
+ });
+ },
+ updateLastCommitBranch: (_, { lastCommitBranch = undefined }, { cache }) => {
+ cache.writeQuery({
+ query: getLastCommitBranchQuery,
+ data: produce(cache.readQuery({ query: getLastCommitBranchQuery }), (draftData) => {
+ draftData.lastCommitBranch = lastCommitBranch;
+ }),
+ });
+ },
},
};