Minimize/Maximize upload status popup intial commit
Signed-off-by: Asharani <asharani.murugesh@in.bosch.com>
This commit is contained in:
@@ -16,5 +16,5 @@ package org.eclipse.hawkbit.ui.artifacts.event;
|
|||||||
*/
|
*/
|
||||||
public enum UploadArtifactUIEvent {
|
public enum UploadArtifactUIEvent {
|
||||||
|
|
||||||
SHOW_DROP_HINTS, HIDE_DROP_HINTS, SOFTWARE_DRAG_START, SOFTWARE_TYPE_DRAG_START, UPDATE_UPLOAD_COUNT, ENABLE_PROCESS_BUTTON, HIDE_FILTER_BY_TYPE, SHOW_FILTER_BY_TYPE, DISCARD_DELETE_SOFTWARE, DISCARD_ALL_DELETE_SOFTWARE, DELETED_ALL_SOFWARE, DISABLE_PROCESS_BUTTON, DISCARD_DELETE_SOFTWARE_TYPE, DISCARD_ALL_DELETE_SOFTWARE_TYPE, DELETED_ALL_SOFWARE_TYPE
|
SHOW_DROP_HINTS, HIDE_DROP_HINTS, SOFTWARE_DRAG_START, SOFTWARE_TYPE_DRAG_START, UPDATE_UPLOAD_COUNT, ENABLE_PROCESS_BUTTON, HIDE_FILTER_BY_TYPE, SHOW_FILTER_BY_TYPE, DISCARD_DELETE_SOFTWARE, DISCARD_ALL_DELETE_SOFTWARE, DELETED_ALL_SOFWARE, DISABLE_PROCESS_BUTTON, DISCARD_DELETE_SOFTWARE_TYPE, DISCARD_ALL_DELETE_SOFTWARE_TYPE, DELETED_ALL_SOFWARE_TYPE,MINIMIZED_STATUS_POPUP,MAXIMIZED_STATUS_POPUP,UPLOAD_FINISHED,UPLOAD_STARTED, UPLOAD_STREAMINING_FINISHED
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,17 @@
|
|||||||
package org.eclipse.hawkbit.ui.artifacts.state;
|
package org.eclipse.hawkbit.ui.artifacts.state;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.upload.UploadStatusObject;
|
||||||
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
import org.eclipse.hawkbit.ui.common.ManagmentEntityState;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
@@ -58,8 +61,42 @@ public class ArtifactUploadState implements ManagmentEntityState<Long>, Serializ
|
|||||||
private final Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
|
private final Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
|
||||||
|
|
||||||
private boolean noDataAvilableSoftwareModule = Boolean.FALSE;
|
private boolean noDataAvilableSoftwareModule = Boolean.FALSE;
|
||||||
|
|
||||||
|
private boolean isStatusPopupMinimized = Boolean.FALSE;
|
||||||
|
|
||||||
|
private boolean isUploadCompleted = Boolean.FALSE;
|
||||||
|
|
||||||
|
private List<UploadStatusObject> uploadedFileStatusList = new ArrayList<>();
|
||||||
|
|
||||||
|
public List<UploadStatusObject> getUploadedFileStatusList() {
|
||||||
|
return uploadedFileStatusList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUploadedFileStatusList(List<UploadStatusObject> uploadedFileStatusList) {
|
||||||
|
this.uploadedFileStatusList = uploadedFileStatusList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUploadCompleted() {
|
||||||
|
return isUploadCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUploadCompleted(boolean isUploadCompleted) {
|
||||||
|
this.isUploadCompleted = isUploadCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
|
public void setStatusPopupMinimized(boolean isStatusPopupMinimized) {
|
||||||
|
this.isStatusPopupMinimized = isStatusPopupMinimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isStatusPopupMinimized() {
|
||||||
|
return isStatusPopupMinimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
* Set software.
|
* Set software.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -13,11 +13,13 @@ import java.io.OutputStream;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
import org.eclipse.hawkbit.repository.exception.ArtifactUploadFailedException;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
import org.eclipse.hawkbit.ui.artifacts.state.CustomFile;
|
||||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.vaadin.spring.events.EventBus;
|
||||||
|
|
||||||
import com.vaadin.server.StreamVariable;
|
import com.vaadin.server.StreamVariable;
|
||||||
import com.vaadin.ui.Upload;
|
import com.vaadin.ui.Upload;
|
||||||
@@ -66,6 +68,8 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
private volatile boolean interrupted = false;
|
private volatile boolean interrupted = false;
|
||||||
private String failureReason;
|
private String failureReason;
|
||||||
private final I18N i18n;
|
private final I18N i18n;
|
||||||
|
private transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
|
|
||||||
UploadHandler(final String fileName, final long fileSize, final UploadLayout view,
|
UploadHandler(final String fileName, final long fileSize, final UploadLayout view,
|
||||||
final UploadStatusInfoWindow infoWindow, final long maxSize, final Upload upload, final String mimeType) {
|
final UploadStatusInfoWindow infoWindow, final long maxSize, final Upload upload, final String mimeType) {
|
||||||
@@ -78,7 +82,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
this.upload = upload;
|
this.upload = upload;
|
||||||
this.mimeType = mimeType;
|
this.mimeType = mimeType;
|
||||||
this.i18n = SpringContextHelper.getBean(I18N.class);
|
this.i18n = SpringContextHelper.getBean(I18N.class);
|
||||||
|
this.eventBus = SpringContextHelper.getBean(EventBus.SessionEventBus.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -166,7 +170,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
if (view.enableProcessBtn()) {
|
if (view.enableProcessBtn()) {
|
||||||
infoWindow.uploadSessionFinished();
|
infoWindow.uploadSessionFinished();
|
||||||
}
|
}
|
||||||
view.updateActionCount();
|
eventBus.publish(this, UploadArtifactUIEvent.UPLOAD_STREAMINING_FINISHED);
|
||||||
|
|
||||||
// display the duplicate message after streaming all files
|
// display the duplicate message after streaming all files
|
||||||
view.displayDuplicateValidationMessage();
|
view.displayDuplicateValidationMessage();
|
||||||
@@ -237,10 +241,12 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
public void updateProgress(final long readBytes, final long contentLength) {
|
public void updateProgress(final long readBytes, final long contentLength) {
|
||||||
if (readBytes > maxSize || contentLength > maxSize) {
|
if (readBytes > maxSize || contentLength > maxSize) {
|
||||||
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
||||||
|
|
||||||
view.decreaseNumberOfFileUploadsExpected();
|
view.decreaseNumberOfFileUploadsExpected();
|
||||||
final SoftwareModule sw = view.getSoftwareModuleSelected();
|
final SoftwareModule sw = view.getSoftwareModuleSelected();
|
||||||
view.getFileSelected().remove(new CustomFile(fileName, sw.getName(), sw.getVersion()));
|
view.getFileSelected().remove(new CustomFile(fileName, sw.getName(), sw.getVersion()));
|
||||||
view.updateActionCount();
|
view.updateActionCount();
|
||||||
|
|
||||||
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
||||||
infoWindow.uploadFailed(fileName, failureReason);
|
infoWindow.uploadFailed(fileName, failureReason);
|
||||||
upload.interruptUpload();
|
upload.interruptUpload();
|
||||||
@@ -261,10 +267,12 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
public void onProgress(final StreamingProgressEvent event) {
|
public void onProgress(final StreamingProgressEvent event) {
|
||||||
if (event.getBytesReceived() > maxSize || event.getContentLength() > maxSize) {
|
if (event.getBytesReceived() > maxSize || event.getContentLength() > maxSize) {
|
||||||
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
LOG.error("User tried to upload more than was allowed ({}).", maxSize);
|
||||||
|
|
||||||
view.decreaseNumberOfFileUploadsExpected();
|
view.decreaseNumberOfFileUploadsExpected();
|
||||||
final SoftwareModule sw = view.getSoftwareModuleSelected();
|
final SoftwareModule sw = view.getSoftwareModuleSelected();
|
||||||
view.getFileSelected().remove(new CustomFile(fileName, sw.getName(), sw.getVersion()));
|
view.getFileSelected().remove(new CustomFile(fileName, sw.getName(), sw.getVersion()));
|
||||||
view.updateActionCount();
|
eventBus.publish(this, UploadArtifactUIEvent.UPLOAD_STREAMINING_FINISHED);
|
||||||
|
|
||||||
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
failureReason = i18n.get("message.uploadedfile.size.exceeded", maxSize);
|
||||||
infoWindow.uploadFailed(event.getFileName(), failureReason);
|
infoWindow.uploadFailed(event.getFileName(), failureReason);
|
||||||
interrupted = true;
|
interrupted = true;
|
||||||
@@ -285,11 +293,19 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
@Override
|
@Override
|
||||||
public void streamingFailed(final StreamingErrorEvent event) {
|
public void streamingFailed(final StreamingErrorEvent event) {
|
||||||
LOG.info("Streaming failed for file :{}", event.getFileName());
|
LOG.info("Streaming failed for file :{}", event.getFileName());
|
||||||
|
|
||||||
view.decreaseNumberOfFileUploadsExpected();
|
view.decreaseNumberOfFileUploadsExpected();
|
||||||
final SoftwareModule sw = view.getSoftwareModuleSelected();
|
final SoftwareModule sw = view.getSoftwareModuleSelected();
|
||||||
view.getFileSelected().remove(new CustomFile(fileName, sw.getName(), sw.getVersion()));
|
view.getFileSelected().remove(new CustomFile(fileName, sw.getName(), sw.getVersion()));
|
||||||
view.updateActionCount();
|
eventBus.publish(this, UploadArtifactUIEvent.UPLOAD_STREAMINING_FINISHED);
|
||||||
infoWindow.uploadFailed(event.getFileName(), failureReason);
|
|
||||||
|
if (failureReason != null) {
|
||||||
|
// Display custom error message
|
||||||
|
infoWindow.uploadFailed(event.getFileName(), failureReason);
|
||||||
|
} else {
|
||||||
|
// internal upload error
|
||||||
|
infoWindow.uploadFailed(event.getFileName(), event.getException().getMessage());
|
||||||
|
}
|
||||||
// check if we are finished
|
// check if we are finished
|
||||||
if (view.enableProcessBtn()) {
|
if (view.enableProcessBtn()) {
|
||||||
infoWindow.uploadSessionFinished();
|
infoWindow.uploadSessionFinished();
|
||||||
@@ -299,6 +315,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
|
|||||||
LOG.info("Streaming failed due to :{}", event.getException());
|
LOG.info("Streaming failed due to :{}", event.getException());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload failed for {@link Upload} variant.
|
* Upload failed for {@link Upload} variant.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private final List<String> duplicateFileNamesList = new ArrayList<>();
|
private final List<String> duplicateFileNamesList = new ArrayList<>();
|
||||||
|
|
||||||
private Button processBtn;
|
private Button processBtn ;
|
||||||
|
|
||||||
private Button discardBtn;
|
private Button discardBtn;
|
||||||
|
|
||||||
@@ -119,6 +119,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private Boolean hasDirectory = Boolean.FALSE;
|
private Boolean hasDirectory = Boolean.FALSE;
|
||||||
|
|
||||||
|
private Button uploadStatusButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the upload layout.
|
* Initialize the upload layout.
|
||||||
*/
|
*/
|
||||||
@@ -127,12 +129,13 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
createComponents();
|
createComponents();
|
||||||
buildLayout();
|
buildLayout();
|
||||||
updateActionCount();
|
updateActionCount();
|
||||||
|
restoreState();
|
||||||
eventBus.subscribe(this);
|
eventBus.subscribe(this);
|
||||||
ui = UI.getCurrent();
|
ui = UI.getCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createComponents() {
|
private void createComponents() {
|
||||||
|
createUploadStatusButton();
|
||||||
createProcessButton();
|
createProcessButton();
|
||||||
createDiscardBtn();
|
createDiscardBtn();
|
||||||
}
|
}
|
||||||
@@ -154,12 +157,15 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
fileUploadLayout = new HorizontalLayout();
|
fileUploadLayout = new HorizontalLayout();
|
||||||
fileUploadLayout.setSpacing(true);
|
fileUploadLayout.setSpacing(true);
|
||||||
|
fileUploadLayout.addStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
|
||||||
fileUploadLayout.addComponent(upload);
|
fileUploadLayout.addComponent(upload);
|
||||||
fileUploadLayout.setComponentAlignment(upload, Alignment.MIDDLE_LEFT);
|
fileUploadLayout.setComponentAlignment(upload, Alignment.MIDDLE_LEFT);
|
||||||
fileUploadLayout.addComponent(processBtn);
|
fileUploadLayout.addComponent(processBtn);
|
||||||
fileUploadLayout.setComponentAlignment(processBtn, Alignment.MIDDLE_RIGHT);
|
fileUploadLayout.setComponentAlignment(processBtn, Alignment.MIDDLE_RIGHT);
|
||||||
fileUploadLayout.addComponent(discardBtn);
|
fileUploadLayout.addComponent(discardBtn);
|
||||||
fileUploadLayout.setComponentAlignment(discardBtn, Alignment.MIDDLE_RIGHT);
|
fileUploadLayout.setComponentAlignment(discardBtn, Alignment.MIDDLE_RIGHT);
|
||||||
|
fileUploadLayout.addComponent(uploadStatusButton);
|
||||||
|
fileUploadLayout.setComponentAlignment(uploadStatusButton, Alignment.MIDDLE_RIGHT);
|
||||||
setMargin(false);
|
setMargin(false);
|
||||||
|
|
||||||
/* create drag-drop wrapper for drop area */
|
/* create drag-drop wrapper for drop area */
|
||||||
@@ -167,7 +173,13 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
dropAreaWrapper.setDropHandler(new DropAreahandler());
|
dropAreaWrapper.setDropHandler(new DropAreahandler());
|
||||||
setSizeFull();
|
setSizeFull();
|
||||||
setSpacing(true);
|
setSpacing(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreState() {
|
||||||
|
if (artifactUploadState.isStatusPopupMinimized()) {
|
||||||
|
showUploadStatusButton();
|
||||||
|
setUploadStatusButtonIconToFinished();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DragAndDropWrapper getDropAreaWrapper() {
|
public DragAndDropWrapper getDropAreaWrapper() {
|
||||||
@@ -324,8 +336,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
||||||
|
|
||||||
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
|
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
|
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
|
||||||
|
|
||||||
final CustomFile customFile = new CustomFile(name, size, tempFile.getAbsolutePath(),
|
final CustomFile customFile = new CustomFile(name, size, tempFile.getAbsolutePath(),
|
||||||
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion(), mimeType);
|
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion(), mimeType);
|
||||||
@@ -403,8 +415,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
public Boolean checkIfFileIsDuplicate(final String name) {
|
public Boolean checkIfFileIsDuplicate(final String name) {
|
||||||
Boolean isDuplicate = false;
|
Boolean isDuplicate = false;
|
||||||
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
||||||
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
|
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
|
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
|
||||||
|
|
||||||
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
|
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
|
||||||
final String fileSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
final String fileSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
@@ -469,8 +481,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
void updateFileSize(final String name, final long size) {
|
void updateFileSize(final String name, final long size) {
|
||||||
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
final SoftwareModule selectedSoftwareModule = artifactUploadState.getSelectedBaseSoftwareModule().get();
|
||||||
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil
|
final String currentBaseSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
.getFormattedNameVersion(selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
|
selectedSoftwareModule.getName(), selectedSoftwareModule.getVersion());
|
||||||
|
|
||||||
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
|
for (final CustomFile customFile : artifactUploadState.getFileSelected()) {
|
||||||
final String fileSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
final String fileSoftwareModuleKey = HawkbitCommonUtil.getFormattedNameVersion(
|
||||||
@@ -507,9 +519,10 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
if (event.getButton().equals(discardBtn)) {
|
if (event.getButton().equals(discardBtn)) {
|
||||||
if (artifactUploadState.getFileSelected().isEmpty()) {
|
if (artifactUploadState.getFileSelected().isEmpty()) {
|
||||||
uiNotification.displayValidationError(i18n.get("message.error.noFileSelected"));
|
uiNotification.displayValidationError(i18n.get("message.error.noFileSelected"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
clearFileList();
|
clearFileList();
|
||||||
|
uploadInfoWindow.clearWindow();
|
||||||
|
hideUploadStatusButton();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -536,12 +549,12 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
|
|
||||||
private void setConfirmationPopupHeightWidth(final float newWidth, final float newHeight) {
|
private void setConfirmationPopupHeightWidth(final float newWidth, final float newHeight) {
|
||||||
if (currentUploadConfirmationwindow != null) {
|
if (currentUploadConfirmationwindow != null) {
|
||||||
currentUploadConfirmationwindow.getUploadArtifactDetails().setWidth(HawkbitCommonUtil
|
currentUploadConfirmationwindow.getUploadArtifactDetails().setWidth(
|
||||||
.getArtifactUploadPopupWidth(newWidth, SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH),
|
HawkbitCommonUtil.getArtifactUploadPopupWidth(newWidth,
|
||||||
Unit.PIXELS);
|
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH), Unit.PIXELS);
|
||||||
currentUploadConfirmationwindow.getUploadDetailsTable().setHeight(HawkbitCommonUtil
|
currentUploadConfirmationwindow.getUploadDetailsTable().setHeight(
|
||||||
.getArtifactUploadPopupHeight(newHeight, SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT),
|
HawkbitCommonUtil.getArtifactUploadPopupHeight(newHeight,
|
||||||
Unit.PIXELS);
|
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT), Unit.PIXELS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -558,10 +571,12 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
&& currentUploadConfirmationwindow.getCurrentUploadResultWindow() != null) {
|
&& currentUploadConfirmationwindow.getCurrentUploadResultWindow() != null) {
|
||||||
final UploadResultWindow uploadResultWindow = currentUploadConfirmationwindow
|
final UploadResultWindow uploadResultWindow = currentUploadConfirmationwindow
|
||||||
.getCurrentUploadResultWindow();
|
.getCurrentUploadResultWindow();
|
||||||
uploadResultWindow.getUploadResultsWindow().setWidth(HawkbitCommonUtil.getArtifactUploadPopupWidth(newWidth,
|
uploadResultWindow.getUploadResultsWindow().setWidth(
|
||||||
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH), Unit.PIXELS);
|
HawkbitCommonUtil.getArtifactUploadPopupWidth(newWidth,
|
||||||
uploadResultWindow.getUploadResultTable().setHeight(HawkbitCommonUtil.getArtifactUploadPopupHeight(
|
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_WIDTH), Unit.PIXELS);
|
||||||
newHeight, SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT), Unit.PIXELS);
|
uploadResultWindow.getUploadResultTable().setHeight(
|
||||||
|
HawkbitCommonUtil.getArtifactUploadPopupHeight(newHeight,
|
||||||
|
SPUIDefinitions.MIN_UPLOAD_CONFIRMATION_POPUP_HEIGHT), Unit.PIXELS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,8 +587,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
} else {
|
} else {
|
||||||
currentUploadConfirmationwindow = new UploadConfirmationwindow(this, artifactUploadState);
|
currentUploadConfirmationwindow = new UploadConfirmationwindow(this, artifactUploadState);
|
||||||
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
|
UI.getCurrent().addWindow(currentUploadConfirmationwindow.getUploadConfrimationWindow());
|
||||||
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(),
|
setConfirmationPopupHeightWidth(Page.getCurrent().getBrowserWindowWidth(), Page.getCurrent()
|
||||||
Page.getCurrent().getBrowserWindowHeight());
|
.getBrowserWindowHeight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -608,7 +623,20 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
void onEvent(final UploadArtifactUIEvent event) {
|
void onEvent(final UploadArtifactUIEvent event) {
|
||||||
if (event == UploadArtifactUIEvent.DELETED_ALL_SOFWARE) {
|
if (event == UploadArtifactUIEvent.DELETED_ALL_SOFWARE) {
|
||||||
ui.access(() -> updateActionCount());
|
ui.access(() -> updateActionCount());
|
||||||
|
} else if (event == UploadArtifactUIEvent.MINIMIZED_STATUS_POPUP) {
|
||||||
|
ui.access(() -> showUploadStatusButton());
|
||||||
|
} else if (event == UploadArtifactUIEvent.MAXIMIZED_STATUS_POPUP) {
|
||||||
|
ui.access(() -> maximizeStatusPopup());
|
||||||
|
} else if (event == UploadArtifactUIEvent.UPLOAD_FINISHED) {
|
||||||
|
ui.access(() -> setUploadStatusButtonIconToFinished());
|
||||||
|
} else if (event == UploadArtifactUIEvent.UPLOAD_STARTED) {
|
||||||
|
ui.access(() -> setUploadStatusButtonIconToInProgress());
|
||||||
|
}else if (event == UploadArtifactUIEvent.UPLOAD_STREAMINING_FINISHED) {
|
||||||
|
//TODO re-check
|
||||||
|
updateActionCount();
|
||||||
|
enableProcessBtn();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreDestroy
|
@PreDestroy
|
||||||
@@ -637,8 +665,8 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
* @param selectedBaseSoftwareModule
|
* @param selectedBaseSoftwareModule
|
||||||
*/
|
*/
|
||||||
public void refreshArtifactDetailsLayout(final SoftwareModule selectedBaseSoftwareModule) {
|
public void refreshArtifactDetailsLayout(final SoftwareModule selectedBaseSoftwareModule) {
|
||||||
eventBus.publish(this,
|
eventBus.publish(this, new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED,
|
||||||
new SoftwareModuleEvent(SoftwareModuleEventType.ARTIFACTS_CHANGED, selectedBaseSoftwareModule));
|
selectedBaseSoftwareModule));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -655,4 +683,55 @@ public class UploadLayout extends VerticalLayout {
|
|||||||
public void setHasDirectory(final Boolean hasDirectory) {
|
public void setHasDirectory(final Boolean hasDirectory) {
|
||||||
this.hasDirectory = hasDirectory;
|
this.hasDirectory = hasDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createUploadStatusButton() {
|
||||||
|
uploadStatusButton = SPUIComponentProvider.getButton(SPUIComponetIdProvider.UPLOAD_STATUS_BUTTON, "", "", "",
|
||||||
|
false, null, SPUIButtonStyleSmall.class);
|
||||||
|
uploadStatusButton.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
||||||
|
uploadStatusButton.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
|
uploadStatusButton.setWidth("100px");
|
||||||
|
uploadStatusButton.setHtmlContentAllowed(true);
|
||||||
|
uploadStatusButton.addClickListener(event -> onClickOfUploadStatusButton());
|
||||||
|
uploadStatusButton.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onClickOfUploadStatusButton() {
|
||||||
|
artifactUploadState.setStatusPopupMinimized(false);
|
||||||
|
eventBus.publish(this, UploadArtifactUIEvent.MAXIMIZED_STATUS_POPUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showUploadStatusButton() {
|
||||||
|
if (uploadStatusButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uploadStatusButton.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void hideUploadStatusButton() {
|
||||||
|
if (uploadStatusButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uploadStatusButton.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maximizeStatusPopup() {
|
||||||
|
hideUploadStatusButton();
|
||||||
|
uploadInfoWindow.maximizeStatusPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUploadStatusButtonIconToFinished() {
|
||||||
|
if (uploadStatusButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uploadStatusButton.removeStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
|
uploadStatusButton.setIcon(FontAwesome.UPLOAD);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setUploadStatusButtonIconToInProgress() {
|
||||||
|
if (uploadStatusButton == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
uploadStatusButton.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
|
uploadStatusButton.setIcon(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,20 +8,37 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.artifacts.upload;
|
package org.eclipse.hawkbit.ui.artifacts.upload;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.event.UploadArtifactUIEvent;
|
||||||
|
import org.eclipse.hawkbit.ui.artifacts.state.ArtifactUploadState;
|
||||||
|
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.vaadin.spring.events.EventBus;
|
||||||
|
|
||||||
|
import com.vaadin.data.Container.Indexed;
|
||||||
import com.vaadin.data.Item;
|
import com.vaadin.data.Item;
|
||||||
import com.vaadin.data.util.IndexedContainer;
|
import com.vaadin.data.util.IndexedContainer;
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
import com.vaadin.shared.ui.window.WindowMode;
|
import com.vaadin.shared.ui.window.WindowMode;
|
||||||
import com.vaadin.spring.annotation.SpringComponent;
|
import com.vaadin.spring.annotation.SpringComponent;
|
||||||
import com.vaadin.spring.annotation.ViewScope;
|
import com.vaadin.spring.annotation.ViewScope;
|
||||||
|
import com.vaadin.ui.Button;
|
||||||
|
import com.vaadin.ui.Button.ClickEvent;
|
||||||
import com.vaadin.ui.Grid;
|
import com.vaadin.ui.Grid;
|
||||||
import com.vaadin.ui.Grid.SelectionMode;
|
import com.vaadin.ui.Grid.SelectionMode;
|
||||||
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
|
import com.vaadin.ui.Label;
|
||||||
import com.vaadin.ui.UI;
|
import com.vaadin.ui.UI;
|
||||||
|
import com.vaadin.ui.VerticalLayout;
|
||||||
import com.vaadin.ui.Window;
|
import com.vaadin.ui.Window;
|
||||||
import com.vaadin.ui.renderers.HtmlRenderer;
|
import com.vaadin.ui.renderers.HtmlRenderer;
|
||||||
import com.vaadin.ui.renderers.ProgressBarRenderer;
|
import com.vaadin.ui.renderers.ProgressBarRenderer;
|
||||||
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
import elemental.json.JsonValue;
|
import elemental.json.JsonValue;
|
||||||
|
|
||||||
@@ -34,7 +51,13 @@ import elemental.json.JsonValue;
|
|||||||
|
|
||||||
@ViewScope
|
@ViewScope
|
||||||
@SpringComponent
|
@SpringComponent
|
||||||
public class UploadStatusInfoWindow extends Window implements Window.CloseListener, Window.WindowModeChangeListener {
|
public class UploadStatusInfoWindow extends Window {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private transient EventBus.SessionEventBus eventBus;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ArtifactUploadState artifactUploadState;
|
||||||
|
|
||||||
private static final String PROGRESS = "Progress";
|
private static final String PROGRESS = "Progress";
|
||||||
|
|
||||||
@@ -52,39 +75,105 @@ public class UploadStatusInfoWindow extends Window implements Window.CloseListen
|
|||||||
|
|
||||||
private volatile boolean errorOccured = false;
|
private volatile boolean errorOccured = false;
|
||||||
|
|
||||||
|
private Button minimizeButton;
|
||||||
|
|
||||||
|
private VerticalLayout mainLayout;
|
||||||
|
|
||||||
|
private Label windowCaption;
|
||||||
|
|
||||||
|
private Button closeButton;
|
||||||
|
|
||||||
|
private Button resizeButton;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
*/
|
*/
|
||||||
UploadStatusInfoWindow() {
|
UploadStatusInfoWindow() {
|
||||||
super("Upload Status");
|
super();
|
||||||
|
|
||||||
addStyleName(SPUIStyleDefinitions.UPLOAD_INFO);
|
setPopupProperties();
|
||||||
center();
|
createStatusPopupHeaderComponents();
|
||||||
setImmediate(true);
|
|
||||||
setResizable(true);
|
|
||||||
setDraggable(true);
|
|
||||||
setClosable(true);
|
|
||||||
uploads = new IndexedContainer();
|
|
||||||
uploads.addContainerProperty(STATUS, String.class, "Active");
|
|
||||||
uploads.addContainerProperty(FILE_NAME, String.class, null);
|
|
||||||
uploads.addContainerProperty(PROGRESS, Double.class, 0D);
|
|
||||||
uploads.addContainerProperty(REASON, String.class, "");
|
|
||||||
|
|
||||||
grid = new Grid(uploads);
|
mainLayout = new VerticalLayout();
|
||||||
grid.addStyleName(SPUIStyleDefinitions.UPLOAD_STATUS_GRID);
|
mainLayout.setSpacing(Boolean.TRUE);
|
||||||
grid.setSelectionMode(SelectionMode.NONE);
|
mainLayout.setSizeUndefined();
|
||||||
grid.getColumn(STATUS).setRenderer(new StatusRenderer());
|
|
||||||
grid.getColumn(PROGRESS).setRenderer(new ProgressBarRenderer());
|
|
||||||
setColumnWidth();
|
|
||||||
grid.setFrozenColumnCount(4);
|
|
||||||
grid.setColumnOrder(STATUS, PROGRESS, FILE_NAME, REASON);
|
|
||||||
grid.setHeaderVisible(true);
|
|
||||||
grid.setImmediate(true);
|
|
||||||
setPopupSizeInMinMode();
|
setPopupSizeInMinMode();
|
||||||
|
|
||||||
setContent(grid);
|
uploads = getGridContainer();
|
||||||
addCloseListener(this);
|
grid = createGrid();
|
||||||
addWindowModeChangeListener(this);
|
setGridColumnProperties();
|
||||||
|
|
||||||
|
mainLayout.addComponents(getCaptionLayout(), grid);
|
||||||
|
mainLayout.setExpandRatio(grid, 1.0F);
|
||||||
|
setContent(mainLayout);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void restoreState() {
|
||||||
|
Indexed container = grid.getContainerDataSource();
|
||||||
|
if (container.getItemIds().isEmpty()) {
|
||||||
|
container.removeAllItems();
|
||||||
|
for (UploadStatusObject statusObject : artifactUploadState.getUploadedFileStatusList()) {
|
||||||
|
Item item = container.addItem(statusObject.getFilename());
|
||||||
|
item.getItemProperty(REASON).setValue(statusObject.getReason() != null ? statusObject.getReason() : "");
|
||||||
|
item.getItemProperty(STATUS).setValue(statusObject.getStatus());
|
||||||
|
item.getItemProperty(PROGRESS).setValue(statusObject.getProgress());
|
||||||
|
item.getItemProperty(FILE_NAME).setValue(statusObject.getFilename());
|
||||||
|
}
|
||||||
|
artifactUploadState.setUploadCompleted(true);
|
||||||
|
minimizeButton.setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setPopupProperties() {
|
||||||
|
addStyleName(SPUIStyleDefinitions.UPLOAD_INFO);
|
||||||
|
setImmediate(true);
|
||||||
|
setResizable(false);
|
||||||
|
setDraggable(true);
|
||||||
|
setClosable(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setGridColumnProperties() {
|
||||||
|
grid.getColumn(STATUS).setRenderer(new StatusRenderer());
|
||||||
|
grid.getColumn(PROGRESS).setRenderer(new ProgressBarRenderer());
|
||||||
|
grid.setColumnOrder(STATUS, PROGRESS, FILE_NAME, REASON);
|
||||||
|
setColumnWidth();
|
||||||
|
grid.setFrozenColumnCount(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Grid createGrid() {
|
||||||
|
Grid statusGrid = new Grid(uploads);
|
||||||
|
statusGrid.addStyleName(SPUIStyleDefinitions.UPLOAD_STATUS_GRID);
|
||||||
|
statusGrid.setSelectionMode(SelectionMode.NONE);
|
||||||
|
statusGrid.setHeaderVisible(true);
|
||||||
|
statusGrid.setImmediate(true);
|
||||||
|
statusGrid.setSizeFull();
|
||||||
|
return statusGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private IndexedContainer getGridContainer() {
|
||||||
|
IndexedContainer uploadContainer = new IndexedContainer();
|
||||||
|
uploadContainer.addContainerProperty(STATUS, String.class, "Active");
|
||||||
|
uploadContainer.addContainerProperty(FILE_NAME, String.class, null);
|
||||||
|
uploadContainer.addContainerProperty(PROGRESS, Double.class, 0D);
|
||||||
|
uploadContainer.addContainerProperty(REASON, String.class, "");
|
||||||
|
return uploadContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private HorizontalLayout getCaptionLayout() {
|
||||||
|
final HorizontalLayout captionLayout = new HorizontalLayout();
|
||||||
|
captionLayout.setSizeFull();
|
||||||
|
captionLayout.setHeight("36px");
|
||||||
|
captionLayout.addComponents(windowCaption, minimizeButton, resizeButton, closeButton);
|
||||||
|
captionLayout.setExpandRatio(windowCaption, 1.0F);
|
||||||
|
captionLayout.addStyleName("v-window-header");
|
||||||
|
return captionLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createStatusPopupHeaderComponents() {
|
||||||
|
minimizeButton = getMinimizeButton();
|
||||||
|
windowCaption = new Label("Upload status");
|
||||||
|
closeButton = getCloseButton();
|
||||||
|
resizeButton = getResizeButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setColumnWidth() {
|
private void setColumnWidth() {
|
||||||
@@ -99,15 +188,13 @@ public class UploadStatusInfoWindow extends Window implements Window.CloseListen
|
|||||||
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class StatusRenderer extends HtmlRenderer {
|
private static class StatusRenderer extends HtmlRenderer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JsonValue encode(final String value) {
|
public JsonValue encode(final String value) {
|
||||||
|
String result ;
|
||||||
String result = "";
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case "Finished":
|
case "Finished":
|
||||||
result = "<div class=\"statusIconGreen\">" + FontAwesome.CHECK_CIRCLE.getHtml() + "</div>";
|
result = "<div class=\"statusIconGreen\">" + FontAwesome.CHECK_CIRCLE.getHtml() + "</div>";
|
||||||
@@ -129,28 +216,52 @@ public class UploadStatusInfoWindow extends Window implements Window.CloseListen
|
|||||||
void uploadSessionFinished() {
|
void uploadSessionFinished() {
|
||||||
if (!errorOccured) {
|
if (!errorOccured) {
|
||||||
close();
|
close();
|
||||||
|
eventBus.publish(this, UploadArtifactUIEvent.UPLOAD_FINISHED);
|
||||||
|
artifactUploadState.setUploadCompleted(true);
|
||||||
|
minimizeButton.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void uploadSessionStarted() {
|
void uploadSessionStarted() {
|
||||||
close();
|
close();
|
||||||
|
openWindow();
|
||||||
|
minimizeButton.setEnabled(true);
|
||||||
|
eventBus.publish(this, UploadArtifactUIEvent.UPLOAD_STARTED);
|
||||||
|
artifactUploadState.setUploadCompleted(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void openWindow() {
|
||||||
UI.getCurrent().addWindow(this);
|
UI.getCurrent().addWindow(this);
|
||||||
center();
|
center();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void maximizeStatusPopup() {
|
||||||
|
openWindow();
|
||||||
|
restoreState();
|
||||||
|
}
|
||||||
|
|
||||||
void uploadStarted(final String filename) {
|
void uploadStarted(final String filename) {
|
||||||
final Item item = uploads.addItem(filename);
|
final Item item = uploads.addItem(filename);
|
||||||
item.getItemProperty(FILE_NAME).setValue(filename);
|
item.getItemProperty(FILE_NAME).setValue(filename);
|
||||||
grid.scrollToEnd();
|
grid.scrollToEnd();
|
||||||
|
UploadStatusObject uploadStatus = new UploadStatusObject(filename);
|
||||||
|
uploadStatus.setStatus("Active");
|
||||||
|
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 Item item = uploads.getItem(filename);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(PROGRESS).setValue((double) readBytes / (double) contentLength);
|
double progress = (double) readBytes / (double) contentLength;
|
||||||
|
item.getItemProperty(PROGRESS).setValue(progress);
|
||||||
|
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
||||||
|
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!uploadStatusObjectList.isEmpty()) {
|
||||||
|
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
||||||
|
uploadStatusObject.setProgress(progress);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,8 +274,15 @@ public class UploadStatusInfoWindow extends Window implements Window.CloseListen
|
|||||||
public void uploadSucceeded(final String filename) {
|
public void uploadSucceeded(final String filename) {
|
||||||
final Item item = uploads.getItem(filename);
|
final Item item = uploads.getItem(filename);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
item.getItemProperty(STATUS).setValue("Finished");
|
String status = "Finished";
|
||||||
|
item.getItemProperty(STATUS).setValue(status);
|
||||||
|
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
||||||
|
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!uploadStatusObjectList.isEmpty()) {
|
||||||
|
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
||||||
|
uploadStatusObject.setStatus(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,51 +293,81 @@ public class UploadStatusInfoWindow extends Window implements Window.CloseListen
|
|||||||
errorOccured = true;
|
errorOccured = true;
|
||||||
}
|
}
|
||||||
item.getItemProperty(REASON).setValue(errorReason);
|
item.getItemProperty(REASON).setValue(errorReason);
|
||||||
item.getItemProperty(STATUS).setValue("Failed");
|
String status = "Failed";
|
||||||
|
item.getItemProperty(STATUS).setValue(status);
|
||||||
|
List<UploadStatusObject> uploadStatusObjectList = (List<UploadStatusObject>) artifactUploadState
|
||||||
|
.getUploadedFileStatusList().stream().filter(e -> e.getFilename().equals(filename))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (!uploadStatusObjectList.isEmpty()) {
|
||||||
|
UploadStatusObject uploadStatusObject = uploadStatusObjectList.get(0);
|
||||||
|
uploadStatusObject.setStatus(status);
|
||||||
|
uploadStatusObject.setReason(errorReason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
protected void clearWindow() {
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see com.vaadin.ui.Window.CloseListener#windowClose(com.vaadin.ui.Window.
|
|
||||||
* CloseEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void windowClose(final CloseEvent e) {
|
|
||||||
clearWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearWindow() {
|
|
||||||
errorOccured = false;
|
errorOccured = false;
|
||||||
uploads.removeAllItems();
|
uploads.removeAllItems();
|
||||||
setWindowMode(WindowMode.NORMAL);
|
setWindowMode(WindowMode.NORMAL);
|
||||||
|
this.close();
|
||||||
|
artifactUploadState.getUploadedFileStatusList().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
private void setPopupSizeInMinMode() {
|
||||||
* (non-Javadoc)
|
mainLayout.setWidth(800, Unit.PIXELS);
|
||||||
*
|
mainLayout.setHeight(510, Unit.PIXELS);
|
||||||
* @see com.vaadin.ui.Window.WindowModeChangeListener#windowModeChanged(com.
|
}
|
||||||
* vaadin.ui.Window. WindowModeChangeEvent)
|
|
||||||
*/
|
private Button getMinimizeButton() {
|
||||||
@Override
|
final Button minimizeBtn = SPUIComponentProvider.getButton(
|
||||||
public void windowModeChanged(final WindowModeChangeEvent event) {
|
SPUIComponetIdProvider.UPLOAD_STATUS_POPUP_MINIMIZE_BUTTON_ID, "", "", "", true, FontAwesome.MINUS,
|
||||||
if (event.getWindow().getWindowMode() == WindowMode.MAXIMIZED) {
|
SPUIButtonStyleSmallNoBorder.class);
|
||||||
|
minimizeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
||||||
|
minimizeBtn.addClickListener(event -> minimizeWindow());
|
||||||
|
minimizeBtn.setEnabled(true);
|
||||||
|
return minimizeBtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button getResizeButton() {
|
||||||
|
final Button resizeBtn = SPUIComponentProvider.getButton(
|
||||||
|
SPUIComponetIdProvider.UPLOAD_STATUS_POPUP_RESIZE_BUTTON_ID, "", "", "", true, FontAwesome.EXPAND,
|
||||||
|
SPUIButtonStyleSmallNoBorder.class);
|
||||||
|
resizeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
||||||
|
resizeBtn.addClickListener(event -> resizeWindow(event));
|
||||||
|
return resizeBtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resizeWindow(ClickEvent event) {
|
||||||
|
if (event.getButton().getIcon() == FontAwesome.EXPAND) {
|
||||||
|
event.getButton().setIcon(FontAwesome.COMPRESS);
|
||||||
|
setWindowMode(WindowMode.MAXIMIZED);
|
||||||
resetColumnWidth();
|
resetColumnWidth();
|
||||||
grid.getColumn(STATUS).setExpandRatio(0);
|
grid.getColumn(STATUS).setExpandRatio(0);
|
||||||
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.setSizeFull();
|
mainLayout.setSizeFull();
|
||||||
} else {
|
} else {
|
||||||
|
event.getButton().setIcon(FontAwesome.EXPAND);
|
||||||
|
setWindowMode(WindowMode.NORMAL);
|
||||||
setColumnWidth();
|
setColumnWidth();
|
||||||
setPopupSizeInMinMode();
|
setPopupSizeInMinMode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPopupSizeInMinMode() {
|
private void minimizeWindow() {
|
||||||
grid.setWidth(800, Unit.PIXELS);
|
this.close();
|
||||||
grid.setHeight(510, Unit.PIXELS);
|
artifactUploadState.setStatusPopupMinimized(true);
|
||||||
|
eventBus.publish(this, UploadArtifactUIEvent.MINIMIZED_STATUS_POPUP);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Button getCloseButton() {
|
||||||
|
final Button closeBtn = SPUIComponentProvider.getButton(
|
||||||
|
SPUIComponetIdProvider.UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID, "", "", "", true, FontAwesome.TIMES,
|
||||||
|
SPUIButtonStyleSmallNoBorder.class);
|
||||||
|
closeBtn.addStyleName(ValoTheme.BUTTON_BORDERLESS);
|
||||||
|
closeBtn.addClickListener(event -> clearWindow());
|
||||||
|
return closeBtn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
package org.eclipse.hawkbit.ui.artifacts.upload;
|
||||||
|
|
||||||
|
public class UploadStatusObject {
|
||||||
|
private String status;
|
||||||
|
private Double progress;
|
||||||
|
private String filename;
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
public UploadStatusObject(String status, Double progress, String fileName, String reason) {
|
||||||
|
this(fileName);
|
||||||
|
this.status = status;
|
||||||
|
this.progress = progress;
|
||||||
|
this.reason = reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UploadStatusObject(String fileName) {
|
||||||
|
this.filename = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(Double progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilename() {
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilename(String filename) {
|
||||||
|
this.filename = filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReason() {
|
||||||
|
return reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReason(String reason) {
|
||||||
|
this.reason = reason;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == null || obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (obj instanceof UploadStatusObject && this.getFilename() == ((UploadStatusObject) obj).getFilename()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -130,7 +130,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
addComponent(hLayout);
|
addComponent(hLayout);
|
||||||
setComponentAlignment(hLayout, Alignment.BOTTOM_CENTER);
|
setComponentAlignment(hLayout, Alignment.BOTTOM_CENTER);
|
||||||
}
|
}
|
||||||
setStyleName("footer-layout");
|
setStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
|
||||||
setWidth("100%");
|
setWidth("100%");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
final Button button = SPUIComponentProvider.getButton(SPUIComponetIdProvider.BULK_UPLOAD_STATUS_BUTTON, "", "",
|
final Button button = SPUIComponentProvider.getButton(SPUIComponetIdProvider.BULK_UPLOAD_STATUS_BUTTON, "", "",
|
||||||
"", false, null, SPUIButtonStyleSmall.class);
|
"", false, null, SPUIButtonStyleSmall.class);
|
||||||
button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
button.setStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
|
||||||
button.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
button.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
button.setWidth("100px");
|
button.setWidth("100px");
|
||||||
button.setHtmlContentAllowed(true);
|
button.setHtmlContentAllowed(true);
|
||||||
button.addClickListener(event -> onClickBulkUploadNotificationButton());
|
button.addClickListener(event -> onClickBulkUploadNotificationButton());
|
||||||
@@ -199,7 +199,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
if (bulkUploadStatusButton == null) {
|
if (bulkUploadStatusButton == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bulkUploadStatusButton.removeStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
bulkUploadStatusButton.removeStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
bulkUploadStatusButton.setIcon(FontAwesome.UPLOAD);
|
bulkUploadStatusButton.setIcon(FontAwesome.UPLOAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ public abstract class AbstractDeleteActionsLayout extends VerticalLayout impleme
|
|||||||
if (bulkUploadStatusButton == null) {
|
if (bulkUploadStatusButton == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bulkUploadStatusButton.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_PROGRESS_INDICATOR_STYLE);
|
bulkUploadStatusButton.addStyleName(SPUIStyleDefinitions.UPLOAD_PROGRESS_INDICATOR_STYLE);
|
||||||
bulkUploadStatusButton.setIcon(null);
|
bulkUploadStatusButton.setIcon(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
package org.eclipse.hawkbit.ui.common.grid;
|
package org.eclipse.hawkbit.ui.common.grid;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
import org.eclipse.hawkbit.ui.utils.SPUIComponetIdProvider;
|
||||||
|
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||||
|
|
||||||
import com.vaadin.ui.Alignment;
|
import com.vaadin.ui.Alignment;
|
||||||
import com.vaadin.ui.HorizontalLayout;
|
import com.vaadin.ui.HorizontalLayout;
|
||||||
@@ -72,7 +73,7 @@ public abstract class AbstractGridLayout extends VerticalLayout {
|
|||||||
final Label countMessageLabel = getCountMessageLabel();
|
final Label countMessageLabel = getCountMessageLabel();
|
||||||
countMessageLabel.setId(SPUIComponetIdProvider.ROLLOUT_GROUP_TARGET_LABEL);
|
countMessageLabel.setId(SPUIComponetIdProvider.ROLLOUT_GROUP_TARGET_LABEL);
|
||||||
rolloutGroupTargetsCountLayout.addComponent(getCountMessageLabel());
|
rolloutGroupTargetsCountLayout.addComponent(getCountMessageLabel());
|
||||||
rolloutGroupTargetsCountLayout.setStyleName("footer-layout");
|
rolloutGroupTargetsCountLayout.setStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
|
||||||
rolloutGroupTargetsCountLayout.setWidth("100%");
|
rolloutGroupTargetsCountLayout.setWidth("100%");
|
||||||
return rolloutGroupTargetsCountLayout;
|
return rolloutGroupTargetsCountLayout;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.eclipse.hawkbit.ui.HawkbitUI;
|
|||||||
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
import org.eclipse.hawkbit.ui.filtermanagement.event.CustomFilterUIEvent;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.footer.TargetFilterCountMessageLabel;
|
import org.eclipse.hawkbit.ui.filtermanagement.footer.TargetFilterCountMessageLabel;
|
||||||
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
import org.eclipse.hawkbit.ui.filtermanagement.state.FilterManagementUIState;
|
||||||
|
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;
|
||||||
import org.vaadin.spring.events.EventScope;
|
import org.vaadin.spring.events.EventScope;
|
||||||
@@ -151,7 +152,7 @@ public class FilterManagementView extends VerticalLayout implements View {
|
|||||||
private HorizontalLayout addTargetFilterMessageLabel() {
|
private HorizontalLayout addTargetFilterMessageLabel() {
|
||||||
final HorizontalLayout messageLabelLayout = new HorizontalLayout();
|
final HorizontalLayout messageLabelLayout = new HorizontalLayout();
|
||||||
messageLabelLayout.addComponent(targetFilterCountMessageLabel);
|
messageLabelLayout.addComponent(targetFilterCountMessageLabel);
|
||||||
messageLabelLayout.addStyleName("footer-layout");
|
messageLabelLayout.addStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
|
||||||
return messageLabelLayout;
|
return messageLabelLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -883,6 +883,27 @@ public final class SPUIComponetIdProvider {
|
|||||||
*/
|
*/
|
||||||
public static final String VALIDATION_STATUS_ICON_ID = "validation.status.icon";
|
public static final String VALIDATION_STATUS_ICON_ID = "validation.status.icon";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Artifact upload status popup - minimize button id.
|
||||||
|
*/
|
||||||
|
public static final String UPLOAD_STATUS_POPUP_MINIMIZE_BUTTON_ID = "artifact.upload.minimize.button.id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Artifact upload status popup - close button id.
|
||||||
|
*/
|
||||||
|
public static final String UPLOAD_STATUS_POPUP_CLOSE_BUTTON_ID = "artifact.upload.close.button.id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Artifact upload status popup - resize button id.
|
||||||
|
*/
|
||||||
|
public static final String UPLOAD_STATUS_POPUP_RESIZE_BUTTON_ID = "artifact.upload.resize.button.id";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Artifact upload view - upload status button id.
|
||||||
|
*/
|
||||||
|
public static final String UPLOAD_STATUS_BUTTON = "artficat.upload.status.button.id";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /* Private Constructor.
|
* /* Private Constructor.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -240,9 +240,9 @@ public final class SPUIStyleDefinitions {
|
|||||||
public static final String DISABLE_ACTION_TYPE_LAYOUT = "disable-action-type-layout";
|
public static final String DISABLE_ACTION_TYPE_LAYOUT = "disable-action-type-layout";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bulk upload progress indicator style.
|
* Upload progress indicator style.
|
||||||
*/
|
*/
|
||||||
public static final String BULK_UPLOAD_PROGRESS_INDICATOR_STYLE = "app-loading";
|
public static final String UPLOAD_PROGRESS_INDICATOR_STYLE = "app-loading";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Target filter search progress indicator style.
|
* Target filter search progress indicator style.
|
||||||
@@ -293,6 +293,11 @@ public final class SPUIStyleDefinitions {
|
|||||||
* Status pending icon.
|
* Status pending icon.
|
||||||
*/
|
*/
|
||||||
public static final String STATUS_ICON_PENDING = "statusIconPending";
|
public static final String STATUS_ICON_PENDING = "statusIconPending";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Footer layout style.
|
||||||
|
*/
|
||||||
|
public static final String FOOTER_LAYOUT = "footer-layout";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|||||||
Reference in New Issue
Block a user