Skip to content

Commit

Permalink
Fix parse command bug and yamlTemplate state bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Borzenko committed Jul 26, 2023
1 parent 3f692a8 commit 24f5e5f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/app/common/app.values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export default class AppValues {
public static readonly URL_PATTERN = /^(http:\/\/)|(https:\/\/)/i;
public static readonly SCHEMA_NAME_PATTERN =
/^[a-zA-Z0-9]+[a-zA-Z0-9\s(_)]*$/i;
public static readonly SPLIT_ARGUMENTS_PATTERN = /\w+|"[^"]+"/g;
public static readonly SPLIT_ARGUMENTS_PATTERN =
/[^\s"']+|"([^"]*)"+|'([^']*)'/g;

public static readonly DISPLAY_DATE_FORMAT = "DD MMM YYYY";
public static readonly DISPLAY_TOOLTIP_DATE_FORMAT = "MMM D, YYYY, HH:mm A";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { ProcessFormService } from "./process-form.service";
import { DatasetHistoryUpdate } from "src/app/dataset-view/dataset.subscriptions.interface";
import { EditPollingSourceService } from "./edit-polling-source.service";
import { MaybeNull } from "src/app/common/app.types";
import { from } from "rxjs";
import { SupportedEvents } from "src/app/dataset-block/metadata-block/components/event-details/supported.events";
import { STEPPER_GLOBAL_OPTIONS } from "@angular/cdk/stepper";

Expand All @@ -57,6 +58,7 @@ export class AddPollingSourceComponent extends BaseComponent implements OnInit {
public errorMessage = "";
public history: DatasetHistoryUpdate;
public eventYamlByHash: MaybeNull<string>;
public changedEventYamlByHash: string;
public datasetKind: DatasetKind;
public preprocessStepValue: PreprocessStepValue = {
engine: "",
Expand Down Expand Up @@ -180,15 +182,20 @@ export class AddPollingSourceComponent extends BaseComponent implements OnInit {
);
const instance = modalRef.componentInstance as FinalYamlModalComponent;
this.processFormService.transformForm(this.pollingSourceForm);
instance.yamlTemplate =
this.yamlEventService.buildYamlSetPollingSourceEvent(
this.pollingSourceForm.value as Omit<
SetPollingSource,
"__typename"
>,
this.showPreprocessStep ? this.preprocessStepValue : null,
);

instance.yamlTemplate = this.errorMessage
? this.changedEventYamlByHash
: this.yamlEventService.buildYamlSetPollingSourceEvent(
this.pollingSourceForm.value as Omit<
SetPollingSource,
"__typename"
>,
this.showPreprocessStep ? this.preprocessStepValue : null,
);
instance.datasetInfo = this.getDatasetInfoFromUrl();
from(modalRef.result).subscribe((eventYaml) => {
this.changedEventYamlByHash = eventYaml;
});
}

public onShowPreprcessStep(showPreprocessStep: boolean): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ export class FinalYamlModalComponent extends BaseComponent {
)
.subscribe(),
);
this.activeModal.close("close modal");
this.activeModal.close(this.yamlTemplate);
}
}

0 comments on commit 24f5e5f

Please sign in to comment.