@cqa-lib/cqa-ui 1.1.471 → 1.1.473

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.
@@ -40052,7 +40052,8 @@ class TestCaseDetailsEditComponent {
40052
40052
  this.dataDrivenEnabled = !!this.getConfigItemValue('Key Flags', 'Data Driven');
40053
40053
  const enableAiSmartness = this.getConfigItemValue('AI Configuration', 'Enable AI Smartness');
40054
40054
  const defaultAiAction = this.getConfigItemValue('AI Configuration', 'Default AI Action');
40055
- const knowledgeBaseDefaultTestCase = this.getConfigItemValue('AI Configuration', 'Knowledge Base Default Test Case');
40055
+ const knowledgeBaseDefaultTestCaseRaw = this.getConfigItemValue('AI Configuration', 'Knowledge Base Default Test Case');
40056
+ const knowledgeBaseDefaultTestCase = this.resolveToOptionValue(knowledgeBaseDefaultTestCaseRaw, this.selectConfigOverrides?.['knowledgeBaseDefaultTestCase']?.options) ?? knowledgeBaseDefaultTestCaseRaw;
40056
40057
  const useAiMetadataRaw = this.getConfigItemValue('AI Configuration', 'Enable AI metadata collection');
40057
40058
  const useAiMetadata = this.normalizeBooleanSelectValue(useAiMetadataRaw);
40058
40059
  const prerequisiteCases = this.getPrerequisiteCasesFromConfig();
@@ -40186,6 +40187,13 @@ class TestCaseDetailsEditComponent {
40186
40187
  if (defaultAiRaw)
40187
40188
  patch['defaultAiAction'] = defaultAiRaw;
40188
40189
  }
40190
+ const kbCtrl = this.editForm.get('knowledgeBaseDefaultTestCase');
40191
+ if (kbCtrl && !kbCtrl.dirty) {
40192
+ const kbRaw = this.getConfigItemValue('AI Configuration', 'Knowledge Base Default Test Case');
40193
+ const kbResolved = this.resolveToOptionValue(kbRaw, this.selectConfigOverrides?.['knowledgeBaseDefaultTestCase']?.options) ?? kbRaw;
40194
+ if (kbResolved)
40195
+ patch['knowledgeBaseDefaultTestCase'] = kbResolved;
40196
+ }
40189
40197
  if (Object.keys(patch).length) {
40190
40198
  this.editForm.patchValue(patch, { emitEvent: false });
40191
40199
  }
@@ -40221,7 +40229,8 @@ class TestCaseDetailsEditComponent {
40221
40229
  if (changes['configSections'] || changes['configSectionsRow2']) {
40222
40230
  const enableAiSmartness = this.getConfigItemValue('AI Configuration', 'Enable AI Smartness');
40223
40231
  const defaultAiAction = this.getConfigItemValue('AI Configuration', 'Default AI Action');
40224
- const knowledgeBaseDefaultTestCase = this.getConfigItemValue('AI Configuration', 'Knowledge Base Default Test Case');
40232
+ const knowledgeBaseDefaultTestCaseRaw = this.getConfigItemValue('AI Configuration', 'Knowledge Base Default Test Case');
40233
+ const knowledgeBaseDefaultTestCase = this.resolveToOptionValue(knowledgeBaseDefaultTestCaseRaw, this.selectConfigOverrides?.['knowledgeBaseDefaultTestCase']?.options) ?? knowledgeBaseDefaultTestCaseRaw;
40225
40234
  const prerequisiteCases = this.getPrerequisiteCasesFromConfig();
40226
40235
  const typeRaw = (this.getConfigItemValue('Execution', 'Type') || this.typeItem?.value) ?? '';
40227
40236
  const testDataProfileRaw = this.getConfigItemValue('Execution', 'Test Data Profile') ?? '';
@@ -40728,6 +40737,10 @@ class StepBuilderGroupComponent {
40728
40737
  this.searchStepGroups = new EventEmitter();
40729
40738
  this.selectedStepGroup = null;
40730
40739
  this.runtimeVariableValues = {};
40740
+ /** Tracks initial state for edit mode to detect changes */
40741
+ this.initialStepGroupIdSnapshot = null;
40742
+ this.initialRuntimeValuesSnapshot = '{}';
40743
+ this.snapshotReady = false;
40731
40744
  this.stepGroupForm = this.fb.group({
40732
40745
  stepGroupId: [null, Validators.required]
40733
40746
  });
@@ -40787,6 +40800,10 @@ class StepBuilderGroupComponent {
40787
40800
  if (foundGroup) {
40788
40801
  this.stepGroupForm.patchValue({ stepGroupId: this.initialStepGroupId });
40789
40802
  this.selectedStepGroup = foundGroup;
40803
+ // Capture snapshot for change detection (will be recaptured if runtime variables load later)
40804
+ if (this.editMode) {
40805
+ this.captureInitialSnapshot();
40806
+ }
40790
40807
  }
40791
40808
  }
40792
40809
  }
@@ -40838,6 +40855,10 @@ class StepBuilderGroupComponent {
40838
40855
  }
40839
40856
  });
40840
40857
  }
40858
+ // Capture snapshot after runtime values are initialized (for edit mode change detection)
40859
+ if (this.editMode) {
40860
+ this.captureInitialSnapshot();
40861
+ }
40841
40862
  }
40842
40863
  onRuntimeVariableChange(groupId, paramName, value) {
40843
40864
  if (!this.runtimeVariableValues[groupId]) {
@@ -40866,8 +40887,33 @@ class StepBuilderGroupComponent {
40866
40887
  onCancel() {
40867
40888
  this.cancelled.emit();
40868
40889
  }
40890
+ /** Returns true if the form has changed from its initial state (edit mode only) */
40891
+ hasChanges() {
40892
+ if (!this.editMode) {
40893
+ return true; // In create mode, always allow submission
40894
+ }
40895
+ // Until the snapshot is ready, treat as no changes (disable button)
40896
+ if (!this.snapshotReady) {
40897
+ return false;
40898
+ }
40899
+ const currentStepGroupId = this.stepGroupForm.value.stepGroupId;
40900
+ if (currentStepGroupId !== this.initialStepGroupIdSnapshot) {
40901
+ return true;
40902
+ }
40903
+ return JSON.stringify(this.runtimeVariableValues) !== this.initialRuntimeValuesSnapshot;
40904
+ }
40905
+ /** Captures the current state as the baseline for change detection */
40906
+ captureInitialSnapshot() {
40907
+ // Only capture when a valid step group is selected
40908
+ if (!this.selectedStepGroup) {
40909
+ return;
40910
+ }
40911
+ this.initialStepGroupIdSnapshot = this.stepGroupForm.value.stepGroupId || null;
40912
+ this.initialRuntimeValuesSnapshot = JSON.stringify(this.runtimeVariableValues);
40913
+ this.snapshotReady = true;
40914
+ }
40869
40915
  isFormValid() {
40870
- return this.stepGroupForm.valid && !!this.selectedStepGroup;
40916
+ return this.stepGroupForm.valid && !!this.selectedStepGroup && this.hasChanges();
40871
40917
  }
40872
40918
  }
40873
40919
  StepBuilderGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: StepBuilderGroupComponent, deps: [{ token: i1$1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component });