forked from openiap/opencore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathControllers.ts
More file actions
7272 lines (6996 loc) · 316 KB
/
Copy pathControllers.ts
File metadata and controls
7272 lines (6996 loc) · 316 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { userdata, api, entityCtrl, entitiesCtrl } from "./CommonControllers";
import { TokenUser, QueueMessage, SigninMessage, Ace, NoderedUser, stripe_base, Base, NoderedUtil, WebSocketClient, Role, NoderedConfig, stripe_invoice, Message, Customer, KubeResources, KubeResourceValues, Resource, ResourceVariant, ResourceUsage } from "@openiap/openflow-api";
import { RPAWorkflow, Provider, Form, WorkflowInstance, Workflow, unattendedclient } from "./Entities";
import { WebSocketClientService } from "./WebSocketClientService";
import * as jsondiffpatch from "jsondiffpatch";
import * as ofurl from "./formsio_of_provider";
import { AddWorkitemMessage, AddWorkitemQueueMessage, DeleteWorkitemMessage, DeleteWorkitemQueueMessage, UpdateWorkitemMessage, UpdateWorkitemQueueMessage, Workitem, WorkitemQueue } from "@openiap/openflow-api";
declare let $: any;
function treatAsUTC(date): number {
const result = new Date(date);
result.setMinutes(result.getMinutes() - result.getTimezoneOffset());
return result as any;
}
function daysBetween(startDate, endDate): number {
const millisecondsPerDay = 24 * 60 * 60 * 1000;
return (treatAsUTC(endDate) - treatAsUTC(startDate)) / millisecondsPerDay;
}
declare const Formio: any;
declare const FileSaver: any;
export class jsutil {
public static async ensureJQuery() {
try {
const ele = $('body');
} catch (error) {
await this.loadScript("jquery.min.js");
}
}
public static async loadScript(url: string): Promise<void> {
return new Promise<void>(async (resolve) => {
var script = document.createElement("script")
script.type = "text/javascript";
script.onload = function () {
resolve();
};
script.src = url;
document.getElementsByTagName("head")[0].appendChild(script);
});
}
public static async getScript(url: string): Promise<void> {
return new Promise<void>(async (resolve, reject) => {
$.getScript(url, () => {
resolve();
}).fail((e1, e2, e3) => {
if (e1.readyState == 0) {
reject('script failed to load');
//script failed to load
} else if (e3 != null) {
reject(e3.toString());
} else {
reject('unknonw error loading ' + url);
}
});
});
}
}
export class MenuCtrl {
public user: TokenUser;
public signedin: boolean = false;
public path: string = "";
public searchstring: string = "";
public halfmoon: any;
public static $inject = [
"$rootScope",
"$scope",
"$location",
"$routeParams",
"WebSocketClientService",
"api",
"userdata"
];
public customer: Base;
public customers: Base[];
public allowclick: boolean = true;
constructor(
public $rootScope: ng.IRootScopeService,
public $scope: ng.IScope,
public $location: ng.ILocationService,
public $routeParams: ng.route.IRouteParamsService,
public WebSocketClientService: WebSocketClientService,
public api: api,
public userdata: userdata
) {
document.addEventListener(
"click",
(event) => {
try {
if (!this.allowclick) {
// event.cancelBubble = true;
event.stopImmediatePropagation();
return event.preventDefault();
}
} catch (error) {
console.error(error);
}
});
this.halfmoon = require("halfmoon");
console.debug("MenuCtrl::constructor");
$scope.$root.$on('$routeChangeStart', (...args) => { this.routeChangeStart.apply(this, args); });
this.path = this.$location.path();
this.halfmoon.onDOMContentLoaded();
const cleanup = this.$scope.$on('signin', async (event, data) => {
if (event && data) { }
this.user = data;
this.signedin = true;
this.customer = this.WebSocketClientService.customer;
this.customers = await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer" }, orderby: { "name": 1 }, top: 20 });
if (!NoderedUtil.IsNullEmpty(this.user.selectedcustomerid)) {
if (this.customers.filter(x => x._id == this.user.selectedcustomerid).length == 0) {
this.customers = (await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer", _id: this.user.selectedcustomerid } })).concat(this.customers);
}
}
if (!NoderedUtil.IsNullEmpty(this.user.customerid)) {
if (this.customers.filter(x => x._id == this.user.customerid).length == 0) {
this.customers = (await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer", _id: this.user.customerid } })).concat(this.customers);
}
}
if (!this.$scope.$$phase) { this.$scope.$apply(); }
this.StartNewFeaturesTour(null);
});
const cleanup2 = this.$scope.$on('refreshtoken', async (event, data) => {
if (event && data) { }
this.user = data;
this.signedin = true;
if (this.user.selectedcustomerid == null) {
this.customer = null;
} else {
this.customer = this.WebSocketClientService.customer;
this.customers = await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer" }, orderby: { "name": 1 }, top: 20 });
if (!NoderedUtil.IsNullEmpty(this.user.selectedcustomerid)) {
if (this.customers.filter(x => x._id == this.user.selectedcustomerid).length == 0) {
this.customers = (await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer", _id: this.user.selectedcustomerid } })).concat(this.customers);
}
}
if (!NoderedUtil.IsNullEmpty(this.user.customerid)) {
if (this.customers.filter(x => x._id == this.user.customerid).length == 0) {
this.customers = (await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer", _id: this.user.customerid } })).concat(this.customers);
}
}
if (this.customers && this.customers.length > 0) {
for (let cust of this.customers) {
if (cust._id == this.user.selectedcustomerid) {
this.customer = cust;
this.WebSocketClientService.customer = cust as any;
}
}
if (this.customers.length == 1) {
this.customer = this.customers[0];
this.WebSocketClientService.customer = this.customers[0] as any;
}
}
}
if (!this.$scope.$$phase) { this.$scope.$apply(); }
this.StartNewFeaturesTour(null)
// cleanup();
});
this.$scope.$on('setsearch', (event, data) => {
if (event && data) { }
this.searchstring = data;
});
this.$scope.$on('menurefresh', async (event, data) => {
if (event && data) { }
this.customer = this.WebSocketClientService.customer;
this.customers = await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer" }, orderby: { "name": 1 }, top: 20 });
if (!NoderedUtil.IsNullEmpty(this.user.selectedcustomerid)) {
if (this.customers.filter(x => x._id == this.user.selectedcustomerid).length == 0) {
this.customers = (await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer", _id: this.user.selectedcustomerid } })).concat(this.customers);
}
}
if (!NoderedUtil.IsNullEmpty(this.user.customerid)) {
if (this.customers.filter(x => x._id == this.user.customerid).length == 0) {
this.customers = (await NoderedUtil.Query({ collectionname: "users", query: { _type: "customer", _id: this.user.customerid } })).concat(this.customers);
}
}
if (this.customers.length > 0) {
for (let cust of this.customers)
if (cust._id == this.user.selectedcustomerid) this.customer = cust;
if (this.customers.length == 1) {
this.customer = this.customers[0];
this.WebSocketClientService.customer = this.customers[0] as any;
}
}
if (this.customer != null) this.WebSocketClientService.customer = this.customer as any;
if (!this.$scope.$$phase) { this.$scope.$apply(); }
});
}
routeChangeStart(event: any, next: any, current: any) {
this.path = this.$location.path();
}
hasrole(role: string) {
if (NoderedUtil.IsNullUndefinded(WebSocketClient.instance)) return false;
if (NoderedUtil.IsNullUndefinded(WebSocketClient.instance.user)) return false;
if (role == "customer admins" && !NoderedUtil.IsNullUndefinded(WebSocketClient.instance.user.customerid)) {
return true;
}
const hits = WebSocketClient.instance.user.roles.filter(member => member.name == role);
return (hits.length == 1)
}
hascordova() {
return this.WebSocketClientService.usingCordova;
}
stopimpersonation() {
// this.WebSocketClientService.loadToken();
this.WebSocketClientService.impersonate("-1");
}
PathIs(path: string) {
if (path == null && path == undefined) return false;
if (this.path == null && this.path == undefined) return false;
if (Array.isArray(path)) {
for (var i = 0; i < path.length; i++) {
if (path[i].endsWith("/") && this.path.toLowerCase().startsWith(path[i].toLowerCase()))
return true;
else if (this.path.toLowerCase() == path[i].toLowerCase()) {
return true;
}
}
return false;
} else {
if (path.endsWith("/") && this.path.toLowerCase().startsWith(path.toLowerCase()))
return true;
else if (this.path.toLowerCase() == path.toLowerCase()) {
return true;
}
return false;
}
}
toggleDarkMode() {
this.halfmoon.toggleDarkMode();
}
toggleSidebar() {
this.halfmoon.toggleSidebar();
}
Search() {
this.$rootScope.$broadcast("search", this.searchstring);
}
async EditCustomer(customer) {
try {
if (customer == null) return;
WebSocketClient.instance.user.selectedcustomerid = customer._id;
this.WebSocketClientService.customer = customer as any;
await NoderedUtil.SelectCustomer({ customerid: WebSocketClient.instance.user.selectedcustomerid });
this.$location.path("/Customer/" + customer._id);
if (!this.$scope.$$phase) { this.$scope.$apply(); }
} catch (error) {
console.error(error);
}
}
async SelectCustomer(customer) {
// if (customer != null) {
// console.debug("SelectCustomer " + customer.name, customer)
// } else {
// console.debug("SelectCustomer null", customer)
// }
try {
this.customer = customer;
if (customer != null) {
WebSocketClient.instance.user.selectedcustomerid = customer._id;
await NoderedUtil.SelectCustomer({ customerid: WebSocketClient.instance.user.selectedcustomerid });
this.WebSocketClientService.customer = customer as any;
if (this.PathIs("/Customer")) {
this.$location.path("/Customer/" + customer._id);
if (!this.$scope.$$phase) { this.$scope.$apply(); }
}
} else {
WebSocketClient.instance.user.selectedcustomerid = null;
await NoderedUtil.SelectCustomer({ customerid: WebSocketClient.instance.user.selectedcustomerid });
this.WebSocketClientService.customer = null;
}
// this.$rootScope.$broadcast("menurefresh");
this.$rootScope.$broadcast("search", this.searchstring);
} catch (error) {
console.error(error);
}
if (!this.$scope.$$phase) { this.$scope.$apply(); }
}
setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
const expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
getCookie(cname) {
const name = cname + "=";
const decodedCookie = decodeURIComponent(document.cookie);
const ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
public NewFeaturesTour: any;
public Shepherd = require("shepherd.js");
StartNewFeaturesTour(startfrom) {
try {
if (this.NewFeaturesTour != null) return;
if (!this.WebSocketClientService.enable_web_tours) return;
var me = this;
this.NewFeaturesTour = new this.Shepherd.Tour({
useModalOverlay: true,
tourName: 'featuretour',
exitOnEsc: true,
defaultStepOptions: {
cancelIcon: {
enabled: true
},
scrollTo: { behavior: 'smooth', block: 'center' }
},
});
let step: number = this.getCookie("newfeatures") as any;
if (NoderedUtil.IsNullEmpty(step)) step = 0;
if (!NoderedUtil.IsNullEmpty(startfrom)) {
step = startfrom;
}
step = parseInt(step as any);
this.NewFeaturesTour.on("show", (e) => {
const currentstep = parseInt(e.step.id);
if (currentstep < 0) {
step = step + 1;
this.setCookie("newfeatures", step, 365);
} else {
step = currentstep;
this.setCookie("newfeatures", currentstep, 365);
}
});
this.NewFeaturesTour.on("complete", (e) => {
this.NewFeaturesTour = null;
});
this.NewFeaturesTour.on("cancel", (e) => {
this.NewFeaturesTour = null;
});
const backbutton = {
action() {
return this.back();
},
classes: 'shepherd-button-secondary',
text: 'Back'
};
const nextbutton = {
action() {
return this.next();
},
text: 'Next'
};
const completebutton = {
action() {
return this.complete();
},
text: 'Complete'
};
this.NewFeaturesTour.addStep({
title: 'New User Interface in OpenFlow',
text: `The new UI in Openflow, allows for using darkmode, you can toogle darkmode on this button or you can use the keyboard shortcut Shift+D.`,
attachTo: {
element: '#menudarkmode'
},
buttons: [nextbutton],
id: '0'
});
if (this.WebSocketClientService.multi_tenant && this.customer == null && this.customers.length == 0) this.NewFeaturesTour.addStep({
title: 'Enable multi tenancy',
text: `Per default OpenFlow is running in a single user mode, where users cannot share information. Click here to create a new Customer, and enable access to multiple user, roles, control access to data and workflows and to buy additional services`,
attachTo: {
element: '#menumultitenant'
},
buttons: [backbutton, nextbutton],
id: '1'
});
if (this.hasrole("customer admins") || this.hasrole("resellers") || this.hasrole("admins")) {
if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length == 1) this.NewFeaturesTour.addStep({
title: 'Manage your company',
text: `Click here to manage you company details, this is also where you can check your next Invoice and how many services you have added`,
attachTo: {
element: '#menumanagecustomer'
},
buttons: [backbutton, nextbutton],
id: '50'
});
if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length > 0) this.NewFeaturesTour.addStep({
title: 'Manage your users ',
text: `Click here to manage your users. You can create, edit and delete new users, and you can purchase and assign new services to users here`,
attachTo: {
element: '#menuadminusers'
},
when: {
show() {
me.OpenAdminsMenu();
},
hide() {
me.CloseAllMenus();
}
},
buttons: [backbutton, nextbutton],
id: '51'
});
if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length > 1) this.NewFeaturesTour.addStep({
title: 'Select a company',
text: `Click here to select a company to work with. This will filter the users and roles list, and control what customer to add new items too`,
attachTo: {
element: '#menuresellermenu'
},
buttons: [backbutton, nextbutton],
id: '52'
});
}
if (this.NewFeaturesTour.steps.length > 0) {
const laststepid = parseInt(this.NewFeaturesTour.steps[this.NewFeaturesTour.steps.length - 1].id);
if (step <= laststepid) {
this.NewFeaturesTour.addStep({
title: 'Thank you for using OpenIAP',
text: `We hope you will enjoy the power of the leading open Source Integrated Automation Platform, click here to see different help tours.`,
attachTo: {
element: '#menutour'
},
buttons: [backbutton, completebutton],
id: '-1'
});
for (let i = 0; i < this.NewFeaturesTour.steps.length; i++) {
const _stepid = parseInt(this.NewFeaturesTour.steps[i].id);
if (_stepid < step) continue;
this.NewFeaturesTour.show(_stepid.toString())
return;
}
}
}
this.NewFeaturesTour = null;
} catch (error) {
console.error(error);
}
}
ListTours() {
var me = this;
try {
const tour = new this.Shepherd.Tour({
useModalOverlay: true,
tourName: 'listoftour',
exitOnEsc: true,
defaultStepOptions: {
cancelIcon: {
enabled: true
},
scrollTo: { behavior: 'smooth', block: 'center' }
},
});
let bottons: any[] = [];
bottons.push({
action() {
me.StartNewFeaturesTour(0);
return this.complete();
},
text: 'New Features'
});
if (this.WebSocketClientService.multi_tenant && this.customers.length > 0 && (this.hasrole("admins") ||
this.hasrole("resellers") || this.hasrole("customer admins"))) {
bottons.push({
action() {
me.StartManageCompanyTour();
return this.complete();
},
text: 'Manage Company'
});
}
bottons.push({
action() {
me.StartManageDataTour();
return this.complete();
},
text: 'Manage Data'
});
bottons.push({
action() {
me.StartManageRobotsAndNoderedTour();
return this.complete();
},
text: 'Manage Robots and Nodered'
});
if (this.WebSocketClientService.stripe_api_key == "pk_live_0XOJdv1fPLPnOnRn40CSdBsh009Ge1B2yI") {
tour.addStep({
title: 'What do you want to explorer ?',
text: `Select from one of the below guided tours to learn more. Use your keyboard arror keys to move back and forward and Esc to exit the tour. <br><small><i>For billing questions and sales support feel free to reach out on support@openiap.io, for all other questions use the <a class="text-primary" href="https://bb.openiap.io/" target="_blank" rel="noopener">forum</a> or <a class="text-primary" href="https://rocket.openiap.io/" target="_blank" rel="noopener">rocket</a> chat</i></small>`,
buttons: bottons,
id: 'tourlist'
});
} else {
tour.addStep({
title: 'What do you want to explorer ?',
text: `Select from one of the below guided tours to learn more. Use your keyboard arror keys to move back and forward and Esc to exit the tour.`,
buttons: bottons,
id: 'tourlist'
});
}
tour.start();
} catch (error) {
console.error(error);
}
}
OpenAdminsMenu() {
var me = this;
this.allowclick = false;
var target = document.getElementById("navbar-dropdown-toggle-btn-1");
this.halfmoon.deactivateAllDropdownToggles();
target.classList.add("active");
target.closest(".dropdown").classList.add("show");
setTimeout(() => {
me.allowclick = true;
}, 250);
}
CloseAllMenus() {
this.halfmoon.deactivateAllDropdownToggles();
}
StartManageCompanyTour() {
try {
var me = this;
const tour = new this.Shepherd.Tour({
useModalOverlay: false,
tourName: 'managecompanytour',
exitOnEsc: true,
defaultStepOptions: {
cancelIcon: {
enabled: true
},
scrollTo: { behavior: 'smooth', block: 'center' }
},
});
let step: number = 0;
tour.on("show", (e) => {
const currentstep = parseInt(e.step.id);
if (currentstep == 0 || currentstep == 2 || currentstep == 4) {
me.OpenAdminsMenu();
}
if (currentstep < 0) {
step = step + 1;
} else {
step = currentstep;
}
});
const backbutton = {
action() {
return this.back();
},
classes: 'shepherd-button-secondary',
text: 'Back'
};
const nextbutton = {
action() {
return this.next();
},
text: 'Next'
};
const completebutton = {
action() {
return this.complete();
},
text: 'Complete'
};
tour.addStep({
title: 'User management',
text: `You manage users by clicking Users in the admin menu`,
beforeShowPromise: function () {
return new Promise((resolve) => setTimeout(resolve, 250));
},
when: {
show() {
me.$location.path("/Users");
if (!me.$scope.$$phase) { me.$scope.$apply(); }
}
},
attachTo: {
element: '#menuadminusers',
on: 'bottom'
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [0, 15] } }]
},
buttons: [nextbutton],
id: '0'
});
tour.addStep({
title: 'User management',
text: `You assign new services to your users by clicking the <em class="fas fa-money-bill-wave"></em> icon. This require a valid vat number to have been added on the company page`,
beforeShowPromise: function () {
return new Promise((resolve) => setTimeout(resolve, 250));
},
when: {
show() {
}
},
buttons: [backbutton, nextbutton],
id: '1'
});
tour.addStep({
title: 'Roles management',
text: `You manage roles by clicking Roles in the admin menu. It is more efficent to use roles as a way to control access to resources and data. Many features will auto generate roles you can use to control access to these, like NodeRED workflows`,
beforeShowPromise: function () {
return new Promise((resolve) => setTimeout(resolve, 250));
},
when: {
show() {
}
},
attachTo: {
element: '#menuadminroles',
on: 'bottom'
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [0, 15] } }]
},
buttons: [backbutton, nextbutton],
id: '2'
});
tour.addStep({
title: 'Roles management',
text: `Roles is also how we load balance workload across multiple robots. Simply check RPA on the edit role page to allow assigning workflows to that role. Any robot that is only and not busy, will then pick up that workitem `,
attachTo: {
},
buttons: [backbutton, nextbutton],
id: '3'
});
tour.addStep({
title: 'Audit logs',
text: `This is the log of security events related to you and users you manage, this combined with the built in version control and on-the-fly encryption, makes it easy to comply with various regulatory demands like GDRP, FedRAMP, HIPAA etc. By default only your own entries are shown`,
beforeShowPromise: function () {
return new Promise((resolve) => setTimeout(resolve, 250));
},
when: {
show() {
me.$location.path("/Auditlogs");
if (!me.$scope.$$phase) { me.$scope.$apply(); }
}
},
attachTo: {
element: '#menuadminauditlogs',
on: 'bottom'
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [0, 15] } }]
},
buttons: [backbutton, completebutton],
id: '4'
});
// tour.addStep({
// title: 'Manage credentials',
// text: `For a more secure envoriment, it is a good practice to use encrypted credentials added here and not save those as plaintext in a robot workflow. Remember to give all robots access to the credentials.`,
// attachTo: {
// element: '#menuadmincredentials'
// },
// buttons: defaultbuttons,
// id: '3'
// });
// tour.addStep({
// title: 'Workflow forms',
// text: `Nodered Workflows allows you to design forms with an endless combination of different form elements to interact with users as part of a process`,
// attachTo: {
// element: '#menuadminforms'
// },
// buttons: defaultbuttons,
// id: '5'
// });
// tour.addStep({
// title: 'Files',
// text: `Files associated with robot workflows, forms and files you use as part of a Nodered workflow gets stored here. You can upload, download, delete and manage permissions on all files here. Remember to clean up, as a free user you only get 25 megabyte of storage`,
// attachTo: {
// element: '#menuadminfiles'
// },
// buttons: defaultbuttons,
// id: '6'
// });
// if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length > 1) tour.addStep({
// title: 'Enable multi tenancy',
// text: `Per default OpenFlow is running in a single user mode, where users cannot share information. Click here to create a new Customer, and enable access to multiple user, roles, control access to data and workflows and to buy additional services`,
// attachTo: {
// element: '#menumultitenant'
// },
// buttons: defaultbuttons,
// id: '7'
// });
// if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length < 2) tour.addStep({
// title: 'Manage you users ',
// text: `Click here to manage your users. You can create, edit and delete new users, and you can purchase and assign new services to users here`,
// attachTo: {
// element: '#menuadminusers'
// },
// buttons: defaultbuttons,
// id: '8'
// });
// if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length < 2) tour.addStep({
// title: 'Manage you roles',
// text: `Click here to manage your roles. It is much more efficent to use a role when assigning permissons`,
// attachTo: {
// element: '#menuadminroles'
// },
// buttons: defaultbuttons,
// id: '9'
// });
// if (this.WebSocketClientService.multi_tenant && this.customer != null && this.customers.length < 2) tour.addStep({
// title: 'Manage you company',
// text: `Click here to manage you company details, this is also where you can check your next Invoice and how many services you have added`,
// attachTo: {
// element: '#menumanagecustomer'
// },
// buttons: defaultbuttons,
// id: '10'
// });
// tour.addStep({
// title: 'Rerun tour',
// text: `We hope you will enjoy the power on the leading opensource automation platform, click here to restart all tour steps.`,
// attachTo: {
// element: '#menutour'
// },
// buttons: [
// {
// action() {
// return this.back();
// },
// classes: 'shepherd-button-secondary',
// text: 'Back'
// },
// {
// action() {
// return this.cancel();
// },
// text: 'Exit'
// }
// ],
// id: '-1'
// });
for (let i = 0; i < tour.steps.length; i++) {
const _stepid = parseInt(tour.steps[i].id);
if (_stepid < step) continue;
tour.show(_stepid.toString())
break;
}
} catch (error) {
console.error(error);
}
}
StartManageDataTour() {
try {
var me = this;
const tour = new this.Shepherd.Tour({
useModalOverlay: false,
tourName: 'managedatatour',
exitOnEsc: true,
defaultStepOptions: {
cancelIcon: {
enabled: true
},
scrollTo: { behavior: 'smooth', block: 'center' }
},
});
let step: number = 0;
tour.on("show", (e) => {
const currentstep = parseInt(e.step.id);
// if (currentstep == 0 || currentstep == 2 || currentstep == 4) {
// me.OpenAdminsMenu();
// }
if (currentstep < 0) {
step = step + 1;
} else {
step = currentstep;
}
});
const backbutton = {
action() {
return this.back();
},
classes: 'shepherd-button-secondary',
text: 'Back'
};
const nextbutton = {
action() {
return this.next();
},
text: 'Next'
};
tour.addStep({
title: 'Managing Data',
text: `OpenFlow is primarily a database with an security layer, and an api to orchestrate multiple NodeRED and OpenRPA robots. Data is there for a central element of understanding and getting the ful benefit of the platform`,
buttons: [nextbutton],
id: '0'
});
tour.addStep({
title: 'Managing Data',
text: `Most pages is a "view" on the data, but you can access ALL data inside the database, by clicking entities in the menu`,
attachTo: {
element: '#menuentities',
on: 'bottom'
},
when: {
hide() {
delete me.userdata.data.EntitiesCtrl;
me.$location.path("/Entities/entities");
if (!me.$scope.$$phase) { me.$scope.$apply(); }
}
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [50, 10] } }]
},
buttons: [backbutton, nextbutton],
id: '1'
});
tour.addStep({
title: 'Managing Data',
text: `The database contains a list of collections, similar to tables in an traditional relational database. We can store different kinds of data in the same collection, and there for group, and search our data in a more meaningful way`,
beforeShowPromise: function () {
return new Promise((resolve) => setTimeout(resolve, 250));
},
attachTo: {
element: '#menucollections',
on: 'bottom'
},
when: {
hide() {
delete me.userdata.data.EntitiesCtrl;
me.$location.path("/Entities/users");
if (!me.$scope.$$phase) { me.$scope.$apply(); }
}
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [50, 20] } }]
},
buttons: [backbutton, nextbutton],
id: '2'
});
tour.addStep({
title: 'Managing Data',
text: `I selected the "users" collection, and as you can see it contains both user and role objects.<br>
Clicking <em class="fas fa-notes-medical"></em> will open the history for that object, allowing you to see different versions of the object<br>
<em class="fas fa-edit"></em> to edit and set permissions, <em
class="fas fa-trash"></em> to delete the entity`,
buttons: [backbutton, nextbutton],
id: '3'
});
tour.addStep({
title: 'Managing Data',
text: `Up here we have access to Undelete <em class="fas fa-undo"></em> to restore deleted object, <em class="fas fa-clone"></em> clone tool, that allows us to group all data by different keys and <em class="fas fa-plus"></em> to add a new entity to this collection`,
attachTo: {
element: '#entitiestools',
on: 'bottom'
},
when: {
hide() {
me.$location.path("/Entity/entities");
delete me.userdata.data.EntitiesCtrl;
if (!me.$scope.$$phase) { me.$scope.$apply(); }
}
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [0, 20] } }]
},
buttons: [backbutton, nextbutton],
id: '4'
});
tour.addStep({
title: 'Managing Data',
text: `When adding data, either from the webpage, a robot, NodeRED, PowerShell or the API, you need to comply with the entity restrictions setup for this OpenFlow instance, you will get an Access Denied if you do not have the right create permissions.`,
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [50, 20] } }]
},
buttons: [backbutton, nextbutton],
id: '5'
});
tour.addStep({
title: 'Managing Data',
text: `Every entity in the database has an Access Control List that defines who can read, edit, delete or invoke this entity. Invoke will have different meanings for different types of entities`,
attachTo: {
element: '#entitypermissions',
on: 'bottom'
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [50, 40] } }]
},
buttons: [backbutton, nextbutton],
id: '6'
});
tour.addStep({
title: 'Managing Data',
text: `Hear you can search for, and then add any user or role. You define what right you want to assign them. As a rule of thumb use roles, and not users unless absolutely necessary. Even with a low number of users it is often much more effecient to use roles to control permissions, than having to go back and update the permissions on all objects later to add/remove a user.`,
attachTo: {
element: '#addusergroup',
on: 'bottom'
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [50, 20] } }]
},
buttons: [backbutton, nextbutton],
id: '7'
});
tour.addStep({
title: 'Managing Data',
text: `By default you get an structured view that allows adding or removing properties, but you are free to click the "show json" button to edit the object directly`,
attachTo: {
element: '#enableshowjson',
on: 'bottom'
},
popperOptions: {
modifiers: [{ name: 'offset', options: { offset: [50, 20] } }]
},
buttons: [backbutton, nextbutton],
id: '8'
});
for (let i = 0; i < tour.steps.length; i++) {
const _stepid = parseInt(tour.steps[i].id);
if (_stepid < step) continue;
tour.show(_stepid.toString())
break;
}
} catch (error) {
console.error(error);
}
}
StartManageRobotsAndNoderedTour() {
try {
var me = this;
const tour = new this.Shepherd.Tour({
useModalOverlay: false,
tourName: 'managerobotnoderedtour',
exitOnEsc: true,
defaultStepOptions: {
cancelIcon: {
enabled: true
},
scrollTo: { behavior: 'smooth', block: 'center' }
},
});
let step: number = 0;
tour.on("show", (e) => {
const currentstep = parseInt(e.step.id);
if (currentstep == 0 || currentstep == 1 || currentstep == 3 || currentstep == 6) {
me.OpenAdminsMenu();
}
if (currentstep < 0) {
step = step + 1;
} else {
step = currentstep;
}
});
const backbutton = {
action() {
return this.back();
},
classes: 'shepherd-button-secondary',
text: 'Back'
};
const nextbutton = {
action() {
return this.next();
},
text: 'Next'
};
const completebutton = {