From 0bfca16dda66a4670e3435b85f2729271bd476b0 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 29 Sep 2021 20:39:39 +0100 Subject: [PATCH] :zap: Re: #254 - Adds new tab functionality to Workspace --- src/components/Workspace/SideBar.vue | 4 ++-- src/components/Workspace/SideBarItem.vue | 3 ++- src/components/Workspace/SideBarSection.vue | 5 +++-- src/views/Workspace.vue | 8 ++++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/Workspace/SideBar.vue b/src/components/Workspace/SideBar.vue index e3115d17..0c8fa5a4 100644 --- a/src/components/Workspace/SideBar.vue +++ b/src/components/Workspace/SideBar.vue @@ -58,8 +58,8 @@ export default { this.isOpen = this.isOpen.map((val, ind) => (ind !== index ? false : !val)); }, /* When item clicked, emit a launch event */ - launchApp(url) { - this.$emit('launch-app', url); + launchApp(options) { + this.$emit('launch-app', options); }, /* If an initial URL is specified, then open relevant section */ openDefaultSection() { diff --git a/src/components/Workspace/SideBarItem.vue b/src/components/Workspace/SideBarItem.vue index 5a66042a..da5508c6 100644 --- a/src/components/Workspace/SideBarItem.vue +++ b/src/components/Workspace/SideBarItem.vue @@ -17,6 +17,7 @@ export default { icon: String, title: String, url: String, + target: String, click: Function, }, components: { @@ -24,7 +25,7 @@ export default { }, methods: { itemClicked() { - if (this.url) this.$emit('launch-app', this.url); + if (this.url) this.$emit('launch-app', { url: this.url, target: this.target }); }, }, data() { diff --git a/src/components/Workspace/SideBarSection.vue b/src/components/Workspace/SideBarSection.vue index b0410291..e2f8f8ff 100644 --- a/src/components/Workspace/SideBarSection.vue +++ b/src/components/Workspace/SideBarSection.vue @@ -6,6 +6,7 @@ :icon="item.icon" :title="item.title" :url="item.url" + :target="item.target" @launch-app="launchApp" /> @@ -26,8 +27,8 @@ export default { SideBarItem, }, methods: { - launchApp(url) { - this.$emit('launch-app', url); + launchApp(options) { + this.$emit('launch-app', options); }, }, }; diff --git a/src/views/Workspace.vue b/src/views/Workspace.vue index bebbba1e..c23eb98f 100644 --- a/src/views/Workspace.vue +++ b/src/views/Workspace.vue @@ -37,8 +37,12 @@ export default { MultiTaskingWebComtent, }, methods: { - launchApp(url) { - this.url = url; + launchApp(options) { + if (options.target === 'newtab') { + window.open(options.url, '_blank'); + } else { + this.url = options.url; + } }, setTheme() { const theme = this.GetTheme();