Skip to content

Commit f15d3e6

Browse files
committed
minor fix to select customer
1 parent 2ecb54d commit f15d3e6

7 files changed

Lines changed: 45 additions & 19 deletions

File tree

OpenFlow/src/Messages/Message.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,10 @@ export class Message {
507507
await this.EnsureCustomer(cli, span);
508508
break;
509509
case "selectcustomer":
510+
this.EnsureJWT(cli);
510511
await this.SelectCustomer(span);
511-
this.ReloadUserToken(cli, span)
512+
this.ReloadUserToken(cli, span);
513+
cli.Send(this);
512514
break;
513515
case "housekeeping":
514516
this.EnsureJWT(cli);

OpenFlow/src/public/Controllers.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,16 @@ export class MenuCtrl {
187187
this.$rootScope.$broadcast("search", this.searchstring);
188188
}
189189
async EditCustomer(customer) {
190-
if (customer == null) return;
191-
this.WebSocketClientService.user.selectedcustomerid = customer._id;
192-
this.WebSocketClientService.customer = customer as any;
193-
await NoderedUtil.SelectCustomer(this.WebSocketClientService.user.selectedcustomerid, null, 2);
194-
this.$location.path("/Customer/" + customer._id);
195-
if (!this.$scope.$$phase) { this.$scope.$apply(); }
190+
try {
191+
if (customer == null) return;
192+
this.WebSocketClientService.user.selectedcustomerid = customer._id;
193+
this.WebSocketClientService.customer = customer as any;
194+
await NoderedUtil.SelectCustomer(this.WebSocketClientService.user.selectedcustomerid, null, 2);
195+
this.$location.path("/Customer/" + customer._id);
196+
if (!this.$scope.$$phase) { this.$scope.$apply(); }
197+
} catch (error) {
198+
console.error(error);
199+
}
196200
}
197201
async SelectCustomer(customer) {
198202
// if (customer != null) {

OpenFlow/src/public/Customer.html

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ <h1 class="pagetitle" translate lib="web">customer</h1>
77
<div class="row"
88
ng-show="ctrl.WebSocketClientService.customer == null && menuctrl.WebSocketClientService.stripe_api_key && menuctrl.WebSocketClientService.stripe_api_key != ''">
99
<div class="col-sm-7">
10-
To enable multitenancy and purchase options, you need to fill out the form below.<br><br>
10+
To enable multitenancy you need to fill out the form below.<br>
11+
To allow purchase options TAX/VAT is mandatory<br>
12+
</div>
13+
</div>
14+
<div class="row"
15+
ng-show="ctrl.WebSocketClientService.customer != null && menuctrl.WebSocketClientService.stripe_api_key && menuctrl.WebSocketClientService.stripe_api_key != '' && (ctrl.WebSocketClientService.customer.stripeid == '' || ctrl.WebSocketClientService.customer.stripeid == null) ">
16+
<div class="col-sm-7">
17+
To allow purchase a valid TAX/VAT number is mandatory<br><br>
1118
</div>
1219
</div>
1320

@@ -346,6 +353,12 @@ <h1 class="pagetitle" translate lib="web">customer</h1>
346353
<format-bytes ng-model="ctrl.model.dbusage" ng-show="ctrl.model.dbusage" />
347354
<format-bytes ng-model="WebSocketClientService.user.dbusage" ng-show="!ctrl.model.dbusage" />
348355
</div>
356+
<div class="row"
357+
ng-show="ctrl.WebSocketClientService.customer != null && menuctrl.WebSocketClientService.stripe_api_key && menuctrl.WebSocketClientService.stripe_api_key != '' && (ctrl.WebSocketClientService.customer.stripeid != '' && ctrl.WebSocketClientService.customer.stripeid != null) ">
358+
<div class="col-sm-7">
359+
<h4>Buy/manage company plans</h4><br><br>
360+
</div>
361+
</div>
349362
<div ng-repeat="Resource in ctrl.Resources | orderBy: 'order'" ng-show="ctrl.model.stripeid">
350363
<div class="row" ng-repeat="Product in Resource.products | orderBy: 'order'"
351364
ng-show="Resource.customerassign == 'multiplevariants'">
@@ -397,7 +410,14 @@ <h1 class="pagetitle" translate lib="web">customer</h1>
397410
</div>
398411

399412

400-
<h1 ng-show="ctrl.model.stripeid">User assigned plans</h1>
413+
<div class="row"
414+
ng-show="ctrl.WebSocketClientService.customer != null && menuctrl.WebSocketClientService.stripe_api_key && menuctrl.WebSocketClientService.stripe_api_key != '' && (ctrl.WebSocketClientService.customer.stripeid != '' && ctrl.WebSocketClientService.customer.stripeid != null) ">
415+
<div class="col-sm-7">
416+
<h4>Buy/manage user plans <a href="#/Users">here</a></h4><br><br>
417+
418+
</div>
419+
</div>
420+
401421

402422
<div ng-repeat="Resource in ctrl.UserResources | orderBy: 'order'" ng-show="ctrl.model.stripeid">
403423
<h4>{{Resource.name}}</h4>

OpenFlow/src/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292

9393
<div id="menumanagecustomer" ng-class="{active: menuctrl.PathIs('/Customer')}"
9494
ng-show="menuctrl.WebSocketClientService.multi_tenant && menuctrl.customer != null && menuctrl.customers.length == 1">
95-
<a href ng-click="menuctrl.EditCustomer(menuctrl.customer)" class="nav-link">Manage
95+
<a href ng-click="menuctrl.EditCustomer(menuctrl.customer)" class="nav-link">Buy/Manage
9696
{{menuctrl.customer.name}}</a>
9797
</div>
9898

OpenFlowNodeRED/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/nodered",
3-
"version": "1.3.45",
3+
"version": "1.3.46",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {
@@ -26,11 +26,11 @@
2626
"dependencies": {
2727
"@nodemailer/mailparser2": "^1.0.3",
2828
"@openiap/openflow-api": "^1.0.108",
29-
"@opentelemetry/api": "^0.18.1",
30-
"@opentelemetry/core": "^0.19.0",
31-
"@opentelemetry/exporter-collector-grpc": "^0.19.0",
32-
"@opentelemetry/metrics": "^0.19.0",
33-
"@opentelemetry/tracing": "^0.19.0",
29+
"@opentelemetry/api": "1.0.0-rc.3",
30+
"@opentelemetry/core": "0.19.0",
31+
"@opentelemetry/exporter-collector-grpc": "0.19.0",
32+
"@opentelemetry/metrics": "0.19.0",
33+
"@opentelemetry/tracing": "0.19.0",
3434
"async-retry": "^1.3.1",
3535
"body-parser": "^1.19.0",
3636
"command-line-args": "^5.1.1",

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.3.45
1+
1.3.46

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@openiap/openflow",
3-
"version": "1.3.45",
3+
"version": "1.3.46",
44
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
55
"main": "index.js",
66
"scripts": {
@@ -108,4 +108,4 @@
108108
"typescript": "^4.3.4",
109109
"watchify": "^4.0.0"
110110
}
111-
}
111+
}

0 commit comments

Comments
 (0)