diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-01 15:17:55 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-01 15:17:55 +0300 |
commit | 1ae73e5bfcb2dc4a49f40886f729fc4797ba2a65 (patch) | |
tree | 03cb6dac129fb29c9500651a051d1f61966d79b8 /app/assets/javascripts/environments | |
parent | 719524126026437133586ce042dfc48c0d166ecd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/environments')
5 files changed, 20 insertions, 6 deletions
diff --git a/app/assets/javascripts/environments/components/environment_pin.vue b/app/assets/javascripts/environments/components/environment_pin.vue index 0b753d53ee3..f5a83b97552 100644 --- a/app/assets/javascripts/environments/components/environment_pin.vue +++ b/app/assets/javascripts/environments/components/environment_pin.vue @@ -6,6 +6,7 @@ import { GlDropdownItem } from '@gitlab/ui'; import { __ } from '~/locale'; import eventHub from '../event_hub'; +import cancelAutoStopMutation from '../graphql/mutations/cancel_auto_stop.mutation.graphql'; export default { components: { @@ -16,10 +17,22 @@ export default { type: String, required: true, }, + graphql: { + type: Boolean, + required: false, + default: false, + }, }, methods: { onPinClick() { - eventHub.$emit('cancelAutoStop', this.autoStopUrl); + if (this.graphql) { + this.$apollo.mutate({ + mutation: cancelAutoStopMutation, + variables: { autoStopUrl: this.autoStopUrl }, + }); + } else { + eventHub.$emit('cancelAutoStop', this.autoStopUrl); + } }, }, title: __('Prevent auto-stopping'), diff --git a/app/assets/javascripts/environments/components/new_environment_item.vue b/app/assets/javascripts/environments/components/new_environment_item.vue index 26379faa185..e23a02b3dfd 100644 --- a/app/assets/javascripts/environments/components/new_environment_item.vue +++ b/app/assets/javascripts/environments/components/new_environment_item.vue @@ -243,6 +243,7 @@ export default { <pin v-if="canShowAutoStopDate" :auto-stop-url="autoStopPath" + graphql data-track-action="click_button" data-track-label="environment_pin" /> diff --git a/app/assets/javascripts/environments/graphql/mutations/cancel_auto_stop.mutation.graphql b/app/assets/javascripts/environments/graphql/mutations/cancel_auto_stop.mutation.graphql index 22dfb8a7a89..0b473495710 100644 --- a/app/assets/javascripts/environments/graphql/mutations/cancel_auto_stop.mutation.graphql +++ b/app/assets/javascripts/environments/graphql/mutations/cancel_auto_stop.mutation.graphql @@ -1,5 +1,5 @@ -mutation cancelAutoStop($environment: LocalEnvironment) { - cancelAutoStop(environment: $environment) @client { +mutation cancelAutoStop($autoStopUrl: String!) { + cancelAutoStop(autoStopUrl: $autoStopUrl) @client { errors } } diff --git a/app/assets/javascripts/environments/graphql/resolvers.js b/app/assets/javascripts/environments/graphql/resolvers.js index 812fa0c81f0..9e0e0fff47f 100644 --- a/app/assets/javascripts/environments/graphql/resolvers.js +++ b/app/assets/javascripts/environments/graphql/resolvers.js @@ -134,9 +134,9 @@ export const resolvers = (endpoint) => ({ data: { environmentToRollback: environment }, }); }, - cancelAutoStop(_, { environment: { autoStopPath } }) { + cancelAutoStop(_, { autoStopUrl }) { return axios - .post(autoStopPath) + .post(autoStopUrl) .then(() => buildErrors()) .catch((err) => buildErrors([ diff --git a/app/assets/javascripts/environments/graphql/typedefs.graphql b/app/assets/javascripts/environments/graphql/typedefs.graphql index c02f6b2838a..cc54b4ecd67 100644 --- a/app/assets/javascripts/environments/graphql/typedefs.graphql +++ b/app/assets/javascripts/environments/graphql/typedefs.graphql @@ -77,7 +77,7 @@ extend type Mutation { stopEnvironment(environment: LocalEnvironmentInput): LocalErrors deleteEnvironment(environment: LocalEnvironmentInput): LocalErrors rollbackEnvironment(environment: LocalEnvironmentInput): LocalErrors - cancelAutoStop(environment: LocalEnvironmentInput): LocalErrors + cancelAutoStop(autoStopUrl: String!): LocalErrors setEnvironmentToDelete(environment: LocalEnvironmentInput): LocalErrors setEnvironmentToRollback(environment: LocalEnvironmentInput): LocalErrors setEnvironmentToStop(environment: LocalEnvironmentInput): LocalErrors |