Skip to content
Snippets Groups Projects
Commit 4341e7d4 authored by Filipa Lacerda's avatar Filipa Lacerda Committed by Jan Provaznik
Browse files

Fix stage dropdown rendering only in English

The default value of the selected stage was a translated string.
This commit removes the string and uses a flag property instead.
The stage dropdown is now only rendered after the stages endpoint
is received.
parent 6fe7fcd7
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -36,7 +36,7 @@
},
},
computed: {
...mapState(['job', 'isLoading', 'stages', 'jobs', 'selectedStage']),
...mapState(['job', 'isLoading', 'stages', 'jobs', 'selectedStage', 'isLoadingStages']),
coverage() {
return `${this.job.coverage}%`;
},
Loading
Loading
@@ -274,6 +274,7 @@
/>
 
<stages-dropdown
v-if="!isLoadingStages"
:stages="stages"
:pipeline="job.pipeline"
:selected-stage="selectedStage"
Loading
Loading
Loading
Loading
@@ -22,7 +22,6 @@
required: true,
},
},
computed: {
hasRef() {
return !_.isEmpty(this.pipeline.ref);
Loading
Loading
Loading
Loading
@@ -60,7 +60,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;
}
},
Loading
Loading
import { __ } from '~/locale';
export default () => ({
jobEndpoint: null,
traceEndpoint: null,
Loading
Loading
@@ -36,7 +34,7 @@ export default () => ({
// sidebar dropdown
isLoadingStages: false,
isLoadingJobs: false,
selectedStage: __('More'),
selectedStage: '',
stages: [],
jobs: [],
});
title: Fix stage dropdown not rendering in different languages
merge_request:
author:
type: other
Loading
Loading
@@ -148,10 +148,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();
});
});
 
Loading
Loading
Loading
Loading
@@ -123,8 +123,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');
});
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment