Open pipeline list panel when clicking CI icon in Web IDE
Closes #47843
This commit is contained in:
parent
acdac151f5
commit
b6e18a2f1a
4 changed files with 49 additions and 6 deletions
|
@ -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 {
|
||||||
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 {
|
||||||
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"
|
||||||
|
|
5
changelogs/unreleased/ide-pipeline-icon-open.yml
Normal file
5
changelogs/unreleased/ide-pipeline-icon-open.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Clicking CI icon in Web IDE now opens up pipelines panel
|
||||||
|
merge_request:
|
||||||
|
author:
|
||||||
|
type: added
|
|
@ -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', () => {
|
||||||
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 = {
|
||||||
master: {
|
master: {
|
||||||
treeId: 'abcproject/master',
|
treeId: 'abcproject/master',
|
||||||
can_push: true,
|
can_push: true,
|
||||||
|
commit: {
|
||||||
|
id: '123',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mergeRequests: {},
|
mergeRequests: {},
|
||||||
|
|
Loading…
Reference in a new issue