Skip to content

Commit 64a96a9

Browse files
Merge pull request EnMasseProject#16 from k-wall/address-addressspace-status-phase
Expose AddressSpace and Address Status Phase
2 parents ddfd206 + 80d2d6e commit 64a96a9

File tree

3 files changed

+33
-4
lines changed

3 files changed

+33
-4
lines changed

console/console-init/ui/mock-console-server/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ query all_address_spaces {
8181
}
8282
}
8383
Status {
84+
Phase
8485
IsReady
8586
Messages
8687
}
@@ -113,6 +114,7 @@ query all_addresses_for_addressspace_view {
113114
Status {
114115
IsReady
115116
Messages
117+
Phase
116118
PlanStatus {
117119
Partitions
118120
}

console/console-init/ui/mock-console-server/mock-console-server.js

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,15 @@ function createAddressSpace(as) {
212212
throw `Address space with name '${as.ObjectMeta.Name} already exists in namespace ${as.ObjectMeta.Namespace}`;
213213
}
214214

215+
var phase = "Active";
216+
var messages = [];
217+
if (as.Status && as.Status.Phase) {
218+
phase = as.Status.Phase
219+
}
220+
if (phase !== "Active") {
221+
messages.push("The following deployments are not ready: [admin.daf7b31]")
222+
}
223+
215224
var addressSpace = {
216225
ObjectMeta: {
217226
Name: as.ObjectMeta.Name,
@@ -224,9 +233,9 @@ function createAddressSpace(as) {
224233
Type: as.Spec.Type
225234
},
226235
Status: {
227-
"isReady": true,
228-
"messages": [],
229-
"phase": "Active"
236+
IsReady: phase === "Active",
237+
Messages: messages,
238+
Phase: phase
230239
}
231240
};
232241

@@ -304,6 +313,9 @@ createAddressSpace(
304313
Spec: {
305314
Plan: "standard-medium",
306315
Type: "standard"
316+
},
317+
Status: {
318+
Phase: "Configuring"
307319
}
308320
});
309321

@@ -435,6 +447,14 @@ function createAddress(addr) {
435447
throw `Address with name '${addr.ObjectMeta.Name} already exists in address space ${addr.Spec.AddressSpace}`;
436448
}
437449

450+
var phase = "Active";
451+
var messages = [];
452+
if (addr.Status && addr.Status.Phase) {
453+
phase = addr.Status.Phase
454+
}
455+
if (phase !== "Active") {
456+
messages.push("Address " + addr.ObjectMeta.Name + " not found on qdrouterd")
457+
}
438458
var address = {
439459
ObjectMeta: {
440460
Name: addr.ObjectMeta.Name,
@@ -449,7 +469,9 @@ function createAddress(addr) {
449469
Type: addr.Spec.Type
450470
},
451471
Status: {
452-
Phase: "Active",
472+
IsReady: "Active" === phase,
473+
Messages: messages,
474+
Phase: phase,
453475
PlanStatus: {
454476
Name: plan.ObjectMeta.Name,
455477
Partitions: 1
@@ -539,6 +561,9 @@ function closeConnection(objectmeta) {
539561
AddressSpace: addressSpaces[0].ObjectMeta.Name,
540562
Plan: "standard-small-queue",
541563
Type: "queue"
564+
},
565+
Status: {
566+
Phase: n.startsWith("c") ? "Configuring" : (n.startsWith("p") ? "Pending" : "Active")
542567
}
543568
})));
544569

console/console-init/ui/mock-console-server/schema.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const typeDefs = gql`
122122
type AddressSpaceStatus_enmasse_io_v1beta1 {
123123
IsReady: Boolean!
124124
Messages: [String!]
125+
Phase: String!
125126
}
126127
127128
type AddressSpec_enmasse_io_v1beta1 {
@@ -135,6 +136,7 @@ const typeDefs = gql`
135136
type AddressStatus_enmasse_io_v1beta1 {
136137
IsReady: Boolean!
137138
Messages: [String!]
139+
Phase: String!
138140
PlanStatus: AddressPlanStatus_enmasse_io_v1beta1
139141
}
140142

0 commit comments

Comments
 (0)