eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject eagle git commit: [EAGLE-910] support merge portal
Date Sat, 18 Feb 2017 07:17:51 GMT
Repository: eagle
Updated Branches:
  refs/heads/master db26c1cf1 -> 73d03b9e5


[EAGLE-910] support merge portal

UI merge side bar item if same name

Author: zombieJ <smith3816@gmail.com>

Closes #816 from zombieJ/EAGLE-910.


Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/73d03b9e
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/73d03b9e
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/73d03b9e

Branch: refs/heads/master
Commit: 73d03b9e5b534a737e0fb96bd2f09e4c51591321
Parents: db26c1c
Author: zombieJ <smith3816@gmail.com>
Authored: Sat Feb 18 15:17:21 2017 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Sat Feb 18 15:17:21 2017 +0800

----------------------------------------------------------------------
 .../app/dev/public/js/services/pageSrv.js       | 21 +++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/73d03b9e/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
index f4ea2f4..6f7e3c6 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/services/pageSrv.js
@@ -132,6 +132,22 @@
 			return portal;
 		}
 
+		/**
+		 * Merge navigation item if same name
+		 */
+		function mergePortalList(list) {
+			var mergedList = [];
+			$.each(list, function (i, portal) {
+				var mergedPortal = common.array.find(portal.name, mergedList, ['name']);
+				if (mergedPortal && portal.list && mergedPortal.list) {
+					mergedPortal.list = mergedPortal.list.concat(portal.list);
+				} else {
+					mergedList.push($.extend({}, portal));
+				}
+			});
+			return mergedList;
+		}
+
 		Portal.refresh = function () {
 			// TODO: check admin
 
@@ -144,17 +160,20 @@
 				};
 			});
 			connectedMainPortalList.push({name: "Sites", icon: "server", showFunc: checkApplication,
list: siteList});
+			connectedMainPortalList = mergePortalList(connectedMainPortalList);
 
 			// Site level
 			sitePortals = {};
 			$.each(Site.list, function (i, site) {
 				var siteHome = {name: site.siteName || site.siteId + " Home", icon: "home", path: "#/site/"
+ site.siteId};
-				sitePortals[site.siteId] = [backHome, siteHome].concat($.map(sitePortalList, function
(portal) {
+				var sitePortalList = [backHome, siteHome].concat($.map(sitePortalList, function (portal)
{
 					var hasApp = !!common.array.find(portal.application, site.applicationList, "descriptor.type");
 					if(hasApp) {
 						return convertSitePortal(site, portal);
 					}
 				}));
+
+				sitePortals[site.siteId] = mergePortalList(sitePortalList);
 			});
 		};
 


Mime
View raw message