Repository: incubator-eagle
Updated Branches:
  refs/heads/master 607e74a74 -> a5537c0c2


[EAGLE-748] Streams UI display dataSource describe

Streams UI display dataSource describe

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

Closes #621 from zombieJ/EAGLE-748.


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

Branch: refs/heads/master
Commit: a5537c0c2ce283ba2013f9b2f46e81efc5c72c58
Parents: 607e74a
Author: zombieJ <smith3...@gmail.com>
Authored: Tue Nov 8 15:16:41 2016 +0800
Committer: zombieJ <smith3...@gmail.com>
Committed: Tue Nov 8 15:16:41 2016 +0800

----------------------------------------------------------------------
 .../app/dev/partials/alert/streamList.html      |  7 +++--
 .../webapp/app/dev/public/js/ctrls/alertCtrl.js | 32 ++++++++++++++------
 2 files changed, 28 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a5537c0c/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
----------------------------------------------------------------------
diff --git 
a/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html 
b/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
index 2c2332f..0824188 100644
--- a/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
+++ b/eagle-server/src/main/webapp/app/dev/partials/alert/streamList.html
@@ -37,11 +37,14 @@
                                <tbody>
                                        <tr>
                                                <td><span class="label 
label-primary">{{item.streamId}}</span></td>
-                                               <td>{{item.appType}}</td>
+                                               <td class="text-no-break">
+                                                       
{{item.application.type}}
+                                                       <a class="fa fa-plug" 
uib-tooltip="Click to view data source" ng-click="showDataSource(item)"></a>
+                                               </td>
                                                <td>{{item.siteId}}</td>
                                                <td>
                                                        <ul class="no-margin">
-                                                               <li 
ng-repeat="column in item.schema.columns track by $index">
+                                                               <li 
ng-repeat="column in item.columns track by $index">
                                                                        
<strong>{{column.name}}</strong>:
                                                                        
{{column.type}}
                                                                </li>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/a5537c0c/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
----------------------------------------------------------------------
diff --git a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js 
b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
index 9b6defb..5d20960 100644
--- a/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
+++ b/eagle-server/src/main/webapp/app/dev/public/js/ctrls/alertCtrl.js
@@ -56,19 +56,33 @@
        // 
======================================================================================
        // =                                       Stream                       
                =
        // 
======================================================================================
-       eagleControllers.controller('alertStreamListCtrl', function ($scope, 
$wrapState, PageConfig, Application) {
+       eagleControllers.controller('alertStreamListCtrl', function ($scope, 
$wrapState, PageConfig, Application, Entity) {
                PageConfig.title = "Streams";
 
-               $scope.streamList = $.map(Application.list, function (app) {
-                       return (app.streams || []).map(function (stream) {
-                               return {
-                                       streamId: stream.streamId,
-                                       appType: app.descriptor.type,
-                                       siteId: app.site.siteId,
-                                       schema: stream.schema
-                               };
+               $scope.streamList = [];
+               Entity.queryMetadata("streams")._then(function (res) {
+                       $scope.streamList = $.map(res.data, function (stream) {
+                               var application = 
Application.findProvider(stream.dataSource);
+                               return $.extend({application: application}, 
stream);
                        });
                });
+
+               $scope.dataSources = {};
+               Entity.queryMetadata("datasources")._then(function(res) {
+                       $.each(res.data, function (i, dataSource) {
+                               $scope.dataSources[dataSource.name] = 
dataSource;
+                       });
+               });
+
+               $scope.showDataSource = function (stream) {
+                       var dataSource = $scope.dataSources[stream.dataSource];
+                       console.log(">>>", dataSource);
+                       $.dialog({
+                               title: dataSource.name,
+                               content: $("<pre 
class='text-break'>").html(JSON.stringify(dataSource, null, "\t")),
+                               size: "large"
+                       });
+               };
        });
 
        // 
======================================================================================

Reply via email to