Skip to content

Commit 2f765d1

Browse files
author
Dingane Hlaluku
committed
Safegaurd for when the given zone has no hosts
1 parent c3bc344 commit 2f765d1

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ui/scripts/instanceWizard.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
dataType: "json",
3030
async: false,
3131
success: function(json) {
32-
pods = [{
32+
var pods = [{
3333
id: -1,
3434
description: 'Default',
3535
parentId: -1
@@ -43,8 +43,8 @@
4343
parentId: this.zoneid
4444
});
4545
});
46-
podcallback(pods);
4746
}
47+
podcallback(pods);
4848
}
4949
});
5050
},
@@ -57,7 +57,7 @@
5757
dataType: "json",
5858
async: false,
5959
success: function(json) {
60-
clusters = [{
60+
var clusters = [{
6161
id: -1,
6262
description: 'Default',
6363
parentId: -1
@@ -71,8 +71,8 @@
7171
parentId: this.podid
7272
});
7373
});
74-
clustercallback(clusters);
7574
}
75+
clustercallback(clusters);
7676
}
7777
});
7878
},
@@ -85,12 +85,12 @@
8585
dataType: "json",
8686
async: false,
8787
success: function(json) {
88-
var hostObjs = json.listhostsresponse.host;
89-
hosts = [{
88+
var hosts = [{
9089
id: -1,
9190
description: 'Default',
9291
parentId: -1
9392
}];
93+
var hostObjs = json.listhostsresponse.host;
9494
if (hostObjs != undefined) {
9595
$(hostObjs).each(function() {
9696
hosts.push({
@@ -99,8 +99,10 @@
9999
parentId: this.clusterid
100100
});
101101
});
102-
hostcallback(hosts);
102+
} else {
103+
hosts[0].description = "No hosts in Zone"
103104
}
105+
hostcallback(hosts);
104106
}
105107
});
106108
},

0 commit comments

Comments
 (0)