Repository: eagle Updated Branches: refs/heads/master 56c2b8a6f -> a71a36bf4
[EAGLE-951] adjust the UI * Remove 'Back' in site level view. * Move integration out of user panel. * Fix site level widget first time no loading Author: zombieJ <[email protected]> Closes #867 from zombieJ/EAGLE-951. Project: http://git-wip-us.apache.org/repos/asf/eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/a71a36bf Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/a71a36bf Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/a71a36bf Branch: refs/heads/master Commit: a71a36bf4ea212e23ac21c117adae51568e13295 Parents: 56c2b8a Author: zombieJ <[email protected]> Authored: Mon Mar 13 14:24:19 2017 +0800 Committer: Hao Chen <[email protected]> Committed: Mon Mar 13 14:24:19 2017 +0800 ---------------------------------------------------------------------- eagle-server/src/main/webapp/app/dev/index.html | 6 ++-- .../app/dev/public/js/services/pageSrv.js | 5 ---- .../app/dev/public/js/services/siteSrv.js | 29 +++++++++++++++----- 3 files changed, 25 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/eagle/blob/a71a36bf/eagle-server/src/main/webapp/app/dev/index.html ---------------------------------------------------------------------- diff --git a/eagle-server/src/main/webapp/app/dev/index.html b/eagle-server/src/main/webapp/app/dev/index.html index e9c48a6..24e80c1 100644 --- a/eagle-server/src/main/webapp/app/dev/index.html +++ b/eagle-server/src/main/webapp/app/dev/index.html @@ -148,6 +148,9 @@ <li ng-if="!Auth.isLogin"> <a ui-sref="login">Login</a> </li> + <li ng-if="Auth.isLogin"> + <a ui-sref="integration.siteList()"><i class="fa fa-cog"></i></a> + </li> <li ng-if="Auth.isLogin" class="dropdown user user-menu"> <a class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-user"></i> @@ -163,9 +166,6 @@ </p> </li> <li class="user-footer"> - <div class="pull-left" ng-if="Auth.isAdmin"> - <a ui-sref="integration.siteList()" class="btn btn-default btn-flat">Integration</a> - </div> <div class="pull-right"> <a class="btn btn-default btn-flat" ng-click="Auth.logout()">Sign out</a> </div> http://git-wip-us.apache.org/repos/asf/eagle/blob/a71a36bf/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 2faa059..99cf534 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 @@ -81,10 +81,6 @@ // = Portal = // ============================================================ serviceModule.service('Portal', function($wrapState, Site, Application, Auth) { - function checkSite() { - return Site.list.length !== 0; - } - var defaultPortalList = [ {name: "Overview", icon: "home", path: "#/"}, ]; @@ -114,7 +110,6 @@ } return[ - {name: "Back", icon: "arrow-left", path: "#/"}, {name: site.siteName || site.siteId + " Home", icon: "home", path: "#/site/" + site.siteId}, {name: "Alert", icon: "bell", list: alertPortal}, ]; http://git-wip-us.apache.org/repos/asf/eagle/blob/a71a36bf/eagle-server/src/main/webapp/app/dev/public/js/services/siteSrv.js ---------------------------------------------------------------------- diff --git a/eagle-server/src/main/webapp/app/dev/public/js/services/siteSrv.js b/eagle-server/src/main/webapp/app/dev/public/js/services/siteSrv.js index b4aa622..4c76ffe 100644 --- a/eagle-server/src/main/webapp/app/dev/public/js/services/siteSrv.js +++ b/eagle-server/src/main/webapp/app/dev/public/js/services/siteSrv.js @@ -55,13 +55,17 @@ } // Load sites + function notifyListener() { + $.each(reloadListenerList, function (i, listener) { + listener(Site); + }); + } + Site.reload = function () { var list = Site.list = Entity.query('sites'); list._promise.then(function () { linkApplications(list, Application.list); - $.each(reloadListenerList, function (i, listener) { - listener(Site); - }); + notifyListener(); }); return Site; }; @@ -111,12 +115,23 @@ }; // Initialization - Application.onReload(function () { - Site.reload(); - }); - Site.reload(); + (function () { + Application.getPromise().then(function () { + Application.onReload(function () { + Site.reload(); + }); + }); + + // Call listener at first time when site & application is ready + var siteList = Site.list; + $q.all([siteList._promise, Application.getPromise()]).then(function() { + linkApplications(siteList, Application.list); + notifyListener(); + }); + })(); + return Site; }); }());
