Commit a3c8525d authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ide-pipeline-icon-open' into 'master'

Open pipeline list panel when clicking CI icon in Web IDE

Closes #47843

See merge request gitlab-org/gitlab-ce!20516
parents f4e60c26 b6e18a2f
...@@ -5,6 +5,7 @@ import tooltip from '~/vue_shared/directives/tooltip'; ...@@ -5,6 +5,7 @@ import tooltip from '~/vue_shared/directives/tooltip';
import timeAgoMixin from '~/vue_shared/mixins/timeago'; import timeAgoMixin from '~/vue_shared/mixins/timeago';
import CiIcon from '../../vue_shared/components/ci_icon.vue'; import CiIcon from '../../vue_shared/components/ci_icon.vue';
import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue'; import userAvatarImage from '../../vue_shared/components/user_avatar/user_avatar_image.vue';
import { rightSidebarViews } from '../constants';
export default { export default {
components: { components: {
...@@ -49,6 +50,7 @@ export default { ...@@ -49,6 +50,7 @@ export default {
this.stopPipelinePolling(); this.stopPipelinePolling();
}, },
methods: { methods: {
...mapActions(['setRightPane']),
...mapActions('pipelines', ['fetchLatestPipeline', 'stopPipelinePolling']), ...mapActions('pipelines', ['fetchLatestPipeline', 'stopPipelinePolling']),
startTimer() { startTimer() {
this.intervalId = setInterval(() => { this.intervalId = setInterval(() => {
...@@ -69,24 +71,31 @@ export default { ...@@ -69,24 +71,31 @@ export default {
return `${this.currentProject.web_url}/commit/${shortSha}`; return `${this.currentProject.web_url}/commit/${shortSha}`;
}, },
}, },
rightSidebarViews,
}; };
</script> </script>
<template> <template>
<footer class="ide-status-bar"> <footer class="ide-status-bar">
<div <div
v-if="lastCommit && lastCommitFormatedAge" v-if="lastCommit"
class="ide-status-branch" class="ide-status-branch"
> >
<span <span
v-if="latestPipeline && latestPipeline.details" v-if="latestPipeline && latestPipeline.details"
class="ide-status-pipeline" class="ide-status-pipeline"
>
<button
type="button"
class="p-0 border-0 h-50"
@click="setRightPane($options.rightSidebarViews.pipelines)"
> >
<ci-icon <ci-icon
v-tooltip v-tooltip
:status="latestPipeline.details.status" :status="latestPipeline.details.status"
:title="latestPipeline.details.status.text" :title="latestPipeline.details.status.text"
/> />
</button>
Pipeline Pipeline
<a <a
:href="latestPipeline.details.status.details_path" :href="latestPipeline.details.status.details_path"
......
---
title: Clicking CI icon in Web IDE now opens up pipelines panel
merge_request:
author:
type: added
...@@ -13,6 +13,7 @@ describe('ideStatusBar', () => { ...@@ -13,6 +13,7 @@ describe('ideStatusBar', () => {
store.state.currentProjectId = 'abcproject'; store.state.currentProjectId = 'abcproject';
store.state.projects.abcproject = projectData; store.state.projects.abcproject = projectData;
store.state.currentBranchId = 'master';
vm = createComponentWithStore(Component, store).$mount(); vm = createComponentWithStore(Component, store).$mount();
}); });
...@@ -60,4 +61,29 @@ describe('ideStatusBar', () => { ...@@ -60,4 +61,29 @@ describe('ideStatusBar', () => {
expect(vm.getCommitPath('abc123de')).toBe('/commit/abc123de'); expect(vm.getCommitPath('abc123de')).toBe('/commit/abc123de');
}); });
}); });
describe('pipeline status', () => {
it('opens right sidebar on clicking icon', done => {
spyOn(vm, 'setRightPane');
Vue.set(vm.$store.state.pipelines, 'latestPipeline', {
details: {
status: {
text: 'success',
details_path: 'test',
icon: 'success',
},
},
});
vm
.$nextTick()
.then(() => {
vm.$el.querySelector('.ide-status-pipeline button').click();
expect(vm.setRightPane).toHaveBeenCalledWith('pipelines-list');
})
.then(done)
.catch(done.fail);
});
});
}); });
...@@ -9,6 +9,9 @@ export const projectData = { ...@@ -9,6 +9,9 @@ export const projectData = {
master: { master: {
treeId: 'abcproject/master', treeId: 'abcproject/master',
can_push: true, can_push: true,
commit: {
id: '123',
},
}, },
}, },
mergeRequests: {}, mergeRequests: {},
......
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