Skip to content

Commit 978df97

Browse files
committed
improve showing errors
1 parent ed3c8eb commit 978df97

7 files changed

Lines changed: 60 additions & 35 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ module openflow {
4646
if (data.data.command == "invokecompleted") {
4747
this.arguments = data.data.data;
4848
}
49+
if (data.data.command == "invokefailed") {
50+
if (data.data && data.data.data && data.data.data.Message) {
51+
this.errormessage = data.data.data.Message;
52+
} else {
53+
this.errormessage = JSON.stringify(data.data);
54+
}
55+
56+
}
57+
4958
if (!this.$scope.$$phase) { this.$scope.$apply(); }
5059
});
5160

@@ -64,16 +73,13 @@ module openflow {
6473
if (!this.$scope.$$phase) { this.$scope.$apply(); }
6574
}
6675
async submit(): Promise<void> {
76+
this.errormessage = "";
6777
var rpacommand = {
6878
command: "invoke",
6979
workflowid: this.model._id,
7080
data: this.arguments
7181
}
7282
if (this.arguments === null || this.arguments === undefined) { this.arguments = {}; }
73-
// var message = {
74-
// jwt: this.WebSocketClient.jwt,
75-
// payload: rpacommand
76-
// }
7783
var result: any = await this.api.QueueMessage(this.user._id, rpacommand);
7884
try {
7985
// result = JSON.parse(result);
@@ -98,7 +104,7 @@ module openflow {
98104
console.debug("RPAWorkflowsCtrl");
99105
this.collection = "openrpa";
100106
this.basequery = { _type: "workflow" };
101-
this.baseprojection = { _type: 1, type: 1, name: 1, _created: 1, _createdby: 1, _modified: 1 };
107+
this.baseprojection = { _type: 1, type: 1, name: 1, _created: 1, _createdby: 1, _modified: 1, projectandname: 1 };
102108
this.postloadData = this.processdata;
103109
WebSocketClient.onSignedin((user: TokenUser) => {
104110
this.loadData();
@@ -2642,8 +2648,8 @@ module openflow {
26422648
"api"
26432649
];
26442650
public messages: string = "";
2651+
public errormessage: string = "";
26452652
public queuename: string = "webtest";
2646-
public message: string = "Hi mom";
26472653
public noderedurl: string = "";
26482654
public instance: any = null;
26492655
public instancestatus: string = "";
@@ -2692,30 +2698,37 @@ module openflow {
26922698
});
26932699
}
26942700
async save() {
2695-
if (this.limitsmemory != "") {
2696-
if (this.user.nodered == null) this.user.nodered = new noderedconfig();
2697-
if (this.user.nodered.resources == null) this.user.nodered.resources = new resources();
2698-
if (this.user.nodered.resources.limits == null) this.user.nodered.resources.limits = new resourcevalues();
2699-
if (this.user.nodered.resources.limits.memory != this.limitsmemory) {
2700-
this.user.nodered.resources.limits.memory = this.limitsmemory;
2701-
}
2702-
} else {
2703-
if (this.user.nodered != null && this.user.nodered.resources != null && this.user.nodered.resources.limits != null) {
2704-
if (this.limitsmemory != this.user.nodered.resources.limits.memory) {
2701+
try {
2702+
this.errormessage = "";
2703+
if (this.limitsmemory != "") {
2704+
if (this.user.nodered == null) this.user.nodered = new noderedconfig();
2705+
if (this.user.nodered.resources == null) this.user.nodered.resources = new resources();
2706+
if (this.user.nodered.resources.limits == null) this.user.nodered.resources.limits = new resourcevalues();
2707+
if (this.user.nodered.resources.limits.memory != this.limitsmemory) {
27052708
this.user.nodered.resources.limits.memory = this.limitsmemory;
27062709
}
2710+
} else {
2711+
if (this.user.nodered != null && this.user.nodered.resources != null && this.user.nodered.resources.limits != null) {
2712+
if (this.limitsmemory != this.user.nodered.resources.limits.memory) {
2713+
this.user.nodered.resources.limits.memory = this.limitsmemory;
2714+
}
2715+
}
27072716
}
2717+
this.loading = true;
2718+
this.messages += 'Updating ' + this.user.name + "\n";
2719+
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2720+
await this.api.Update("users", this.user);
2721+
this.loading = false;
2722+
this.messages += 'update complete\n';
2723+
} catch (error) {
2724+
this.errormessage = error;
27082725
}
2709-
this.loading = true;
2710-
this.messages += 'Updating ' + this.user.name + "\n";
2711-
if (!this.$scope.$$phase) { this.$scope.$apply(); }
2712-
await this.api.Update("users", this.user);
27132726
this.loading = false;
2714-
this.messages += 'update complete\n';
27152727
if (!this.$scope.$$phase) { this.$scope.$apply(); }
27162728
}
27172729
async GetNoderedInstance() {
27182730
try {
2731+
this.errormessage = "";
27192732
this.instancestatus = "fetching status";
27202733

27212734
this.instance = await this.api.GetNoderedInstance(this.userid, this.name);
@@ -2732,6 +2745,7 @@ module openflow {
27322745
}
27332746
this.messages += "GetNoderedInstance completed, status " + this.instancestatus + "\n";
27342747
} catch (error) {
2748+
this.errormessage = error;
27352749
this.messages += error + "\n";
27362750
this.instancestatus = "";
27372751
console.error(error);
@@ -2741,13 +2755,15 @@ module openflow {
27412755
}
27422756
async GetNoderedInstanceLog() {
27432757
try {
2758+
this.errormessage = "";
27442759
this.instancestatus = "fetching log";
27452760
console.debug("GetNoderedInstanceLog:");
27462761
this.instancelog = await this.api.GetNoderedInstanceLog(this.userid, this.name);
27472762
this.instancelog = this.instancelog.split("\n").reverse().join("\n");
27482763
this.messages += "GetNoderedInstanceLog completed\n";
27492764
this.instancestatus = "";
27502765
} catch (error) {
2766+
this.errormessage = error;
27512767
this.messages += error + "\n";
27522768
this.instancestatus = "";
27532769
console.error(error);
@@ -2756,9 +2772,11 @@ module openflow {
27562772
}
27572773
async EnsureNoderedInstance() {
27582774
try {
2775+
this.errormessage = "";
27592776
await this.api.EnsureNoderedInstance(this.userid, this.name);
27602777
this.messages += "EnsureNoderedInstance completed" + "\n";
27612778
} catch (error) {
2779+
this.errormessage = error;
27622780
this.messages += error + "\n";
27632781
console.error(error);
27642782
}
@@ -2767,9 +2785,11 @@ module openflow {
27672785
}
27682786
async DeleteNoderedInstance() {
27692787
try {
2788+
this.errormessage = "";
27702789
await this.api.DeleteNoderedInstance(this.userid, this.name);
27712790
this.messages += "DeleteNoderedInstance completed" + "\n";
27722791
} catch (error) {
2792+
this.errormessage = error;
27732793
this.messages += error + "\n";
27742794
console.error(error);
27752795
}
@@ -2778,9 +2798,11 @@ module openflow {
27782798
}
27792799
async RestartNoderedInstance() {
27802800
try {
2801+
this.errormessage = "";
27812802
await this.api.RestartNoderedInstance(this.userid, this.name);
27822803
this.messages += "RestartNoderedInstance completed" + "\n";
27832804
} catch (error) {
2805+
this.errormessage = error;
27842806
this.messages += error + "\n";
27852807
console.error(error);
27862808
}
@@ -2789,9 +2811,11 @@ module openflow {
27892811
}
27902812
async StartNoderedInstance() {
27912813
try {
2814+
this.errormessage = "";
27922815
await this.api.StartNoderedInstance(this.userid, this.name);
27932816
this.messages += "StartNoderedInstance completed" + "\n";
27942817
} catch (error) {
2818+
this.errormessage = error;
27952819
this.messages += error + "\n";
27962820
console.error(error);
27972821
}
@@ -2800,24 +2824,24 @@ module openflow {
28002824
}
28012825
async StopNoderedInstance() {
28022826
try {
2827+
this.errormessage = "";
28032828
await this.api.StopNoderedInstance(this.userid, this.name);
28042829
this.messages += "StopNoderedInstance completed" + "\n";
28052830
} catch (error) {
2831+
this.errormessage = error;
28062832
this.messages += error + "\n";
28072833
console.error(error);
28082834
}
28092835
if (!this.$scope.$$phase) { this.$scope.$apply(); }
28102836
this.GetNoderedInstance();
28112837
}
2812-
2813-
async submit() {
2814-
await this.SendOne(this.queuename, this.message);
2815-
}
28162838
async SendOne(queuename: string, message: any): Promise<void> {
28172839
var result: any = await this.api.QueueMessage(queuename, message);
28182840
try {
2841+
this.errormessage = "";
28192842
// result = JSON.parse(result);
28202843
} catch (error) {
2844+
this.errormessage = error;
28212845
}
28222846
this.messages += result + "\n";
28232847
if (!this.$scope.$$phase) { this.$scope.$apply(); }

OpenFlow/src/public/Nodered.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<h1 translate lib="web">sockets</h1>
33
</div>
44

5-
<form ng-submit="ctrl.submit()" class="form-horizontal" role="form" autocomplete="off" ng-hide="ctrl.showjson==true">
5+
<form class="form-horizontal" role="form" autocomplete="off" ng-hide="ctrl.showjson==true">
66
<section>
77
<div class="form-group">
88
<div class="col-sm-offset-2 col-sm-10">
@@ -87,8 +87,9 @@ <h1 translate lib="web">sockets</h1>
8787
</div>
8888
</section>
8989

90+
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-primary" role="alert">{{ctrl.messages}}</div>
91+
9092

91-
<pre>{{ ctrl.messages }}</pre>
9293
<p>If this is your first time creating a NodeRed instance, please signout and signin again, to refresh group
9394
memberships for your user</p>
9495
<p>It can take a few minutes from you order a deletion of NodeRed, til it stops running. If accessing nodered in a

OpenFlow/src/public/RPAWorkflow.html

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
<h1 class="pagetitle">{{ctrl.model.name}}</h1>
44
</div>
55
</div>
6-
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
7-
<pre ng-show="ctrl.message!=null">{{ ctrl.message }}</pre>
86
<form ng-submit="ctrl.submit()" class="form-horizontal" role="form" autocomplete="off" ng-hide="ctrl.showjson==true">
97
<section>
108
<div class="form-group">
@@ -33,6 +31,6 @@ <h1 class="pagetitle">{{ctrl.model.name}}</h1>
3331
</div>
3432
</div>
3533
</form>
36-
{{ ctrl.arguments }}
34+
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
3735

38-
<pre ng-show="ctrl.messages!=null">{{ ctrl.messages }}</pre>
36+
<pre ng-show="ctrl.messages!=''" class=" alert alert-primary" role="alert">{{ ctrl.messages }}</pre>

OpenFlow/src/public/RPAWorkflows.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ <h1 translate lib="web">rpaworkflows</h1>
1515
<table id="table1" class="table table-striped" when-scrolled="ctrl.more()" style="width: 100%;">
1616
<thead class="thead-dark">
1717
<tr>
18-
<th ng-click="ctrl.ToggleOrder('name')"><b translate lib="web">name</b></th>
18+
<th ng-click="ctrl.ToggleOrder('projectandname')"><b translate lib="web">projectandname</b></th>
1919
<th ng-click="ctrl.ToggleOrder('_createdby')"><b translate lib="web">who</b></th>
2020
<th ng-click="ctrl.ToggleOrder('_modified')"><b translate lib="web">updated</b></th>
2121
<th>Runs last 5 days</th>
@@ -24,7 +24,7 @@ <h1 translate lib="web">rpaworkflows</h1>
2424
</thead>
2525
<tbody>
2626
<tr ng-repeat="model in ctrl.models">
27-
<td>{{model.name}}</td>
27+
<td>{{model.projectandname}}</td>
2828
<td>{{model._createdby}}</td>
2929
<td>
3030
<timesince ng-model="model._modified" />

OpenFlowNodeRED/src/nodered/nodes/workflow.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
$.getJSON('workflow_forms', function (data) {
108108
$('#node-input-form-select').empty();
109109
$('#node-input-form-select').append($('<option>', {
110-
value: null,
110+
value: "",
111111
text: "none"
112112
}));
113113
$.each(data, function (i, ele) {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.549
1+
0.0.550

readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,6 @@ Lastly we need to start a background job that copies asserts to the dist folder,
115115

116116
`gulp`
117117

118+
You can now access openflow web on [http://localhost.openrpa.dk](http://localhost.openrpa.dk) and nodered on [http://localhost.openrpa.dk:1880](http://localhost.openrpa.dk:1880)
119+
118120
For further help or education contact [OpenIAP](https://openrpa.dk/) for a support agreement

0 commit comments

Comments
 (0)