mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-23 21:55:30 +02:00
⚡ Adds support for widgets in Minimal View
This commit is contained in:
parent
9ab84195c2
commit
41d9ead46b
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div :class="`minimal-section-inner ${selected ? 'selected' : ''} ${showAll ? 'show-all': ''}`">
|
<div :class="`minimal-section-inner ${selected ? 'selected' : ''} ${showAll ? 'show-all': ''}`">
|
||||||
<div class="section-items" v-if="selected || showAll">
|
<div class="section-items" v-if="items && (selected || showAll)">
|
||||||
<Item
|
<Item
|
||||||
v-for="(item, index) in items"
|
v-for="(item, index) in items"
|
||||||
:id="`${index}_${makeId(item.title)}`"
|
:id="`${index}_${makeId(item.title)}`"
|
||||||
@ -22,6 +22,15 @@
|
|||||||
@triggerModal="triggerModal"
|
@triggerModal="triggerModal"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="widgets && (selected || showAll)">
|
||||||
|
<WidgetBase
|
||||||
|
v-for="(widget, widgetIndx) in widgets"
|
||||||
|
:key="widgetIndx"
|
||||||
|
:widget="widget"
|
||||||
|
:index="widgetIndx"
|
||||||
|
@navigateToSection="navigateToSection"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<IframeModal
|
<IframeModal
|
||||||
:ref="`iframeModal-${groupId}`"
|
:ref="`iframeModal-${groupId}`"
|
||||||
:name="`iframeModal-${groupId}`"
|
:name="`iframeModal-${groupId}`"
|
||||||
@ -31,7 +40,9 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import router from '@/router';
|
||||||
import Item from '@/components/LinkItems/Item.vue';
|
import Item from '@/components/LinkItems/Item.vue';
|
||||||
|
import WidgetBase from '@/components/Widgets/WidgetBase';
|
||||||
import IframeModal from '@/components/LinkItems/IframeModal.vue';
|
import IframeModal from '@/components/LinkItems/IframeModal.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -42,6 +53,7 @@ export default {
|
|||||||
icon: String,
|
icon: String,
|
||||||
displayData: Object,
|
displayData: Object,
|
||||||
items: Array,
|
items: Array,
|
||||||
|
widgets: Array,
|
||||||
itemSize: String,
|
itemSize: String,
|
||||||
modalOpen: Boolean,
|
modalOpen: Boolean,
|
||||||
index: Number,
|
index: Number,
|
||||||
@ -55,6 +67,7 @@ export default {
|
|||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
Item,
|
Item,
|
||||||
|
WidgetBase,
|
||||||
IframeModal,
|
IframeModal,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -80,6 +93,13 @@ export default {
|
|||||||
if (interval < 1) interval = 0;
|
if (interval < 1) interval = 0;
|
||||||
return interval;
|
return interval;
|
||||||
},
|
},
|
||||||
|
/* Navigate to the section's single-section view page */
|
||||||
|
navigateToSection() {
|
||||||
|
const parse = (section) => section.replace(' ', '-').toLowerCase().trim();
|
||||||
|
const sectionIdentifier = parse(this.title);
|
||||||
|
router.push({ path: `/home/${sectionIdentifier}` });
|
||||||
|
this.closeContextMenu();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
:icon="section.icon || undefined"
|
:icon="section.icon || undefined"
|
||||||
:groupId="`section-${index}`"
|
:groupId="`section-${index}`"
|
||||||
:items="filterTiles(section.items)"
|
:items="filterTiles(section.items)"
|
||||||
|
:widgets="section.widgets"
|
||||||
:selected="selectedSection === index"
|
:selected="selectedSection === index"
|
||||||
:showAll="!tabbedView"
|
:showAll="!tabbedView"
|
||||||
itemSize="small"
|
itemSize="small"
|
||||||
@ -104,7 +105,9 @@ export default {
|
|||||||
else {
|
else {
|
||||||
let itemsFound = true;
|
let itemsFound = true;
|
||||||
this.sections.forEach((section) => {
|
this.sections.forEach((section) => {
|
||||||
if (this.filterTiles(section.items).length > 0) itemsFound = false;
|
if (section.widgets || this.filterTiles(section.items).length > 0) {
|
||||||
|
itemsFound = false;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return itemsFound;
|
return itemsFound;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user