Migrate to toastr.
This commit is contained in:
parent
68df4e5ce2
commit
801d2ae380
@ -1,3 +1,7 @@
|
|||||||
|
import { Logger } from '@nsalaun/ng-logger';
|
||||||
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { ToastrService } from 'ngx-toastr';
|
||||||
|
|
||||||
var scheduleFormTmpl = require('./schedule.form.tmpl.html'),
|
var scheduleFormTmpl = require('./schedule.form.tmpl.html'),
|
||||||
scheduleDeleteTmpl = require('./schedule.delete.tmpl.html');
|
scheduleDeleteTmpl = require('./schedule.delete.tmpl.html');
|
||||||
|
|
||||||
@ -8,7 +12,7 @@ export class ScheduleController{
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private $stateParams,
|
private $stateParams,
|
||||||
private Notification,
|
private toastrService: ToastrService,
|
||||||
private ScheduledOperation,
|
private ScheduledOperation,
|
||||||
private $modal
|
private $modal
|
||||||
) {
|
) {
|
||||||
@ -42,14 +46,14 @@ export class ScheduleController{
|
|||||||
* Save operation.
|
* Save operation.
|
||||||
*/
|
*/
|
||||||
save = function(operation) {
|
save = function(operation) {
|
||||||
return operation.$save().then(function(operation) {
|
return operation.$save().then((operation) => {
|
||||||
this.Notification.success('Scheduled operation #' + operation.id + ' saved.');
|
this.toastrService.success('Scheduled operation #' + operation.id + ' saved.');
|
||||||
|
|
||||||
this.operations = this.load();
|
this.operations = this.load();
|
||||||
|
|
||||||
return operation;
|
return operation;
|
||||||
}, function(result){
|
}, (result) => {
|
||||||
this.Notification.error(
|
this.toastrService.error(
|
||||||
'Error while saving scheduled operation: ' + result.message
|
'Error while saving scheduled operation: ' + result.message
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -66,7 +70,7 @@ export class ScheduleController{
|
|||||||
controller: function($scope, title, operation, $delete) {
|
controller: function($scope, title, operation, $delete) {
|
||||||
$scope.title = title;
|
$scope.title = title;
|
||||||
$scope.operation = operation;
|
$scope.operation = operation;
|
||||||
$scope.$delete = function() {
|
$scope.$delete = () => {
|
||||||
$scope.$hide();
|
$scope.$hide();
|
||||||
$delete($scope.operation);
|
$delete($scope.operation);
|
||||||
};
|
};
|
||||||
@ -74,7 +78,9 @@ export class ScheduleController{
|
|||||||
locals: {
|
locals: {
|
||||||
title: title,
|
title: title,
|
||||||
operation: operation,
|
operation: operation,
|
||||||
$delete: this.delete
|
$delete: (operation) => {
|
||||||
|
this.delete(operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -85,14 +91,14 @@ export class ScheduleController{
|
|||||||
delete = function(operation) {
|
delete = function(operation) {
|
||||||
var id = operation.id;
|
var id = operation.id;
|
||||||
|
|
||||||
return operation.$delete().then(function() {
|
return operation.$delete().then(() => {
|
||||||
this.Notification.success('Scheduled operation #' + id + ' deleted.');
|
this.toastrService.success('Scheduled operation #' + id + ' deleted.');
|
||||||
|
|
||||||
this.operations = this.load();
|
this.operations = this.load();
|
||||||
|
|
||||||
return operation;
|
return operation;
|
||||||
}, function(result) {
|
}, (result) => {
|
||||||
this.Notification.error(
|
this.toastrService.error(
|
||||||
'An error occurred while trying to delete scheduled operation #' +
|
'An error occurred while trying to delete scheduled operation #' +
|
||||||
id + ':<br />' + result
|
id + ':<br />' + result
|
||||||
);
|
);
|
||||||
@ -116,7 +122,7 @@ export class ScheduleController{
|
|||||||
controller: function($scope, title, operation, $save) {
|
controller: function($scope, title, operation, $save) {
|
||||||
$scope.title = title;
|
$scope.title = title;
|
||||||
$scope.operation = operation;
|
$scope.operation = operation;
|
||||||
$scope.$save = function() {
|
$scope.$save = () => {
|
||||||
$scope.$hide();
|
$scope.$hide();
|
||||||
$save($scope.operation);
|
$save($scope.operation);
|
||||||
};
|
};
|
||||||
@ -124,7 +130,9 @@ export class ScheduleController{
|
|||||||
locals: {
|
locals: {
|
||||||
title: title,
|
title: title,
|
||||||
operation: operation,
|
operation: operation,
|
||||||
$save: this.save
|
$save: (operation) => {
|
||||||
|
this.save(operation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user