@lowcodeunit/applications-flow-common 1.39.87-enterprise-switch-fix → 1.39.88-enterprise-switch-fix
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/services/eac.service.mjs +14 -4
- package/esm2020/lib/services/project.service.mjs +103 -75
- package/fesm2015/lowcodeunit-applications-flow-common.mjs +119 -79
- package/fesm2015/lowcodeunit-applications-flow-common.mjs.map +1 -1
- package/fesm2020/lowcodeunit-applications-flow-common.mjs +115 -77
- package/fesm2020/lowcodeunit-applications-flow-common.mjs.map +1 -1
- package/package.json +1 -1
@@ -491,65 +491,74 @@ class ProjectService {
|
|
491
491
|
async ListEnterprises(state) {
|
492
492
|
return new Promise((resolve, reject) => {
|
493
493
|
state.LoadingEnterprises = true;
|
494
|
-
this.appsFlowSvc.ListEnterprises().subscribe(
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
494
|
+
this.appsFlowSvc.ListEnterprises().subscribe({
|
495
|
+
next: async (response) => {
|
496
|
+
// console.log('list Enterprises resp: ', response);
|
497
|
+
state.LoadingEnterprises = false;
|
498
|
+
if (response.Status.Code === 0) {
|
499
|
+
state.Enterprises = response.Model;
|
500
|
+
resolve(response.Model);
|
501
|
+
}
|
502
|
+
else {
|
503
|
+
reject(response.Status);
|
504
|
+
// console.log(response);
|
505
|
+
}
|
506
|
+
},
|
507
|
+
error: (err) => {
|
508
|
+
state.LoadingEnterprises = false;
|
509
|
+
reject(err);
|
510
|
+
console.log(err);
|
511
|
+
},
|
509
512
|
});
|
510
513
|
});
|
511
514
|
}
|
512
|
-
LoadEnterpriseAsCode(state) {
|
515
|
+
async LoadEnterpriseAsCode(state) {
|
513
516
|
return new Promise((resolve, reject) => {
|
514
|
-
|
515
|
-
state.Loading = true;
|
516
|
-
state.LoadingActiveEnterprise = true;
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
state.
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
let
|
537
|
-
if (
|
538
|
-
|
539
|
-
let
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
517
|
+
console.log('Load ent called!!!');
|
518
|
+
// state.Loading = true;
|
519
|
+
// state.LoadingActiveEnterprise = true;
|
520
|
+
// BaseModeledResponse<EnterpriseAsCode>
|
521
|
+
this.appsFlowSvc.LoadEnterpriseAsCode().subscribe({
|
522
|
+
next: (response) => {
|
523
|
+
console.log('State at Load ent: ', state);
|
524
|
+
state.Loading = false;
|
525
|
+
state.LoadingActiveEnterprise = false;
|
526
|
+
console.log('Load eac State after set Loading FALSE: ', state);
|
527
|
+
if (response.Status.Code === 0) {
|
528
|
+
state.EaC = response.Model || {};
|
529
|
+
}
|
530
|
+
else if (response.Status.Code === 3) {
|
531
|
+
}
|
532
|
+
state.EaC = state.EaC || {};
|
533
|
+
// console.log('state.eac = ', state.EaC);
|
534
|
+
this.CreatingProject =
|
535
|
+
Object.keys(state?.EaC?.Projects || {}).length <= 0;
|
536
|
+
resolve(state.EaC);
|
537
|
+
this.activatedRoute.queryParams.subscribe((params) => {
|
538
|
+
if (params?.direct == 'true') {
|
539
|
+
let projKeys = Object.keys(state.EaC.Projects || {});
|
540
|
+
if (projKeys.length == 1) {
|
541
|
+
// console.log('Directing to deeper link');
|
542
|
+
let appKeys = Object.keys(state.EaC.Applications || {});
|
543
|
+
if (appKeys.length == 1) {
|
544
|
+
let app = state.EaC.Applications[appKeys[0]];
|
545
|
+
let routeKey = encodeURIComponent(app.LookupConfig.PathRegex?.replace('.*', '') || '/');
|
546
|
+
window.location.href = `/dashboard/application/${appKeys[0]}/${routeKey}/${projKeys[0]}`;
|
547
|
+
}
|
548
|
+
else {
|
549
|
+
window.location.href = `/dashboard/project/${projKeys[0]}`;
|
550
|
+
}
|
544
551
|
}
|
545
552
|
}
|
546
|
-
}
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
+
});
|
554
|
+
// console.log(state);
|
555
|
+
},
|
556
|
+
error: (err) => {
|
557
|
+
console.log('Load EAC ERROR Block');
|
558
|
+
state.Loading = false;
|
559
|
+
reject(err);
|
560
|
+
console.error(err);
|
561
|
+
},
|
553
562
|
});
|
554
563
|
});
|
555
564
|
}
|
@@ -612,7 +621,6 @@ class ProjectService {
|
|
612
621
|
state.LoadingActiveEnterprise = true;
|
613
622
|
state.LoadingFeed = true;
|
614
623
|
state.ActiveEnterpriseLookup = activeEntLookup;
|
615
|
-
// state.LoadingFeed = true;
|
616
624
|
this.appsFlowSvc.SetActiveEnterprise(activeEntLookup).subscribe(async (response) => {
|
617
625
|
if (response.Status.Code === 0) {
|
618
626
|
this.EditingProjectLookup = null;
|
@@ -657,32 +665,52 @@ class ProjectService {
|
|
657
665
|
}
|
658
666
|
async SaveEnterpriseAsCode(state, eac) {
|
659
667
|
return new Promise((resolve, reject) => {
|
668
|
+
console.log('save EAC called');
|
660
669
|
state.Loading = true;
|
670
|
+
state.LoadingActiveEnterprise = true;
|
661
671
|
// console.log('eac: ', eac);
|
662
|
-
this.appsFlowSvc
|
663
|
-
|
664
|
-
|
665
|
-
|
672
|
+
let saveEntSub = this.appsFlowSvc
|
673
|
+
.SaveEnterpriseAsCode(eac)
|
674
|
+
.subscribe({
|
675
|
+
next: async (response) => {
|
676
|
+
if (response.Status.Code === 0) {
|
677
|
+
resolve(response.Status);
|
678
|
+
console.log('Save EAC Success');
|
679
|
+
// var results = Promise.all([
|
666
680
|
// this.EnsureUserEnterprise(state),
|
667
|
-
this.LoadEnterpriseAsCode(state),
|
668
|
-
this.ListEnterprises(state),
|
681
|
+
// this.LoadEnterpriseAsCode(state),
|
682
|
+
// this.ListEnterprises(state),
|
669
683
|
// this.GetActiveEnterprise(state),
|
670
|
-
this.LoadUserFeed(
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
684
|
+
// this.LoadUserFeed(
|
685
|
+
// 1,
|
686
|
+
// 25,
|
687
|
+
// localStorage.getItem('activeFilter')
|
688
|
+
// ? localStorage.getItem('activeFilter')
|
689
|
+
// : '',
|
690
|
+
// false,
|
691
|
+
// state
|
692
|
+
// ),
|
693
|
+
// ]);
|
694
|
+
var results = this.LoadEnterpriseAsCode(state);
|
695
|
+
console.log('LOAD EAC RESULTS: ', results);
|
696
|
+
state.Loading = false;
|
697
|
+
state.LoadingActiveEnterprise = false;
|
698
|
+
console.log('State from save eac: ', state);
|
699
|
+
}
|
700
|
+
else {
|
701
|
+
state.Loading = false;
|
702
|
+
reject(response.Status);
|
703
|
+
// console.log(response);
|
704
|
+
}
|
705
|
+
},
|
706
|
+
error: (err) => {
|
677
707
|
state.Loading = false;
|
678
|
-
reject(
|
679
|
-
|
680
|
-
}
|
681
|
-
}, (err) => {
|
682
|
-
state.Loading = false;
|
683
|
-
reject(err);
|
684
|
-
console.log(err);
|
708
|
+
reject(err);
|
709
|
+
console.log(err);
|
710
|
+
},
|
685
711
|
});
|
712
|
+
console.log('SAVE ENT SUB: ', saveEntSub);
|
713
|
+
// saveEntSub.unsubscribe();
|
686
714
|
});
|
687
715
|
}
|
688
716
|
SetCreatingProject(creatingProject) {
|
@@ -1018,6 +1046,9 @@ class EaCService {
|
|
1018
1046
|
return status;
|
1019
1047
|
}
|
1020
1048
|
}
|
1049
|
+
// this.appsFlowEventsSvc.EnsureUserEnterpriseEvent.subscribe(async () => {
|
1050
|
+
// await this.projectService.EnsureUserEnterprise(this.State);
|
1051
|
+
// });
|
1021
1052
|
async EnsureUserEnterprise() {
|
1022
1053
|
const state = this.stateSubject.getValue();
|
1023
1054
|
const status = await this.projectService.EnsureUserEnterprise(state);
|
@@ -1085,6 +1116,7 @@ class EaCService {
|
|
1085
1116
|
return state;
|
1086
1117
|
}
|
1087
1118
|
async SaveApplicationAsCode(req) {
|
1119
|
+
console.log('Calling Save App as Code: ', req);
|
1088
1120
|
return await this.handleSaveApplication(req);
|
1089
1121
|
}
|
1090
1122
|
async SaveDFSModifier(req) {
|
@@ -1137,6 +1169,7 @@ class EaCService {
|
|
1137
1169
|
// Helpers
|
1138
1170
|
async handleSaveApplication(req) {
|
1139
1171
|
const state = this.stateSubject.getValue();
|
1172
|
+
console.log('calling handle Save App: ', state);
|
1140
1173
|
const saveEaC = {
|
1141
1174
|
EnterpriseLookup: state.EaC.EnterpriseLookup,
|
1142
1175
|
Applications: {},
|
@@ -1153,9 +1186,13 @@ class EaCService {
|
|
1153
1186
|
if (req.Application) {
|
1154
1187
|
saveEaC.Applications[req.ApplicationLookup] = req.Application;
|
1155
1188
|
}
|
1156
|
-
|
1189
|
+
//await
|
1190
|
+
const status = await Promise.all([
|
1191
|
+
this.projectService.SaveEnterpriseAsCode(state, saveEaC),
|
1192
|
+
]);
|
1193
|
+
console.log('State after save app: ', state);
|
1157
1194
|
this.stateSubject.next(state);
|
1158
|
-
return status;
|
1195
|
+
return status[0];
|
1159
1196
|
}
|
1160
1197
|
async handleSaveDFSModifier(req) {
|
1161
1198
|
const state = this.stateSubject.getValue();
|
@@ -1177,11 +1214,12 @@ class EaCService {
|
|
1177
1214
|
}
|
1178
1215
|
if (req.ApplicationLookup) {
|
1179
1216
|
// console.log('APPLOokup: ', req.ApplicationLookup);
|
1217
|
+
// console.log('saveEAC: ', saveEaC);
|
1180
1218
|
saveEaC.Applications[req.ApplicationLookup] = {
|
1181
1219
|
ModifierLookups: req.ModifierLookups,
|
1182
1220
|
};
|
1183
1221
|
}
|
1184
|
-
console.log('Save mod eac: ', saveEaC);
|
1222
|
+
// console.log('Save mod eac: ', saveEaC);
|
1185
1223
|
const status = await this.projectService.SaveEnterpriseAsCode(state, saveEaC);
|
1186
1224
|
this.stateSubject.next(state);
|
1187
1225
|
return status;
|