diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-21 21:18:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-21 21:18:42 +0300 |
commit | 2ee7cff13b1a3929bebf2af7d223e2f445d72fca (patch) | |
tree | b155d3f76bd575b8401544a0d05fdbf595529056 /app/assets/javascripts/environments | |
parent | 871e82b7c73283c2c71355e3258a6c9d3b8c0eda (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/environments')
-rw-r--r-- | app/assets/javascripts/environments/components/delete_environment_modal.vue | 3 | ||||
-rw-r--r-- | app/assets/javascripts/environments/graphql/resolvers.js | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/app/assets/javascripts/environments/components/delete_environment_modal.vue b/app/assets/javascripts/environments/components/delete_environment_modal.vue index d3d4c7d23d8..3173c2bd644 100644 --- a/app/assets/javascripts/environments/components/delete_environment_modal.vue +++ b/app/assets/javascripts/environments/components/delete_environment_modal.vue @@ -62,7 +62,8 @@ export default { mutation: deleteEnvironmentMutation, variables: { environment: this.environment }, }) - .then(([message]) => { + .then(({ data }) => { + const [message] = data?.deleteEvironment?.errors ?? []; if (message) { createFlash({ message }); } diff --git a/app/assets/javascripts/environments/graphql/resolvers.js b/app/assets/javascripts/environments/graphql/resolvers.js index dc763b77157..2544fd5273c 100644 --- a/app/assets/javascripts/environments/graphql/resolvers.js +++ b/app/assets/javascripts/environments/graphql/resolvers.js @@ -11,6 +11,7 @@ import environmentToRollbackQuery from './queries/environment_to_rollback.query. import environmentToStopQuery from './queries/environment_to_stop.query.graphql'; import environmentToDeleteQuery from './queries/environment_to_delete.query.graphql'; import environmentToChangeCanaryQuery from './queries/environment_to_change_canary.query.graphql'; +import isEnvironmentStoppingQuery from './queries/is_environment_stopping.query.graphql'; import pageInfoQuery from './queries/page_info.query.graphql'; const buildErrors = (errors = []) => ({ @@ -71,11 +72,21 @@ export const resolvers = (endpoint) => ({ }, }, Mutation: { - stopEnvironment(_, { environment }) { + stopEnvironment(_, { environment }, { client }) { + client.writeQuery({ + query: isEnvironmentStoppingQuery, + variables: { environment }, + data: { isEnvironmentStopping: true }, + }); return axios .post(environment.stopPath) .then(() => buildErrors()) .catch(() => { + client.writeQuery({ + query: isEnvironmentStoppingQuery, + variables: { environment }, + data: { isEnvironmentStopping: false }, + }); return buildErrors([ s__('Environments|An error occurred while stopping the environment, please try again'), ]); |