-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
127 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
<script setup lang="ts"> | ||
import { useRouter } from 'vue-router' | ||
import { descriptions } from '../../routes' | ||
const router = useRouter(); | ||
</script> | ||
<template> | ||
<q-breadcrumbs class="q-pl-md q-pt-md q-pb-md"> | ||
<q-breadcrumbs-el v-for="item in router.currentRoute.value.matched" v-bind:key="item.name" | ||
:label="item.name!=undefined && descriptions[item.name]!=undefined?descriptions[item.name].breadcrumb:item.name" | ||
:icon="item.name!=undefined && descriptions[item.name]!=undefined?descriptions[item.name].icon:''" | ||
:label="item.meta!=undefined && item.meta.breadcrumb!=undefined?item.meta.breadcrumb:item.name" | ||
:icon="item.meta!=undefined && item.meta.icon!=undefined?item.meta.icon:''" | ||
:to="item.path" /> | ||
</q-breadcrumbs> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,72 @@ | ||
<script setup lang="ts"> | ||
import MainMenuLinks from './MainMenuLinks.vue'; | ||
import { menuLinksProps } from '../../routes'; | ||
import { menuLinksProps } from '../../routes/interfaces.js'; | ||
import { elude } from '../../libs/core'; | ||
import { useRouter } from 'vue-router' | ||
import { watch,onMounted, ref } from 'vue' | ||
import {installColor,automationColor,workloadColor,databaseColor,storageColor,configColor,networkColor,securityColor,systemColor} from '../../routes/custom' | ||
const expansionItem = ref(null); | ||
const router = useRouter(); | ||
const maxCaptionLength= 25; | ||
const props = withDefaults(defineProps<menuLinksProps>(), { | ||
caption: '', | ||
link: '#', | ||
icon: '', | ||
level: 0, | ||
}); | ||
const shouldOpen = (route) =>route.matched.map(f=>f.name).includes(props.name) || (Array.isArray(props.children) && props.children.map(f=>f.name||f.title).reduce((ret,name) => ret || (route.matched.map(c=> c.name).includes(name as string)), false)) | ||
function getLevel0Color(name){ | ||
switch (name) { | ||
case 'install': return installColor; | ||
case 'automation': return automationColor; | ||
case 'workload': return workloadColor; | ||
case 'database': return databaseColor; | ||
case 'storage': return storageColor; | ||
case 'config': return configColor; | ||
case 'network': return networkColor; | ||
case 'security': return securityColor; | ||
case 'system': return systemColor; | ||
} | ||
return '' | ||
} | ||
if (props.children != undefined && props.children.length > 0) onMounted(() => { | ||
watch(router.currentRoute,(route) => { | ||
if (expansionItem.value==null) return; | ||
if (shouldOpen(route)) expansionItem.value.show(); | ||
else expansionItem.value.hide(); | ||
}) | ||
}); | ||
</script> | ||
<template> | ||
<div v-if="children != undefined && children.length > 0"> | ||
<q-expansion-item | ||
<div v-if="children != undefined && children.length > 0" :class="`${getLevel0Color(props.name)==''?'':'bg-'+getLevel0Color(props.name)+'-1'}`"> | ||
<q-expansion-item ref="expansionItem" | ||
expand-separator | ||
:header-inset-level="level" | ||
:href="link" | ||
:to="target!=undefined?{ name: target }:name!=undefined?{ name }:null" | ||
:active="router.currentRoute.value.matched.map(f=>f.name).includes(props.name)" | ||
:default-opened="router.currentRoute.value.matched.map(f=>f.name).includes(props.name) || children.map(f=>f.name||f.title).reduce((ret,name) => ret || (router.currentRoute.value.matched.map(c=> c.name).includes(name as string)), false)"> | ||
:default-opened="shouldOpen(router.currentRoute.value)"> | ||
<template v-slot:header> | ||
<q-item-section v-if="icon != ''" avatar> | ||
<q-avatar :icon="icon" /> | ||
<q-avatar :icon="icon" :class="`${getLevel0Color(props.name)==''?'':' text-white bg-'+getLevel0Color(props.name)}`" /> | ||
</q-item-section> | ||
<q-item-section> | ||
<q-item-section>{{title}}</q-item-section> | ||
<q-item-label v-if="caption != ''" caption>{{elude(caption, maxCaptionLength)}}</q-item-label> | ||
</q-item-section> | ||
</template> | ||
<div v-if="router.currentRoute.value.matched.length>1"> | ||
<MainMenuLinks | ||
v-for="child in children" | ||
:key="`${child.title}-${router.currentRoute.value.matched[router.currentRoute.value.matched.length-1].path}`" | ||
v-bind="child" /> | ||
</div> | ||
<MainMenuLinks v-for="child in children" :key="`${child.title}`" v-bind="child" /> | ||
</q-expansion-item> | ||
</div> | ||
<div v-else> | ||
<q-item clickable v-ripple :inset-level="level" :active="router.currentRoute.value.matched.map(f=>f.name).includes(props.name)" :href="link"> | ||
<q-item clickable v-ripple :inset-level="level" :to="target!=undefined?{ name: target }:name!=undefined?{ name }:null" | ||
:active="router.currentRoute.value.matched.map(f=>f.name).includes(props.name)"> | ||
<q-item-section v-if="icon != ''" avatar> | ||
<q-avatar :icon="icon" /> | ||
</q-item-section> | ||
<q-item-section> | ||
<q-item-section>{{title}}</q-item-section> | ||
<q-item-label v-if="caption != ''" caption>{{elude(caption, maxCaptionLength)}}</q-item-label> | ||
</q-item-section> | ||
<q-avatar :icon="icon" /> | ||
</q-item-section> | ||
<q-item-section> | ||
<q-item-section>{{title}}</q-item-section> | ||
<q-item-label v-if="caption != ''" caption>{{elude(caption, maxCaptionLength)}}</q-item-label> | ||
</q-item-section> | ||
</q-item> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export interface menuLinksProps { | ||
title: string | ||
caption?: string | ||
link?: string | ||
icon?: string | ||
level?: number | ||
active?: boolean | ||
name?: string | ||
target?: string | ||
children?: Array<menuLinksProps> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.