@alfresco/adf-process-services-cloud 8.4.0-18007101927 → 8.4.0-18007979343

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.
@@ -13339,7 +13339,7 @@ class StartProcessCloudComponent {
13339
13339
  }
13340
13340
  }
13341
13341
  get disableStartButton() {
13342
- return !this.appName || !this.processDefinition.valid || this.isProcessStarting || !this.processDefinitionLoaded || this.isFormCloudLoading;
13342
+ return !this.appName || !this.processDefinition.valid || this.isProcessStarting || this.isFormCloudLoading;
13343
13343
  }
13344
13344
  get isProcessDefinitionsEmpty() {
13345
13345
  return !this.processDefinitionList.length;
@@ -13390,8 +13390,8 @@ class StartProcessCloudComponent {
13390
13390
  this.filteredProcesses = [];
13391
13391
  this.staticMappings = [];
13392
13392
  this.isProcessStarting = false;
13393
- this.isFormCloudLoading = false;
13394
13393
  this.isFormCloudLoaded = false;
13394
+ this.isFormCloudLoading = true;
13395
13395
  this.processDefinitionLoaded = false;
13396
13396
  this.processForm = new FormGroup({
13397
13397
  processInstanceName: new FormControl('', [
@@ -13416,6 +13416,9 @@ class StartProcessCloudComponent {
13416
13416
  if (this.processDefinitionName) {
13417
13417
  this.processDefinition.setValue(this.processDefinitionName);
13418
13418
  }
13419
+ else {
13420
+ this.isFormCloudLoading = false;
13421
+ }
13419
13422
  this.processDefinition.valueChanges
13420
13423
  .pipe(debounceTime(PROCESS_DEFINITION_DEBOUNCE))
13421
13424
  .pipe(takeUntilDestroyed(this.destroyRef))
@@ -13454,57 +13457,47 @@ class StartProcessCloudComponent {
13454
13457
  selectProcessDefinitionByProcessDefinitionName(processDefinitionName) {
13455
13458
  this.filteredProcesses = this.getProcessDefinitionListByNameOrKey(processDefinitionName);
13456
13459
  this.isFormCloudLoading = this.isProcessFormValid && this.filteredProcesses && this.filteredProcesses.length === 1;
13457
- if (this.isFormCloudLoading) {
13460
+ if (!this.isFormCloudLoading) {
13458
13461
  this.setProcessDefinitionOnForm(this.filteredProcesses[0].name);
13459
13462
  }
13460
13463
  }
13461
- fetchStaticVariablesAndConstants(selectedProcessDefinitionName) {
13462
- const processDefinitionCurrent = this.selectProcessDefinition(selectedProcessDefinitionName);
13463
- return forkJoin([
13464
+ setProcessDefinitionOnForm(selectedProcessDefinitionName) {
13465
+ this.isFormCloudLoading = true;
13466
+ const processDefinitionCurrent = this.filteredProcesses.find((process) => process.name === selectedProcessDefinitionName || process.key === selectedProcessDefinitionName);
13467
+ forkJoin([
13464
13468
  this.startProcessCloudService
13465
13469
  .getStartEventFormStaticValuesMapping(this.appName, processDefinitionCurrent.id)
13466
13470
  .pipe(catchError(() => of([]))),
13467
13471
  this.startProcessCloudService
13468
13472
  .getStartEventConstants(this.appName, processDefinitionCurrent.id)
13469
13473
  .pipe(catchError(() => of([])))
13470
- ]);
13471
- }
13472
- onFetchStaticVariablesAndConstants([staticMappings, constants]) {
13473
- this.staticMappings = staticMappings;
13474
- this.resolvedValues = this.staticMappings.concat(this.values || []);
13475
- const displayStart = constants?.find((constant) => constant.name === 'startEnabled');
13476
- const startLabel = constants?.find((constant) => constant.name === 'startLabel');
13477
- const displayCancel = constants?.find((constant) => constant.name === 'cancelEnabled');
13478
- const cancelLabel = constants?.find((constant) => constant.name === 'cancelLabel');
13479
- if (displayStart) {
13480
- this.displayStartSubject.next(displayStart?.value);
13481
- }
13482
- if (startLabel) {
13483
- this.startProcessButtonLabel = startLabel?.value?.trim()?.length > 0 ? startLabel.value.trim() : this.defaultStartProcessButtonLabel;
13484
- }
13485
- if (displayCancel) {
13486
- this.showCancelButton = displayCancel?.value === 'true' && this.showCancelButton;
13487
- }
13488
- if (cancelLabel) {
13489
- this.cancelButtonLabel = cancelLabel?.value?.trim()?.length > 0 ? cancelLabel.value.trim() : this.defaultCancelProcessButtonLabel;
13490
- }
13491
- }
13492
- setProcessDefinitionOnForm(selectedProcessDefinitionName) {
13493
- this.isFormCloudLoading = true;
13494
- this.fetchStaticVariablesAndConstants(selectedProcessDefinitionName).subscribe({
13495
- next: ([staticMappings, constants]) => this.onFetchStaticVariablesAndConstants([staticMappings, constants]),
13496
- error: () => {
13497
- this.isFormCloudLoading = false;
13498
- },
13499
- complete: () => {
13474
+ ]).subscribe({
13475
+ next: ([staticMappings, constants]) => {
13476
+ this.staticMappings = staticMappings;
13477
+ this.resolvedValues = this.staticMappings.concat(this.values || []);
13478
+ this.processDefinitionCurrent = processDefinitionCurrent;
13479
+ const displayStart = constants?.find((constant) => constant.name === 'startEnabled');
13480
+ const startLabel = constants?.find((constant) => constant.name === 'startLabel');
13481
+ const displayCancel = constants?.find((constant) => constant.name === 'cancelEnabled');
13482
+ const cancelLabel = constants?.find((constant) => constant.name === 'cancelLabel');
13483
+ if (displayStart) {
13484
+ this.displayStartSubject.next(displayStart?.value);
13485
+ }
13486
+ if (startLabel) {
13487
+ this.startProcessButtonLabel =
13488
+ startLabel?.value?.trim()?.length > 0 ? startLabel.value.trim() : this.defaultStartProcessButtonLabel;
13489
+ }
13490
+ if (displayCancel) {
13491
+ this.showCancelButton = displayCancel?.value === 'true' && this.showCancelButton;
13492
+ }
13493
+ if (cancelLabel) {
13494
+ this.cancelButtonLabel = cancelLabel?.value?.trim()?.length > 0 ? cancelLabel.value.trim() : this.defaultCancelProcessButtonLabel;
13495
+ }
13500
13496
  this.isFormCloudLoading = false;
13501
13497
  }
13502
13498
  });
13503
- this.processPayloadCloud.processDefinitionKey = this.processDefinitionCurrent.key;
13504
- }
13505
- selectProcessDefinition(keyOrName) {
13506
- this.processDefinitionCurrent = this.filteredProcesses.find((process) => process.name === keyOrName || process.key === keyOrName);
13507
- return this.processDefinitionCurrent;
13499
+ this.isFormCloudLoaded = false;
13500
+ this.processPayloadCloud.processDefinitionKey = processDefinitionCurrent.key;
13508
13501
  }
13509
13502
  getProcessDefinitionListByNameOrKey(processDefinitionName) {
13510
13503
  return this.processDefinitionList.filter((processDefinitionCloud) => !processDefinitionName || this.getProcessDefinition(processDefinitionCloud, processDefinitionName));
@@ -13531,37 +13524,30 @@ class StartProcessCloudComponent {
13531
13524
  this.resetErrorMessage();
13532
13525
  this.startProcessCloudService
13533
13526
  .getProcessDefinitions(this.appName)
13534
- .pipe(takeUntilDestroyed(this.destroyRef), tap((processDefinitionRepresentations) => {
13535
- this.processDefinitionList = processDefinitionRepresentations;
13536
- }), switchMap((processDefinitionRepresentations) => {
13537
- if (!this.processDefinitionName) {
13538
- return EMPTY;
13539
- }
13540
- if (processDefinitionRepresentations.length === 1) {
13541
- this.selectDefaultProcessDefinition();
13542
- return EMPTY;
13543
- }
13544
- this.processDefinition.setValue(this.processDefinitionName);
13545
- const selectedProcessDefinition = this.processDefinitionList.find((process) => process.name === this.processDefinitionName);
13546
- if (!selectedProcessDefinition) {
13547
- return EMPTY;
13548
- }
13549
- this.filteredProcesses = this.getProcessDefinitionListByNameOrKey(selectedProcessDefinition.name);
13550
- this.processDefinitionSelectionChanged(selectedProcessDefinition);
13551
- return this.fetchStaticVariablesAndConstants(selectedProcessDefinition.name);
13552
- }))
13527
+ .pipe(takeUntilDestroyed(this.destroyRef))
13553
13528
  .subscribe({
13554
- next: ([staticMappings, constants]) => {
13555
- if (staticMappings && constants) {
13556
- this.onFetchStaticVariablesAndConstants([staticMappings, constants]);
13529
+ next: (processDefinitionRepresentations) => {
13530
+ this.processDefinitionList = processDefinitionRepresentations;
13531
+ if (processDefinitionRepresentations.length === 1) {
13532
+ this.selectDefaultProcessDefinition();
13533
+ }
13534
+ else if (this.processDefinitionName) {
13535
+ this.processDefinition.setValue(this.processDefinitionName, { emitEvent: false });
13536
+ const processDefinition = this.processDefinitionList.find((process) => process.name === this.processDefinitionName);
13537
+ if (processDefinition) {
13538
+ this.filteredProcesses = this.getProcessDefinitionListByNameOrKey(processDefinition.name);
13539
+ this.setProcessDefinitionOnForm(processDefinition.name);
13540
+ this.processDefinitionSelectionChanged(processDefinition);
13541
+ }
13542
+ }
13543
+ else {
13544
+ this.isFormCloudLoading = false;
13557
13545
  }
13558
13546
  this.processDefinitionLoaded = true;
13559
13547
  },
13560
13548
  error: () => {
13561
13549
  this.errorMessageId = 'ADF_CLOUD_PROCESS_LIST.ADF_CLOUD_START_PROCESS.ERROR.LOAD_PROCESS_DEFS';
13562
- },
13563
- complete: () => {
13564
- this.processDefinitionLoaded = true;
13550
+ this.isFormCloudLoading = false;
13565
13551
  }
13566
13552
  });
13567
13553
  }