Commit 8b08b5cd authored by Jose Vargas's avatar Jose Vargas

Change runnerHelpPath to use frontend utils

This changes the runnerHelpPath data attribute from HAML
and makes uses of the helpPagePath utility from javascript
that creates the documentation links
parent d426642b
......@@ -54,11 +54,6 @@ export default {
required: false,
default: null,
},
runnerHelpUrl: {
type: String,
required: false,
default: null,
},
deploymentHelpUrl: {
type: String,
required: false,
......@@ -250,7 +245,6 @@ export default {
v-if="shouldRenderSharedRunnerLimitWarning"
:quota-used="job.runners.quota.used"
:quota-limit="job.runners.quota.limit"
:runners-path="runnerHelpUrl"
:project-path="projectPath"
:subscriptions-more-minutes-url="subscriptionsMoreMinutesUrl"
/>
......@@ -330,7 +324,6 @@ export default {
'right-sidebar-collapsed': !isSidebarOpen,
}"
:artifact-help-url="artifactHelpUrl"
:runner-help-url="runnerHelpUrl"
data-testid="job-sidebar"
/>
</div>
......
......@@ -41,11 +41,6 @@ export default {
required: false,
default: '',
},
runnerHelpUrl: {
type: String,
required: false,
default: '',
},
},
computed: {
...mapGetters(['hasForwardDeploymentFailure']),
......@@ -135,7 +130,7 @@ export default {
<gl-icon :size="14" name="external-link" />
</gl-link>
</div>
<job-sidebar-details-container :runner-help-url="runnerHelpUrl" />
<job-sidebar-details-container />
<artifacts-block v-if="hasArtifact" :artifact="job.artifact" :help-url="artifactHelpUrl" />
<trigger-block v-if="hasTriggers" :trigger="job.trigger" />
<commit-block
......
......@@ -3,6 +3,7 @@ import { mapState } from 'vuex';
import { __, sprintf } from '~/locale';
import timeagoMixin from '~/vue_shared/mixins/timeago';
import { timeIntervalInWords } from '~/lib/utils/datetime_utility';
import { helpPagePath } from '~/helpers/help_page_helper';
import DetailRow from './sidebar_detail_row.vue';
export default {
......@@ -11,13 +12,6 @@ export default {
DetailRow,
},
mixins: [timeagoMixin],
props: {
runnerHelpUrl: {
type: String,
required: false,
default: '',
},
},
computed: {
...mapState(['job']),
coverage() {
......@@ -51,6 +45,11 @@ export default {
queued() {
return timeIntervalInWords(this.job.queued);
},
runnerHelpUrl() {
return helpPagePath('ci/runners/README.html', {
anchor: 'set-maximum-job-timeout-for-a-runner',
});
},
runnerId() {
return `${this.job.runner.description} (#${this.job.runner.id})`;
},
......
......@@ -13,7 +13,6 @@ export default () => {
const {
artifactHelpUrl,
deploymentHelpUrl,
runnerHelpUrl,
runnerSettingsUrl,
variablesSettingsUrl,
subscriptionsMoreMinutesUrl,
......@@ -39,7 +38,6 @@ export default () => {
props: {
artifactHelpUrl,
deploymentHelpUrl,
runnerHelpUrl,
runnerSettingsUrl,
variablesSettingsUrl,
subscriptionsMoreMinutesUrl,
......
......@@ -8,7 +8,6 @@ module Ci
"project_path" => @project.full_path,
"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'),
"runner_help_url" => help_page_path('ci/runners/README.html', anchor: 'set-maximum-job-timeout-for-a-runner'),
"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),
......
<script>
import { GlButton, GlAlert } from '@gitlab/ui';
import { s__, sprintf } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
export default {
components: {
......@@ -16,11 +17,6 @@ export default {
type: Number,
required: true,
},
runnersPath: {
type: String,
required: false,
default: null,
},
projectPath: {
type: String,
required: true,
......@@ -43,6 +39,11 @@ export default {
{ quotaUsed: this.quotaUsed, quotaLimit: this.quotaLimit },
);
},
runnersPath() {
return helpPagePath('ci/runners/README.html', {
anchor: 'set-maximum-job-timeout-for-a-runner',
});
},
},
};
</script>
......
......@@ -6,7 +6,6 @@ import { trimText } from 'helpers/text_helper';
describe('Shared Runner Limit Block', () => {
let wrapper;
const runnersPath = 'root/project/runners';
const projectPath = 'h5bp/html5-boilerplate';
const subscriptionsMoreMinutesUrl = 'https://customers.gitlab.com/buy_pipeline_minutes';
......@@ -27,7 +26,6 @@ describe('Shared Runner Limit Block', () => {
propsData: {
quotaUsed: 1000,
quotaLimit: 4000,
runnersPath,
projectPath,
subscriptionsMoreMinutesUrl,
},
......@@ -56,7 +54,6 @@ describe('Shared Runner Limit Block', () => {
quotaUsed: 1000,
quotaLimit: 4000,
projectPath,
runnersPath,
subscriptionsMoreMinutesUrl,
},
});
......@@ -64,21 +61,4 @@ describe('Shared Runner Limit Block', () => {
expect(trimText(wrapper.text())).toContain('For more information, go to the Runners page.');
});
});
describe('without runnersPath', () => {
it('does not render runner link', () => {
factory({
propsData: {
quotaUsed: 1000,
quotaLimit: 4000,
projectPath,
subscriptionsMoreMinutesUrl,
},
});
expect(trimText(wrapper.element.textContent)).not.toContain(
'For more information, go to the Runners page.',
);
});
});
});
......@@ -34,7 +34,6 @@ describe('Job App', () => {
const props = {
artifactHelpUrl: 'help/artifact',
runnerHelpUrl: 'help/runner',
deploymentHelpUrl: 'help/deployment',
runnerSettingsUrl: 'settings/ci-cd/runners',
variablesSettingsUrl: 'settings/ci-cd/variables',
......
......@@ -116,14 +116,5 @@ describe('Job Sidebar Details Container', () => {
expect(findJobTimeout().exists()).toBe(false);
});
it('should pass the help URL', async () => {
const helpUrl = 'fakeUrl';
const props = { runnerHelpUrl: helpUrl };
createWrapper({ props });
await store.dispatch('receiveJobSuccess', { metadata: { timeout_human_readable } });
expect(findJobTimeout().props('helpUrl')).toBe(helpUrl);
});
});
});
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