Commit 798dd96d authored by Phil Hughes's avatar Phil Hughes

Merge branch '320949-auto-devops-help-path-remove-prop' into 'master'

Remove autodevops popover link href props

See merge request gitlab-org/gitlab!54225
parents f4bc9698 b8cabd96
...@@ -34,7 +34,6 @@ export default () => { ...@@ -34,7 +34,6 @@ export default () => {
helpPagePath: pipelineTableViewEl.dataset.helpPagePath, helpPagePath: pipelineTableViewEl.dataset.helpPagePath,
emptyStateSvgPath: pipelineTableViewEl.dataset.emptyStateSvgPath, emptyStateSvgPath: pipelineTableViewEl.dataset.emptyStateSvgPath,
errorStateSvgPath: pipelineTableViewEl.dataset.errorStateSvgPath, errorStateSvgPath: pipelineTableViewEl.dataset.errorStateSvgPath,
autoDevopsHelpPath: pipelineTableViewEl.dataset.helpAutoDevopsPath,
}, },
}); });
}, },
......
...@@ -29,10 +29,6 @@ export default { ...@@ -29,10 +29,6 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
autoDevopsHelpPath: {
type: String,
required: true,
},
errorStateSvgPath: { errorStateSvgPath: {
type: String, type: String,
required: true, required: true,
...@@ -212,7 +208,6 @@ export default { ...@@ -212,7 +208,6 @@ export default {
<pipelines-table-component <pipelines-table-component
:pipelines="state.pipelines" :pipelines="state.pipelines"
:update-graph-dropdown="updateGraphDropdown" :update-graph-dropdown="updateGraphDropdown"
:auto-devops-help-path="autoDevopsHelpPath"
:view-type="viewType" :view-type="viewType"
> >
<template #table-header-actions> <template #table-header-actions>
......
...@@ -364,7 +364,6 @@ export default class MergeRequestTabs { ...@@ -364,7 +364,6 @@ export default class MergeRequestTabs {
helpPagePath: pipelineTableViewEl.dataset.helpPagePath, helpPagePath: pipelineTableViewEl.dataset.helpPagePath,
emptyStateSvgPath: pipelineTableViewEl.dataset.emptyStateSvgPath, emptyStateSvgPath: pipelineTableViewEl.dataset.emptyStateSvgPath,
errorStateSvgPath: pipelineTableViewEl.dataset.errorStateSvgPath, errorStateSvgPath: pipelineTableViewEl.dataset.errorStateSvgPath,
autoDevopsHelpPath: pipelineTableViewEl.dataset.helpAutoDevopsPath,
canCreatePipelineInTargetProject: Boolean( canCreatePipelineInTargetProject: Boolean(
mrWidgetData?.can_create_pipeline_in_target_project, mrWidgetData?.can_create_pipeline_in_target_project,
), ),
......
<script> <script>
import { GlLink, GlPopover, GlSprintf, GlTooltipDirective, GlBadge } from '@gitlab/ui'; import { GlLink, GlPopover, GlSprintf, GlTooltipDirective, GlBadge } from '@gitlab/ui';
import { helpPagePath } from '~/helpers/help_page_helper';
import { SCHEDULE_ORIGIN } from '../../constants'; import { SCHEDULE_ORIGIN } from '../../constants';
export default { export default {
...@@ -26,10 +27,6 @@ export default { ...@@ -26,10 +27,6 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
autoDevopsHelpPath: {
type: String,
required: true,
},
}, },
computed: { computed: {
user() { user() {
...@@ -44,6 +41,12 @@ export default { ...@@ -44,6 +41,12 @@ export default {
this.pipeline?.project?.full_path !== `/${this.targetProjectFullPath}`, this.pipeline?.project?.full_path !== `/${this.targetProjectFullPath}`,
); );
}, },
autoDevopsTagId() {
return `pipeline-url-autodevops-${this.pipeline.id}`;
},
autoDevopsHelpPath() {
return helpPagePath('topics/autodevops/index.md');
},
}, },
}; };
</script> </script>
...@@ -103,19 +106,18 @@ export default { ...@@ -103,19 +106,18 @@ export default {
data-testid="pipeline-url-failure" data-testid="pipeline-url-failure"
>{{ __('error') }}</gl-badge >{{ __('error') }}</gl-badge
> >
<template v-if="pipeline.flags.auto_devops">
<gl-link <gl-link
v-if="pipeline.flags.auto_devops" :id="autoDevopsTagId"
:id="`pipeline-url-autodevops-${pipeline.id}`"
tabindex="0" tabindex="0"
data-testid="pipeline-url-autodevops" data-testid="pipeline-url-autodevops"
role="button" role="button"
><gl-badge variant="info" size="sm">{{ __('Auto DevOps') }}</gl-badge></gl-link
>
<gl-popover
:target="`pipeline-url-autodevops-${pipeline.id}`"
triggers="focus"
placement="top"
> >
<gl-badge variant="info" size="sm">
{{ __('Auto DevOps') }}
</gl-badge>
</gl-link>
<gl-popover :target="autoDevopsTagId" triggers="focus" placement="top">
<template #title> <template #title>
<div class="gl-font-weight-normal gl-line-height-normal"> <div class="gl-font-weight-normal gl-line-height-normal">
<gl-sprintf <gl-sprintf
...@@ -131,10 +133,16 @@ export default { ...@@ -131,10 +133,16 @@ export default {
</gl-sprintf> </gl-sprintf>
</div> </div>
</template> </template>
<gl-link :href="autoDevopsHelpPath" target="_blank" rel="noopener noreferrer nofollow">{{ <gl-link
__('Learn more about Auto DevOps') :href="autoDevopsHelpPath"
}}</gl-link> data-testid="pipeline-url-autodevops-link"
target="_blank"
>
{{ __('Learn more about Auto DevOps') }}
</gl-link>
</gl-popover> </gl-popover>
</template>
<gl-badge <gl-badge
v-if="pipeline.flags.stuck" v-if="pipeline.flags.stuck"
variant="warning" variant="warning"
......
...@@ -68,10 +68,6 @@ export default { ...@@ -68,10 +68,6 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
autoDevopsHelpPath: {
type: String,
required: true,
},
hasGitlabCi: { hasGitlabCi: {
type: Boolean, type: Boolean,
required: true, required: true,
...@@ -362,7 +358,6 @@ export default { ...@@ -362,7 +358,6 @@ export default {
:pipelines="state.pipelines" :pipelines="state.pipelines"
:pipeline-schedule-url="pipelineScheduleUrl" :pipeline-schedule-url="pipelineScheduleUrl"
:update-graph-dropdown="updateGraphDropdown" :update-graph-dropdown="updateGraphDropdown"
:auto-devops-help-path="autoDevopsHelpPath"
:view-type="viewType" :view-type="viewType"
/> />
</div> </div>
......
...@@ -32,10 +32,6 @@ export default { ...@@ -32,10 +32,6 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
autoDevopsHelpPath: {
type: String,
required: true,
},
viewType: { viewType: {
type: String, type: String,
required: true, required: true,
...@@ -102,7 +98,6 @@ export default { ...@@ -102,7 +98,6 @@ export default {
:pipeline="model" :pipeline="model"
:pipeline-schedule-url="pipelineScheduleUrl" :pipeline-schedule-url="pipelineScheduleUrl"
:update-graph-dropdown="updateGraphDropdown" :update-graph-dropdown="updateGraphDropdown"
:auto-devops-help-path="autoDevopsHelpPath"
:view-type="viewType" :view-type="viewType"
:canceling-pipeline="cancelingPipeline" :canceling-pipeline="cancelingPipeline"
/> />
......
...@@ -47,10 +47,6 @@ export default { ...@@ -47,10 +47,6 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
autoDevopsHelpPath: {
type: String,
required: true,
},
viewType: { viewType: {
type: String, type: String,
required: true, required: true,
...@@ -194,11 +190,7 @@ export default { ...@@ -194,11 +190,7 @@ export default {
</div> </div>
</div> </div>
<pipeline-url <pipeline-url :pipeline="pipeline" :pipeline-schedule-url="pipelineScheduleUrl" />
:pipeline="pipeline"
:pipeline-schedule-url="pipelineScheduleUrl"
:auto-devops-help-path="autoDevopsHelpPath"
/>
<pipeline-triggerer :pipeline="pipeline" /> <pipeline-triggerer :pipeline="pipeline" />
<div class="table-section section-wrap section-20"> <div class="table-section section-wrap section-20">
......
...@@ -27,7 +27,6 @@ export const initPipelinesIndex = (selector = '#pipelines-list-vue') => { ...@@ -27,7 +27,6 @@ export const initPipelinesIndex = (selector = '#pipelines-list-vue') => {
emptyStateSvgPath, emptyStateSvgPath,
errorStateSvgPath, errorStateSvgPath,
noPipelinesSvgPath, noPipelinesSvgPath,
autoDevopsHelpPath,
newPipelinePath, newPipelinePath,
canCreatePipeline, canCreatePipeline,
hasGitlabCi, hasGitlabCi,
...@@ -60,7 +59,6 @@ export const initPipelinesIndex = (selector = '#pipelines-list-vue') => { ...@@ -60,7 +59,6 @@ export const initPipelinesIndex = (selector = '#pipelines-list-vue') => {
emptyStateSvgPath, emptyStateSvgPath,
errorStateSvgPath, errorStateSvgPath,
noPipelinesSvgPath, noPipelinesSvgPath,
autoDevopsHelpPath,
newPipelinePath, newPipelinePath,
canCreatePipeline: parseBoolean(canCreatePipeline), canCreatePipeline: parseBoolean(canCreatePipeline),
hasGitlabCi: parseBoolean(hasGitlabCi), hasGitlabCi: parseBoolean(hasGitlabCi),
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#commit-pipeline-table-view{ data: { disable_initialization: disable_initialization, #commit-pipeline-table-view{ data: { disable_initialization: disable_initialization,
endpoint: endpoint, endpoint: endpoint,
"help-page-path" => help_page_path('ci/quick_start/README'), "help-page-path" => help_page_path('ci/quick_start/README'),
"help-auto-devops-path" => help_page_path('topics/autodevops/index.md'),
"empty-state-svg-path" => image_path('illustrations/pipelines_empty.svg'), "empty-state-svg-path" => image_path('illustrations/pipelines_empty.svg'),
"error-state-svg-path" => image_path('illustrations/pipelines_failed.svg'), "error-state-svg-path" => image_path('illustrations/pipelines_failed.svg'),
"project-id": @project.id, "project-id": @project.id,
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
project_id: @project.id, project_id: @project.id,
params: params.to_json, params: params.to_json,
"help-page-path" => help_page_path('ci/quick_start/README'), "help-page-path" => help_page_path('ci/quick_start/README'),
"auto-devops-help-path" => help_page_path('topics/autodevops/index.md'),
"pipeline-schedule-url" => pipeline_schedules_path(@project), "pipeline-schedule-url" => pipeline_schedules_path(@project),
"empty-state-svg-path" => image_path('illustrations/pipelines_empty.svg'), "empty-state-svg-path" => image_path('illustrations/pipelines_empty.svg'),
"error-state-svg-path" => image_path('illustrations/pipelines_failed.svg'), "error-state-svg-path" => image_path('illustrations/pipelines_failed.svg'),
......
...@@ -16,7 +16,6 @@ describe('Pipelines table in Commits and Merge requests', () => { ...@@ -16,7 +16,6 @@ describe('Pipelines table in Commits and Merge requests', () => {
helpPagePath: 'foo', helpPagePath: 'foo',
emptyStateSvgPath: 'foo', emptyStateSvgPath: 'foo',
errorStateSvgPath: 'foo', errorStateSvgPath: 'foo',
autoDevopsHelpPath: 'foo',
}; };
preloadFixtures(jsonFixtureName); preloadFixtures(jsonFixtureName);
......
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import $ from 'jquery';
import { trimText } from 'helpers/text_helper'; import { trimText } from 'helpers/text_helper';
import PipelineUrlComponent from '~/pipelines/components/pipelines_list/pipeline_url.vue'; import PipelineUrlComponent from '~/pipelines/components/pipelines_list/pipeline_url.vue';
$.fn.popover = () => {}; const projectPath = 'test/test';
describe('Pipeline Url Component', () => { describe('Pipeline Url Component', () => {
let wrapper; let wrapper;
...@@ -14,6 +13,7 @@ describe('Pipeline Url Component', () => { ...@@ -14,6 +13,7 @@ describe('Pipeline Url Component', () => {
const findYamlTag = () => wrapper.find('[data-testid="pipeline-url-yaml"]'); const findYamlTag = () => wrapper.find('[data-testid="pipeline-url-yaml"]');
const findFailureTag = () => wrapper.find('[data-testid="pipeline-url-failure"]'); const findFailureTag = () => wrapper.find('[data-testid="pipeline-url-failure"]');
const findAutoDevopsTag = () => wrapper.find('[data-testid="pipeline-url-autodevops"]'); const findAutoDevopsTag = () => wrapper.find('[data-testid="pipeline-url-autodevops"]');
const findAutoDevopsTagLink = () => wrapper.find('[data-testid="pipeline-url-autodevops-link"]');
const findStuckTag = () => wrapper.find('[data-testid="pipeline-url-stuck"]'); const findStuckTag = () => wrapper.find('[data-testid="pipeline-url-stuck"]');
const findDetachedTag = () => wrapper.find('[data-testid="pipeline-url-detached"]'); const findDetachedTag = () => wrapper.find('[data-testid="pipeline-url-detached"]');
const findForkTag = () => wrapper.find('[data-testid="pipeline-url-fork"]'); const findForkTag = () => wrapper.find('[data-testid="pipeline-url-fork"]');
...@@ -23,9 +23,9 @@ describe('Pipeline Url Component', () => { ...@@ -23,9 +23,9 @@ describe('Pipeline Url Component', () => {
pipeline: { pipeline: {
id: 1, id: 1,
path: 'foo', path: 'foo',
project: { full_path: `/${projectPath}` },
flags: {}, flags: {},
}, },
autoDevopsHelpPath: 'foo',
pipelineScheduleUrl: 'foo', pipelineScheduleUrl: 'foo',
}; };
...@@ -33,7 +33,7 @@ describe('Pipeline Url Component', () => { ...@@ -33,7 +33,7 @@ describe('Pipeline Url Component', () => {
wrapper = shallowMount(PipelineUrlComponent, { wrapper = shallowMount(PipelineUrlComponent, {
propsData: { ...defaultProps, ...props }, propsData: { ...defaultProps, ...props },
provide: { provide: {
targetProjectFullPath: 'test/test', targetProjectFullPath: projectPath,
}, },
}); });
}; };
...@@ -57,6 +57,19 @@ describe('Pipeline Url Component', () => { ...@@ -57,6 +57,19 @@ describe('Pipeline Url Component', () => {
expect(findPipelineUrlLink().text()).toBe('#1'); expect(findPipelineUrlLink().text()).toBe('#1');
}); });
it('should not render tags when flags are not set', () => {
createComponent();
expect(findStuckTag().exists()).toBe(false);
expect(findLatestTag().exists()).toBe(false);
expect(findYamlTag().exists()).toBe(false);
expect(findAutoDevopsTag().exists()).toBe(false);
expect(findFailureTag().exists()).toBe(false);
expect(findScheduledTag().exists()).toBe(false);
expect(findForkTag().exists()).toBe(false);
expect(findTrainTag().exists()).toBe(false);
});
it('should render the stuck tag when flag is provided', () => { it('should render the stuck tag when flag is provided', () => {
createComponent({ createComponent({
pipeline: { pipeline: {
...@@ -96,6 +109,7 @@ describe('Pipeline Url Component', () => { ...@@ -96,6 +109,7 @@ describe('Pipeline Url Component', () => {
it('should render an autodevops badge when flag is provided', () => { it('should render an autodevops badge when flag is provided', () => {
createComponent({ createComponent({
pipeline: { pipeline: {
...defaultProps.pipeline,
flags: { flags: {
auto_devops: true, auto_devops: true,
}, },
...@@ -103,6 +117,11 @@ describe('Pipeline Url Component', () => { ...@@ -103,6 +117,11 @@ describe('Pipeline Url Component', () => {
}); });
expect(trimText(findAutoDevopsTag().text())).toBe('Auto DevOps'); expect(trimText(findAutoDevopsTag().text())).toBe('Auto DevOps');
expect(findAutoDevopsTagLink().attributes()).toMatchObject({
href: '/help/topics/autodevops/index.md',
target: '_blank',
});
}); });
it('should render a detached badge when flag is provided', () => { it('should render a detached badge when flag is provided', () => {
...@@ -147,7 +166,7 @@ describe('Pipeline Url Component', () => { ...@@ -147,7 +166,7 @@ describe('Pipeline Url Component', () => {
createComponent({ createComponent({
pipeline: { pipeline: {
flags: {}, flags: {},
project: { fullPath: 'test/forked' }, project: { fullPath: '/test/forked' },
}, },
}); });
......
...@@ -34,7 +34,6 @@ describe('Pipelines', () => { ...@@ -34,7 +34,6 @@ describe('Pipelines', () => {
let origWindowLocation; let origWindowLocation;
const paths = { const paths = {
autoDevopsHelpPath: '/help/topics/autodevops/index.md',
helpPagePath: '/help/ci/quick_start/README', helpPagePath: '/help/ci/quick_start/README',
emptyStateSvgPath: '/assets/illustrations/pipelines_empty.svg', emptyStateSvgPath: '/assets/illustrations/pipelines_empty.svg',
errorStateSvgPath: '/assets/illustrations/pipelines_failed.svg', errorStateSvgPath: '/assets/illustrations/pipelines_failed.svg',
...@@ -45,7 +44,6 @@ describe('Pipelines', () => { ...@@ -45,7 +44,6 @@ describe('Pipelines', () => {
}; };
const noPermissions = { const noPermissions = {
autoDevopsHelpPath: '/help/topics/autodevops/index.md',
helpPagePath: '/help/ci/quick_start/README', helpPagePath: '/help/ci/quick_start/README',
emptyStateSvgPath: '/assets/illustrations/pipelines_empty.svg', emptyStateSvgPath: '/assets/illustrations/pipelines_empty.svg',
errorStateSvgPath: '/assets/illustrations/pipelines_failed.svg', errorStateSvgPath: '/assets/illustrations/pipelines_failed.svg',
......
...@@ -9,7 +9,6 @@ describe('Pipelines Table Row', () => { ...@@ -9,7 +9,6 @@ describe('Pipelines Table Row', () => {
mount(PipelinesTableRowComponent, { mount(PipelinesTableRowComponent, {
propsData: { propsData: {
pipeline, pipeline,
autoDevopsHelpPath: 'foo',
viewType: 'root', viewType: 'root',
}, },
}); });
......
...@@ -9,7 +9,6 @@ describe('Pipelines Table', () => { ...@@ -9,7 +9,6 @@ describe('Pipelines Table', () => {
const defaultProps = { const defaultProps = {
pipelines: [], pipelines: [],
autoDevopsHelpPath: 'foo',
viewType: 'root', viewType: 'root',
}; };
...@@ -58,7 +57,7 @@ describe('Pipelines Table', () => { ...@@ -58,7 +57,7 @@ describe('Pipelines Table', () => {
describe('with data', () => { describe('with data', () => {
it('should render rows', () => { it('should render rows', () => {
createComponent({ pipelines: [pipeline], autoDevopsHelpPath: 'foo', viewType: 'root' }); createComponent({ pipelines: [pipeline], viewType: 'root' });
expect(findRows()).toHaveLength(1); expect(findRows()).toHaveLength(1);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment