Skip to content

Commit

Permalink
⚡ Re: gchq#254 - Adds new tab functionality to Workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Sep 29, 2021
1 parent bc100b8 commit 0bfca16
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/components/Workspace/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 2 additions & 1 deletion src/components/Workspace/SideBarItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ export default {
icon: String,
title: String,
url: String,
target: String,
click: Function,
},
components: {
Icon,
},
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() {
Expand Down
5 changes: 3 additions & 2 deletions src/components/Workspace/SideBarSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:icon="item.icon"
:title="item.title"
:url="item.url"
:target="item.target"
@launch-app="launchApp"
/>
</div>
Expand All @@ -26,8 +27,8 @@ export default {
SideBarItem,
},
methods: {
launchApp(url) {
this.$emit('launch-app', url);
launchApp(options) {
this.$emit('launch-app', options);
},
},
};
Expand Down
8 changes: 6 additions & 2 deletions src/views/Workspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 0bfca16

Please sign in to comment.