Skip to content
Snippets Groups Projects
Commit 4e5a698c authored by Miguel Rincon's avatar Miguel Rincon
Browse files

Merge branch 'mrincon-remove-runner-deprecated-usages-redirectTo' into 'master'

Remove deprecated usages of redirectTo in runners

See merge request !120843



Merged-by: Miguel Rincon's avatarMiguel Rincon <mrincon@gitlab.com>
Approved-by: default avatarJames Rushford <jrushford@gitlab.com>
parents 9d4873fd 84c0008b
No related branches found
No related tags found
No related merge requests found
Pipeline #872240128 passed
Pipeline: GitLab

#872248250

    Pipeline: GitLab

    #872244216

      Showing
      with 49 additions and 37 deletions
      <script>
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo, setUrlParams } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl, setUrlParams } from '~/lib/utils/url_utility';
      import { s__ } from '~/locale';
      import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue';
      ......@@ -32,7 +32,7 @@ export default {
      message: s__('Runners|Runner created.'),
      variant: VARIANT_SUCCESS,
      });
      redirectTo(ephemeralRegisterUrl); // eslint-disable-line import/no-deprecated
      visitUrl(ephemeralRegisterUrl);
      },
      onError(error) {
      createAlert({ message: error.message });
      ......
      ......@@ -2,7 +2,7 @@
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { TYPENAME_CI_RUNNER } from '~/graphql_shared/constants';
      import { convertToGraphQLId } from '~/graphql_shared/utils';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import RunnerDeleteButton from '../components/runner_delete_button.vue';
      import RunnerEditButton from '../components/runner_edit_button.vue';
      ......@@ -71,7 +71,7 @@ export default {
      },
      onDeleted({ message }) {
      saveAlertToLocalStorage({ message, variant: VARIANT_SUCCESS });
      redirectTo(this.runnersPath); // eslint-disable-line import/no-deprecated
      visitUrl(this.runnersPath);
      },
      },
      };
      ......
      ......@@ -14,7 +14,7 @@ import {
      runnerToModel,
      } from 'ee_else_ce/ci/runner/runner_update_form_utils';
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { __ } from '~/locale';
      import { captureException } from '~/ci/runner/sentry_utils';
      import { ACCESS_LEVEL_NOT_PROTECTED, ACCESS_LEVEL_REF_PROTECTED, PROJECT_TYPE } from '../constants';
      ......@@ -101,7 +101,7 @@ export default {
      },
      onSuccess() {
      saveAlertToLocalStorage({ message: __('Changes saved.'), variant: VARIANT_SUCCESS });
      redirectTo(this.runnerPath); // eslint-disable-line import/no-deprecated
      visitUrl(this.runnerPath);
      },
      onError(message) {
      this.saving = false;
      ......
      <script>
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo, setUrlParams } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl, setUrlParams } from '~/lib/utils/url_utility';
      import { s__ } from '~/locale';
      import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue';
      ......@@ -38,7 +38,7 @@ export default {
      message: s__('Runners|Runner created.'),
      variant: VARIANT_SUCCESS,
      });
      redirectTo(ephemeralRegisterUrl); // eslint-disable-line import/no-deprecated
      visitUrl(ephemeralRegisterUrl);
      },
      onError(error) {
      createAlert({ message: error.message });
      ......
      ......@@ -2,7 +2,7 @@
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { TYPENAME_CI_RUNNER } from '~/graphql_shared/constants';
      import { convertToGraphQLId } from '~/graphql_shared/utils';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import RunnerDeleteButton from '../components/runner_delete_button.vue';
      import RunnerEditButton from '../components/runner_edit_button.vue';
      ......@@ -76,7 +76,7 @@ export default {
      },
      onDeleted({ message }) {
      saveAlertToLocalStorage({ message, variant: VARIANT_SUCCESS });
      redirectTo(this.runnersPath); // eslint-disable-line import/no-deprecated
      visitUrl(this.runnersPath);
      },
      },
      };
      ......
      <script>
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo, setUrlParams } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl, setUrlParams } from '~/lib/utils/url_utility';
      import { s__ } from '~/locale';
      import RegistrationCompatibilityAlert from '~/ci/runner/components/registration/registration_compatibility_alert.vue';
      ......@@ -38,7 +38,7 @@ export default {
      message: s__('Runners|Runner created.'),
      variant: VARIANT_SUCCESS,
      });
      redirectTo(ephemeralRegisterUrl); // eslint-disable-line import/no-deprecated
      visitUrl(ephemeralRegisterUrl);
      },
      onError(error) {
      createAlert({ message: error.message });
      ......
      ......@@ -7,13 +7,16 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper';
      import waitForPromises from 'helpers/wait_for_promises';
      import { runnerFormData } from 'jest/ci/runner/mock_data';
      import { VARIANT_SUCCESS } from '~/alert';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { saveAlertToLocalStorage } from '~/ci/runner/local_storage_alert/save_alert_to_local_storage';
      import RunnerUpdateForm from '~/ci/runner/components/runner_update_form.vue';
      import runnerUpdateMutation from '~/ci/runner/graphql/edit/runner_update.mutation.graphql';
      jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/lib/utils/url_utility');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      visitUrl: jest.fn(),
      }));
      const mockRunner = runnerFormData.data.runner;
      const mockRunnerPath = '/admin/runners/1';
      ......@@ -65,7 +68,7 @@ describe('RunnerUpdateForm', () => {
      variant: VARIANT_SUCCESS,
      }),
      );
      expect(redirectTo).toHaveBeenCalledWith(mockRunnerPath); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(mockRunnerPath);
      };
      beforeEach(() => {
      ......
      ......@@ -16,14 +16,14 @@ import {
      WINDOWS_PLATFORM,
      } from '~/ci/runner/constants';
      import RunnerCreateForm from '~/ci/runner/components/runner_create_form.vue';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { runnerCreateResult } from '../mock_data';
      jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/alert');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      redirectTo: jest.fn(),
      visitUrl: jest.fn(),
      }));
      const mockCreatedRunner = runnerCreateResult.data.runnerCreate.runner;
      ......@@ -87,7 +87,7 @@ describe('AdminNewRunnerApp', () => {
      it('redirects to the registration page', () => {
      const url = `${mockCreatedRunner.ephemeralRegisterUrl}?${PARAM_KEY_PLATFORM}=${DEFAULT_PLATFORM}`;
      expect(redirectTo).toHaveBeenCalledWith(url); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(url);
      });
      });
      ......@@ -100,7 +100,7 @@ describe('AdminNewRunnerApp', () => {
      it('redirects to the registration page with the platform', () => {
      const url = `${mockCreatedRunner.ephemeralRegisterUrl}?${PARAM_KEY_PLATFORM}=${WINDOWS_PLATFORM}`;
      expect(redirectTo).toHaveBeenCalledWith(url); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(url);
      });
      });
      ......
      ......@@ -5,7 +5,7 @@ import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_help
      import createMockApollo from 'helpers/mock_apollo_helper';
      import waitForPromises from 'helpers/wait_for_promises';
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { getIdFromGraphQLId } from '~/graphql_shared/utils';
      import RunnerHeader from '~/ci/runner/components/runner_header.vue';
      ......@@ -26,7 +26,10 @@ import { runnerData } from '../mock_data';
      jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/alert');
      jest.mock('~/ci/runner/sentry_utils');
      jest.mock('~/lib/utils/url_utility');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      visitUrl: jest.fn(),
      }));
      const mockRunner = runnerData.data.runner;
      const mockRunnerGraphqlId = mockRunner.id;
      ......@@ -180,7 +183,7 @@ describe('AdminRunnerShowApp', () => {
      message: 'Runner deleted',
      variant: VARIANT_SUCCESS,
      });
      expect(redirectTo).toHaveBeenCalledWith(mockRunnersPath); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(mockRunnersPath);
      });
      });
      ......
      ......@@ -6,7 +6,7 @@ import createMockApollo from 'helpers/mock_apollo_helper';
      import { mountExtended } from 'helpers/vue_test_utils_helper';
      import waitForPromises from 'helpers/wait_for_promises';
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import RunnerUpdateForm from '~/ci/runner/components/runner_update_form.vue';
      import {
      INSTANCE_TYPE,
      ......@@ -23,7 +23,10 @@ import { runnerFormData } from '../mock_data';
      jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/alert');
      jest.mock('~/ci/runner/sentry_utils');
      jest.mock('~/lib/utils/url_utility');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      visitUrl: jest.fn(),
      }));
      const mockRunner = runnerFormData.data.runner;
      const mockRunnerPath = '/admin/runners/1';
      ......@@ -86,7 +89,7 @@ describe('RunnerUpdateForm', () => {
      variant: VARIANT_SUCCESS,
      }),
      );
      expect(redirectTo).toHaveBeenCalledWith(mockRunnerPath); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(mockRunnerPath);
      };
      beforeEach(() => {
      ......@@ -278,7 +281,7 @@ describe('RunnerUpdateForm', () => {
      expect(captureException).not.toHaveBeenCalled();
      expect(saveAlertToLocalStorage).not.toHaveBeenCalled();
      expect(redirectTo).not.toHaveBeenCalled(); // eslint-disable-line import/no-deprecated
      expect(visitUrl).not.toHaveBeenCalled();
      });
      });
      });
      ......@@ -16,7 +16,7 @@ import {
      WINDOWS_PLATFORM,
      } from '~/ci/runner/constants';
      import RunnerCreateForm from '~/ci/runner/components/runner_create_form.vue';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { runnerCreateResult } from '../mock_data';
      const mockGroupId = 'gid://gitlab/Group/72';
      ......@@ -25,7 +25,7 @@ jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/alert');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      redirectTo: jest.fn(),
      visitUrl: jest.fn(),
      }));
      const mockCreatedRunner = runnerCreateResult.data.runnerCreate.runner;
      ......@@ -92,7 +92,7 @@ describe('GroupRunnerRunnerApp', () => {
      it('redirects to the registration page', () => {
      const url = `${mockCreatedRunner.ephemeralRegisterUrl}?${PARAM_KEY_PLATFORM}=${DEFAULT_PLATFORM}`;
      expect(redirectTo).toHaveBeenCalledWith(url); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(url);
      });
      });
      ......@@ -105,7 +105,7 @@ describe('GroupRunnerRunnerApp', () => {
      it('redirects to the registration page with the platform', () => {
      const url = `${mockCreatedRunner.ephemeralRegisterUrl}?${PARAM_KEY_PLATFORM}=${WINDOWS_PLATFORM}`;
      expect(redirectTo).toHaveBeenCalledWith(url); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(url);
      });
      });
      ......
      ......@@ -5,7 +5,7 @@ import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_help
      import createMockApollo from 'helpers/mock_apollo_helper';
      import waitForPromises from 'helpers/wait_for_promises';
      import { createAlert, VARIANT_SUCCESS } from '~/alert';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { getIdFromGraphQLId } from '~/graphql_shared/utils';
      import RunnerHeader from '~/ci/runner/components/runner_header.vue';
      ......@@ -26,7 +26,10 @@ import { runnerData } from '../mock_data';
      jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/alert');
      jest.mock('~/ci/runner/sentry_utils');
      jest.mock('~/lib/utils/url_utility');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      visitUrl: jest.fn(),
      }));
      const mockRunner = runnerData.data.runner;
      const mockRunnerGraphqlId = mockRunner.id;
      ......@@ -185,7 +188,7 @@ describe('GroupRunnerShowApp', () => {
      message: 'Runner deleted',
      variant: VARIANT_SUCCESS,
      });
      expect(redirectTo).toHaveBeenCalledWith(mockRunnersPath); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(mockRunnersPath);
      });
      });
      });
      ......
      ......@@ -16,7 +16,7 @@ import {
      WINDOWS_PLATFORM,
      } from '~/ci/runner/constants';
      import RunnerCreateForm from '~/ci/runner/components/runner_create_form.vue';
      import { redirectTo } from '~/lib/utils/url_utility'; // eslint-disable-line import/no-deprecated
      import { visitUrl } from '~/lib/utils/url_utility';
      import { runnerCreateResult, mockRegistrationToken } from '../mock_data';
      const mockProjectId = 'gid://gitlab/Project/72';
      ......@@ -25,7 +25,7 @@ jest.mock('~/ci/runner/local_storage_alert/save_alert_to_local_storage');
      jest.mock('~/alert');
      jest.mock('~/lib/utils/url_utility', () => ({
      ...jest.requireActual('~/lib/utils/url_utility'),
      redirectTo: jest.fn(),
      visitUrl: jest.fn(),
      }));
      const mockCreatedRunner = runnerCreateResult.data.runnerCreate.runner;
      ......@@ -93,7 +93,7 @@ describe('ProjectRunnerRunnerApp', () => {
      it('redirects to the registration page', () => {
      const url = `${mockCreatedRunner.ephemeralRegisterUrl}?${PARAM_KEY_PLATFORM}=${DEFAULT_PLATFORM}`;
      expect(redirectTo).toHaveBeenCalledWith(url); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(url);
      });
      });
      ......@@ -106,7 +106,7 @@ describe('ProjectRunnerRunnerApp', () => {
      it('redirects to the registration page with the platform', () => {
      const url = `${mockCreatedRunner.ephemeralRegisterUrl}?${PARAM_KEY_PLATFORM}=${WINDOWS_PLATFORM}`;
      expect(redirectTo).toHaveBeenCalledWith(url); // eslint-disable-line import/no-deprecated
      expect(visitUrl).toHaveBeenCalledWith(url);
      });
      });
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment