Skip to content

Commit

Permalink
Restored fetch uncacheable checkbox (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriy-borzenko authored Sep 16, 2024
1 parent e11fa51 commit f9b831a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
});
}

Expand All @@ -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({
Expand Down

0 comments on commit f9b831a

Please sign in to comment.