Commit 44d332e0 authored by Kushal Pandya's avatar Kushal Pandya

Add Vue Issuable Sidebar app

Adds Vue Issuablr Sidebar app containing
wrapper component for Right Sidebar.
parent 86d28c47
<script>
export default {
props: {
signedIn: {
type: Boolean,
required: true,
},
sidebarStatusClass: {
type: String,
required: false,
default: '',
},
},
};
</script>
<template>
<aside
:class="sidebarStatusClass"
class="right-sidebar js-right-sidebar js-issuable-sidebar"
aria-live="polite"
></aside>
</template>
import Vue from 'vue';
import SidebarApp from './components/sidebar_app.vue';
export default () => {
const el = document.getElementById('js-vue-issuable-sidebar');
if (!el) {
return false;
}
const { sidebarStatusClass } = el.dataset;
// An empty string is present when user is signed in.
const signedIn = el.dataset.signedIn === '';
return new Vue({
el,
components: { SidebarApp },
render: createElement =>
createElement('sidebar-app', {
props: {
signedIn,
sidebarStatusClass,
},
}),
});
};
......@@ -4,11 +4,16 @@ import ShortcutsIssuable from '~/behaviors/shortcuts/shortcuts_issuable';
import { handleLocationHash } from '~/lib/utils/common_utils';
import howToMerge from '~/how_to_merge';
import initPipelines from '~/commit/pipelines/pipelines_bundle';
import initVueIssuableSidebarApp from '~/issuable_sidebar/sidebar_bundle';
import initWidget from '../../../vue_merge_request_widget';
export default function() {
new ZenMode(); // eslint-disable-line no-new
initIssuableSidebar();
if (gon.features && gon.features.vueIssuableSidebar) {
initVueIssuableSidebarApp();
} else {
initIssuableSidebar();
}
initPipelines();
new ShortcutsIssuable(true); // eslint-disable-line no-new
handleLocationHash();
......
......@@ -4,6 +4,8 @@ import initShow from '../init_merge_request_show';
document.addEventListener('DOMContentLoaded', () => {
initShow();
initSidebarBundle();
if (gon.features && !gon.features.vueIssuableSidebar) {
initSidebarBundle();
}
initMrNotes();
});
<script>
import { mapState } from 'vuex';
import { mapState, mapGetters } from 'vuex';
import IssuableBody from '~/issue_show/components/app.vue';
import IssuableSidebar from '~/issuable_sidebar/components/sidebar_app.vue';
import RelatedItems from 'ee/related_issues/components/related_issues_root.vue';
import EpicSidebar from './epic_sidebar.vue';
......@@ -10,6 +11,7 @@ export default {
epicsPathIdSeparator: '&',
components: {
IssuableBody,
IssuableSidebar,
RelatedItems,
EpicSidebar,
},
......@@ -30,10 +32,18 @@ export default {
'initialDescriptionHtml',
'initialDescriptionText',
'lockVersion',
'sidebarCollapsed',
]),
...mapGetters(['isUserSignedIn']),
isEpicTreeEnabled() {
return gon.features && gon.features.epicTrees;
},
isVueIssuableEpicSidebarEnabled() {
return gon.features && gon.features.vueIssuableEpicSidebar;
},
sidebarStatusClass() {
return this.sidebarCollapsed ? 'right-sidebar-collapsed' : 'right-sidebar-expanded';
},
},
};
</script>
......@@ -84,6 +94,11 @@ export default {
css-class="js-related-issues-block"
path-id-separator="#"
/>
<epic-sidebar />
<issuable-sidebar
v-if="isVueIssuableEpicSidebarEnabled"
:signed-in="isUserSignedIn"
:sidebar-status-class="sidebarStatusClass"
/>
<epic-sidebar v-else />
</div>
</template>
......@@ -5,7 +5,9 @@ import { initReviewBar } from 'ee/batch_comments';
document.addEventListener('DOMContentLoaded', () => {
initShow();
initSidebarBundle();
if (gon.features && !gon.features.vueIssuableSidebar) {
initSidebarBundle();
}
initMrNotes();
initReviewBar();
});
......@@ -154,6 +154,17 @@ RSpec.configure do |config|
.with(:force_autodevops_on_by_default, anything)
.and_return(false)
# The following can be removed once Vue Issuable Sidebar
# is feature-complete and can be made default in place
# of older sidebar.
# See https://gitlab.com/groups/gitlab-org/-/epics/1863
allow(Feature).to receive(:enabled?)
.with(:vue_issuable_sidebar, anything)
.and_return(false)
allow(Feature).to receive(:enabled?)
.with(:vue_issuable_epic_sidebar, anything)
.and_return(false)
# Stub these calls due to being expensive operations
# It can be reenabled for specific tests via:
#
......
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