debian-mirror-gitlab/app/assets/javascripts/ide/components/panes/right.vue

132 lines
3.5 KiB
Vue
Raw Normal View History

2018-11-08 19:23:39 +05:30
<script>
2018-11-18 11:00:15 +05:30
import { mapActions, mapState, mapGetters } from 'vuex';
2018-11-08 19:23:39 +05:30
import tooltip from '../../../vue_shared/directives/tooltip';
import Icon from '../../../vue_shared/components/icon.vue';
import { rightSidebarViews } from '../../constants';
import PipelinesList from '../pipelines/list.vue';
import JobsDetail from '../jobs/detail.vue';
import MergeRequestInfo from '../merge_requests/info.vue';
import ResizablePanel from '../resizable_panel.vue';
2018-11-18 11:00:15 +05:30
import Clientside from '../preview/clientside.vue';
2018-11-08 19:23:39 +05:30
export default {
directives: {
tooltip,
},
components: {
Icon,
PipelinesList,
JobsDetail,
ResizablePanel,
MergeRequestInfo,
2018-11-18 11:00:15 +05:30
Clientside,
2018-11-08 19:23:39 +05:30
},
computed: {
2018-11-18 11:00:15 +05:30
...mapState(['rightPane', 'currentMergeRequestId', 'clientsidePreviewEnabled']),
...mapGetters(['packageJson']),
2018-11-08 19:23:39 +05:30
pipelinesActive() {
return (
this.rightPane === rightSidebarViews.pipelines ||
this.rightPane === rightSidebarViews.jobsDetail
);
},
2018-11-18 11:00:15 +05:30
showLivePreview() {
return this.packageJson && this.clientsidePreviewEnabled;
},
2018-11-08 19:23:39 +05:30
},
methods: {
...mapActions(['setRightPane']),
clickTab(e, view) {
e.target.blur();
this.setRightPane(view);
},
},
rightSidebarViews,
};
</script>
<template>
<div
class="multi-file-commit-panel ide-right-sidebar"
>
<resizable-panel
v-if="rightPane"
:collapsible="false"
:initial-width="350"
:min-size="350"
2018-11-18 11:00:15 +05:30
:class="`ide-right-sidebar-${rightPane}`"
2018-11-08 19:23:39 +05:30
side="right"
2018-11-18 11:00:15 +05:30
class="multi-file-commit-panel-inner"
2018-11-08 19:23:39 +05:30
>
<component :is="rightPane" />
</resizable-panel>
<nav class="ide-activity-bar">
<ul class="list-unstyled">
<li
v-if="currentMergeRequestId"
>
<button
v-tooltip
:title="__('Merge Request')"
:aria-label="__('Merge Request')"
:class="{
active: rightPane === $options.rightSidebarViews.mergeRequestInfo
}"
data-container="body"
data-placement="left"
class="ide-sidebar-link is-right"
type="button"
@click="clickTab($event, $options.rightSidebarViews.mergeRequestInfo)"
>
<icon
:size="16"
name="text-description"
/>
</button>
</li>
<li>
<button
v-tooltip
:title="__('Pipelines')"
:aria-label="__('Pipelines')"
:class="{
active: pipelinesActive
}"
data-container="body"
data-placement="left"
class="ide-sidebar-link is-right"
type="button"
@click="clickTab($event, $options.rightSidebarViews.pipelines)"
>
<icon
:size="16"
name="rocket"
/>
</button>
</li>
2018-11-18 11:00:15 +05:30
<li v-if="showLivePreview">
<button
v-tooltip
:title="__('Live preview')"
:aria-label="__('Live preview')"
:class="{
active: rightPane === $options.rightSidebarViews.clientSidePreview
}"
data-container="body"
data-placement="left"
class="ide-sidebar-link is-right"
type="button"
@click="clickTab($event, $options.rightSidebarViews.clientSidePreview)"
>
<icon
:size="16"
name="live-preview"
/>
</button>
</li>
2018-11-08 19:23:39 +05:30
</ul>
</nav>
</div>
</template>