Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 38e4be7

Browse files
BoykoAlexilayaperumalg
authored andcommitted
Related stream service
UI skeleton for related streams Basic UI for detailed stream info page Finalize the basic UI
1 parent 11a9978 commit 38e4be7

File tree

7 files changed

+100
-1
lines changed

7 files changed

+100
-1
lines changed

ui/app/scripts/routes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,15 @@ define(['./app'], function (dashboard) {
183183
feature: 'streamsEnabled'
184184
}
185185
})
186+
.state('home.streams.detailedStream', {
187+
url : 'streams/definitions/{streamName}',
188+
templateUrl : streamTemplatesPath + '/detailed-stream.html',
189+
controller: 'DetailedStreamController',
190+
data:{
191+
authenticate: true,
192+
feature: 'streamsEnabled'
193+
}
194+
})
186195

187196
.state('home.jobs.tabs.definitions', {
188197
url : '/definitions',

ui/app/scripts/stream/controllers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ define(['angular'], function (angular) {
5454
$injector.invoke(propertiesDialogController, this, {'$scope': $scope, '$modalInstance': $modalInstance, 'cell': cell, 'streamInfo': streamInfo});
5555
});
5656
}])
57+
.controller('DetailedStreamController',
58+
['$scope','$injector', function ($scope, $injector) {
59+
require(['stream/controllers/detailed-stream'], function (detailedStreamController) {
60+
$injector.invoke(detailedStreamController, this, {'$scope': $scope});
61+
});
62+
}])
5763
.controller('DefinitionDeployController',
5864
['$scope', '$injector', function ($scope, $injector) {
5965
require(['stream/controllers/definition-deploy'], function (streamDefinitionDeployController) {

ui/app/scripts/stream/controllers/definitions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ define(['model/pageable'], function (Pageable) {
9494
$scope.deployStream = function (streamDefinition) {
9595
$state.go('home.streams.deployStream', {definitionName: streamDefinition.name});
9696
};
97+
$scope.detailed = function(streamDefinition) {
98+
$state.go('home.streams.detailedStream', {streamName: streamDefinition.name});
99+
};
97100
$scope.undeployStream = function (streamDefinition) {
98101
utils.$log.info('Undeploying Stream ' + streamDefinition.name);
99102
utils.$log.info(streamService);
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2016 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Stream definition detailed graph controller
19+
*
20+
* @author Alex Boyko
21+
*/
22+
define(function(require) {
23+
'use strict';
24+
25+
var angular = require('angular');
26+
27+
return ['DataflowUtils', '$scope', '$state', '$stateParams', 'StreamService',
28+
function (utils, $scope, $state, $stateParams, streamService) {
29+
30+
$scope.back = function() {
31+
$state.go('home.streams.tabs.definitions');
32+
};
33+
34+
$scope.streamName = $stateParams.streamName;
35+
36+
streamService.getRelatedDefinitions($scope.streamName, true).then(function(results) {
37+
var streams = results.data._embedded.streamDefinitionResourceList;
38+
if (streams && angular.isArray(streams) && streams.length > 0) {
39+
var dsl = '';
40+
streams.forEach(function(stream) {
41+
dsl += stream.name + '=' + stream.dslText + '\n';
42+
});
43+
$scope.definition = {
44+
text: dsl,
45+
name: $scope.streamName
46+
};
47+
} else {
48+
$scope.definition = {
49+
text: '',
50+
name: $scope.streamName
51+
};
52+
}
53+
$scope.flo.updateGraphRepresentation();
54+
});
55+
56+
$scope.$apply();
57+
58+
}
59+
];
60+
});

ui/app/scripts/stream/services.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ define(function(require) {
5353
url: $rootScope.dataflowServerUrl + '/streams/definitions/' + streamName
5454
});
5555
},
56+
getRelatedDefinitions: function(streamName, nested) {
57+
return $http({
58+
method: 'GET',
59+
url: $rootScope.dataflowServerUrl + '/streams/definitions/' + streamName + '/related',
60+
params: {
61+
nested: nested
62+
}
63+
});
64+
},
5665
deploy: function (streamDefinition, properties) {
5766
$log.info('Deploy Stream ' + streamDefinition.name);
5867
return $resource($rootScope.dataflowServerUrl + '/streams/deployments/' + streamDefinition.name, null, {

ui/app/scripts/stream/views/definitions.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<th>Name</th>
3232
<th>Definition</th>
3333
<th>Status <a class="status-help" dataflow-popover=".status-help-content" title="Available Deployment Statuses"><span class="glyphicon glyphicon-question-sign"></span></a></th>
34-
<th colspan="3" class="text-center">Actions</th>
34+
<th colspan="4" class="text-center">Actions</th>
3535
</tr>
3636
</thead>
3737
<tbody>
@@ -43,6 +43,11 @@
4343
<td>{{item.name}}</td>
4444
<td>{{item.dslText}}</td>
4545
<td>{{item.status}}</td>
46+
<td class="action-column">
47+
<button type="button" ng-click="detailed(item)" class="btn btn-default">
48+
<span class="glyphicon glyphicon-info-sign"></span> Details
49+
</button>
50+
</td>
4651
<td class="action-column">
4752
<button type="button" ng-click="undeployStream(item)"
4853
ng-disabled="item.status === 'deploying' || item.status === 'undeployed'"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<h1>{{streamName}}</h1>
2+
<flo-editor disable-properties="true" palette-size="170" metamodel-service-name="StreamMetamodelService" init-read-only-canvas="true"
3+
render-service-name="StreamRenderService" ng-init="flo.noPalette=true; canvasControls={zoom:true}; paperPadding=65;">
4+
</flo-editor>
5+
<div class="text-center" style="padding-top:20px;">
6+
<button class="btn btn-default" ng-click="back()">Back</button>
7+
</div>

0 commit comments

Comments
 (0)