@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.
@@ -496,68 +496,79 @@ class ProjectService {
496
496
  return __awaiter(this, void 0, void 0, function* () {
497
497
  return new Promise((resolve, reject) => {
498
498
  state.LoadingEnterprises = true;
499
- this.appsFlowSvc.ListEnterprises().subscribe((response) => __awaiter(this, void 0, void 0, function* () {
500
- // console.log('list Enterprises resp: ', response);
501
- state.LoadingEnterprises = false;
502
- if (response.Status.Code === 0) {
503
- state.Enterprises = response.Model;
504
- resolve(response.Model);
505
- }
506
- else {
507
- reject(response.Status);
508
- // console.log(response);
509
- }
510
- }), (err) => {
511
- state.LoadingEnterprises = false;
512
- reject(err);
513
- console.log(err);
499
+ this.appsFlowSvc.ListEnterprises().subscribe({
500
+ next: (response) => __awaiter(this, void 0, void 0, function* () {
501
+ // console.log('list Enterprises resp: ', response);
502
+ state.LoadingEnterprises = false;
503
+ if (response.Status.Code === 0) {
504
+ state.Enterprises = response.Model;
505
+ resolve(response.Model);
506
+ }
507
+ else {
508
+ reject(response.Status);
509
+ // console.log(response);
510
+ }
511
+ }),
512
+ error: (err) => {
513
+ state.LoadingEnterprises = false;
514
+ reject(err);
515
+ console.log(err);
516
+ },
514
517
  });
515
518
  });
516
519
  });
517
520
  }
518
521
  LoadEnterpriseAsCode(state) {
519
- return new Promise((resolve, reject) => {
520
- // console.log('Load ent called!!!');
521
- state.Loading = true;
522
- state.LoadingActiveEnterprise = true;
523
- this.appsFlowSvc.LoadEnterpriseAsCode().subscribe((response) => {
524
- var _a;
525
- state.Loading = false;
526
- state.LoadingActiveEnterprise = false;
527
- // console.log('Load eac response: ', response);
528
- if (response.Status.Code === 0) {
529
- state.EaC = response.Model || {};
530
- }
531
- else if (response.Status.Code === 3) {
532
- }
533
- state.EaC = state.EaC || {};
534
- // console.log('state.eac = ', state.EaC);
535
- this.CreatingProject =
536
- Object.keys(((_a = state === null || state === void 0 ? void 0 : state.EaC) === null || _a === void 0 ? void 0 : _a.Projects) || {}).length <= 0;
537
- resolve(state.EaC);
538
- this.activatedRoute.queryParams.subscribe((params) => {
539
- var _a;
540
- if ((params === null || params === void 0 ? void 0 : params.direct) == 'true') {
541
- let projKeys = Object.keys(state.EaC.Projects || {});
542
- if (projKeys.length == 1) {
543
- // console.log('Directing to deeper link');
544
- let appKeys = Object.keys(state.EaC.Applications || {});
545
- if (appKeys.length == 1) {
546
- let app = state.EaC.Applications[appKeys[0]];
547
- let routeKey = encodeURIComponent(((_a = app.LookupConfig.PathRegex) === null || _a === void 0 ? void 0 : _a.replace('.*', '')) || '/');
548
- window.location.href = `/dashboard/application/${appKeys[0]}/${routeKey}/${projKeys[0]}`;
549
- }
550
- else {
551
- window.location.href = `/dashboard/project/${projKeys[0]}`;
552
- }
522
+ return __awaiter(this, void 0, void 0, function* () {
523
+ return new Promise((resolve, reject) => {
524
+ console.log('Load ent called!!!');
525
+ // state.Loading = true;
526
+ // state.LoadingActiveEnterprise = true;
527
+ // BaseModeledResponse<EnterpriseAsCode>
528
+ this.appsFlowSvc.LoadEnterpriseAsCode().subscribe({
529
+ next: (response) => {
530
+ var _a;
531
+ console.log('State at Load ent: ', state);
532
+ state.Loading = false;
533
+ state.LoadingActiveEnterprise = false;
534
+ console.log('Load eac State after set Loading FALSE: ', state);
535
+ if (response.Status.Code === 0) {
536
+ state.EaC = response.Model || {};
553
537
  }
554
- }
538
+ else if (response.Status.Code === 3) {
539
+ }
540
+ state.EaC = state.EaC || {};
541
+ // console.log('state.eac = ', state.EaC);
542
+ this.CreatingProject =
543
+ Object.keys(((_a = state === null || state === void 0 ? void 0 : state.EaC) === null || _a === void 0 ? void 0 : _a.Projects) || {}).length <= 0;
544
+ resolve(state.EaC);
545
+ this.activatedRoute.queryParams.subscribe((params) => {
546
+ var _a;
547
+ if ((params === null || params === void 0 ? void 0 : params.direct) == 'true') {
548
+ let projKeys = Object.keys(state.EaC.Projects || {});
549
+ if (projKeys.length == 1) {
550
+ // console.log('Directing to deeper link');
551
+ let appKeys = Object.keys(state.EaC.Applications || {});
552
+ if (appKeys.length == 1) {
553
+ let app = state.EaC.Applications[appKeys[0]];
554
+ let routeKey = encodeURIComponent(((_a = app.LookupConfig.PathRegex) === null || _a === void 0 ? void 0 : _a.replace('.*', '')) || '/');
555
+ window.location.href = `/dashboard/application/${appKeys[0]}/${routeKey}/${projKeys[0]}`;
556
+ }
557
+ else {
558
+ window.location.href = `/dashboard/project/${projKeys[0]}`;
559
+ }
560
+ }
561
+ }
562
+ });
563
+ // console.log(state);
564
+ },
565
+ error: (err) => {
566
+ console.log('Load EAC ERROR Block');
567
+ state.Loading = false;
568
+ reject(err);
569
+ console.error(err);
570
+ },
555
571
  });
556
- // console.log(state);
557
- }, (err) => {
558
- state.Loading = false;
559
- reject(err);
560
- console.log(err);
561
572
  });
562
573
  });
563
574
  }
@@ -626,7 +637,6 @@ class ProjectService {
626
637
  state.LoadingActiveEnterprise = true;
627
638
  state.LoadingFeed = true;
628
639
  state.ActiveEnterpriseLookup = activeEntLookup;
629
- // state.LoadingFeed = true;
630
640
  this.appsFlowSvc.SetActiveEnterprise(activeEntLookup).subscribe((response) => __awaiter(this, void 0, void 0, function* () {
631
641
  if (response.Status.Code === 0) {
632
642
  this.EditingProjectLookup = null;
@@ -673,32 +683,52 @@ class ProjectService {
673
683
  SaveEnterpriseAsCode(state, eac) {
674
684
  return __awaiter(this, void 0, void 0, function* () {
675
685
  return new Promise((resolve, reject) => {
686
+ console.log('save EAC called');
676
687
  state.Loading = true;
688
+ state.LoadingActiveEnterprise = true;
677
689
  // console.log('eac: ', eac);
678
- this.appsFlowSvc.SaveEnterpriseAsCode(eac).subscribe((response) => __awaiter(this, void 0, void 0, function* () {
679
- if (response.Status.Code === 0) {
680
- resolve(response.Status);
681
- var results = yield Promise.all([
690
+ let saveEntSub = this.appsFlowSvc
691
+ .SaveEnterpriseAsCode(eac)
692
+ .subscribe({
693
+ next: (response) => __awaiter(this, void 0, void 0, function* () {
694
+ if (response.Status.Code === 0) {
695
+ resolve(response.Status);
696
+ console.log('Save EAC Success');
697
+ // var results = Promise.all([
682
698
  // this.EnsureUserEnterprise(state),
683
- this.LoadEnterpriseAsCode(state),
684
- this.ListEnterprises(state),
699
+ // this.LoadEnterpriseAsCode(state),
700
+ // this.ListEnterprises(state),
685
701
  // this.GetActiveEnterprise(state),
686
- this.LoadUserFeed(1, 25, localStorage.getItem('activeFilter')
687
- ? localStorage.getItem('activeFilter')
688
- : '', false, state),
689
- ]);
690
- // console.log('LOAD EAC RESULTS: ', results);
691
- }
692
- else {
702
+ // this.LoadUserFeed(
703
+ // 1,
704
+ // 25,
705
+ // localStorage.getItem('activeFilter')
706
+ // ? localStorage.getItem('activeFilter')
707
+ // : '',
708
+ // false,
709
+ // state
710
+ // ),
711
+ // ]);
712
+ var results = this.LoadEnterpriseAsCode(state);
713
+ console.log('LOAD EAC RESULTS: ', results);
714
+ state.Loading = false;
715
+ state.LoadingActiveEnterprise = false;
716
+ console.log('State from save eac: ', state);
717
+ }
718
+ else {
719
+ state.Loading = false;
720
+ reject(response.Status);
721
+ // console.log(response);
722
+ }
723
+ }),
724
+ error: (err) => {
693
725
  state.Loading = false;
694
- reject(response.Status);
695
- // console.log(response);
696
- }
697
- }), (err) => {
698
- state.Loading = false;
699
- reject(err);
700
- console.log(err);
726
+ reject(err);
727
+ console.log(err);
728
+ },
701
729
  });
730
+ console.log('SAVE ENT SUB: ', saveEntSub);
731
+ // saveEntSub.unsubscribe();
702
732
  });
703
733
  });
704
734
  }
@@ -1048,6 +1078,9 @@ class EaCService {
1048
1078
  }
1049
1079
  });
1050
1080
  }
1081
+ // this.appsFlowEventsSvc.EnsureUserEnterpriseEvent.subscribe(async () => {
1082
+ // await this.projectService.EnsureUserEnterprise(this.State);
1083
+ // });
1051
1084
  EnsureUserEnterprise() {
1052
1085
  return __awaiter(this, void 0, void 0, function* () {
1053
1086
  const state = this.stateSubject.getValue();
@@ -1132,6 +1165,7 @@ class EaCService {
1132
1165
  }
1133
1166
  SaveApplicationAsCode(req) {
1134
1167
  return __awaiter(this, void 0, void 0, function* () {
1168
+ console.log('Calling Save App as Code: ', req);
1135
1169
  return yield this.handleSaveApplication(req);
1136
1170
  });
1137
1171
  }
@@ -1204,6 +1238,7 @@ class EaCService {
1204
1238
  handleSaveApplication(req) {
1205
1239
  return __awaiter(this, void 0, void 0, function* () {
1206
1240
  const state = this.stateSubject.getValue();
1241
+ console.log('calling handle Save App: ', state);
1207
1242
  const saveEaC = {
1208
1243
  EnterpriseLookup: state.EaC.EnterpriseLookup,
1209
1244
  Applications: {},
@@ -1220,9 +1255,13 @@ class EaCService {
1220
1255
  if (req.Application) {
1221
1256
  saveEaC.Applications[req.ApplicationLookup] = req.Application;
1222
1257
  }
1223
- const status = yield this.projectService.SaveEnterpriseAsCode(state, saveEaC);
1258
+ //await
1259
+ const status = yield Promise.all([
1260
+ this.projectService.SaveEnterpriseAsCode(state, saveEaC),
1261
+ ]);
1262
+ console.log('State after save app: ', state);
1224
1263
  this.stateSubject.next(state);
1225
- return status;
1264
+ return status[0];
1226
1265
  });
1227
1266
  }
1228
1267
  handleSaveDFSModifier(req) {
@@ -1246,11 +1285,12 @@ class EaCService {
1246
1285
  }
1247
1286
  if (req.ApplicationLookup) {
1248
1287
  // console.log('APPLOokup: ', req.ApplicationLookup);
1288
+ // console.log('saveEAC: ', saveEaC);
1249
1289
  saveEaC.Applications[req.ApplicationLookup] = {
1250
1290
  ModifierLookups: req.ModifierLookups,
1251
1291
  };
1252
1292
  }
1253
- console.log('Save mod eac: ', saveEaC);
1293
+ // console.log('Save mod eac: ', saveEaC);
1254
1294
  const status = yield this.projectService.SaveEnterpriseAsCode(state, saveEaC);
1255
1295
  this.stateSubject.next(state);
1256
1296
  return status;