mirror of
https://github.com/Lissy93/dashy.git
synced 2025-09-25 18:58:48 +02:00
Improves on the ifram modal functionality
This commit is contained in:
parent
0c12cdb0f6
commit
9bec0526db
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<modal name="iframe-modal" :resizable="true"
|
<modal :name="name" :resizable="true" width="80%" height="80%" @closed="$emit('closed')">
|
||||||
:adaptive="true" width="80%" height="80%">
|
<div slot="top-right" @click="hide()">Close</div>
|
||||||
<iframe :src="url" class="frame" />
|
<a @click="hide()" class="close-button" title="Close">x</a>
|
||||||
|
<iframe :src="url" @keydown.esc="close" class="frame"/>
|
||||||
</modal>
|
</modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -9,17 +10,24 @@
|
|||||||
export default {
|
export default {
|
||||||
name: 'IframeModal',
|
name: 'IframeModal',
|
||||||
props: {
|
props: {
|
||||||
url: String,
|
name: String,
|
||||||
},
|
},
|
||||||
|
data: () => ({
|
||||||
|
url: '#',
|
||||||
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
show: function show() {
|
show: function show(url) {
|
||||||
this.$modal.show('iframe-modal');
|
this.url = url;
|
||||||
|
this.$modal.show(this.name);
|
||||||
|
},
|
||||||
|
hide: function hide() {
|
||||||
|
this.$modal.hide(this.name);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style lang="scss">
|
||||||
|
|
||||||
.frame {
|
.frame {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@ -27,4 +35,23 @@ export default {
|
|||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close-button {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0 0 0 10px;
|
||||||
|
background: var(--primary);
|
||||||
|
color: var(--background);
|
||||||
|
border-left: 1px solid var(--primary);
|
||||||
|
border-bottom: 1px solid var(--primary);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: var(--background);
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,32 +1,30 @@
|
|||||||
<template>
|
<template ref="container">
|
||||||
<a
|
<a @click="itemOpened"
|
||||||
:href="target !== 'iframe' ? url : '#'"
|
:href="target !== 'iframe' ? url : '#'"
|
||||||
v-on:click="itemOpened()"
|
:target="target === 'newtab' ? '_blank' : ''"
|
||||||
:class="`item ${!icon? 'short': ''}`"
|
:class="`item ${!icon? 'short': ''}`"
|
||||||
v-tooltip="getTooltipOptions()"
|
:id="`link-${id}`"
|
||||||
:target="target === 'newtab' ? '_blank' : ''"
|
v-tooltip="getTooltipOptions()"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
>
|
>
|
||||||
<!-- Item Text -->
|
<!-- Item Text -->
|
||||||
<div class="tile-title" :id="`tile-${id}`">
|
<div class="tile-title" :id="`tile-${id}`">
|
||||||
<span class="text">{{ title }}</span>
|
<span class="text">{{ title }}</span>
|
||||||
<div class="overflow-dots">...</div>
|
<div class="overflow-dots">...</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Item Icon -->
|
<!-- Item Icon -->
|
||||||
<Icon :icon="icon" :url="url" />
|
<Icon :icon="icon" :url="url" />
|
||||||
<div :class="`opening-method-icon ${!icon? 'short': ''}`">
|
<div :class="`opening-method-icon ${!icon? 'short': ''}`">
|
||||||
<NewTabOpenIcon v-if="target === 'newtab'" />
|
<NewTabOpenIcon v-if="target === 'newtab'" />
|
||||||
<SameTabOpenIcon v-else-if="target === 'sametab'" />
|
<SameTabOpenIcon v-else-if="target === 'sametab'" />
|
||||||
<IframeOpenIcon v-else-if="target === 'iframe'" />
|
<IframeOpenIcon v-else-if="target === 'iframe'" />
|
||||||
</div>
|
</div>
|
||||||
<IframeModal v-if="target === 'iframe'" :url="url" ref="iframeModal"/>
|
</a>
|
||||||
</a>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Icon from '@/components/ItemIcon.vue';
|
import Icon from '@/components/ItemIcon.vue';
|
||||||
import IframeModal from '@/components/IframeModal.vue';
|
|
||||||
|
|
||||||
import NewTabOpenIcon from '@/assets/icons/open-new-tab.svg';
|
import NewTabOpenIcon from '@/assets/icons/open-new-tab.svg';
|
||||||
import SameTabOpenIcon from '@/assets/icons/open-current-tab.svg';
|
import SameTabOpenIcon from '@/assets/icons/open-current-tab.svg';
|
||||||
@ -59,14 +57,15 @@ export default {
|
|||||||
NewTabOpenIcon,
|
NewTabOpenIcon,
|
||||||
SameTabOpenIcon,
|
SameTabOpenIcon,
|
||||||
IframeOpenIcon,
|
IframeOpenIcon,
|
||||||
IframeModal,
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/* Called when an item is opened, so that search field can be reset */
|
/* Called when an item is clicked, manages the opening of iframe & resets the search field */
|
||||||
itemOpened() {
|
itemOpened(e) {
|
||||||
this.$emit('itemClicked');
|
if (e.altKey || this.target === 'iframe') {
|
||||||
if (this.target === 'iframe') {
|
e.preventDefault();
|
||||||
this.$refs.iframeModal.show();
|
this.$emit('triggerModal', this.url);
|
||||||
|
} else {
|
||||||
|
this.$emit('itemClicked');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -103,6 +102,10 @@ export default {
|
|||||||
@import '../../src/styles/constants.scss';
|
@import '../../src/styles/constants.scss';
|
||||||
|
|
||||||
/* Item wrapper */
|
/* Item wrapper */
|
||||||
|
.item-wrapper {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
.item {
|
.item {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
height: 100px;
|
height: 100px;
|
||||||
@ -128,6 +131,9 @@ export default {
|
|||||||
&.short {
|
&.short {
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
|
.item {
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Text in tile */
|
/* Text in tile */
|
||||||
@ -160,8 +166,8 @@ export default {
|
|||||||
.overflow-dots {
|
.overflow-dots {
|
||||||
display: block;
|
display: block;
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
background: black;
|
// background: var(--background-transparent);
|
||||||
// background: $overflow-ellipse;
|
background: #283e51;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 5;
|
z-index: 5;
|
||||||
right: 0;
|
right: 0;
|
||||||
@ -256,4 +262,8 @@ export default {
|
|||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.disabled-link {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -23,14 +23,22 @@
|
|||||||
:target="item.target"
|
:target="item.target"
|
||||||
:svg="item.svg"
|
:svg="item.svg"
|
||||||
@itemClicked="$emit('itemClicked')"
|
@itemClicked="$emit('itemClicked')"
|
||||||
|
@triggerModal="triggerModal"
|
||||||
/>
|
/>
|
||||||
|
<div ref="modalContainer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<IframeModal
|
||||||
|
:ref="`iframeModal-${groupId}`"
|
||||||
|
:name="`iframeModal-${groupId}`"
|
||||||
|
@closed="$emit('itemClicked')"
|
||||||
|
/>
|
||||||
</Collapsable>
|
</Collapsable>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Item from '@/components/Item.vue';
|
import Item from '@/components/Item.vue';
|
||||||
import Collapsable from '@/components/Collapsable.vue';
|
import Collapsable from '@/components/Collapsable.vue';
|
||||||
|
import IframeModal from '@/components/IframeModal.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ItemGroup',
|
name: 'ItemGroup',
|
||||||
@ -43,11 +51,17 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Collapsable,
|
Collapsable,
|
||||||
Item,
|
Item,
|
||||||
|
IframeModal,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/* Returns a unique lowercase string, based on name, for section ID */
|
||||||
makeId(str) {
|
makeId(str) {
|
||||||
return str.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
|
return str.replace(/\s+/g, '-').replace(/[^a-zA-Z ]/g, '').toLowerCase();
|
||||||
},
|
},
|
||||||
|
/* Opens the iframe modal */
|
||||||
|
triggerModal(url) {
|
||||||
|
this.$refs[`iframeModal-${this.groupId}`].show(url);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -21,12 +21,12 @@ sections:
|
|||||||
description: Malicious traffic detection system
|
description: Malicious traffic detection system
|
||||||
icon: networking/maltrail.png
|
icon: networking/maltrail.png
|
||||||
iconType: img
|
iconType: img
|
||||||
url: 192.168.1.1:8338
|
url: http://192.168.1.1:8338
|
||||||
- title: Ntopng
|
- title: Ntopng
|
||||||
description: Network traffic probe and network use monitor
|
description: Network traffic probe and network use monitor
|
||||||
icon: networking/ntop.png
|
icon: networking/ntop.png
|
||||||
iconType: img
|
iconType: img
|
||||||
url: 192.168.1.1:3001
|
url: http://192.168.1.1:3001
|
||||||
- title: Sensei
|
- title: Sensei
|
||||||
description: Additional data features
|
description: Additional data features
|
||||||
icon: networking/sensei.png
|
icon: networking/sensei.png
|
||||||
@ -143,7 +143,7 @@ sections:
|
|||||||
- title: Switch
|
- title: Switch
|
||||||
description: Manage VLANs on Ubiquity Ethernet switch
|
description: Manage VLANs on Ubiquity Ethernet switch
|
||||||
icon: ''
|
icon: ''
|
||||||
url: "/"
|
url: "#"
|
||||||
- name: External Utilities
|
- name: External Utilities
|
||||||
displayData:
|
displayData:
|
||||||
collapsed: true
|
collapsed: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user