Skip to content
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

Feature/hellodata 1240 copy dashboards #47

Merged
merged 15 commits into from
Mar 7, 2024

Conversation

wieczorslawo
Copy link
Contributor

No description provided.

Copy link
Contributor

@ramich ramich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good, just some comments

@Transactional(readOnly = true)
public String findSupersetInstanceNameByContextKey(String contextKey) {
return findAllByModuleTypeAndKind(ModuleType.SUPERSET, ModuleResourceKind.HELLO_DATA_APP_INFO,
ch.bedag.dap.hellodata.commons.sidecars.resources.v1.appinfo.AppInfoResource.class).stream()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have multiple Classes with same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, I though so because of the fully qualified class-name.

@@ -30,9 +30,11 @@
"@Dalete faq": "FAQ löschen",
"@Dashboard": "Dashboard",
"@Dashboard Overview": "Dashboards",
"@Dashboard import-export": "Dashboard import-export",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better: 'Dashboard Import/Export'

return Paths.get(System.getProperty("java.io.tmpdir"), "dashboards_upload", uploadFolder);
}

private void buildChunks(String binaryFileId, String filename, long totalChunks, long fileSize, Path destinationPath) throws IOException {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe name this method assembleChunks()

throw new RuntimeException("The file is not supported. Upload canceled");
}
writeChunksToFile(destinationPath, chunks);
deleteTempBinaryFileData(binaryFileId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this delete-method could be moved into the try/catch/finally of the listenForRequests-method, so it gets called even in case of an exception.

Copy link
Contributor Author

@wieczorslawo wieczorslawo Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, no problem. But I need the binary file ID to be able to be deleted. So there might be a situation where the folder will remain....

}

private void writeChunksToFile(Path destinationPath, List<File> chunks) throws IOException {
destinationPath.getParent().toFile().mkdirs();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd maybe extract the mkdirs-call out of this method, so the method only writes the chunks

bytesReadTotal += bytesRead;
boolean isLastChunk = bytesReadTotal == file.getSize();
log.info("Sending file to superset, bytes read total: {}, file size: {}", bytesReadTotal, file.getSize());
DashboardUpload dashboardUpload = new DashboardUpload(buffer, ++chunkNumber, fileName, binaryFileId, isLastChunk, file.getSize());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just sth minor, but will there be a chunk with number 0 like this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, why?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok. it's just because normally we use zero-based indexing

@wieczorslawo wieczorslawo merged commit eb47dea into develop Mar 7, 2024
1 check passed
@wieczorslawo wieczorslawo deleted the feature/HELLODATA-1240_copy_dashboards branch March 7, 2024 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants