Skip to content

Commit 3424e5c

Browse files
author
OpenShift Bot
authored
Merge pull request #1706 from spadgett/hide-errors-scope-destroy
Merged by openshift-bot
2 parents a0ff009 + 13a8421 commit 3424e5c

File tree

16 files changed

+72
-106
lines changed

16 files changed

+72
-106
lines changed

app/scripts/controllers/addConfigVolume.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ angular.module('openshiftConsole')
8383
var navigateBack = function() {
8484
$window.history.back();
8585
};
86+
$scope.cancel = navigateBack;
8687

8788
var displayError = function(errorMessage, errorDetails) {
8889
NotificationsService.addNotification({
@@ -96,6 +97,7 @@ angular.module('openshiftConsole')
9697
var hideErrorNotifications = function() {
9798
NotificationsService.hideNotification("add-config-volume-error");
9899
};
100+
$scope.$on('$destroy', hideErrorNotifications);
99101

100102
$scope.addItem = function() {
101103
$scope.attach.items.push({});
@@ -107,11 +109,6 @@ angular.module('openshiftConsole')
107109
setDirty();
108110
};
109111

110-
$scope.cancel = function() {
111-
hideErrorNotifications();
112-
navigateBack();
113-
};
114-
115112
ProjectsService
116113
.get($routeParams.project)
117114
.then(_.spread(function(project, context) {

app/scripts/controllers/attachPVC.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ angular.module('openshiftConsole')
9999
var hideErrorNotifications = function() {
100100
NotificationsService.hideNotification("attach-pvc-error");
101101
};
102+
$scope.$on('$destroy', hideErrorNotifications);
102103

103104
var navigateBack = function() {
104105
$window.history.back();
105106
};
107+
$scope.cancel = navigateBack;
106108

107109
var isContainerSelected = function(container) {
108110
return $scope.attach.allContainers || $scope.attach.containers[container.name];
@@ -214,10 +216,5 @@ angular.module('openshiftConsole')
214216
);
215217
}
216218
};
217-
218-
$scope.cancel = function() {
219-
hideErrorNotifications();
220-
navigateBack();
221-
};
222219
}));
223220
});

app/scripts/controllers/create/createFromImage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ angular.module("openshiftConsole")
7777
}
7878
});
7979
};
80+
$scope.$on('$destroy', hideErrorNotifications);
8081

8182
ProjectsService
8283
.get($routeParams.project)
@@ -410,7 +411,6 @@ angular.module("openshiftConsole")
410411
}));
411412

412413
$scope.cancel = function() {
413-
hideErrorNotifications();
414414
Navigate.toProjectOverview($scope.projectName);
415415
};
416416
});

app/scripts/controllers/createConfigMap.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,12 @@ angular.module('openshiftConsole')
3838
var hideErrorNotifications = function() {
3939
NotificationsService.hideNotification("create-config-map-error");
4040
};
41+
$scope.$on('$destroy', hideErrorNotifications);
4142

4243
var navigateBack = function() {
4344
$window.history.back();
4445
};
45-
46-
$scope.cancel = function() {
47-
hideErrorNotifications();
48-
navigateBack();
49-
};
46+
$scope.cancel = navigateBack;
5047

5148
ProjectsService
5249
.get($routeParams.project)

app/scripts/controllers/createPersistentVolumeClaim.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,12 @@ angular.module('openshiftConsole')
4141
var hideErrorNotifications = function() {
4242
NotificationsService.hideNotification("create-pvc-error");
4343
};
44+
$scope.$on('$destroy', hideErrorNotifications);
4445

4546
var navigateBack = function() {
4647
$window.history.back();
4748
};
48-
49-
$scope.cancel = function() {
50-
hideErrorNotifications();
51-
navigateBack();
52-
};
49+
$scope.cancel = navigateBack;
5350

5451
ProjectsService
5552
.get($routeParams.project)

app/scripts/controllers/createRoute.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,12 @@ angular.module('openshiftConsole')
4949
var hideErrorNotifications = function() {
5050
NotificationsService.hideNotification("create-route-error");
5151
};
52+
$scope.$on('$destroy', hideErrorNotifications);
5253

5354
var navigateBack = function() {
5455
$window.history.back();
5556
};
56-
57-
$scope.cancel = function() {
58-
hideErrorNotifications();
59-
navigateBack();
60-
};
57+
$scope.cancel = navigateBack;
6158

6259
ProjectsService
6360
.get($routeParams.project)

app/scripts/controllers/edit/autoscaler.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,12 @@ angular.module('openshiftConsole')
6868
var navigateBack = function() {
6969
$window.history.back();
7070
};
71+
$scope.cancel = navigateBack;
7172

7273
var hideErrorNotifications = function() {
7374
NotificationsService.hideNotification('edit-hpa-error');
7475
};
75-
76-
$scope.cancel = function() {
77-
hideErrorNotifications();
78-
navigateBack();
79-
};
76+
$scope.$on('$destroy', hideErrorNotifications);
8077

8178
ProjectsService
8279
.get($routeParams.project)

app/scripts/controllers/edit/buildConfig.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,18 +238,15 @@ angular.module('openshiftConsole')
238238
$window.history.back();
239239
}
240240
};
241+
$scope.cancel = navigateBack;
241242

242243
var hideErrorNotifications = function() {
243244
// TODO: Add method to NotificationsService for passing a list of IDs.
244245
NotificationsService.hideNotification("edit-build-config-error");
245246
NotificationsService.hideNotification("edit-build-config-conflict");
246247
NotificationsService.hideNotification("edit-build-config-deleted");
247248
};
248-
249-
$scope.cancel = function() {
250-
hideErrorNotifications();
251-
navigateBack();
252-
};
249+
$scope.$on('$destroy', hideErrorNotifications);
253250

254251
ProjectsService
255252
.get($routeParams.project)

app/scripts/controllers/edit/configMap.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ angular.module('openshiftConsole')
4141
var navigateBack = function() {
4242
$window.history.back();
4343
};
44-
45-
$scope.cancel = function() {
46-
hideErrorNotifications();
47-
navigateBack();
48-
};
44+
$scope.cancel = navigateBack;
4945

5046
ProjectsService
5147
.get($routeParams.project)
@@ -97,6 +93,7 @@ angular.module('openshiftConsole')
9793

9894
$scope.$on('$destroy', function(){
9995
DataService.unwatchAll(watches);
96+
hideErrorNotifications();
10097
});
10198
}));
10299
});

app/scripts/controllers/edit/deploymentConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,11 @@ angular.module('openshiftConsole')
392392
};
393393

394394
$scope.cancel = function() {
395-
hideErrorNotifications();
396395
$window.history.back();
397396
};
398397

399398
$scope.$on('$destroy', function(){
400399
DataService.unwatchAll(watches);
400+
hideErrorNotifications();
401401
});
402402
});

app/scripts/controllers/edit/healthChecks.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,12 @@ angular.module('openshiftConsole')
6666
var navigateBack = function() {
6767
$location.url($scope.resourceURL);
6868
};
69+
$scope.cancel = navigateBack;
6970

7071
var hideErrorNotifications = function() {
7172
NotificationsService.hideNotification("add-health-check-error");
7273
};
73-
74-
$scope.cancel = function() {
75-
hideErrorNotifications();
76-
navigateBack();
77-
};
74+
$scope.$on('$destroy', hideErrorNotifications);
7875

7976
ProjectsService
8077
.get($routeParams.project)

app/scripts/controllers/edit/route.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ angular.module('openshiftConsole')
4343
var hideErrorNotifications = function() {
4444
NotificationsService.hideNotification("edit-route-error");
4545
};
46+
$scope.$on('$destroy', hideErrorNotifications);
4647

4748
var navigateBack = function() {
4849
$location.path($scope.routeURL);
4950
};
50-
51-
$scope.cancel = function() {
52-
hideErrorNotifications();
53-
navigateBack();
54-
};
51+
$scope.cancel = navigateBack;
5552

5653
ProjectsService
5754
.get($routeParams.project)

app/scripts/controllers/setLimits.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ angular.module('openshiftConsole')
7878
NotificationsService.hideNotification("set-compute-limits-error");
7979
};
8080

81-
$scope.cancel = function() {
82-
hideErrorNotifications();
83-
navigateBack();
84-
};
81+
$scope.cancel = navigateBack;
82+
$scope.$on('$destroy', hideErrorNotifications);
8583

8684
ProjectsService
8785
.get($routeParams.project)

0 commit comments

Comments
 (0)