Allowe parallel uploads of same file for different software module.
Display software module details in status popup. Signed-off-by: Asharani <asharani.murugesh@in.bosch.com>
This commit is contained in:
@@ -249,18 +249,18 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
// Update progress is called event after upload interrupted in
|
// Update progress is called event after upload interrupted in
|
||||||
// uploadStarted method
|
// uploadStarted method
|
||||||
if (!uploadInterrupted) {
|
if (!uploadInterrupted) {
|
||||||
if (readBytes > maxSize || contentLength > maxSize) {
|
|
||||||
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
|
||||||
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
|
||||||
interruptFileUpload();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (aborted) {
|
if (aborted) {
|
||||||
LOG.error("User aborted file upload");
|
LOG.error("User aborted file upload");
|
||||||
failureReason = i18n.get("message.uploadedfile.aborted");
|
failureReason = i18n.get("message.uploadedfile.aborted");
|
||||||
interruptFileUpload();
|
interruptFileUpload();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (readBytes > maxSize || contentLength > maxSize) {
|
||||||
|
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
||||||
|
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
||||||
|
interruptFileUpload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_IN_PROGRESS,
|
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_IN_PROGRESS,
|
||||||
new UploadFileStatus(fileName, readBytes, contentLength, selectedSwForUpload)));
|
new UploadFileStatus(fileName, readBytes, contentLength, selectedSwForUpload)));
|
||||||
LOG.info("Update progress - {} : {}", fileName, (double) readBytes / (double) contentLength);
|
LOG.info("Update progress - {} : {}", fileName, (double) readBytes / (double) contentLength);
|
||||||
@@ -274,18 +274,18 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(final StreamingProgressEvent event) {
|
public void onProgress(final StreamingProgressEvent event) {
|
||||||
if (event.getBytesReceived() > maxSize || event.getContentLength() > maxSize) {
|
|
||||||
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
|
||||||
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
|
||||||
interruptFileStreaming();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (aborted) {
|
if (aborted) {
|
||||||
LOG.error("User aborted the upload");
|
LOG.error("User aborted the upload");
|
||||||
failureReason = i18n.get("message.uploadedfile.aborted");
|
failureReason = i18n.get("message.uploadedfile.aborted");
|
||||||
interruptFileStreaming();
|
interruptFileStreaming();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event.getBytesReceived() > maxSize || event.getContentLength() > maxSize) {
|
||||||
|
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
||||||
|
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
||||||
|
interruptFileStreaming();
|
||||||
|
return;
|
||||||
|
}
|
||||||
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_IN_PROGRESS, new UploadFileStatus(
|
eventBus.publish(this, new UploadStatusEvent(UploadStatusEventType.UPLOAD_IN_PROGRESS, new UploadFileStatus(
|
||||||
fileName, event.getBytesReceived(), event.getContentLength(), selectedSw)));
|
fileName, event.getBytesReceived(), event.getContentLength(), selectedSw)));
|
||||||
// Logging to solve sonar issue
|
// Logging to solve sonar issue
|
||||||
@@ -380,4 +380,5 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
upload.interruptUpload();
|
upload.interruptUpload();
|
||||||
uploadInterrupted = true;
|
uploadInterrupted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,6 +222,11 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
setUploadStatusButtonIconToFinished();
|
setUploadStatusButtonIconToFinished();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (artifactUploadState.isUploadCompleted()) {
|
||||||
|
artifactUploadState.getNumberOfFilesActuallyUpload().set(0);
|
||||||
|
artifactUploadState.getNumberOfFileUploadsExpected().set(0);
|
||||||
|
artifactUploadState.getNumberOfFileUploadsFailed().set(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DragAndDropWrapper getDropAreaWrapper() {
|
public DragAndDropWrapper getDropAreaWrapper() {
|
||||||
@@ -692,7 +697,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
// failed reason to be updated only if there is error other than
|
// failed reason to be updated only if there is error other than
|
||||||
// duplicate file error
|
// duplicate file error
|
||||||
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
||||||
.getFailureReason());
|
.getFailureReason(), event.getUploadStatus().getSoftwareModule());
|
||||||
increaseNumberOfFileUploadsFailed();
|
increaseNumberOfFileUploadsFailed();
|
||||||
}
|
}
|
||||||
decreaseNumberOfFileUploadsExpected();
|
decreaseNumberOfFileUploadsExpected();
|
||||||
@@ -722,13 +727,12 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
updateUploadCounts();
|
updateUploadCounts();
|
||||||
enableProcessBtn();
|
enableProcessBtn();
|
||||||
duplicateFileNamesList.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUploadComplete() {
|
private boolean isUploadComplete() {
|
||||||
int uploadedCount = artifactUploadState.getNumberOfFilesActuallyUpload().intValue();
|
int uploadedCount = artifactUploadState.getNumberOfFilesActuallyUpload().intValue();
|
||||||
int expectedUploadsCount = artifactUploadState.getNumberOfFileUploadsExpected().intValue();
|
int expectedUploadsCount = artifactUploadState.getNumberOfFileUploadsExpected().intValue();
|
||||||
return uploadedCount == expectedUploadsCount;
|
return uploadedCount == expectedUploadsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onUploadFailure(final UploadStatusEvent event) {
|
private void onUploadFailure(final UploadStatusEvent event) {
|
||||||
@@ -746,7 +750,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
// failed reason to be updated only if there is error other than
|
// failed reason to be updated only if there is error other than
|
||||||
// duplicate file error
|
// duplicate file error
|
||||||
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
uploadInfoWindow.uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
||||||
.getFailureReason());
|
.getFailureReason(), event.getUploadStatus().getSoftwareModule());
|
||||||
increaseNumberOfFileUploadsFailed();
|
increaseNumberOfFileUploadsFailed();
|
||||||
decreaseNumberOfFileUploadsExpected();
|
decreaseNumberOfFileUploadsExpected();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent.UploadStatusEventType;
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadStatusEvent.UploadStatusEventType;
|
||||||
@@ -21,8 +22,10 @@ import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
|||||||
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
import org.eclipse.hawkbit.ui.common.ConfirmationDialog;
|
||||||
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.vaadin.spring.events.EventBus;
|
import org.vaadin.spring.events.EventBus;
|
||||||
@@ -100,7 +103,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
private Button resizeButton;
|
private Button resizeButton;
|
||||||
|
|
||||||
private UI ui;
|
private UI ui;
|
||||||
|
|
||||||
private ConfirmationDialog confirmDialog;
|
private ConfirmationDialog confirmDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,7 +129,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
setContent(mainLayout);
|
setContent(mainLayout);
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
ui = UI.getCurrent();
|
ui = UI.getCurrent();
|
||||||
|
|
||||||
createConfirmDialog();
|
createConfirmDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,22 +138,25 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_IN_PROGRESS) {
|
if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_IN_PROGRESS) {
|
||||||
UI.getCurrent().access(
|
UI.getCurrent().access(
|
||||||
() -> updateProgress(event.getUploadStatus().getFileName(), event.getUploadStatus().getBytesRead(),
|
() -> updateProgress(event.getUploadStatus().getFileName(), event.getUploadStatus().getBytesRead(),
|
||||||
event.getUploadStatus().getContentLength()));
|
event.getUploadStatus().getContentLength(), event.getUploadStatus().getSoftwareModule()));
|
||||||
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STARTED) {
|
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STARTED) {
|
||||||
UI.getCurrent().access(() -> onStartOfUpload(event));
|
UI.getCurrent().access(() -> onStartOfUpload(event));
|
||||||
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FAILED) {
|
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FAILED) {
|
||||||
ui.access(() -> uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
ui.access(() -> uploadFailed(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
||||||
.getFailureReason()));
|
.getFailureReason(), event.getUploadStatus().getSoftwareModule()));
|
||||||
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_SUCCESSFUL) {
|
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_SUCCESSFUL) {
|
||||||
UI.getCurrent().access(() -> uploadSucceeded(event.getUploadStatus().getFileName()));
|
UI.getCurrent().access(
|
||||||
|
() -> uploadSucceeded(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
||||||
|
.getSoftwareModule()));
|
||||||
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FINISHED) {
|
} else if (event.getUploadProgressEventType() == UploadStatusEventType.UPLOAD_STREAMING_FINISHED) {
|
||||||
ui.access(() -> uploadSucceeded(event.getUploadStatus().getFileName()));
|
ui.access(() -> uploadSucceeded(event.getUploadStatus().getFileName(), event.getUploadStatus()
|
||||||
|
.getSoftwareModule()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onStartOfUpload(UploadStatusEvent event) {
|
private void onStartOfUpload(UploadStatusEvent event) {
|
||||||
uploadSessionStarted();
|
uploadSessionStarted();
|
||||||
uploadStarted(event.getUploadStatus().getFileName());
|
uploadStarted(event.getUploadStatus().getFileName(), event.getUploadStatus().getSoftwareModule());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
@@ -167,11 +173,15 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
if (container.getItemIds().isEmpty()) {
|
if (container.getItemIds().isEmpty()) {
|
||||||
container.removeAllItems();
|
container.removeAllItems();
|
||||||
for (UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) {
|
for (UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) {
|
||||||
Item item = container.addItem(statusObject.getFilename());
|
Item item = container.addItem(getItemid(statusObject.getFilename(),
|
||||||
|
statusObject.getSelectedSoftwareModule()));
|
||||||
item.getItemProperty(REASON).setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
|
item.getItemProperty(REASON).setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
|
||||||
item.getItemProperty(STATUS).setValue(statusObject.getStatus());
|
item.getItemProperty(STATUS).setValue(statusObject.getStatus());
|
||||||
item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
|
item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
|
||||||
item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
|
item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
|
||||||
|
SoftwareModule sw = statusObject.getSelectedSoftwareModule();
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(
|
||||||
|
HawkbitCommonUtil.getFormattedNameVersion(sw.getName(), sw.getVersion()));
|
||||||
}
|
}
|
||||||
if (artifactUploadState.isUploadCompleted()) {
|
if (artifactUploadState.isUploadCompleted()) {
|
||||||
minimizeButton.setEnabled(false);
|
minimizeButton.setEnabled(false);
|
||||||
@@ -192,9 +202,10 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
private void setGridColumnProperties() {
|
private void setGridColumnProperties() {
|
||||||
grid.getColumn(STATUS).setRenderer(new StatusRenderer());
|
grid.getColumn(STATUS).setRenderer(new StatusRenderer());
|
||||||
grid.getColumn(PROGRESS).setRenderer(new ProgressBarRenderer());
|
grid.getColumn(PROGRESS).setRenderer(new ProgressBarRenderer());
|
||||||
grid.setColumnOrder(STATUS, PROGRESS, FILE_NAME, REASON);
|
grid.setColumnOrder(STATUS, PROGRESS, FILE_NAME, SPUILabelDefinitions.NAME_VERSION, REASON);
|
||||||
setColumnWidth();
|
setColumnWidth();
|
||||||
grid.setFrozenColumnCount(4);
|
grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setHeaderCaption(i18n.get("upload.swModuleTable.header"));
|
||||||
|
grid.setFrozenColumnCount(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Grid createGrid() {
|
private Grid createGrid() {
|
||||||
@@ -213,6 +224,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
uploadContainer.addContainerProperty(FILE_NAME, String.class, null);
|
uploadContainer.addContainerProperty(FILE_NAME, String.class, null);
|
||||||
uploadContainer.addContainerProperty(PROGRESS, Double.class, 0D);
|
uploadContainer.addContainerProperty(PROGRESS, Double.class, 0D);
|
||||||
uploadContainer.addContainerProperty(REASON, String.class, "");
|
uploadContainer.addContainerProperty(REASON, String.class, "");
|
||||||
|
uploadContainer.addContainerProperty(SPUILabelDefinitions.NAME_VERSION, String.class, "");
|
||||||
return uploadContainer;
|
return uploadContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,10 +246,11 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setColumnWidth() {
|
private void setColumnWidth() {
|
||||||
grid.getColumn(STATUS).setWidth(70);
|
grid.getColumn(STATUS).setWidth(60);
|
||||||
grid.getColumn(PROGRESS).setWidth(150);
|
grid.getColumn(PROGRESS).setWidth(150);
|
||||||
grid.getColumn(FILE_NAME).setWidth(280);
|
grid.getColumn(FILE_NAME).setWidth(200);
|
||||||
grid.getColumn(REASON).setWidth(300);
|
grid.getColumn(REASON).setWidth(290);
|
||||||
|
grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setWidth(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetColumnWidth() {
|
private void resetColumnWidth() {
|
||||||
@@ -245,6 +258,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
grid.getColumn(PROGRESS).setWidthUndefined();
|
grid.getColumn(PROGRESS).setWidthUndefined();
|
||||||
grid.getColumn(FILE_NAME).setWidthUndefined();
|
grid.getColumn(FILE_NAME).setWidthUndefined();
|
||||||
grid.getColumn(REASON).setWidthUndefined();
|
grid.getColumn(REASON).setWidthUndefined();
|
||||||
|
grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setWidthUndefined();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class StatusRenderer extends HtmlRenderer {
|
private static class StatusRenderer extends HtmlRenderer {
|
||||||
@@ -307,29 +321,32 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
restoreState();
|
restoreState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void uploadStarted(final String filename) {
|
void uploadStarted(final String filename, final SoftwareModule softwareModule) {
|
||||||
final Item item = uploads.addItem(filename);
|
final Item item = uploads.addItem(getItemid(filename, softwareModule));
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(FILE_NAME).setValue(filename);
|
item.getItemProperty(FILE_NAME).setValue(filename);
|
||||||
|
item.getItemProperty(SPUILabelDefinitions.NAME_VERSION).setValue(
|
||||||
|
HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(), softwareModule.getVersion()));
|
||||||
}
|
}
|
||||||
grid.scrollToEnd();
|
grid.scrollToEnd();
|
||||||
UploadStatusObject uploadStatus = new UploadStatusObject(filename);
|
UploadStatusObject uploadStatus = new UploadStatusObject(filename, softwareModule);
|
||||||
uploadStatus.setStatus("Active");
|
uploadStatus.setStatus("Active");
|
||||||
artifactUploadState.getUploadedFileStatusList().add(uploadStatus);
|
artifactUploadState.getUploadedFileStatusList().add(uploadStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateProgress(final String filename, final long readBytes, final long contentLength) {
|
void updateProgress(final String filename, final long readBytes, final long contentLength,
|
||||||
final Item item = uploads.getItem(filename);
|
final SoftwareModule softwareModule) {
|
||||||
|
final Item item = uploads.getItem(getItemid(filename, softwareModule));
|
||||||
|
double progress = (double) readBytes / (double) contentLength;
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
double progress = (double) readBytes / (double) contentLength;
|
|
||||||
item.getItemProperty(PROGRESS).setValue(progress);
|
item.getItemProperty(PROGRESS).setValue(progress);
|
||||||
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
}
|
||||||
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
||||||
.collect(Collectors.toList());
|
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
||||||
if (!uploadStatusObjectList.isEmpty()) {
|
.collect(Collectors.toList());
|
||||||
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
if (!uploadStatusObjectList.isEmpty()) {
|
||||||
uploadStatusObject.setProgress(progress);
|
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
||||||
}
|
uploadStatusObject.setProgress(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,26 +355,29 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
*
|
*
|
||||||
* @param filename
|
* @param filename
|
||||||
* of the uploaded file.
|
* of the uploaded file.
|
||||||
|
* @param softwareModule
|
||||||
|
* selected software module
|
||||||
*/
|
*/
|
||||||
public void uploadSucceeded(final String filename) {
|
public void uploadSucceeded(final String filename, SoftwareModule softwareModule) {
|
||||||
final Item item = uploads.getItem(filename);
|
final Item item = uploads.getItem(getItemid(filename, softwareModule));
|
||||||
|
String status = "Finished";
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
String status = "Finished";
|
|
||||||
item.getItemProperty(STATUS).setValue(status);
|
item.getItemProperty(STATUS).setValue(status);
|
||||||
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
}
|
||||||
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
||||||
.collect(Collectors.toList());
|
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
||||||
if (!uploadStatusObjectList.isEmpty()) {
|
.collect(Collectors.toList());
|
||||||
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
if (!uploadStatusObjectList.isEmpty()) {
|
||||||
uploadStatusObject.setStatus(status);
|
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
||||||
}
|
uploadStatusObject.setStatus(status);
|
||||||
|
uploadStatusObject.setProgress(1d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void uploadFailed(final String filename, final String errorReason) {
|
void uploadFailed(final String filename, final String errorReason, SoftwareModule softwareModule) {
|
||||||
errorOccured = true;
|
errorOccured = true;
|
||||||
String status = "Failed";
|
String status = "Failed";
|
||||||
final Item item = uploads.getItem(filename);
|
final Item item = uploads.getItem(getItemid(filename, softwareModule));
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(REASON).setValue(errorReason);
|
item.getItemProperty(REASON).setValue(errorReason);
|
||||||
item.getItemProperty(STATUS).setValue(status);
|
item.getItemProperty(STATUS).setValue(status);
|
||||||
@@ -385,7 +405,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setPopupSizeInMinMode() {
|
private void setPopupSizeInMinMode() {
|
||||||
mainLayout.setWidth(800, Unit.PIXELS);
|
mainLayout.setWidth(900, Unit.PIXELS);
|
||||||
mainLayout.setHeight(510, Unit.PIXELS);
|
mainLayout.setHeight(510, Unit.PIXELS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,6 +437,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
grid.getColumn(PROGRESS).setExpandRatio(1);
|
grid.getColumn(PROGRESS).setExpandRatio(1);
|
||||||
grid.getColumn(FILE_NAME).setExpandRatio(2);
|
grid.getColumn(FILE_NAME).setExpandRatio(2);
|
||||||
grid.getColumn(REASON).setExpandRatio(3);
|
grid.getColumn(REASON).setExpandRatio(3);
|
||||||
|
grid.getColumn(SPUILabelDefinitions.NAME_VERSION).setExpandRatio(4);
|
||||||
mainLayout.setSizeFull();
|
mainLayout.setSizeFull();
|
||||||
} else {
|
} else {
|
||||||
event.getButton().setIcon(FontAwesome.EXPAND);
|
event.getButton().setIcon(FontAwesome.EXPAND);
|
||||||
@@ -455,7 +476,7 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void createConfirmDialog() {
|
private void createConfirmDialog() {
|
||||||
confirmDialog = new ConfirmationDialog(i18n.get("caption.cancel.action.confirmbox"),
|
confirmDialog = new ConfirmationDialog(i18n.get("caption.confirm.abort.action"),
|
||||||
i18n.get("message.abort.upload"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
i18n.get("message.abort.upload"), i18n.get("button.ok"), i18n.get("button.cancel"), ok -> {
|
||||||
if (ok) {
|
if (ok) {
|
||||||
eventBus.publish(this, UploadStatusEventType.ABORT_UPLOAD);
|
eventBus.publish(this, UploadStatusEventType.ABORT_UPLOAD);
|
||||||
@@ -463,8 +484,13 @@ public class UploadStatusInfoWindow extends Window {
|
|||||||
errorOccured = true;
|
errorOccured = true;
|
||||||
minimizeButton.setEnabled(false);
|
minimizeButton.setEnabled(false);
|
||||||
closeButton.setEnabled(false);
|
closeButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getItemid(final String filename, final SoftwareModule softwareModule) {
|
||||||
|
return new StringBuilder(filename).append(
|
||||||
|
HawkbitCommonUtil.getFormattedNameVersion(softwareModule.getName(), softwareModule.getVersion()))
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.upload;
|
package org.eclipse.hawkbit.ui.artifacts.upload;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Holds uploaded file status.Used to display the details in upload status
|
* Holds uploaded file status.Used to display the details in upload status
|
||||||
@@ -19,16 +21,23 @@ public class UploadStatusObject {
|
|||||||
private Double progress;
|
private Double progress;
|
||||||
private String filename;
|
private String filename;
|
||||||
private String reason;
|
private String reason;
|
||||||
|
private SoftwareModule selectedSoftwareModule;
|
||||||
|
|
||||||
public UploadStatusObject(String status, Double progress, String fileName, String reason) {
|
public UploadStatusObject(final String status, final Double progress, final String fileName, final String reason,
|
||||||
this(fileName);
|
final SoftwareModule selectedSoftwareModule) {
|
||||||
|
this(fileName,selectedSoftwareModule);
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.progress = progress;
|
this.progress = progress;
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UploadStatusObject(String fileName) {
|
public UploadStatusObject(String fileName, SoftwareModule selectedSoftwareModule) {
|
||||||
this.filename = fileName;
|
this.filename = fileName;
|
||||||
|
this.selectedSoftwareModule = selectedSoftwareModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SoftwareModule getSelectedSoftwareModule() {
|
||||||
|
return selectedSoftwareModule;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getStatus() {
|
public String getStatus() {
|
||||||
|
|||||||
Reference in New Issue
Block a user