Skip to content

Commit

Permalink
Merge 180ad34 into 5b39993
Browse files Browse the repository at this point in the history
  • Loading branch information
eputtone committed Dec 31, 2018
2 parents 5b39993 + 180ad34 commit 5bf9fcf
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Make a corresponding change, if you have customized `nflow.db.*.driver` parameters.

**Details**
- Popup notifications from workflow instance updates, network and authentication issues in Explorer
- Upgraded Spring to version 5.1.3.RELEASE

## 5.2.0 (2018-11-20)
Expand Down
3 changes: 2 additions & 1 deletion nflow-explorer/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"dygraphs": "1.1.0",
"dagre-d3": "0.6.1",
"angular-chart.js": "1.1.1",
"svg-pan-zoom": "3.6.0"
"svg-pan-zoom": "3.6.0",
"angular-toastr": "2.1.1"
},
"devDependencies": {
"angular-mocks": "1.7.3",
Expand Down
9 changes: 8 additions & 1 deletion nflow-explorer/src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@
'ngTouch',
'ui.bootstrap',
'chart.js',
'AdalAngular'
'AdalAngular',
'toastr'
]);

m.run(function (EndpointService, ExecutorService) {
EndpointService.init();
ExecutorService.start();
});

m.config(function (toastrConfig) {
angular.extend(toastrConfig, {
preventOpenDuplicates: true
});
});

})();
1 change: 1 addition & 0 deletions nflow-explorer/src/app/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
angular.module('nflowExplorer.config', [
'nflowExplorer.config.console',
'nflowExplorer.config.routes',
'nflowExplorer.config.notificationFilter',
])
.constant('config', new Config());

Expand Down
30 changes: 30 additions & 0 deletions nflow-explorer/src/app/config/notificationFilter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
(function () {
'use strict';
var m = angular.module('nflowExplorer.config.notificationFilter', ['toastr']);

m.service('httpNotificationInterceptor', ['$q', '$injector', function($q, $injector) {
return {
responseError: function(rejection) {
var toastr = $injector.get('toastr');
var toastrConfig = {
timeOut: 0
};
if (rejection.status === -1) {
toastr.error('Check network connection, CORS settings and ensure that nFlow REST API is running',
'REST API request aborted by browser', toastrConfig);
} else if (rejection.status === 401 || rejection.status === 403) {
toastr.error('Authentication failed', toastrConfig);
} else if (rejection.status === 404) {
toastr.error('Check that your URL is valid', 'Page not found', toastrConfig);
} else if (rejection.status >= 500) {
toastr.error('Internal server error', toastrConfig);
}
return $q.reject(rejection);
}
};
}]);

m.config(function($httpProvider) {
$httpProvider.interceptors.push('httpNotificationInterceptor');
});
})();
13 changes: 10 additions & 3 deletions nflow-explorer/src/app/workflow/tabs/manageSignal.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
};
});

m.controller('WorkflowManageSignalCtrl', function($state, WorkflowService) {
m.controller('WorkflowManageSignalCtrl', function($state, WorkflowService, toastr) {
var model = {};
var self = this;
self.model = model;
Expand All @@ -32,9 +32,16 @@
signal: model.signal.value,
reason: model.signalReason
};
WorkflowService.signal(self.workflow.id, request).then(refresh);
WorkflowService.signal(self.workflow.id, request).then(updatedSuccess, updateFailed);
}

function refresh() { $state.reload(); }
function updatedSuccess() {
toastr.success('Workflow instance signal updated');
$state.reload();
}

function updateFailed() {
toastr.error('Workflow instance signal update failed');
}
});
})();
13 changes: 10 additions & 3 deletions nflow-explorer/src/app/workflow/tabs/manageState.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
};
});

m.controller('WorkflowManageStateCtrl', function($state, WorkflowService, WorkflowGraphApi, $scope) {
m.controller('WorkflowManageStateCtrl', function($state, WorkflowService, WorkflowGraphApi, $scope, toastr) {
var model = {};
model.timeUnits = ['minutes', 'hours', 'days'];
model.timeUnit = model.timeUnits[0];
Expand Down Expand Up @@ -77,9 +77,16 @@
request.actionDescription = model.actionDescription;
}

WorkflowService.update(self.workflow.id, request).then(refresh);
WorkflowService.update(self.workflow.id, request).then(updatedSuccess, updateFailed);
}

function refresh() { $state.reload(); }
function updatedSuccess() {
toastr.success('Workflow instance state updated');
$state.reload();
}

function updateFailed() {
toastr.error('Workflow instance state update failed');
}
});
})();
15 changes: 11 additions & 4 deletions nflow-explorer/src/app/workflow/tabs/manageVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
};
});

m.controller('WorkflowManageVariablesCtrl', function($state, WorkflowService) {
m.controller('WorkflowManageVariablesCtrl', function($state, WorkflowService, toastr) {
var model = {};
var self = this;
self.model = model;
Expand All @@ -32,14 +32,21 @@
var request = {};
if (model.variableName && model.variableValue) {
request.stateVariables = {};
request.stateVariables[model.variableName] = model.variableValue;
request.stateVariables[model.variableName] = model.variableValue;
}
if (model.actionDescription) {
request.actionDescription = model.actionDescription;
}
WorkflowService.update(self.workflow.id, request).then(refresh);
WorkflowService.update(self.workflow.id, request).then(updateSuccess, updateFailed);
}

function refresh() { $state.reload(); }
function updateSuccess() {
toastr.success('Workflow instance variables updated');
$state.reload();
}

function updateFailed() {
toastr.error('Workflow instance variables update failed');
}
});
})();
3 changes: 3 additions & 0 deletions nflow-explorer/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/angular-toastr/dist/angular-toastr.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
Expand Down Expand Up @@ -60,6 +61,7 @@
<script src="bower_components/chart.js/dist/Chart.js"></script>
<script src="bower_components/angular-chart.js/dist/angular-chart.js"></script>
<script src="bower_components/svg-pan-zoom/dist/svg-pan-zoom.js"></script>
<script src="bower_components/angular-toastr/dist/angular-toastr.tpls.js"></script>
<!-- endbower -->
<!-- endbuild -->

Expand All @@ -83,6 +85,7 @@
<script src="app/config/console.js"></script>
<script src="app/config/routes.js"></script>
<script src="app/config/adal.js"></script>
<script src="app/config/notificationFilter.js"></script>

<script src="app/components/index.js"></script>
<script src="app/components/constants.js"></script>
Expand Down

0 comments on commit 5bf9fcf

Please sign in to comment.