You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/02/23 10:32:21 UTC

[cloudstack-primate] 01/02: router: don't cache components

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git

commit c4825c2d14df133632f240039f6e187893b1dbb8
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sun Feb 23 15:48:42 2020 +0530

    router: don't cache components
    
    Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
 src/components/view/InfoCard.vue |  2 +-
 src/config/router.js             |  7 +------
 src/views/AutogenView.vue        | 14 +-------------
 3 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/components/view/InfoCard.vue b/src/components/view/InfoCard.vue
index a3da95d..112fb01 100644
--- a/src/components/view/InfoCard.vue
+++ b/src/components/view/InfoCard.vue
@@ -29,7 +29,7 @@
             </div>
             <slot name="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>
               <console style="margin-left: 10px" :resource="resource" size="default" v-if="resource.id" />
             </slot>
diff --git a/src/config/router.js b/src/config/router.js
index 8036e7a..a9089eb 100644
--- a/src/config/router.js
+++ b/src/config/router.js
@@ -37,7 +37,7 @@ export function generateRouterMap (section) {
     name: section.name,
     path: '/' + section.name,
     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
   }
 
@@ -54,7 +54,6 @@ export function generateRouterMap (section) {
         meta: {
           title: child.title,
           name: child.name,
-          keepAlive: true,
           icon: child.icon,
           docHelp: child.docHelp,
           permission: child.permission,
@@ -76,7 +75,6 @@ export function generateRouterMap (section) {
             meta: {
               title: child.title,
               name: child.name,
-              keepAlive: true,
               icon: child.icon,
               docHelp: child.docHelp,
               permission: child.permission,
@@ -104,7 +102,6 @@ export function generateRouterMap (section) {
             meta: {
               title: child.title,
               name: child.name,
-              keepAlive: true,
               permission: [action.api]
             },
             component: action.component
@@ -122,7 +119,6 @@ export function generateRouterMap (section) {
       meta: {
         title: section.title,
         name: section.name,
-        keepAlive: true,
         icon: section.icon,
         docHelp: section.docHelp,
         hidden: section.hidden,
@@ -170,7 +166,6 @@ export const asyncRouterMap = [
         name: 'dashboard',
         meta: {
           title: 'Dashboard',
-          keepAlive: true,
           icon: 'dashboard',
           tabs: [
             {
diff --git a/src/views/AutogenView.vue b/src/views/AutogenView.vue
index 856eba6..c4e9133 100644
--- a/src/views/AutogenView.vue
+++ b/src/views/AutogenView.vue
@@ -325,19 +325,7 @@ export default {
   },
   watch: {
     '$route' (to, from) {
-      // The route config creates two groups of section components one for each
-      // 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/')) {
+      if (to.fullPath !== from.fullPath && !to.fullPath.includes('action/')) {
         this.searchQuery = ''
         this.page = 1
         this.itemCount = 0