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

Commit b36aef9

Browse files
ghillertBoykoAlex
authored andcommitted
gh-149 Link Task and Batch-Job with the right execution details
* Fix: Use new URL for launching tasks `/tasks/executions` * Fix: Use new `uri` property for the Maven coordinates of apps * Add task execution details feature * Under `Task Execution Details`, link `Job Execution Ids` to the `Job Execution Details` page * Under `Job Execution Details`, link the `Task Execution Id` to the `Task Execution Details` page gh-149 Polishing Polish Fix typo
1 parent 2d34c86 commit b36aef9

File tree

12 files changed

+228
-17
lines changed

12 files changed

+228
-17
lines changed

ui/app/scripts/directives.js

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,24 @@ define(['angular', 'xregexp', 'moment'], function(angular) {
3131
//transclude: true,
3232
//scope: {},
3333
link: function (scope, element) {
34-
var originalValue = scope.contextValue.value;
35-
var newHtml = originalValue;
36-
var matches;
34+
scope.$watch(
35+
function () { return element.text(); },
36+
function (newValue/*, oldValue */) {
37+
var originalValue = newValue;
38+
var newHtml = originalValue;
39+
var matches;
3740

38-
if (originalValue.substring) {
39-
matches = originalValue.match(urlPattern);
40-
}
41-
if (typeof matches !== 'undefined') {
42-
angular.forEach(matches, function(url) {
43-
newHtml = newHtml.replace(url, '<a href=\''+ url + '\'>' + url + '</a>');
44-
});
45-
}
46-
element.html(newHtml);
41+
if (originalValue.substring) {
42+
matches = originalValue.match(urlPattern);
43+
}
44+
if (typeof matches !== 'undefined') {
45+
angular.forEach(matches, function(url) {
46+
newHtml = newHtml.replace(url, '<a href=\''+ url + '\'>' + url + '</a>');
47+
});
48+
}
49+
element.html(newHtml);
50+
}
51+
);
4752
}
4853
};
4954
}])

ui/app/scripts/job/controllers/execution-details.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ define([], function () {
7373
utils.$log.info('Showing Job Execution details for Job Execution with Id: ' + jobExecution.executionId);
7474
$state.go('home.jobs.executiondetails', {executionId: jobExecution.executionId});
7575
};
76+
$scope.viewTaskExecutionDetails = function (taskExecutionId) {
77+
utils.$log.info('Showing Task Execution details for Task Execution with Id: ' + taskExecutionId);
78+
$state.go('home.tasks.executiondetails', {executionId: taskExecutionId});
79+
};
7680
$scope.restartJob = function (job) {
7781
utils.$log.info('Restarting Job ' + job.name);
7882
jobExecutions.restart(job).$promise.then(

ui/app/scripts/job/views/execution-details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h4 ng-show="jobExecutionDetailsNotFound">The Job Execution Details for Executio
4040
<tr>
4141
<tr>
4242
<td>Task Execution Id</td>
43-
<td>{{jobExecutionDetails.taskExecutionId}}</td>
43+
<td><button type="button" class="btn btn-default" ng-click="viewTaskExecutionDetails(jobExecutionDetails.taskExecutionId)" title="Details">{{jobExecutionDetails.taskExecutionId}}</button></td>
4444
<tr>
4545
<tr>
4646
<td>Composed Job</td>

ui/app/scripts/routes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,15 @@ define(['./app'], function (dashboard) {
312312
feature: 'tasksEnabled'
313313
}
314314
})
315+
.state('home.tasks.executiondetails', {
316+
url : 'tasks/executions/{executionId}',
317+
templateUrl : taskTemplatesPath + '/execution-details.html',
318+
controller: 'TaskExecutionDetailsController',
319+
data:{
320+
authenticate: true,
321+
feature: 'tasksEnabled'
322+
}
323+
})
315324
.state('home.analytics.tabs', {
316325
url: 'analytics',
317326
abstract: true,

ui/app/scripts/shared/services.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ define(function (require) {
3131
var appNameRegex = new XRegExp('[\\p{N}|\\p{L}|\\p{Po}]*(?=[\\s]*--)', 'i');
3232

3333
$rootScope.jobExecutionIdHierarchy = [];
34+
$rootScope.taskExecutionIdHierarchy = [];
3435

3536
return {
3637
$log: $log,
@@ -42,6 +43,7 @@ define(function (require) {
4243
$rootScope.cgbusy = promise;
4344
},
4445
jobExecutionIdHierarchy: $rootScope.jobExecutionIdHierarchy,
46+
taskExecutionIdHierarchy: $rootScope.taskExecutionIdHierarchy,
4547
getAppNameFromJobDefinition: function(jobDefinition) {
4648
if (!jobDefinition) {
4749
throw new Error('jobDefinition must be defined.');

ui/app/scripts/task/controllers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ define(['angular'], function (angular) {
4343
$injector.invoke(taskExecutionsController, this, {'$scope': $scope});
4444
});
4545
}])
46+
.controller('TaskExecutionDetailsController',
47+
['$scope', '$injector', function ($scope, $injector) {
48+
require(['task/controllers/execution-details'], function (taskExecutionDetailsController) {
49+
$injector.invoke(taskExecutionDetailsController, this, {'$scope': $scope});
50+
});
51+
}])
4652
.controller('TaskLaunchController',
4753
['$scope', '$injector', function ($scope, $injector) {
4854
require(['task/controllers/launch'], function (taskLaunchController) {
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*
2+
* Copyright 2017 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+
* Definition of the Task Execution Details controller
19+
*
20+
* @author Gunnar Hillert
21+
*/
22+
define([], function () {
23+
'use strict';
24+
return ['$scope', 'TaskExecutions', 'DataflowUtils', '$state', '$stateParams',
25+
function ($scope, taskExecutions, utils, $state, $stateParams) {
26+
function loadTaskExecutionDetails(executionId) {
27+
var singleTaskExecutionPromise = taskExecutions.getSingleTaskExecution(executionId).$promise;
28+
utils.addBusyPromise(singleTaskExecutionPromise);
29+
30+
singleTaskExecutionPromise.then(
31+
function (result) {
32+
utils.$log.info(result);
33+
$scope.taskExecutionDetails = result;
34+
// if (utils.taskExecutionIdHierarchy.length === 0 || utils.taskExecutionIdHierarchy[utils.taskExecutionIdHierarchy.length-1] !== executionId) {
35+
// utils.taskExecutionIdHierarchy.push(executionId);
36+
// }
37+
}, function (error) {
38+
if (error.status === 404) {
39+
$scope.taskExecutionDetailsNotFound = true;
40+
$scope.executionId = $stateParams.executionId;
41+
}
42+
else {
43+
utils.growl.error(error);
44+
}
45+
}
46+
);
47+
}
48+
$scope.$apply(function () {
49+
$scope.appName = $stateParams.appName;
50+
$scope.optionsPredicate = 'name';
51+
loadTaskExecutionDetails($stateParams.executionId);
52+
});
53+
$scope.taskJobExecutionDetails = function () {
54+
utils.$log.info('Closing Task Execution Details Window');
55+
56+
if (utils.taskExecutionIdHierarchy.length > 1) {
57+
utils.taskExecutionIdHierarchy.pop();
58+
$state.go('home.tasks.executiondetails', {executionId: utils.taskExecutionIdHierarchy.pop()});
59+
}
60+
else {
61+
$state.go('home.tasks.tabs.executions');
62+
}
63+
};
64+
$scope.viewJobExecutionDetails = function (jobExecutionId) {
65+
utils.$log.info('Showing Job Execution details for Job Execution with Id: ' + jobExecutionId);
66+
$state.go('home.jobs.executiondetails', {executionId: jobExecutionId});
67+
};
68+
$scope.closeTaskExecutionDetails = function () {
69+
utils.$log.info('Closing Job Execution Details Window');
70+
71+
if (utils.taskExecutionIdHierarchy.length > 1) {
72+
utils.taskExecutionIdHierarchy.pop();
73+
$state.go('home.tasks.executiondetails', {executionId: utils.taskExecutionIdHierarchy.pop()});
74+
}
75+
else {
76+
$state.go('home.tasks.tabs.executions');
77+
}
78+
};
79+
}];
80+
});

ui/app/scripts/task/controllers/executions.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
define(['model/pageable'], function (Pageable) {
2424
'use strict';
25-
return ['$scope', 'TaskExecutions', 'DataflowUtils', function ($scope, taskExecutions, utils) {
25+
return ['$scope', 'TaskExecutions', 'DataflowUtils', '$state', function ($scope, taskExecutions, utils, $state) {
2626
function loadTaskExecutions(pageable) {
2727
var taskExcutionsPromise = taskExecutions.getAllTaskExecutions(pageable).$promise;
2828
utils.addBusyPromise(taskExcutionsPromise);
@@ -55,6 +55,12 @@ define(['model/pageable'], function (Pageable) {
5555
loadTaskExecutions(sortState);
5656
};
5757

58+
utils.taskExecutionIdHierarchy.length=0;
59+
$scope.viewTaskExecutionDetails = function (taskExecution) {
60+
utils.$log.info('Showing Task Execution details for Task Execution with Id: ' + taskExecution.executionId);
61+
$state.go('home.tasks.executiondetails', {executionId: taskExecution.executionId});
62+
};
63+
5864
loadTaskExecutions($scope.pageable);
5965
}];
6066
});

ui/app/scripts/task/services.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ define(function(require) {
130130
})
131131
.factory('TaskExecutions', function ($resource, $rootScope, $log) {
132132
return {
133+
getSingleTaskExecution: function (taskExecutionId) {
134+
$log.info('Getting details for Task Execution with Id ' + taskExecutionId);
135+
return $resource($rootScope.dataflowServerUrl + '/tasks/executions/' + taskExecutionId).get();
136+
},
133137
getAllTaskExecutions: function (pageable) {
134138
var params = {};
135139
if (pageable === undefined) {
@@ -184,8 +188,8 @@ define(function(require) {
184188
},
185189
launch: function (taskName, propertiesAsString, argumentsAsString) {
186190
console.log('Launching task...' + taskName);
187-
$resource($rootScope.dataflowServerUrl + '/tasks/deployments/:taskname', {
188-
'taskname': taskName, 'properties': propertiesAsString, 'arguments': argumentsAsString }, {
191+
$resource($rootScope.dataflowServerUrl + '/tasks/executions', {
192+
'name': taskName, 'properties': propertiesAsString, 'arguments': argumentsAsString }, {
189193
launch: { method: 'POST' }
190194
}).launch().$promise.then(
191195
function () {

ui/app/scripts/task/views/apps.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<tbody>
88
<tr dir-paginate="item in pageable.items | itemsPerPage: pageable.pageSize" total-items="pageable.total">
99
<td>{{item.name}}</td>
10-
<td>{{item.coordinates}}</td>
10+
<td>{{item.uri}}</td>
1111
<td class="action-column">
1212
<button type="button"
1313
class="btn btn-default" ng-click="createDefinition(item)" title="Create Definition"

0 commit comments

Comments
 (0)