Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
[EAGLE-910] support merge portal
Browse files Browse the repository at this point in the history
UI merge side bar item if same name

Author: zombieJ <smith3816@gmail.com>

Closes #816 from zombieJ/EAGLE-910.
  • Loading branch information
zombieJ authored and haoch committed Feb 18, 2017
1 parent db26c1c commit 73d03b9
Showing 1 changed file with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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);
});
};

Expand Down

0 comments on commit 73d03b9

Please sign in to comment.