-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix: fix validation for datasource in action import and save flow #34754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -287,6 +287,11 @@ public Mono<ActionDTO> validateAndSaveActionToRepository(NewAction newAction) { | |
|
|
||
| @Override | ||
| public Mono<NewAction> validateAction(NewAction newAction) { | ||
| return validateAction(newAction, false); | ||
| } | ||
|
|
||
| @Override | ||
| public Mono<NewAction> validateAction(NewAction newAction, boolean isDryOps) { | ||
| this.setGitSyncIdInNewAction(newAction); | ||
|
|
||
| ActionDTO action = newAction.getUnpublishedAction(); | ||
|
|
@@ -373,10 +378,12 @@ public Mono<NewAction> validateAction(NewAction newAction) { | |
| datasourceMono = datasourceService | ||
| .findById(action.getDatasource().getId()) | ||
| .switchIfEmpty(Mono.defer(() -> { | ||
| action.setIsValid(false); | ||
| invalids.add(AppsmithError.NO_RESOURCE_FOUND.getMessage( | ||
| FieldName.DATASOURCE, | ||
| action.getDatasource().getId())); | ||
| if (!isDryOps) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When would this validation happen in case of dryOps?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When the datasource is attached to action, we fetch datasource from db and update the workspaceId for action. |
||
| action.setIsValid(false); | ||
| invalids.add(AppsmithError.NO_RESOURCE_FOUND.getMessage( | ||
| FieldName.DATASOURCE, | ||
| action.getDatasource().getId())); | ||
| } | ||
| return Mono.just(action.getDatasource()); | ||
| })) | ||
| .map(datasource -> { | ||
|
|
@@ -441,15 +448,15 @@ public Mono<NewAction> validateAction(NewAction newAction) { | |
| @Override | ||
| public Mono<Void> bulkValidateAndInsertActionInRepository(List<NewAction> newActionList) { | ||
| return Flux.fromIterable(newActionList) | ||
| .flatMap(this::validateAction) | ||
| .flatMap(newAction -> validateAction(newAction, true)) | ||
| .collectList() | ||
| .flatMap(repository::bulkInsert); | ||
| } | ||
|
|
||
| @Override | ||
| public Mono<Void> bulkValidateAndUpdateActionInRepository(List<NewAction> newActionList) { | ||
| return Flux.fromIterable(newActionList) | ||
| .flatMap(this::validateAction) | ||
| .flatMap(newAction -> validateAction(newAction, true)) | ||
| .collectList() | ||
| .flatMap(repository::bulkUpdate); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.