Commit 64af5c37 authored by Filipa Lacerda's avatar Filipa Lacerda

Moves available runners check into a computed prop

Adds a changelog entry
parent fed49e7b
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
'emptyStateIllustration', 'emptyStateIllustration',
'isScrollingDown', 'isScrollingDown',
'emptyStateAction', 'emptyStateAction',
'hasRunnersForProject',
]), ]),
shouldRenderContent() { shouldRenderContent() {
...@@ -201,7 +202,7 @@ ...@@ -201,7 +202,7 @@
<stuck-block <stuck-block
v-if="job.stuck" v-if="job.stuck"
class="js-job-stuck" class="js-job-stuck"
:has-no-runners-for-project="job.runners.available && !job.runners.online" :has-no-runners-for-project="hasRunnersForProject"
:tags="job.tags" :tags="job.tags"
:runners-path="runnerSettingsUrl" :runners-path="runnerSettingsUrl"
/> />
......
...@@ -57,5 +57,7 @@ export const shouldRenderSharedRunnerLimitWarning = state => ...@@ -57,5 +57,7 @@ export const shouldRenderSharedRunnerLimitWarning = state =>
export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceComplete; export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceComplete;
export const hasRunnersForProject = state => state.job.runners.available && !state.job.runners.online;
// prevent babel-plugin-rewire from generating an invalid default during karma tests // prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {}; export default () => {};
---
title: Renders stuck block when runners are stuck
merge_request:
author:
type: fixed
...@@ -753,7 +753,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -753,7 +753,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do
it 'renders message about job being stuck because no runners are active' do it 'renders message about job being stuck because no runners are active' do
expect(page).to have_css('.js-stuck-no-active-runner') expect(page).to have_css('.js-stuck-no-active-runner')
expect(page).to have_content("This job is stuck, because you don\'t have any active runners that can run this job.") expect(page).to have_content("This job is stuck, because you don't have any active runners that can run this job.")
end end
end end
......
...@@ -229,4 +229,39 @@ describe('Job Store Getters', () => { ...@@ -229,4 +229,39 @@ describe('Job Store Getters', () => {
}); });
}); });
}); });
describe('hasRunnersForProject', () => {
describe('with available and offline runners', () => {
it('returns true', () => {
localState.job.runners = {
available: true,
online: false
};
expect(getters.hasRunnersForProject(localState)).toEqual(true);
});
});
describe('with non available runners', () => {
it('returns false', () => {
localState.job.runners = {
available: false,
online: false
};
expect(getters.hasRunnersForProject(localState)).toEqual(false);
});
});
describe('with online runners', () => {
it('returns false', () => {
localState.job.runners = {
available: false,
online: true
};
expect(getters.hasRunnersForProject(localState)).toEqual(false);
});
});
});
}); });
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