Commit ba3f488b authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch '335446-fix-broken-ui-link' into 'master'

Fix broken UI link for manual jobs

See merge request gitlab-org/gitlab!65682
parents c59e662b 991e9149
...@@ -35,11 +35,6 @@ export default { ...@@ -35,11 +35,6 @@ export default {
required: false, required: false,
default: false, default: false,
}, },
variablesSettingsUrl: {
type: String,
required: false,
default: null,
},
action: { action: {
type: Object, type: Object,
required: false, required: false,
...@@ -75,11 +70,7 @@ export default { ...@@ -75,11 +70,7 @@ export default {
<p v-if="content" data-testid="job-empty-state-content">{{ content }}</p> <p v-if="content" data-testid="job-empty-state-content">{{ content }}</p>
</div> </div>
<manual-variables-form <manual-variables-form v-if="shouldRenderManualVariables" :action="action" />
v-if="shouldRenderManualVariables"
:action="action"
:variables-settings-url="variablesSettingsUrl"
/>
<div class="text-content"> <div class="text-content">
<div v-if="action && !shouldRenderManualVariables" class="text-center"> <div v-if="action && !shouldRenderManualVariables" class="text-center">
<gl-link <gl-link
......
...@@ -50,11 +50,6 @@ export default { ...@@ -50,11 +50,6 @@ export default {
required: false, required: false,
default: null, default: null,
}, },
variablesSettingsUrl: {
type: String,
required: false,
default: null,
},
deploymentHelpUrl: { deploymentHelpUrl: {
type: String, type: String,
required: false, required: false,
...@@ -315,7 +310,6 @@ export default { ...@@ -315,7 +310,6 @@ export default {
:action="emptyStateAction" :action="emptyStateAction"
:playable="job.playable" :playable="job.playable"
:scheduled="job.scheduled" :scheduled="job.scheduled"
:variables-settings-url="variablesSettingsUrl"
/> />
<!-- EO empty state --> <!-- EO empty state -->
......
<script> <script>
/* eslint-disable vue/no-v-html */ import { GlButton, GlLink, GlSprintf } from '@gitlab/ui';
import { GlButton } from '@gitlab/ui';
import { uniqueId } from 'lodash'; import { uniqueId } from 'lodash';
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import { s__, sprintf } from '~/locale'; import { helpPagePath } from '~/helpers/help_page_helper';
import { s__ } from '~/locale';
export default { export default {
name: 'ManualVariablesForm', name: 'ManualVariablesForm',
components: { components: {
GlButton, GlButton,
GlLink,
GlSprintf,
}, },
props: { props: {
action: { action: {
...@@ -24,11 +26,6 @@ export default { ...@@ -24,11 +26,6 @@ export default {
); );
}, },
}, },
variablesSettingsUrl: {
type: String,
required: true,
default: '',
},
}, },
inputTypes: { inputTypes: {
key: 'key', key: 'key',
...@@ -37,6 +34,9 @@ export default { ...@@ -37,6 +34,9 @@ export default {
i18n: { i18n: {
keyPlaceholder: s__('CiVariables|Input variable key'), keyPlaceholder: s__('CiVariables|Input variable key'),
valuePlaceholder: s__('CiVariables|Input variable value'), valuePlaceholder: s__('CiVariables|Input variable value'),
formHelpText: s__(
'CiVariables|Specify variable values to be used in this run. The values specified in %{linkStart}CI/CD settings%{linkEnd} will be used as default',
),
}, },
data() { data() {
return { return {
...@@ -47,17 +47,8 @@ export default { ...@@ -47,17 +47,8 @@ export default {
}; };
}, },
computed: { computed: {
helpText() { variableSettings() {
return sprintf( return helpPagePath('ci/variables/index', { anchor: 'add-a-cicd-variable-to-a-project' });
s__(
'CiVariables|Specify variable values to be used in this run. The values specified in %{linkStart}CI/CD settings%{linkEnd} will be used as default',
),
{
linkStart: `<a href="${this.variablesSettingsUrl}">`,
linkEnd: '</a>',
},
false,
);
}, },
}, },
watch: { watch: {
...@@ -188,8 +179,14 @@ export default { ...@@ -188,8 +179,14 @@ export default {
</div> </div>
</div> </div>
</div> </div>
<div class="d-flex gl-mt-3 justify-content-center"> <div class="gl-text-center gl-mt-3">
<p class="text-muted" data-testid="form-help-text" v-html="helpText"></p> <gl-sprintf :message="$options.i18n.formHelpText">
<template #link="{ content }">
<gl-link :href="variableSettings" target="_blank">
{{ content }}
</gl-link>
</template>
</gl-sprintf>
</div> </div>
<div class="d-flex justify-content-center"> <div class="d-flex justify-content-center">
<gl-button <gl-button
......
...@@ -15,7 +15,6 @@ export default () => { ...@@ -15,7 +15,6 @@ export default () => {
deploymentHelpUrl, deploymentHelpUrl,
codeQualityHelpUrl, codeQualityHelpUrl,
runnerSettingsUrl, runnerSettingsUrl,
variablesSettingsUrl,
subscriptionsMoreMinutesUrl, subscriptionsMoreMinutesUrl,
endpoint, endpoint,
pagePath, pagePath,
...@@ -41,7 +40,6 @@ export default () => { ...@@ -41,7 +40,6 @@ export default () => {
deploymentHelpUrl, deploymentHelpUrl,
codeQualityHelpUrl, codeQualityHelpUrl,
runnerSettingsUrl, runnerSettingsUrl,
variablesSettingsUrl,
subscriptionsMoreMinutesUrl, subscriptionsMoreMinutesUrl,
endpoint, endpoint,
pagePath, pagePath,
......
...@@ -9,7 +9,6 @@ module Ci ...@@ -9,7 +9,6 @@ module Ci
"artifact_help_url" => help_page_path('user/gitlab_com/index.html', anchor: 'gitlab-cicd'), "artifact_help_url" => help_page_path('user/gitlab_com/index.html', anchor: 'gitlab-cicd'),
"deployment_help_url" => help_page_path('user/project/clusters/index.html', anchor: 'troubleshooting'), "deployment_help_url" => help_page_path('user/project/clusters/index.html', anchor: 'troubleshooting'),
"runner_settings_url" => project_runners_path(@build.project, anchor: 'js-runners-settings'), "runner_settings_url" => project_runners_path(@build.project, anchor: 'js-runners-settings'),
"variables_settings_url" => project_variables_path(@build.project, anchor: 'js-cicd-variables-settings'),
"page_path" => project_job_path(@project, @build), "page_path" => project_job_path(@project, @build),
"build_status" => @build.status, "build_status" => @build.status,
"build_stage" => @build.stage, "build_stage" => @build.stage,
......
...@@ -9,7 +9,6 @@ describe('Empty State', () => { ...@@ -9,7 +9,6 @@ describe('Empty State', () => {
illustrationSizeClass: 'svg-430', illustrationSizeClass: 'svg-430',
title: 'This job has not started yet', title: 'This job has not started yet',
playable: false, playable: false,
variablesSettingsUrl: '',
}; };
const createWrapper = (props) => { const createWrapper = (props) => {
......
...@@ -37,7 +37,6 @@ describe('Job App', () => { ...@@ -37,7 +37,6 @@ describe('Job App', () => {
deploymentHelpUrl: 'help/deployment', deploymentHelpUrl: 'help/deployment',
codeQualityHelpPath: '/help/code_quality', codeQualityHelpPath: '/help/code_quality',
runnerSettingsUrl: 'settings/ci-cd/runners', runnerSettingsUrl: 'settings/ci-cd/runners',
variablesSettingsUrl: 'settings/ci-cd/variables',
terminalPath: 'jobs/123/terminal', terminalPath: 'jobs/123/terminal',
projectPath: 'user-name/project-name', projectPath: 'user-name/project-name',
subscriptionsMoreMinutesUrl: 'https://customers.gitlab.com/buy_pipeline_minutes', subscriptionsMoreMinutesUrl: 'https://customers.gitlab.com/buy_pipeline_minutes',
......
import { GlSprintf, GlLink } from '@gitlab/ui';
import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; import { createLocalVue, mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
...@@ -18,7 +19,6 @@ describe('Manual Variables Form', () => { ...@@ -18,7 +19,6 @@ describe('Manual Variables Form', () => {
method: 'post', method: 'post',
button_title: 'Trigger this manual action', button_title: 'Trigger this manual action',
}, },
variablesSettingsUrl: '/settings',
}; };
const createComponent = ({ props = {}, mountFn = shallowMount } = {}) => { const createComponent = ({ props = {}, mountFn = shallowMount } = {}) => {
...@@ -33,15 +33,19 @@ describe('Manual Variables Form', () => { ...@@ -33,15 +33,19 @@ describe('Manual Variables Form', () => {
propsData: { ...requiredProps, ...props }, propsData: { ...requiredProps, ...props },
localVue, localVue,
store, store,
stubs: {
GlSprintf,
},
}), }),
); );
}; };
const findInputKey = () => wrapper.findComponent({ ref: 'inputKey' }); const findInputKey = () => wrapper.findComponent({ ref: 'inputKey' });
const findInputValue = () => wrapper.findComponent({ ref: 'inputSecretValue' }); const findInputValue = () => wrapper.findComponent({ ref: 'inputSecretValue' });
const findHelpText = () => wrapper.findComponent(GlSprintf);
const findHelpLink = () => wrapper.findComponent(GlLink);
const findTriggerBtn = () => wrapper.findByTestId('trigger-manual-job-btn'); const findTriggerBtn = () => wrapper.findByTestId('trigger-manual-job-btn');
const findHelpText = () => wrapper.findByTestId('form-help-text');
const findDeleteVarBtn = () => wrapper.findByTestId('delete-variable-btn'); const findDeleteVarBtn = () => wrapper.findByTestId('delete-variable-btn');
const findCiVariableKey = () => wrapper.findByTestId('ci-variable-key'); const findCiVariableKey = () => wrapper.findByTestId('ci-variable-key');
const findCiVariableValue = () => wrapper.findByTestId('ci-variable-value'); const findCiVariableValue = () => wrapper.findByTestId('ci-variable-value');
...@@ -62,11 +66,10 @@ describe('Manual Variables Form', () => { ...@@ -62,11 +66,10 @@ describe('Manual Variables Form', () => {
}); });
it('renders help text with provided link', () => { it('renders help text with provided link', () => {
expect(findHelpText().text()).toBe( expect(findHelpText().exists()).toBe(true);
'Specify variable values to be used in this run. The values specified in CI/CD settings will be used as default', expect(findHelpLink().attributes('href')).toBe(
'/help/ci/variables/index#add-a-cicd-variable-to-a-project',
); );
expect(wrapper.find('a').attributes('href')).toBe(requiredProps.variablesSettingsUrl);
}); });
describe('when adding a new variable', () => { describe('when adding a new variable', () => {
......
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