mirror of
https://github.com/Lissy93/dashy.git
synced 2024-12-25 09:56:15 +03:00
✨ Re: #255 - Adds an option for landing URL in workspace
This commit is contained in:
parent
5ec2abcf81
commit
2f1dd2a9fa
@ -14,7 +14,9 @@ This is the main page that you will land on when you first launch the applicatio
|
||||
### Workspace
|
||||
The workspace view displays your links in a sidebar on the left-hand side, and apps are launched within Dashy. This enables you to use all of your self-hosted apps from one place, and makes multi-tasking easy.
|
||||
|
||||
In the workspace view, you can keep previously opened websites/ apps open in the background, by setting `appConfig.enableMultiTasking: true`. This comes at the cost of performance, but does mean that your session with each app is preserved, enabling you to quickly switch between your apps.
|
||||
In the workspace view, you can opt to keep previously opened websites/ apps open in the background, by setting `appConfig.enableMultiTasking: true`. This comes at the cost of performance, but does mean that your session with each app is preserved, enabling you to quickly switch between your apps.
|
||||
|
||||
You can also specify a default app to be opened when you land on the workspace, by setting `appConfig.workspaceLandingUrl: https://app-to-open/`. If this app exists within your sections.items, then the corresponding section will also be expanded.
|
||||
|
||||
<p align="center">
|
||||
<b>Example of Workspace View</b><br>
|
||||
|
@ -39,6 +39,7 @@ export default {
|
||||
inject: ['config'],
|
||||
props: {
|
||||
sections: Array,
|
||||
initUrl: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -56,9 +57,22 @@ export default {
|
||||
openSection(index) {
|
||||
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);
|
||||
},
|
||||
/* If an initial URL is specified, then open relevant section */
|
||||
openDefaultSection() {
|
||||
if (!this.initUrl) return;
|
||||
const process = (url) => url.replace(/[^\w\s]/gi, '').toLowerCase();
|
||||
const compare = (item) => (process(item.url) === process(this.initUrl));
|
||||
this.sections.forEach((section, sectionIndex) => {
|
||||
if (section.items.findIndex(compare) !== -1) this.openSection(sectionIndex);
|
||||
});
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.openDefaultSection();
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="work-space">
|
||||
<SideBar :sections="sections" @launch-app="launchApp" />
|
||||
<SideBar :sections="sections" @launch-app="launchApp" :initUrl="getInitialUrl()" />
|
||||
<WebContent :url="url" v-if="!isMultiTaskingEnabled" />
|
||||
<MultiTaskingWebComtent :url="url" v-else />
|
||||
</div>
|
||||
@ -21,7 +21,7 @@ export default {
|
||||
appConfig: Object,
|
||||
},
|
||||
data: () => ({
|
||||
url: '', // this.$route.query.url || '',
|
||||
url: '',
|
||||
GetTheme,
|
||||
ApplyLocalTheme,
|
||||
ApplyCustomVariables,
|
||||
@ -51,16 +51,21 @@ export default {
|
||||
fontAwesomeScript.setAttribute('src', `https://kit.fontawesome.com/${faKey}.js`);
|
||||
document.head.appendChild(fontAwesomeScript);
|
||||
},
|
||||
repositionFooter() {
|
||||
document.getElementsByTagName('footer')[0].style.position = 'fixed';
|
||||
/* Returns a service URL, if set as a URL param, or if user has specified landing URL */
|
||||
getInitialUrl() {
|
||||
const route = this.$route;
|
||||
if (route.query && route.query.url) {
|
||||
return decodeURI(route.query.url);
|
||||
} else if (this.appConfig.workspaceLandingUrl) {
|
||||
return this.appConfig.workspaceLandingUrl;
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
const route = this.$route;
|
||||
if (route.query && route.query.url) this.url = decodeURI(route.query.url);
|
||||
this.setTheme();
|
||||
this.initiateFontAwesome();
|
||||
// this.repositionFooter();
|
||||
this.url = this.getInitialUrl();
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user