Commit c9f3be2c by Jessica Forrester Committed by GitHub

Merge pull request #60 from spadgett/always-toast-project-delete

Always toast project delete
parents ff35c743 d1a9596a
...@@ -336,14 +336,12 @@ angular.module("openshiftCommonUI") ...@@ -336,14 +336,12 @@ angular.module("openshiftCommonUI")
;'use strict'; ;'use strict';
angular.module("openshiftCommonUI") angular.module("openshiftCommonUI")
.directive("deleteProject", function ($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, AlertMessageService, NotificationsService, Logger) { .directive("deleteProject", function ($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, NotificationsService, Logger) {
return { return {
restrict: "E", restrict: "E",
scope: { scope: {
// The name of project to delete // The name of project to delete
projectName: "@", projectName: "@",
// Alerts object for using inline notifications for success and error alerts, notifications are also sent to enable toast notification display.
alerts: "=",
// Optional display name of the project to delete. // Optional display name of the project to delete.
displayName: "@", displayName: "@",
// Set to true to disable the delete button. // Set to true to disable the delete button.
...@@ -372,11 +370,6 @@ angular.module("openshiftCommonUI") ...@@ -372,11 +370,6 @@ angular.module("openshiftCommonUI")
replace: true, replace: true,
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
var showAlert = function(alert) { var showAlert = function(alert) {
if (scope.stayOnCurrentPage) {
scope.alerts[alert.name] = alert.data;
} else {
AlertMessageService.addAlert(alert);
}
NotificationsService.addNotification(alert.data); NotificationsService.addNotification(alert.data);
}; };
...@@ -443,7 +436,6 @@ angular.module("openshiftCommonUI") ...@@ -443,7 +436,6 @@ angular.module("openshiftCommonUI")
message: _.capitalize(formattedResource) + "\'" + " could not be deleted.", message: _.capitalize(formattedResource) + "\'" + " could not be deleted.",
details: $filter('getErrorDetails')(err) details: $filter('getErrorDetails')(err)
}; };
scope.alerts[projectName] = alert;
NotificationsService.addNotification(alert); NotificationsService.addNotification(alert);
Logger.error(formattedResource + " could not be deleted.", err); Logger.error(formattedResource + " could not be deleted.", err);
}); });
......
...@@ -507,14 +507,12 @@ angular.module("openshiftCommonUI") ...@@ -507,14 +507,12 @@ angular.module("openshiftCommonUI")
;'use strict'; ;'use strict';
angular.module("openshiftCommonUI") angular.module("openshiftCommonUI")
.directive("deleteProject", ["$uibModal", "$location", "$filter", "$q", "hashSizeFilter", "APIService", "DataService", "AlertMessageService", "NotificationsService", "Logger", function ($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, AlertMessageService, NotificationsService, Logger) { .directive("deleteProject", ["$uibModal", "$location", "$filter", "$q", "hashSizeFilter", "APIService", "DataService", "NotificationsService", "Logger", function ($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, NotificationsService, Logger) {
return { return {
restrict: "E", restrict: "E",
scope: { scope: {
// The name of project to delete // The name of project to delete
projectName: "@", projectName: "@",
// Alerts object for using inline notifications for success and error alerts, notifications are also sent to enable toast notification display.
alerts: "=",
// Optional display name of the project to delete. // Optional display name of the project to delete.
displayName: "@", displayName: "@",
// Set to true to disable the delete button. // Set to true to disable the delete button.
...@@ -543,11 +541,6 @@ angular.module("openshiftCommonUI") ...@@ -543,11 +541,6 @@ angular.module("openshiftCommonUI")
replace: true, replace: true,
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
var showAlert = function(alert) { var showAlert = function(alert) {
if (scope.stayOnCurrentPage) {
scope.alerts[alert.name] = alert.data;
} else {
AlertMessageService.addAlert(alert);
}
NotificationsService.addNotification(alert.data); NotificationsService.addNotification(alert.data);
}; };
...@@ -614,7 +607,6 @@ angular.module("openshiftCommonUI") ...@@ -614,7 +607,6 @@ angular.module("openshiftCommonUI")
message: _.capitalize(formattedResource) + "\'" + " could not be deleted.", message: _.capitalize(formattedResource) + "\'" + " could not be deleted.",
details: $filter('getErrorDetails')(err) details: $filter('getErrorDetails')(err)
}; };
scope.alerts[projectName] = alert;
NotificationsService.addNotification(alert); NotificationsService.addNotification(alert);
Logger.error(formattedResource + " could not be deleted.", err); Logger.error(formattedResource + " could not be deleted.", err);
}); });
......
...@@ -129,12 +129,11 @@ cb && cb(); ...@@ -129,12 +129,11 @@ cb && cb();
}; };
} ] } ]
}; };
} ]), angular.module("openshiftCommonUI").directive("deleteProject", [ "$uibModal", "$location", "$filter", "$q", "hashSizeFilter", "APIService", "DataService", "AlertMessageService", "NotificationsService", "Logger", function($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, AlertMessageService, NotificationsService, Logger) { } ]), angular.module("openshiftCommonUI").directive("deleteProject", [ "$uibModal", "$location", "$filter", "$q", "hashSizeFilter", "APIService", "DataService", "NotificationsService", "Logger", function($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, NotificationsService, Logger) {
return { return {
restrict:"E", restrict:"E",
scope:{ scope:{
projectName:"@", projectName:"@",
alerts:"=",
displayName:"@", displayName:"@",
disableDelete:"=?", disableDelete:"=?",
typeNameToConfirm:"=?", typeNameToConfirm:"=?",
...@@ -150,7 +149,7 @@ return angular.isDefined(attr.buttonOnly) ? "src/components/delete-project/delet ...@@ -150,7 +149,7 @@ return angular.isDefined(attr.buttonOnly) ? "src/components/delete-project/delet
replace:!0, replace:!0,
link:function(scope, element, attrs) { link:function(scope, element, attrs) {
var showAlert = function(alert) { var showAlert = function(alert) {
scope.stayOnCurrentPage ? scope.alerts[alert.name] = alert.data :AlertMessageService.addAlert(alert), NotificationsService.addNotification(alert.data); NotificationsService.addNotification(alert.data);
}, navigateToList = function() { }, navigateToList = function() {
if (!scope.stayOnCurrentPage) { if (!scope.stayOnCurrentPage) {
if (scope.redirectUrl) return void $location.url(scope.redirectUrl); if (scope.redirectUrl) return void $location.url(scope.redirectUrl);
...@@ -185,7 +184,7 @@ type:"error", ...@@ -185,7 +184,7 @@ type:"error",
message:_.capitalize(formattedResource) + "' could not be deleted.", message:_.capitalize(formattedResource) + "' could not be deleted.",
details:$filter("getErrorDetails")(err) details:$filter("getErrorDetails")(err)
}; };
scope.alerts[projectName] = alert, NotificationsService.addNotification(alert), Logger.error(formattedResource + " could not be deleted.", err); NotificationsService.addNotification(alert), Logger.error(formattedResource + " could not be deleted.", err);
}); });
}); });
} }
......
'use strict'; 'use strict';
angular.module("openshiftCommonUI") angular.module("openshiftCommonUI")
.directive("deleteProject", function ($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, AlertMessageService, NotificationsService, Logger) { .directive("deleteProject", function ($uibModal, $location, $filter, $q, hashSizeFilter, APIService, DataService, NotificationsService, Logger) {
return { return {
restrict: "E", restrict: "E",
scope: { scope: {
// The name of project to delete // The name of project to delete
projectName: "@", projectName: "@",
// Alerts object for using inline notifications for success and error alerts, notifications are also sent to enable toast notification display.
alerts: "=",
// Optional display name of the project to delete. // Optional display name of the project to delete.
displayName: "@", displayName: "@",
// Set to true to disable the delete button. // Set to true to disable the delete button.
...@@ -37,11 +35,6 @@ angular.module("openshiftCommonUI") ...@@ -37,11 +35,6 @@ angular.module("openshiftCommonUI")
replace: true, replace: true,
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
var showAlert = function(alert) { var showAlert = function(alert) {
if (scope.stayOnCurrentPage) {
scope.alerts[alert.name] = alert.data;
} else {
AlertMessageService.addAlert(alert);
}
NotificationsService.addNotification(alert.data); NotificationsService.addNotification(alert.data);
}; };
...@@ -108,7 +101,6 @@ angular.module("openshiftCommonUI") ...@@ -108,7 +101,6 @@ angular.module("openshiftCommonUI")
message: _.capitalize(formattedResource) + "\'" + " could not be deleted.", message: _.capitalize(formattedResource) + "\'" + " could not be deleted.",
details: $filter('getErrorDetails')(err) details: $filter('getErrorDetails')(err)
}; };
scope.alerts[projectName] = alert;
NotificationsService.addNotification(alert); NotificationsService.addNotification(alert);
Logger.error(formattedResource + " could not be deleted.", err); Logger.error(formattedResource + " could not be deleted.", err);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment