diff --git a/CHANGELOG.md b/CHANGELOG.md index 17a357a7..0da79685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Fixed - Replaced mock initiator for flows tab for account +- Restored `Fetch uncacheable` checkbox when configuration exists ## [0.26.3] - 2024-09-13 ### Fixed diff --git a/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.spec.ts b/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.spec.ts index 408fdf2a..423e750d 100644 --- a/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.spec.ts +++ b/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.spec.ts @@ -25,6 +25,8 @@ import { import { PollingGroupEnum } from "../../dataset-settings.model"; import _ from "lodash"; import { TimeDelta, TimeUnit } from "src/app/api/kamu.graphql.interface"; +import { of } from "rxjs"; +import { mockIngestGetDatasetFlowConfigsSuccess } from "src/app/api/mock/dataset-flow.mock"; describe("DatasetSettingsSchedulingTabComponent", () => { let component: DatasetSettingsSchedulingTabComponent; @@ -190,4 +192,30 @@ describe("DatasetSettingsSchedulingTabComponent", () => { const errorMessageElem = findElementByDataTestId(fixture, "cronExpression-error"); expect(errorMessageElem?.textContent?.trim()).toEqual("Invalid expression"); }); + + it("should check init form with schedule", () => { + component.datasetPermissions = _.cloneDeep(mockFullPowerDatasetPermissionsFragment); + fixture.detectChanges(); + emitClickOnElementByDataTestId(fixture, "button-cron-expression"); + setFieldValue(fixture, "polling-group-cron-expression", MOCK_INVALID_CRON_EXPRESSION); + fixture.detectChanges(); + const errorMessageElem = findElementByDataTestId(fixture, "cronExpression-error"); + expect(errorMessageElem?.textContent?.trim()).toEqual("Invalid expression"); + }); + + it("should check init form with schedule when configuration is exist", () => { + component.datasetPermissions = _.cloneDeep(mockFullPowerDatasetPermissionsFragment); + const fetchDatasetFlowConfigsSpy = spyOn(datasetSchedulingService, "fetchDatasetFlowConfigs").and.returnValue( + of(mockIngestGetDatasetFlowConfigsSuccess), + ); + component.ngOnInit(); + + expect(fetchDatasetFlowConfigsSpy).toHaveBeenCalledTimes(1); + expect(component.pollingGroup.value).toEqual({ + __typename: "TimeDelta", + every: 3, + unit: TimeUnit.Hours, + fetchUncacheable: false, + }); + }); }); diff --git a/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.ts b/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.ts index 157ebf90..36bd18e2 100644 --- a/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.ts +++ b/src/app/dataset-view/additional-components/dataset-settings-component/tabs/scheduling/dataset-settings-scheduling-tab.component.ts @@ -142,13 +142,17 @@ export class DatasetSettingsSchedulingTabComponent extends BaseComponent impleme private setPollingEveryTimeValidator(): void { this.pollingUnitTime.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((data: TimeUnit) => { - this.pollingEveryTime.setValidators([this.everyTimeMapperValidators[data], Validators.required]); + if (data) { + this.pollingEveryTime.setValidators([this.everyTimeMapperValidators[data], Validators.required]); + } }); } private setBatchingEveryTimeValidator(): void { this.batchingUnitTime.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((data: TimeUnit) => { - this.batchingEveryTime.setValidators([this.everyTimeMapperValidators[data], Validators.required]); + if (data) { + this.batchingEveryTime.setValidators([this.everyTimeMapperValidators[data], Validators.required]); + } }); } @@ -173,6 +177,7 @@ export class DatasetSettingsSchedulingTabComponent extends BaseComponent impleme this.pollingForm.patchValue({ updatesState: !paused }); this.pollingGroup.patchValue({ ...flowConfiguration.schedule, + fetchUncacheable: flowConfiguration.fetchUncacheable, }); if (flowConfiguration.schedule.__typename === "Cron5ComponentExpression") { this.pollingGroup.patchValue({