-
Notifications
You must be signed in to change notification settings - Fork 4.7k
chore: Converging git refactor changes #33971
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
b8d4ca3
8e0668b
aeeb005
b91b380
8afe8ee
ff57d32
2f5a12c
7dcb38f
4e0a2d9
ca6d066
4bb1a86
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 |
|---|---|---|
|
|
@@ -21,4 +21,4 @@ | |
| <option name="Make" enabled="true" /> | ||
| </method> | ||
| </configuration> | ||
| </component> | ||
| </component> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -11,6 +11,8 @@ | |||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.domains.GitArtifactMetadata; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.domains.NewAction; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.domains.NewPage; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.dtos.ApplicationJson; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.dtos.ArtifactExchangeJson; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.dtos.GitAuthDTO; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.exceptions.AppsmithError; | ||||||||||||||||||||||||||||||||||||||
| import com.appsmith.server.exceptions.AppsmithException; | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -47,7 +49,7 @@ | |||||||||||||||||||||||||||||||||||||
| @RequiredArgsConstructor | ||||||||||||||||||||||||||||||||||||||
| public class GitApplicationHelperCEImpl implements GitArtifactHelperCE<Application> { | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| private final CommonGitFileUtils gitFileUtils; | ||||||||||||||||||||||||||||||||||||||
| private final CommonGitFileUtils commonGitFileUtils; | ||||||||||||||||||||||||||||||||||||||
| private final GitPrivateRepoHelper gitPrivateRepoHelper; | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| private final ApplicationService applicationService; | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -178,9 +180,9 @@ public Mono<Application> isPrivateRepoLimitReached(Artifact artifact, boolean is | |||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||
| public Mono<Application> publishArtifact(Artifact artifact) { | ||||||||||||||||||||||||||||||||||||||
| public Mono<Application> publishArtifact(Artifact artifact, Boolean isPublishedManually) { | ||||||||||||||||||||||||||||||||||||||
| Application application = (Application) artifact; | ||||||||||||||||||||||||||||||||||||||
| return applicationPageService.publish(application.getId(), true).then(Mono.just(application)); | ||||||||||||||||||||||||||||||||||||||
| return applicationPageService.publish(application.getId(), isPublishedManually); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| // TODO: scope for improvement | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -204,7 +206,7 @@ public Mono<Path> intialiseReadMe(Artifact artifact, Path readMePath, String ori | |||||||||||||||||||||||||||||||||||||
| String editModeUrl = Paths.get(viewModeUrl, "edit").toString(); | ||||||||||||||||||||||||||||||||||||||
| // Initialize the repo with readme file | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| return gitFileUtils | ||||||||||||||||||||||||||||||||||||||
| return commonGitFileUtils | ||||||||||||||||||||||||||||||||||||||
| .initializeReadme(readMePath, originHeader + viewModeUrl, originHeader + editModeUrl) | ||||||||||||||||||||||||||||||||||||||
| .onErrorMap(throwable -> { | ||||||||||||||||||||||||||||||||||||||
| log.error("Error while initialising git repo, {0}", throwable); | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -305,4 +307,23 @@ public Mono<Application> disconnectEntitiesOfDefaultArtifact(Artifact defaultArt | |||||||||||||||||||||||||||||||||||||
| public Application updateArtifactWithDefaultReponseUtils(Artifact artifact) { | ||||||||||||||||||||||||||||||||||||||
| return responseUtils.updateApplicationWithDefaultResources((Application) artifact); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||
| public Mono<Application> createArtifactForImport(String workspaceId, String repoName) { | ||||||||||||||||||||||||||||||||||||||
| Application newApplication = new Application(); | ||||||||||||||||||||||||||||||||||||||
| newApplication.setName(repoName); | ||||||||||||||||||||||||||||||||||||||
| newApplication.setWorkspaceId(workspaceId); | ||||||||||||||||||||||||||||||||||||||
| newApplication.setGitApplicationMetadata(new GitArtifactMetadata()); | ||||||||||||||||||||||||||||||||||||||
| return applicationPageService.createOrUpdateSuffixedApplication(newApplication, newApplication.getName(), 0); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+312
to
+318
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. Consider adding error handling for the + return applicationPageService.createOrUpdateSuffixedApplication(newApplication, newApplication.getName(), 0)
+ .onErrorResume(e -> {
+ log.error("Failed to create artifact for import: {}", e.getMessage());
+ return Mono.error(new AppsmithException(AppsmithError.GENERIC_BAD_REQUEST, e.getMessage()));
+ });Adding error handling will improve robustness by providing feedback when the creation process fails. Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||
| public Mono<Application> deleteArtifact(String artifactId) { | ||||||||||||||||||||||||||||||||||||||
| return applicationPageService.deleteApplication(artifactId); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| @Override | ||||||||||||||||||||||||||||||||||||||
| public Boolean isContextInArtifactEmpty(ArtifactExchangeJson artifactExchangeJson) { | ||||||||||||||||||||||||||||||||||||||
| return CollectionUtils.isNullOrEmpty(((ApplicationJson) artifactExchangeJson).getPageList()); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -436,7 +436,7 @@ public Mono<Application> updateAndSaveArtifactInContext( | |||||||||
| Mono<Application> parentApplicationMono; | ||||||||||
| if (application.getGitApplicationMetadata() != null) { | ||||||||||
| parentApplicationMono = applicationService.findById( | ||||||||||
| application.getGitApplicationMetadata().getDefaultApplicationId()); | ||||||||||
| application.getGitApplicationMetadata().getDefaultArtifactId()); | ||||||||||
|
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. Consider using a more specific exception type for better error handling. - return Mono.error(new AppsmithException(
- AppsmithError.ACL_NO_RESOURCE_FOUND,
- FieldName.APPLICATION,
- importingMetaDTO.getArtifactId()));
+ return Mono.error(new NotFoundException(
+ "Application not found with ID: " + importingMetaDTO.getArtifactId()));This change would make the error more specific and informative, improving the maintainability and debuggability of the code. Committable suggestion
Suggested change
|
||||||||||
| } else { | ||||||||||
| parentApplicationMono = Mono.just(application); | ||||||||||
| } | ||||||||||
|
|
||||||||||
Uh oh!
There was an error while loading. Please reload this page.