Commit 1cc09301 authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Phil Hughes

Fix stage dropdown rendering only in English

parent 9b36f523
...@@ -31,7 +31,7 @@ export default { ...@@ -31,7 +31,7 @@ export default {
}, },
}, },
computed: { computed: {
...mapState(['job', 'stages', 'jobs', 'selectedStage']), ...mapState(['job', 'stages', 'jobs', 'selectedStage', 'isLoadingStages']),
coverage() { coverage() {
return `${this.job.coverage}%`; return `${this.job.coverage}%`;
}, },
...@@ -59,10 +59,10 @@ export default { ...@@ -59,10 +59,10 @@ export default {
return ''; return '';
} }
let t = this.job.metadata.timeout_human_readable; let t = this.job.metadata.timeout_human_readable;
if (this.job.metadata.timeout_source !== '') { if (this.job.metadata.timeout_source !== '') {
t += ` (from ${this.job.metadata.timeout_source})`; t += ` (from ${this.job.metadata.timeout_source})`;
} }
return t; return t;
}, },
...@@ -270,6 +270,7 @@ export default { ...@@ -270,6 +270,7 @@ export default {
/> />
<stages-dropdown <stages-dropdown
v-if="!isLoadingStages"
:stages="stages" :stages="stages"
:pipeline="job.pipeline" :pipeline="job.pipeline"
:selected-stage="selectedStage" :selected-stage="selectedStage"
......
...@@ -22,7 +22,6 @@ export default { ...@@ -22,7 +22,6 @@ export default {
required: true, required: true,
}, },
}, },
computed: { computed: {
hasRef() { hasRef() {
return !_.isEmpty(this.pipeline.ref); return !_.isEmpty(this.pipeline.ref);
......
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
* after the first request, * after the first request,
* and we do not want to hijack that * and we do not want to hijack that
*/ */
if (state.selectedStage === 'More' && job.stage) { if (state.selectedStage === '' && job.stage) {
state.selectedStage = job.stage; state.selectedStage = job.stage;
} }
}, },
......
import { __ } from '~/locale';
export default () => ({ export default () => ({
jobEndpoint: null, jobEndpoint: null,
traceEndpoint: null, traceEndpoint: null,
...@@ -29,7 +27,7 @@ export default () => ({ ...@@ -29,7 +27,7 @@ export default () => ({
// sidebar dropdown & list of jobs // sidebar dropdown & list of jobs
isLoadingStages: false, isLoadingStages: false,
isLoadingJobs: false, isLoadingJobs: false,
selectedStage: __('More'), selectedStage: '',
stages: [], stages: [],
jobs: [], jobs: [],
}); });
---
title: Fix stage dropdown not rendering in different languages
merge_request: 22604
author:
type: other
...@@ -140,10 +140,11 @@ describe('Sidebar details block', () => { ...@@ -140,10 +140,11 @@ describe('Sidebar details block', () => {
}); });
describe('while fetching stages', () => { describe('while fetching stages', () => {
it('renders dropdown with More label', () => { it('it does not render dropdown', () => {
store.dispatch('requestStages');
vm = mountComponentWithStore(SidebarComponent, { store }); vm = mountComponentWithStore(SidebarComponent, { store });
expect(vm.$el.querySelector('.js-selected-stage').textContent.trim()).toEqual('More'); expect(vm.$el.querySelector('.js-selected-stage')).toBeNull();
}); });
}); });
......
...@@ -124,8 +124,8 @@ describe('Jobs Store Mutations', () => { ...@@ -124,8 +124,8 @@ describe('Jobs Store Mutations', () => {
expect(stateCopy.job).toEqual({ id: 1312321 }); expect(stateCopy.job).toEqual({ id: 1312321 });
}); });
it('sets selectedStage when the selectedStage is More', () => { it('sets selectedStage when the selectedStage is empty', () => {
expect(stateCopy.selectedStage).toEqual('More'); expect(stateCopy.selectedStage).toEqual('');
mutations[types.RECEIVE_JOB_SUCCESS](stateCopy, { id: 1312321, stage: 'deploy' }); mutations[types.RECEIVE_JOB_SUCCESS](stateCopy, { id: 1312321, stage: 'deploy' });
expect(stateCopy.selectedStage).toEqual('deploy'); expect(stateCopy.selectedStage).toEqual('deploy');
......
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