[EAGLE-619] UI Home display site states

UI Home display site states

Author: zombieJ <smith3...@gmail.com>

Closes #511 from zombieJ/EAGLE-619.


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

Branch: refs/heads/master
Commit: 00e92d993bc7de3cb253c87622a9041cf614844f
Parents: 8ff8ecf
Author: zombieJ <smith3...@gmail.com>
Authored: Fri Oct 14 18:10:03 2016 +0800
Committer: zombieJ <smith3...@gmail.com>
Committed: Fri Oct 14 18:10:03 2016 +0800

----------------------------------------------------------------------
 eagle-server/src/main/webapp/app/dev/index.html |  2 +-
 .../src/main/webapp/app/dev/partials/home.html  | 48 ++++++------------
 .../app/dev/partials/integration/site.html      |  6 ++-
 .../src/main/webapp/app/dev/public/css/main.css |  4 ++
 .../src/main/webapp/app/dev/public/js/app.js    |  2 +-
 .../webapp/app/dev/public/js/ctrls/mainCtrl.js  |  7 +++
 .../app/dev/public/js/services/pageSrv.js       | 52 +++++++++++---------
 7 files changed, 61 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/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 19ea204..d791819 100644
--- a/eagle-server/src/main/webapp/app/dev/index.html
+++ b/eagle-server/src/main/webapp/app/dev/index.html
@@ -101,7 +101,7 @@
                                <!-- side bar: style can be found in 
sidebar.less -->
                                <section class="sidebar">
                                        <ul class="sidebar-menu">
-                                               <li ng-repeat="portal in 
Portal.list track by $index" ng-class="{treeview: portal.list}">
+                                               <li ng-repeat="portal in 
Portal.list track by $index" ng-class="{treeview: portal.list}" 
ng-if="portal.showFunc ? portal.showFunc() : true">
                                                        <a 
ng-href="{{portal.path}}">
                                                                <i class="fa 
fa-{{portal.icon || 'circle-o'}}"></i>
                                                                
<span>{{portal.name}}</span>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/partials/home.html
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/partials/home.html 
b/eagle-server/src/main/webapp/app/dev/partials/home.html
index ab75b18..545adf0 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/home.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/home.html
@@ -16,45 +16,27 @@
   limitations under the License.
   -->
 
-<!--div class="row" ng-repeat="banner in bannerList track by $index">
-       <div class="col-sm-12" ng-if="banner.title">
-               <h3>{{banner.title}}</h3>
-       </div>
-       <div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in 
banner.list track by $index">
-               <div class="small-box {{widget.color || 'bg-aqua'}}">
+<div class="row">
+       <div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="site in Site.list 
track by $index">
+               <div class="small-box bg-aqua">
                        <div class="inner">
-                               <h3>{{widget.title || "Untitled"}}</h3>
-                               <p>{{widget.description || "-"}}</p>
-                               <p>{{widget.additionalTips || "&nbsp;"}}</p>
+                               <h3>{{site.siteName || site.siteId}}</h3>
+
+                               <p>{{site.applicationList.length}} 
Applications</p>
                        </div>
                        <div class="icon">
-                               <i class="fa fa-question-circle"></i>
+                               <i class="fa fa-certificate"></i>
                        </div>
-                       <a class="small-box-footer">More info <i class="fa 
fa-arrow-circle-right"></i></a>
+                       <a ui-sref="site({siteId: site.siteId})" 
class="small-box-footer">More info <i class="fa fa-arrow-circle-right"></i></a>
                </div>
        </div>
-</div-->
-<div class="row flex">
-       <div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in 
Widget.list track by $index">
-               <div widget="widget"></div>
-       </div>
 </div>
 
-<!--div class="row flex">
-       <div class="col-md-4">
-               <div style="background: red; height: 200px;">111</div>
-       </div>
-       <div class="col-md-4">
-               <div style="background: green;">222</div>
-               <div style="background: blue;">222</div>
-       </div>
-       <div class="col-md-4">
-               <div style="background: red;">333</div>
-       </div>
-       <div class="col-md-4">
-               <div style="background: green;">444</div>
-       </div>
-       <div class="col-md-4">
-               <div style="background: red;">555</div>
+<div ng-if="Widget.list.length">
+       <h3>Widgets</h3>
+       <div class="row flex">
+               <div class="col-sm-6 col-md-4 col-lg-3" ng-repeat="widget in 
Widget.list track by $index">
+                       <div widget="widget"></div>
+               </div>
        </div>
-</div-->
+</div>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html 
b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
index 98e7d97..6b02a70 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/integration/site.html
@@ -210,6 +210,7 @@
                                        <li><a href="[data-id='environment']" 
data-toggle="tab">Environment</a></li>
                                        <li><a href="[data-id='configuration']" 
data-toggle="tab" data-id="configTab">Configuration</a></li>
                                </ul>
+
                                <div class="tab-content">
                                        <div class="tab-pane" data-id="guide">
                                                <label>Dependencies</label>
@@ -227,6 +228,7 @@
                                                <label>Install</label>
                                                <pre 
ng-bind-html="installHTML"></pre>
                                        </div>
+
                                        <div class="tab-pane" 
data-id="environment">
                                                <div class="form-group">
                                                        <label>Mode</label>
@@ -240,11 +242,13 @@
                                                        <input type="text" 
class="form-control" ng-model="tmpApp.jarPath" ng-change="checkJarPath()" />
                                                </div>
                                        </div>
+
                                        <div class="tab-pane" 
data-id="configuration">
-                                               <div class="form-group" 
ng-repeat="field in tmpAppConfigFields track by $index">
+                                               <div class="form-group" 
ng-class="{'has-warning': field.required && !tmpApp.configuration[field.name]}" 
ng-repeat="field in tmpAppConfigFields track by $index">
                                                        <label>
                                                                <a class="fa 
fa-times" ng-click="removeField(field)" ng-if="field._customize"></a>
                                                                
{{field.displayName || field.name}}
+                                                               <span class="fa 
fa-question-circle" ng-if="field.description" 
uib-tooltip="{{field.description}}"></span>
                                                                <small 
ng-if="!field.required" class="text-muted">[optional]</small>
                                                        </label>
                                                        <input type="text" 
class="form-control" placeholder="{{field.description}}" 
ng-model="tmpApp.configuration[field.name]" />

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/css/main.css
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/css/main.css 
b/eagle-server/src/main/webapp/app/dev/public/css/main.css
index ac22f89..16136c8 100644
--- a/eagle-server/src/main/webapp/app/dev/public/css/main.css
+++ b/eagle-server/src/main/webapp/app/dev/public/css/main.css
@@ -211,6 +211,10 @@ ul.stepGuide li > .title {
        bottom: 0;
 }
 
+.small-box.bg-gray {
+       color: #666;
+}
+
        /* 
========================================================================
      * =                                 Tab                                  =
      * 
======================================================================== */

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/js/app.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/app.js 
b/eagle-server/src/main/webapp/app/dev/public/js/app.js
index cdb705c..39c84c5 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/app.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/app.js
@@ -159,7 +159,7 @@ var app = {};
                                // ================================== Site 
==================================
                                .state('site', {
                                        url: "/site/:siteId",
-                                       templateUrl: "partials/home.html?_=" + 
window._TRS(),
+                                       templateUrl: 
"partials/site/home.html?_=" + window._TRS(),
                                        controller: "siteCtrl",
                                        resolve: routeResolve()
                                })

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js 
b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
index ddd3314..015bd4f 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/mainCtrl.js
@@ -26,6 +26,13 @@
        // 
======================================================================================
        eagleControllers.controller('homeCtrl', function ($scope, $wrapState, 
PageConfig) {
                PageConfig.title = "Home";
+
+               $scope.colorList = [
+                       "bg-aqua",
+                       "bg-green",
+                       "bg-yellow",
+                       "bg-red"
+               ];
        });
 
        // 
======================================================================================

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/00e92d99/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 04e3b77..faea8ba 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
@@ -41,27 +41,31 @@
        // ============================================================
        // =                          Portal                          =
        // ============================================================
-       var defaultPortalList = [
-               {name: "Home", icon: "home", path: "#/"},
-               /*{name: "Insight", icon: "heartbeat", list: [
-                       {name: "Dashboards"},
-                       {name: "Metrics"}
-               ]},*/
-               {name: "Alert", icon: "bell", list: [
-                       {name: "Explore Alerts", path: "#/alert/"},
-                       {name: "Policies", path: "#/alert/policyList"},
-                       {name: "Streams", path: "#/alert/streamList"},
-                       {name: "Define Policy", path: "#/alert/policyCreate"}
-               ]}
-       ];
-       var adminPortalList = [
-               {name: "Integration", icon: "puzzle-piece", list: [
-                       {name: "Sites", path: "#/integration/siteList"},
-                       {name: "Applications", path: 
"#/integration/applicationList"}
-               ]}
-       ];
-
-       serviceModule.service('Portal', function($wrapState, Site) {
+       serviceModule.service('Portal', function($wrapState, Site, Application) 
{
+               function checkSite() {
+                       return Site.list.length !== 0;
+               }
+
+               function checkApplication() {
+                       return checkSite() && Application.list.length !== 0;
+               }
+
+               var defaultPortalList = [
+                       {name: "Home", icon: "home", path: "#/"},
+                       {name: "Alert", icon: "bell", showFunc: 
checkApplication, list: [
+                               {name: "Explore Alerts", path: "#/alert/"},
+                               {name: "Policies", path: "#/alert/policyList"},
+                               {name: "Streams", path: "#/alert/streamList"},
+                               {name: "Define Policy", path: 
"#/alert/policyCreate"}
+                       ]}
+               ];
+               var adminPortalList = [
+                       {name: "Integration", icon: "puzzle-piece", showFunc: 
checkSite, list: [
+                               {name: "Sites", path: "#/integration/siteList"},
+                               {name: "Applications", path: 
"#/integration/applicationList"}
+                       ]}
+               ];
+
                var Portal = {};
 
                var mainPortalList = [];
@@ -69,7 +73,7 @@
                var connectedMainPortalList = [];
                var sitePortals = {};
 
-               var backHome = {name: "Back home", icon: "arrow-left", path: 
"#/"};
+               var backHome = {name: "Back", icon: "arrow-left", path: "#/"};
 
                Portal.register = function (portal, isSite) {
                        (isSite ? sitePortalList : mainPortalList).push(portal);
@@ -100,12 +104,12 @@
                                        path: "#/site/" + site.siteId
                                };
                        });
-                       connectedMainPortalList.push({name: "Sites", icon: 
"server", list: siteList});
+                       connectedMainPortalList.push({name: "Sites", icon: 
"server", showFunc: checkApplication, list: siteList});
 
                        // Site level
                        sitePortals = {};
                        $.each(Site.list, function (i, site) {
-                               var siteHome = {name: "Home", icon: "home", 
path: "#/site/" + site.siteId};
+                               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 hasApp = 
!!common.array.find(portal.application, site.applicationList, 
"descriptor.type");
                                        if(hasApp) {

Reply via email to