Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Show toast on service add in create app flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Kelly Domico committed Jul 28, 2016
1 parent e36a870 commit 151bcda
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
var index = parseInt(attrs.uniqueSpaceName, 10);
ctrl.$validators.dupeName = function (modelValue, viewValue) {
ctrl.$validators.dupeName = function (modelValue) {
if (ctrl.$isEmpty(modelValue)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
this.ready = false;
this.warningMsg = gettext('The application needs to be restarted for highlighted variables to be added to the runtime.');
this.isPending = this.model.application.summary.state === 'PENDING';
this.UPDATE_INTERVAL = 1000; // milliseconds
this.UPDATE_INTERVAL = 5000; // milliseconds

this.init();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
AddServiceWorkflowController.$inject = [
'$q',
'$scope',
'$interpolate',
'app.model.modelManager',
'app.event.eventService',
'helion.framework.widgets.detailView'
'helion.framework.widgets.detailView',
'helion.framework.widgets.toaster'
];

/**
Expand All @@ -35,11 +37,15 @@
* @constructor
* @param {object} $q - the Angular $q service
* @param {object} $scope - the Angular $scope service
* @param {object} $interpolate - the Angular $interpolate service
* @param {app.model.modelManager} modelManager - the application model manager
* @param {app.event.eventService} eventService - the event management service
* @param {helion.framework.widgets.detailView} detailView - the detail view widget
* @param {helion.framework.widgets.toaster} toaster - the toast notification service
* @property {object} $q - the Angular $q service
* @property {object} $interpolate - the Angular $interpolate service
* @property {helion.framework.widgets.detailView} detailView - the detail view widget
* @property {helion.framework.widgets.toaster} toaster - the toast notification service
* @property {cloud-foundry.model.application} appModel - the CF application model
* @property {cloud-foundry.model.service-binding} bindingModel - the CF service binding model
* @property {cloud-foundry.model.service-instance} instanceModel - the CF service instance model
Expand All @@ -49,10 +55,12 @@
* @property {string} path - the path to this add-service-workflow folder
* @property {object} addServiceActions - the stop and finish workflow actions
*/
function AddServiceWorkflowController($q, $scope, modelManager, eventService, detailView) {
function AddServiceWorkflowController($q, $scope, $interpolate, modelManager, eventService, detailView, toaster) {
var that = this;
this.$q = $q;
this.$interpolate = $interpolate;
this.detailView = detailView;
this.toaster = toaster;
this.appModel = modelManager.retrieve('cloud-foundry.model.application');
this.bindingModel = modelManager.retrieve('cloud-foundry.model.service-binding');
this.instanceModel = modelManager.retrieve('cloud-foundry.model.service-instance');
Expand Down Expand Up @@ -324,6 +332,13 @@
if (!this.data.confirm) {
this.addService().then(function () {
that.addBinding().then(function () {
// show notification for successful binding
var successMsg = gettext('The {{service}} service has been attached to your {{appName}} application');
var context = {
service: that.options.serviceInstance.entity.name,
appName: that.data.app.summary.name
};
that.toaster.success(that.$interpolate(successMsg)(context), {positionClass: 'toast-top-right'});
that.modal.close();
});
});
Expand Down
5 changes: 4 additions & 1 deletion tools/gulp.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ module.exports = function () {
"main": [ "release/angular-link-header-parser.min.js" ]
},
"angular-toastr": {
"main": [ "./dist/angular-toastr.tpls.js" ]
"main": [
"./dist/angular-toastr.tpls.js",
"./dist/angular-toastr.css"
]
}
}
},
Expand Down

0 comments on commit 151bcda

Please sign in to comment.