Artifact upload : on discard action interupt the ongoing upload -

reverted the changes

Signed-off-by: Asharani <asharani.murugesh@in.bosch.com>
This commit is contained in:
Asharani
2016-05-16 16:26:24 +05:30
parent cb81c78b69
commit eadff47f24
3 changed files with 3 additions and 38 deletions

View File

@@ -15,5 +15,5 @@ package org.eclipse.hawkbit.ui.artifacts.event;
*
*/
public enum UploadArtifactUIEvent {
SHOW_DROP_HINTS, HIDE_DROP_HINTS, SOFTWARE_DRAG_START, SOFTWARE_TYPE_DRAG_START, UPDATE_UPLOAD_COUNT, HIDE_FILTER_BY_TYPE, SHOW_FILTER_BY_TYPE, DISCARD_DELETE_SOFTWARE, DISCARD_ALL_DELETE_SOFTWARE, DELETED_ALL_SOFWARE, DISCARD_DELETE_SOFTWARE_TYPE, DISCARD_ALL_DELETE_SOFTWARE_TYPE, DELETED_ALL_SOFWARE_TYPE, MINIMIZED_STATUS_POPUP, MAXIMIZED_STATUS_POPUP, UPLOAD_IN_PROGESS, DISCARD_UPLOAD, ARTIFACT_RESULT_POPUP_CLOSED
SHOW_DROP_HINTS, HIDE_DROP_HINTS, SOFTWARE_DRAG_START, SOFTWARE_TYPE_DRAG_START, UPDATE_UPLOAD_COUNT, HIDE_FILTER_BY_TYPE, SHOW_FILTER_BY_TYPE, DISCARD_DELETE_SOFTWARE, DISCARD_ALL_DELETE_SOFTWARE, DELETED_ALL_SOFWARE, DISCARD_DELETE_SOFTWARE_TYPE, DISCARD_ALL_DELETE_SOFTWARE_TYPE, DELETED_ALL_SOFWARE_TYPE, MINIMIZED_STATUS_POPUP, MAXIMIZED_STATUS_POPUP, UPLOAD_IN_PROGESS, ARTIFACT_RESULT_POPUP_CLOSED
}

View File

@@ -88,24 +88,6 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
this.mimeType = mimeType;
this.i18n = SpringContextHelper.getBean(I18N.class);
this.eventBus = SpringContextHelper.getBean(EventBus.SessionEventBus.class);
eventBus.subscribe(this);
}
@EventBusListenerMethod(scope = EventScope.SESSION)
void onEvent(final UploadArtifactUIEvent event) {
if (event == UploadArtifactUIEvent.DISCARD_UPLOAD) {
UI.getCurrent().access(() ->intreruptUploadOnDiscard());
}
}
//
@PreDestroy
void destroy() {
/*
* It's good manners to do this, even though vaadin-spring will
* automatically unsubscribe when this UI is garbage collected.
*/
eventBus.unsubscribe(this);
}
/**
@@ -372,12 +354,4 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene
return true;
}
protected void intreruptUploadOnDiscard(){
if(upload!=null && upload.isUploading()){
upload.interruptUpload();
uploadInterrupted = true;
}
streamingInterrupted = true;
}
}

View File

@@ -118,7 +118,6 @@ public class UploadLayout extends VerticalLayout {
private Button uploadStatusButton;
private Boolean changesDiscarded = Boolean.FALSE;
/**
* Initialize the upload layout.
@@ -242,7 +241,6 @@ public class UploadLayout extends VerticalLayout {
@Override
public void drop(final DragAndDropEvent event) {
changesDiscarded = Boolean.FALSE;
if (validate(event)) {
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
// reset the flag
@@ -569,8 +567,6 @@ public class UploadLayout extends VerticalLayout {
}
protected void clearUploadedFileDetails() {
eventBus.publish(this, UploadArtifactUIEvent.DISCARD_UPLOAD);
changesDiscarded = Boolean.TRUE;
clearFileList();
closeUploadStatusPopup();
}
@@ -669,13 +665,11 @@ public class UploadLayout extends VerticalLayout {
/**
* @return
*/
VerticalLayout getDropAreaLayout() {
return dropAreaLayout;
}
private void onStartOfUpload() {
changesDiscarded = Boolean.FALSE;
setUploadStatusButtonIconToInProgress();
if (artifactUploadState.isStatusPopupMinimized()) {
updateStatusButtonCount();
@@ -695,7 +689,6 @@ public class UploadLayout extends VerticalLayout {
}
private void onUploadStreamingFailure(UploadStatusEvent event) {
if (!changesDiscarded) {
/**
* If upload interrupted because of duplicate file,do not remove the
* file already in upload list
@@ -720,7 +713,6 @@ public class UploadLayout extends VerticalLayout {
setUploadStatusButtonIconToFinished();
}
displayDuplicateValidationMessage();
}
}
private void onUploadSuccess(UploadStatusEvent event) {
@@ -753,9 +745,8 @@ public class UploadLayout extends VerticalLayout {
* If upload interrupted because of duplicate file,do not remove the
* file already in upload list
**/
if ((getDuplicateFileNamesList().isEmpty() || !getDuplicateFileNamesList().contains(
event.getUploadStatus().getFileName()))
&& !changesDiscarded) {
if (getDuplicateFileNamesList().isEmpty() || !getDuplicateFileNamesList().contains(
event.getUploadStatus().getFileName())) {
final SoftwareModule sw = getSoftwareModuleSelected();
getFileSelected().remove(
new CustomFile(event.getUploadStatus().getFileName(), sw.getName(), sw.getVersion()));