Skip to content

Commit 203859d

Browse files
committed
improvements to nodered handling
1 parent ca953d6 commit 203859d

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

OpenFlow/src/Messages/Message.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,7 @@ export class Message {
848848
var billings = await Config.db.query<Billing>({ userid: _id, _type: "billing" }, null, 1, 0, null, "users", rootjwt);
849849
if (billings.length > 0) {
850850
var billing: Billing = billings[0];
851-
resources.limits = {};
852-
resources.limits.memory = billing.memory;
851+
if (!Util.IsNullEmpty(billing.memory)) resources.limits.memory = billing.memory;
853852
if (!Util.IsNullEmpty(billing.openflowuserplan)) {
854853
hasbilling = true;
855854
}
@@ -929,6 +928,9 @@ export class Message {
929928
} catch (error) {
930929
cli._logger.error("[" + cli.user.username + "] failed updating noeredinstance");
931930
cli._logger.error("[" + cli.user.username + "] " + JSON.stringify(error));
931+
if (error.response && error.response.body && !Util.IsNullEmpty(error.response.body.message)) {
932+
throw new Error(error.response.body.message);
933+
}
932934
throw new Error("failed updating noeredinstance");
933935
}
934936
}

OpenFlow/src/public/Controllers.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2749,79 +2749,79 @@ module openflow {
27492749
this.errormessage = "";
27502750
await this.api.EnsureNoderedInstance(this.userid, this.name);
27512751
this.messages += "EnsureNoderedInstance completed" + "\n";
2752+
this.GetNoderedInstance();
27522753
} catch (error) {
27532754
this.errormessage = error;
27542755
this.messages += error + "\n";
27552756
console.error(error);
27562757
}
27572758
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2758-
this.GetNoderedInstance();
27592759
}
27602760
async DeleteNoderedInstance() {
27612761
try {
27622762
this.errormessage = "";
27632763
await this.api.DeleteNoderedInstance(this.userid, this.name);
27642764
this.messages += "DeleteNoderedInstance completed" + "\n";
2765+
this.GetNoderedInstance();
27652766
} catch (error) {
27662767
this.errormessage = error;
27672768
this.messages += error + "\n";
27682769
console.error(error);
27692770
}
27702771
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2771-
this.GetNoderedInstance();
27722772
}
27732773
async DeleteNoderedPod(instancename: string) {
27742774
try {
27752775
this.errormessage = "";
27762776
await this.api.DeleteNoderedPod(this.userid, instancename);
27772777
this.messages += "DeleteNoderedPod completed" + "\n";
2778+
this.GetNoderedInstance();
27782779
} catch (error) {
27792780
this.errormessage = error;
27802781
this.messages += error + "\n";
27812782
console.error(error);
27822783
}
27832784
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2784-
this.GetNoderedInstance();
2785-
27862785
}
27872786
async RestartNoderedInstance() {
27882787
try {
27892788
this.errormessage = "";
27902789
await this.api.RestartNoderedInstance(this.userid, this.name);
27912790
this.messages += "RestartNoderedInstance completed" + "\n";
2791+
this.GetNoderedInstance();
27922792
} catch (error) {
27932793
this.errormessage = error;
27942794
this.messages += error + "\n";
27952795
console.error(error);
27962796
}
27972797
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2798-
this.GetNoderedInstance();
27992798
}
28002799
async StartNoderedInstance() {
28012800
try {
28022801
this.errormessage = "";
28032802
await this.api.StartNoderedInstance(this.userid, this.name);
28042803
this.messages += "StartNoderedInstance completed" + "\n";
2804+
this.GetNoderedInstance();
28052805
} catch (error) {
28062806
this.errormessage = error;
28072807
this.messages += error + "\n";
28082808
console.error(error);
28092809
}
28102810
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2811-
this.GetNoderedInstance();
28122811
}
28132812
async StopNoderedInstance() {
28142813
try {
28152814
this.errormessage = "";
28162815
await this.api.StopNoderedInstance(this.userid, this.name);
28172816
this.messages += "StopNoderedInstance completed" + "\n";
2817+
this.GetNoderedInstance();
28182818
} catch (error) {
28192819
this.errormessage = error;
28202820
this.messages += error + "\n";
28212821
console.error(error);
28222822
}
28232823
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2824-
this.GetNoderedInstance();
2824+
28252825
}
28262826
async SendOne(queuename: string, message: any): Promise<void> {
28272827
var result: any = await this.api.QueueMessage(queuename, message);

OpenFlow/src/public/Nodered.html

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ <h1 translate lib="web">sockets</h1>
3535
<div class="col">
3636
<span ng-show="ctrl.instance!=null">{{ instance.metadata.name }}</span>
3737
</div>
38+
<label class="col-sm-1 control-label"><span translate lib="web">mem</span>: </label>
39+
<div class="col-sm-2">
40+
<span
41+
ng-show="ctrl.instance!=null">{{ instance.spec.containers[0].resources.requests.memory + "/" + instance.spec.containers[0].resources.limits.memory }}</span>
42+
</div>
3843
<label class="col-sm-1 control-label"><span translate lib="web">status</span>: </label>
3944
<div class="col-sm-1">
4045
<span
@@ -76,9 +81,9 @@ <h1 translate lib="web">sockets</h1>
7681
<pre>{{ctrl.messages}}</pre>
7782
</div>
7883
<section>
79-
<div class="form-group">
80-
<label class="col-sm-3 control-label"><span translate lib="web">api_allow_anonymous</span>: </label>
81-
<div class="col-sm-9">
84+
<div class="row">
85+
<label class="col-sm-4 control-label"><span translate lib="web">api_allow_anonymous</span>: </label>
86+
<div class="col-sm-1">
8287
<input type="checkbox" class='form-control' ng-model="ctrl.user.nodered.api_allow_anonymous"></input>
8388
</div>
8489
</div>
@@ -107,11 +112,4 @@ <h1 translate lib="web">sockets</h1>
107112
ng-click="ctrl.save()">save</button>
108113
</div>
109114
</div>
110-
</section>
111-
112-
113-
114-
<p>If this is your first time creating a NodeRed instance, please signout and signin again, to refresh group
115-
memberships for your user</p>
116-
<p>It can take a few minutes from you order a deletion of NodeRed, til it stops running. If accessing nodered in a
117-
browser reports 404, you can safely assume it will be gone soon.</p>
115+
</section>

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.570
1+
0.0.571

0 commit comments

Comments
 (0)