Fix stage dropdown rendering only in English

This commit is contained in:
Filipa Lacerda 2018-10-26 07:49:01 +00:00 committed by Phil Hughes
parent 9b36f52310
commit 1cc093011f
7 changed files with 18 additions and 14 deletions

View file

@ -31,7 +31,7 @@ export default {
},
},
computed: {
...mapState(['job', 'stages', 'jobs', 'selectedStage']),
...mapState(['job', 'stages', 'jobs', 'selectedStage', 'isLoadingStages']),
coverage() {
return `${this.job.coverage}%`;
},
@ -59,10 +59,10 @@ export default {
return '';
}
let t = this.job.metadata.timeout_human_readable;
if (this.job.metadata.timeout_source !== '') {
t += ` (from ${this.job.metadata.timeout_source})`;
}
let t = this.job.metadata.timeout_human_readable;
if (this.job.metadata.timeout_source !== '') {
t += ` (from ${this.job.metadata.timeout_source})`;
}
return t;
},
@ -270,6 +270,7 @@ export default {
/>
<stages-dropdown
v-if="!isLoadingStages"
:stages="stages"
:pipeline="job.pipeline"
:selected-stage="selectedStage"

View file

@ -22,7 +22,6 @@ export default {
required: true,
},
},
computed: {
hasRef() {
return !_.isEmpty(this.pipeline.ref);

View file

@ -71,7 +71,7 @@ export default {
* after the first request,
* and we do not want to hijack that
*/
if (state.selectedStage === 'More' && job.stage) {
if (state.selectedStage === '' && job.stage) {
state.selectedStage = job.stage;
}
},

View file

@ -1,5 +1,3 @@
import { __ } from '~/locale';
export default () => ({
jobEndpoint: null,
traceEndpoint: null,
@ -29,7 +27,7 @@ export default () => ({
// sidebar dropdown & list of jobs
isLoadingStages: false,
isLoadingJobs: false,
selectedStage: __('More'),
selectedStage: '',
stages: [],
jobs: [],
});

View file

@ -0,0 +1,5 @@
---
title: Fix stage dropdown not rendering in different languages
merge_request: 22604
author:
type: other

View file

@ -140,10 +140,11 @@ describe('Sidebar details block', () => {
});
describe('while fetching stages', () => {
it('renders dropdown with More label', () => {
it('it does not render dropdown', () => {
store.dispatch('requestStages');
vm = mountComponentWithStore(SidebarComponent, { store });
expect(vm.$el.querySelector('.js-selected-stage').textContent.trim()).toEqual('More');
expect(vm.$el.querySelector('.js-selected-stage')).toBeNull();
});
});

View file

@ -124,8 +124,8 @@ describe('Jobs Store Mutations', () => {
expect(stateCopy.job).toEqual({ id: 1312321 });
});
it('sets selectedStage when the selectedStage is More', () => {
expect(stateCopy.selectedStage).toEqual('More');
it('sets selectedStage when the selectedStage is empty', () => {
expect(stateCopy.selectedStage).toEqual('');
mutations[types.RECEIVE_JOB_SUCCESS](stateCopy, { id: 1312321, stage: 'deploy' });
expect(stateCopy.selectedStage).toEqual('deploy');