Skip to content

Commit 03b49b4

Browse files
author
OpenShift Bot
authored
Merge pull request openshift#665 from benjaminapetersen/pvc-get-watch
Merged by openshift-bot
2 parents b60172f + 8226d84 commit 03b49b4

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

app/scripts/controllers/persistentVolumeClaim.js

+19-22
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,35 @@ angular.module('openshiftConsole')
2525
];
2626

2727
var watches = [];
28-
28+
29+
var pvcResolved = function(pvc, action) {
30+
$scope.pvc = pvc;
31+
$scope.loaded = true;
32+
if (action === "DELETED") {
33+
$scope.alerts["deleted"] = {
34+
type: "warning",
35+
message: "This persistent volume claim has been deleted."
36+
};
37+
}
38+
};
39+
2940
ProjectsService
3041
.get($routeParams.project)
3142
.then(_.spread(function(project, context) {
3243
$scope.project = project;
33-
DataService.get("persistentvolumeclaims", $routeParams.pvc, context).then(
34-
// success
35-
function(pvc) {
36-
$scope.loaded = true;
37-
$scope.pvc = pvc;
38-
39-
// If we found the item successfully, watch for changes on it
40-
watches.push(DataService.watchObject("persistentvolumeclaims", $routeParams.pvc, context, function(pvc, action) {
41-
if (action === "DELETED") {
42-
$scope.alerts["deleted"] = {
43-
type: "warning",
44-
message: "This persistent volume claim has been deleted."
45-
};
46-
}
47-
$scope.pvc = pvc;
48-
}));
49-
},
50-
// failure
51-
function(e) {
44+
DataService
45+
.get("persistentvolumeclaims", $routeParams.pvc, context)
46+
.then(function(pvc) {
47+
pvcResolved(pvc);
48+
watches.push(DataService.watchObject("persistentvolumeclaims", $routeParams.pvc, context, pvcResolved));
49+
}, function(e) {
5250
$scope.loaded = true;
5351
$scope.alerts["load"] = {
5452
type: "error",
5553
message: "The persistent volume claim details could not be loaded.",
5654
details: "Reason: " + $filter('getErrorDetails')(e)
5755
};
58-
}
59-
);
56+
});
6057

6158
$scope.$on('$destroy', function(){
6259
DataService.unwatchAll(watches);

dist/scripts/scripts.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -5433,15 +5433,15 @@ link:"project/" + b.project + "/browse/storage"
54335433
}, {
54345434
title:b.pvc
54355435
} ];
5436-
var f = [];
5437-
d.get(b.project).then(_.spread(function(d, g) {
5438-
a.project = d, c.get("persistentvolumeclaims", b.pvc, g).then(function(d) {
5439-
a.loaded = !0, a.pvc = d, f.push(c.watchObject("persistentvolumeclaims", b.pvc, g, function(b, c) {
5440-
"DELETED" === c && (a.alerts.deleted = {
5436+
var f = [], g = function(b, c) {
5437+
a.pvc = b, a.loaded = !0, "DELETED" === c && (a.alerts.deleted = {
54415438
type:"warning",
54425439
message:"This persistent volume claim has been deleted."
5443-
}), a.pvc = b;
5444-
}));
5440+
});
5441+
};
5442+
d.get(b.project).then(_.spread(function(d, h) {
5443+
a.project = d, c.get("persistentvolumeclaims", b.pvc, h).then(function(a) {
5444+
g(a), f.push(c.watchObject("persistentvolumeclaims", b.pvc, h, g));
54455445
}, function(b) {
54465446
a.loaded = !0, a.alerts.load = {
54475447
type:"error",

0 commit comments

Comments
 (0)