Commit 30a6be7c authored by Michael Le's avatar Michael Le Committed by Natalia Tepluhina

Handle empty project with pipeline drawer

parent 160cb9ba
...@@ -53,9 +53,15 @@ export const receiveLatestPipelineSuccess = ({ rootGetters, commit }, { pipeline ...@@ -53,9 +53,15 @@ export const receiveLatestPipelineSuccess = ({ rootGetters, commit }, { pipeline
commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, lastCommitPipeline); commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, lastCommitPipeline);
}; };
export const fetchLatestPipeline = ({ dispatch, rootGetters }) => { export const fetchLatestPipeline = ({ commit, dispatch, rootGetters }) => {
if (eTagPoll) return; if (eTagPoll) return;
if (!rootGetters.lastCommit) {
commit(types.RECEIVE_LASTEST_PIPELINE_SUCCESS, null);
dispatch('stopPipelinePolling');
return;
}
dispatch('requestLatestPipeline'); dispatch('requestLatestPipeline');
eTagPoll = new Poll({ eTagPoll = new Poll({
......
...@@ -188,6 +188,24 @@ describe('IDE pipelines actions', () => { ...@@ -188,6 +188,24 @@ describe('IDE pipelines actions', () => {
.catch(done.fail); .catch(done.fail);
}); });
}); });
it('sets latest pipeline to `null` and stops polling on empty project', (done) => {
mockedState = {
...mockedState,
rootGetters: {
lastCommit: null,
},
};
testAction(
fetchLatestPipeline,
{},
mockedState,
[{ type: types.RECEIVE_LASTEST_PIPELINE_SUCCESS, payload: null }],
[{ type: 'stopPipelinePolling' }],
done,
);
});
}); });
describe('requestJobs', () => { describe('requestJobs', () => {
......
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