diff --git a/app/assets/javascripts/ci/mixins/pipeline_variables_permissions_mixin.js b/app/assets/javascripts/ci/mixins/pipeline_variables_permissions_mixin.js index c27fa86888dee80d5488a47a5f739f4a88aa2702..1b055810d77b905c7176082e0ad90fc28a06a500 100644 --- a/app/assets/javascripts/ci/mixins/pipeline_variables_permissions_mixin.js +++ b/app/assets/javascripts/ci/mixins/pipeline_variables_permissions_mixin.js @@ -10,11 +10,7 @@ const ROLE_OWNER = 'owner'; export default { USER_ROLES: Object.freeze([ROLE_DEVELOPER, ROLE_MAINTAINER, ROLE_OWNER]), - inject: { - projectPath: { default: '' }, - fullPath: { default: '' }, - userRole: { default: '' }, - }, + inject: ['projectPath', 'userRole'], data() { return { @@ -28,7 +24,7 @@ export default { query: getPipelineVariablesMinimumOverrideRoleQuery, variables() { return { - fullPath: this.projectPath || this.fullPath, + fullPath: this.projectPath, }; }, update({ project }) { diff --git a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue index 80f3a79aed172b8f710213c260b2ee246a0ce364..499d7716fa74b06142ecc49b6714b694c5aa66a6 100644 --- a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue +++ b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules.vue @@ -81,7 +81,7 @@ export default { PipelineScheduleEmptyState, }, inject: { - fullPath: { + projectPath: { default: '', }, pipelinesPath: { @@ -96,7 +96,7 @@ export default { query: getPipelineSchedulesQuery, variables() { return { - projectPath: this.fullPath, + projectPath: this.projectPath, // we need to ensure we send null to the API when // the scope is 'ALL' status: this.scope === ALL_SCOPE ? null : this.scope, diff --git a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_form.vue b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_form.vue index b063c188469127563fda1d0f445f142e75a2d307..83d3a1a64c3fc51909627505515a6e5ebee51627 100644 --- a/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_form.vue +++ b/app/assets/javascripts/ci/pipeline_schedules/components/pipeline_schedules_form.vue @@ -37,7 +37,7 @@ export default { }, mixins: [PipelineVariablesPermissionsMixin], inject: [ - 'fullPath', + 'projectPath', 'projectId', 'defaultBranch', 'dailyLimit', @@ -65,7 +65,7 @@ export default { query: getPipelineSchedulesQuery, variables() { return { - projectPath: this.fullPath, + projectPath: this.projectPath, ids: scheduleId, }; }, @@ -202,7 +202,7 @@ export default { ref: this.scheduleRef, variables: this.preparedVariablesCreate, active: this.activated, - projectPath: this.fullPath, + projectPath: this.projectPath, }, }, }); diff --git a/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_app.js b/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_app.js index 71db9400909531afa50db7ca49ef04190ad91285..c1ce478ea3a059093151578a65dacc2995c22fe7 100644 --- a/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_app.js +++ b/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_app.js @@ -18,14 +18,14 @@ export default () => { return false; } - const { fullPath, pipelinesPath, newSchedulePath, schedulesPath } = containerEl.dataset; + const { projectPath, pipelinesPath, newSchedulePath, schedulesPath } = containerEl.dataset; return new Vue({ el: containerEl, name: 'PipelineSchedulesRoot', apolloProvider, provide: { - fullPath, + projectPath, pipelinesPath, newSchedulePath, schedulesPath, diff --git a/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_form_app.js b/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_form_app.js index 3fae634613db43364cbc4c891c85b52d73f547a8..241169e1511ee0be56dee8755ba50013e0687d1f 100644 --- a/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_form_app.js +++ b/app/assets/javascripts/ci/pipeline_schedules/mount_pipeline_schedules_form_app.js @@ -21,9 +21,9 @@ export default (selector, editing = false) => { canViewPipelineEditor, dailyLimit, defaultBranch, - fullPath, pipelineEditorPath, projectId, + projectPath, schedulesPath, settingsLink, userRole, @@ -38,9 +38,9 @@ export default (selector, editing = false) => { canViewPipelineEditor: parseBoolean(canViewPipelineEditor), dailyLimit: dailyLimit ?? '', defaultBranch, - fullPath, pipelineEditorPath, projectId, + projectPath, schedulesPath, settingsLink, userRole, diff --git a/app/helpers/ci/pipeline_schedules_helper.rb b/app/helpers/ci/pipeline_schedules_helper.rb index ae54c158ddd79f58e40710cc900a92dc2f5edbcf..0a050f139136890f94de87c262c1d7358bff0c11 100644 --- a/app/helpers/ci/pipeline_schedules_helper.rb +++ b/app/helpers/ci/pipeline_schedules_helper.rb @@ -7,9 +7,9 @@ def js_pipeline_schedules_form_data(project, schedule) can_view_pipeline_editor: can_view_pipeline_editor?(project).to_s, daily_limit: schedule.daily_limit, default_branch: project.default_branch, - full_path: project.full_path, pipeline_editor_path: project_ci_pipeline_editor_path(project), project_id: project.id, + project_path: project.full_path, schedules_path: pipeline_schedules_path(project), settings_link: project_settings_ci_cd_path(project), timezone_data: timezone_data.to_json, diff --git a/app/views/projects/pipeline_schedules/index.html.haml b/app/views/projects/pipeline_schedules/index.html.haml index 15a80b6c7b1eed661c0c97b08ae40ed2c34a6f0b..502e4b73c7217121d05763d907992c92b2a4469f 100644 --- a/app/views/projects/pipeline_schedules/index.html.haml +++ b/app/views/projects/pipeline_schedules/index.html.haml @@ -1,4 +1,4 @@ - breadcrumb_title _("Schedules") - page_title _("Pipeline Schedules") -#pipeline-schedules-app{ data: { full_path: @project.full_path, pipelines_path: project_pipelines_path(@project), new_schedule_path: new_project_pipeline_schedule_path(@project) } } +#pipeline-schedules-app{ data: { project_path: @project.full_path, pipelines_path: project_pipelines_path(@project), new_schedule_path: new_project_pipeline_schedule_path(@project) } } diff --git a/spec/frontend/ci/mixins/pipeline_variables_permissions_mixin_spec.js b/spec/frontend/ci/mixins/pipeline_variables_permissions_mixin_spec.js index 948830c4f754423b30783ddb3a30b5658412d947..252352821caa30ca3ec847e26bbd4510bd45df79 100644 --- a/spec/frontend/ci/mixins/pipeline_variables_permissions_mixin_spec.js +++ b/spec/frontend/ci/mixins/pipeline_variables_permissions_mixin_spec.js @@ -66,24 +66,6 @@ describe('Pipeline Variables Permissions Mixin', () => { const findErrorState = () => wrapper.findByTestId('error-state'); describe('on load', () => { - describe('provide data', () => { - beforeEach(() => { - minimumRoleHandler = jest.fn().mockResolvedValue(generateSettingsResponse()); - }); - - it('uses `projectPath` for the query if provided', async () => { - await createComponent(); - expect(minimumRoleHandler).toHaveBeenCalledWith({ fullPath: 'project/path' }); - }); - - it('uses `fullPath` for the query if provided', async () => { - await createComponent({ - provide: { fullPath: 'project/another/path', projectPath: undefined }, - }); - expect(minimumRoleHandler).toHaveBeenCalledWith({ fullPath: 'project/another/path' }); - }); - }); - describe('when settings query is successful', () => { beforeEach(async () => { minimumRoleHandler = jest.fn().mockResolvedValue(generateSettingsResponse()); diff --git a/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_form_spec.js b/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_form_spec.js index 23b05261c3ae5b1431986f910e9c66b1143aa3a7..5583ca0abafa412d5de4732d94a9ecba20fb9612 100644 --- a/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_form_spec.js +++ b/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_form_spec.js @@ -55,7 +55,7 @@ describe('Pipeline schedules form', () => { const dailyLimit = ''; const defaultProvide = { - fullPath: 'gitlab-org/gitlab', + projectPath: 'gitlab-org/gitlab', projectId, defaultBranch, dailyLimit, diff --git a/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_spec.js b/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_spec.js index 2f7a28710dd803396053bc9827ddb2ae79c65903..afc5526b811eee3601547e4e6babd6eaa890d20f 100644 --- a/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_spec.js +++ b/spec/frontend/ci/pipeline_schedules/components/pipeline_schedules_spec.js @@ -73,7 +73,7 @@ describe('Pipeline schedules app', () => { const createComponent = (requestHandlers) => { wrapper = mountExtended(PipelineSchedules, { provide: { - fullPath: 'gitlab-org/gitlab', + projectPath: 'gitlab-org/gitlab', newSchedulePath: '/root/ci-project/-/pipeline_schedules/new', }, mocks: { diff --git a/spec/helpers/ci/pipeline_schedules_helper_spec.rb b/spec/helpers/ci/pipeline_schedules_helper_spec.rb index 4e810081a6f788408ab858b0dd1c9e12ee444cf5..6ff2b09e8ab7abf6c261ba675c5e91908a1075f4 100644 --- a/spec/helpers/ci/pipeline_schedules_helper_spec.rb +++ b/spec/helpers/ci/pipeline_schedules_helper_spec.rb @@ -45,9 +45,9 @@ expect(helper.js_pipeline_schedules_form_data(project, pipeline_schedule)).to include({ can_view_pipeline_editor: 'true', daily_limit: nil, - full_path: project.full_path, pipeline_editor_path: project_ci_pipeline_editor_path(project), project_id: project.id, + project_path: project.full_path, schedules_path: pipeline_schedules_path(project), settings_link: project_settings_ci_cd_path(project), timezone_data: timezones.to_json,