mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-22 05:24:54 +01:00
router: don't cache components
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
e372ad3074
commit
7d23c3e487
@ -29,7 +29,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<slot name="name">
|
<slot name="name">
|
||||||
<h4 class="name">
|
<h4 class="name">
|
||||||
{{ resource.displayname || resource.name || resource.displaytext || resource.hostname || resource.username || resource.ipaddress }}
|
{{ resource.displayname || resource.displaytext || resource.name || resource.hostname || resource.username || resource.ipaddress }}
|
||||||
</h4>
|
</h4>
|
||||||
<console style="margin-left: 10px" :resource="resource" size="default" v-if="resource.id" />
|
<console style="margin-left: 10px" :resource="resource" size="default" v-if="resource.id" />
|
||||||
</slot>
|
</slot>
|
||||||
|
|||||||
@ -37,7 +37,7 @@ export function generateRouterMap (section) {
|
|||||||
name: section.name,
|
name: section.name,
|
||||||
path: '/' + section.name,
|
path: '/' + section.name,
|
||||||
hidden: section.hidden,
|
hidden: section.hidden,
|
||||||
meta: { title: section.title, keepAlive: true, icon: section.icon, docHelp: section.docHelp },
|
meta: { title: section.title, icon: section.icon, docHelp: section.docHelp },
|
||||||
component: RouteView
|
component: RouteView
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,6 @@ export function generateRouterMap (section) {
|
|||||||
meta: {
|
meta: {
|
||||||
title: child.title,
|
title: child.title,
|
||||||
name: child.name,
|
name: child.name,
|
||||||
keepAlive: true,
|
|
||||||
icon: child.icon,
|
icon: child.icon,
|
||||||
docHelp: child.docHelp,
|
docHelp: child.docHelp,
|
||||||
permission: child.permission,
|
permission: child.permission,
|
||||||
@ -76,7 +75,6 @@ export function generateRouterMap (section) {
|
|||||||
meta: {
|
meta: {
|
||||||
title: child.title,
|
title: child.title,
|
||||||
name: child.name,
|
name: child.name,
|
||||||
keepAlive: true,
|
|
||||||
icon: child.icon,
|
icon: child.icon,
|
||||||
docHelp: child.docHelp,
|
docHelp: child.docHelp,
|
||||||
permission: child.permission,
|
permission: child.permission,
|
||||||
@ -104,7 +102,6 @@ export function generateRouterMap (section) {
|
|||||||
meta: {
|
meta: {
|
||||||
title: child.title,
|
title: child.title,
|
||||||
name: child.name,
|
name: child.name,
|
||||||
keepAlive: true,
|
|
||||||
permission: [action.api]
|
permission: [action.api]
|
||||||
},
|
},
|
||||||
component: action.component
|
component: action.component
|
||||||
@ -122,7 +119,6 @@ export function generateRouterMap (section) {
|
|||||||
meta: {
|
meta: {
|
||||||
title: section.title,
|
title: section.title,
|
||||||
name: section.name,
|
name: section.name,
|
||||||
keepAlive: true,
|
|
||||||
icon: section.icon,
|
icon: section.icon,
|
||||||
docHelp: section.docHelp,
|
docHelp: section.docHelp,
|
||||||
hidden: section.hidden,
|
hidden: section.hidden,
|
||||||
@ -170,7 +166,6 @@ export const asyncRouterMap = [
|
|||||||
name: 'dashboard',
|
name: 'dashboard',
|
||||||
meta: {
|
meta: {
|
||||||
title: 'Dashboard',
|
title: 'Dashboard',
|
||||||
keepAlive: true,
|
|
||||||
icon: 'dashboard',
|
icon: 'dashboard',
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -325,19 +325,7 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'$route' (to, from) {
|
'$route' (to, from) {
|
||||||
// The route config creates two groups of section components one for each
|
if (to.fullPath !== from.fullPath && !to.fullPath.includes('action/')) {
|
||||||
// related paths. Once these two groups of components are mounted, on
|
|
||||||
// route changes this method is called twice causing multiple API calls.
|
|
||||||
// The following fixes this issue by using logical XOR to identify the
|
|
||||||
// current component against related `to` route and the path the component
|
|
||||||
// was in and only calls fetchData if `to` route and currentPath are of
|
|
||||||
// the same group of routes.
|
|
||||||
|
|
||||||
const related = ['/project', '/event', '/dashboard']
|
|
||||||
const toPath = related.map(o => to.fullPath.includes(o)).includes(true)
|
|
||||||
const inPath = related.map(o => this.currentPath.includes(o)).includes(true)
|
|
||||||
this.needToFetchData = ((toPath ^ inPath) === 0)
|
|
||||||
if (this.needToFetchData && to.fullPath !== from.fullPath && !to.fullPath.includes('action/')) {
|
|
||||||
this.searchQuery = ''
|
this.searchQuery = ''
|
||||||
this.page = 1
|
this.page = 1
|
||||||
this.itemCount = 0
|
this.itemCount = 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user