-
Notifications
You must be signed in to change notification settings - Fork 22
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
Conversation
# Conflicts: # hello-data-deployment/hello-data-dc-superset/src/main/docker/Dockerfile
There was a problem hiding this 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() |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, why?
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, why?
There was a problem hiding this comment.
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
No description provided.