@@ -76,6 +76,11 @@ import com.vaadin.ui.VerticalLayout;
|
||||
@SpringComponent
|
||||
public class UploadLayout extends VerticalLayout {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final String HTML_DIV = "</div>";
|
||||
|
||||
private static final long serialVersionUID = -566164756606779220L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(UploadLayout.class);
|
||||
@@ -408,18 +413,12 @@ public class UploadLayout extends VerticalLayout {
|
||||
return checkIfSoftwareModuleIsSelected();
|
||||
}
|
||||
|
||||
private boolean isFilesDropped(final DragAndDropEvent event) {
|
||||
private static boolean isFilesDropped(final DragAndDropEvent event) {
|
||||
if (event.getTransferable() instanceof WrapperTransferable) {
|
||||
final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
|
||||
// other components can also be wrapped in WrapperTransferable , so
|
||||
// additional check on files
|
||||
if (files == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
return files != null;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Boolean checkIfSoftwareModuleIsSelected() {
|
||||
@@ -443,6 +442,8 @@ public class UploadLayout extends VerticalLayout {
|
||||
*
|
||||
* @param name
|
||||
* file name
|
||||
* @param selectedSoftwareModule
|
||||
* the current selected sm module
|
||||
* @return Boolean
|
||||
*/
|
||||
public Boolean checkIfFileIsDuplicate(final String name, final SoftwareModule selectedSoftwareModule) {
|
||||
@@ -475,7 +476,7 @@ public class UploadLayout extends VerticalLayout {
|
||||
void updateActionCount() {
|
||||
if (!artifactUploadState.getFileSelected().isEmpty()) {
|
||||
processBtn.setCaption(SPUILabelDefinitions.PROCESS + "<div class='unread'>"
|
||||
+ artifactUploadState.getFileSelected().size() + "</div>");
|
||||
+ artifactUploadState.getFileSelected().size() + HTML_DIV);
|
||||
} else {
|
||||
processBtn.setCaption(SPUILabelDefinitions.PROCESS);
|
||||
}
|
||||
@@ -504,6 +505,9 @@ public class UploadLayout extends VerticalLayout {
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the duplicated message.
|
||||
*/
|
||||
public void showDuplicateMessage() {
|
||||
uiNotification.displayValidationError(getDuplicateFileValidationMessage());
|
||||
}
|
||||
@@ -810,13 +814,13 @@ public class UploadLayout extends VerticalLayout {
|
||||
final StringBuilder builder = new StringBuilder("");
|
||||
if (uploadsFailed != 0) {
|
||||
if (uploadsPending != 0) {
|
||||
builder.append("<div class='error-count error-count-color'>" + uploadsFailed + "</div>");
|
||||
builder.append("<div class='error-count error-count-color'>" + uploadsFailed + HTML_DIV);
|
||||
} else {
|
||||
builder.append("<div class='unread error-count-color'>" + uploadsFailed + "</div>");
|
||||
builder.append("<div class='unread error-count-color'>" + uploadsFailed + HTML_DIV);
|
||||
}
|
||||
}
|
||||
if (uploadsPending != 0) {
|
||||
builder.append("<div class='unread'>" + uploadsPending + "</div>");
|
||||
builder.append("<div class='unread'>" + uploadsPending + HTML_DIV);
|
||||
}
|
||||
uploadStatusButton.setCaption(builder.toString());
|
||||
}
|
||||
|
||||
@@ -18,7 +18,10 @@ import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
/**
|
||||
* Abstract class for target tag token layout.
|
||||
* /** Abstract class for target tag token layout.
|
||||
*
|
||||
* @param <T>
|
||||
* the entity type
|
||||
*/
|
||||
public abstract class AbstractTargetTagToken<T extends BaseEntity> extends AbstractTagToken<T> {
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -23,7 +22,6 @@ import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.ui.management.event.ManagementUIEvent;
|
||||
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
@@ -46,9 +44,6 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
// To Be Done : have to set this value based on view???
|
||||
private static final Boolean NOTAGS_SELECTED = Boolean.FALSE;
|
||||
|
||||
@Autowired
|
||||
private UINotification uinotification;
|
||||
|
||||
@Autowired
|
||||
private transient TargetManagement targetManagement;
|
||||
|
||||
@@ -85,23 +80,11 @@ public class TargetTagToken extends AbstractTargetTagToken<Target> {
|
||||
@Override
|
||||
protected void unassignTag(final String tagName) {
|
||||
final TargetTagAssignmentResult result = toggleAssignment(tagName);
|
||||
if (result.getUnassigned() >= 1 && (isClickedTagListEmpty() || getClickedTagList().contains(tagName))) {
|
||||
if (result.getUnassigned() >= 1) {
|
||||
eventBus.publish(this, ManagementUIEvent.UNASSIGN_TARGET_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean isClickedTagListEmpty() {
|
||||
if (getClickedTagList() == null || getClickedTagList() != null && !getClickedTagList().isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* To Be Done : this implementation will vary in views */
|
||||
private List<String> getClickedTagList() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean isToggleTagAssignmentAllowed() {
|
||||
return checker.hasUpdateTargetPermission();
|
||||
|
||||
@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIHeaderLayoutDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.HeaderLayoutDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUILabelDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUITextAreaDecorator;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUITextFieldDecorator;
|
||||
@@ -104,7 +104,7 @@ public final class SPUIComponentProvider {
|
||||
* @return
|
||||
*/
|
||||
public static HorizontalLayout getHeaderLayout(
|
||||
final Class<? extends SPUIHeaderLayoutDecorator> tableHeaderLayoutDecorator) {
|
||||
final Class<? extends HeaderLayoutDecorator> tableHeaderLayoutDecorator) {
|
||||
// Do we really need this???
|
||||
HorizontalLayout hLayout = getHorizontalLayout(new SPUIHorizontalLayout().getUiHorizontalLayout().getClass());
|
||||
|
||||
@@ -113,11 +113,11 @@ public final class SPUIComponentProvider {
|
||||
}
|
||||
|
||||
try {
|
||||
final SPUIHeaderLayoutDecorator layoutDecorator = tableHeaderLayoutDecorator.newInstance();
|
||||
final HeaderLayoutDecorator layoutDecorator = tableHeaderLayoutDecorator.newInstance();
|
||||
hLayout = layoutDecorator.decorate(hLayout);
|
||||
|
||||
} catch (final InstantiationException | IllegalAccessException exception) {
|
||||
LOG.error("Error occured while creating horizontal decorator " + SPUIHeaderLayoutDecorator.class,
|
||||
LOG.error("Error occured while creating horizontal decorator " + HeaderLayoutDecorator.class,
|
||||
exception);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,17 @@ import com.vaadin.ui.HorizontalLayout;
|
||||
/**
|
||||
*
|
||||
*
|
||||
*
|
||||
* Ui header layout decorater.
|
||||
*/
|
||||
public interface SPUIHeaderLayoutDecorator {
|
||||
@FunctionalInterface
|
||||
public interface HeaderLayoutDecorator {
|
||||
|
||||
/**
|
||||
* decorate the header
|
||||
*
|
||||
* @param layout
|
||||
* @return
|
||||
* the layout
|
||||
* @return the decorated layout
|
||||
*/
|
||||
HorizontalLayout decorate(HorizontalLayout layout);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import com.vaadin.ui.Button;
|
||||
*
|
||||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface SPUIButtonDecorator {
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package org.eclipse.hawkbit.ui.distributions.disttype;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
@@ -27,8 +26,6 @@ import org.eclipse.hawkbit.ui.layouts.CreateUpdateTypeLayout;
|
||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
@@ -59,8 +56,6 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
|
||||
private static final long serialVersionUID = -5169398523815877767L;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateDistSetTypeLayout.class);
|
||||
|
||||
private static final String DIST_TYPE_NAME = "name";
|
||||
private static final String DIST_TYPE_DESCRIPTION = "description";
|
||||
private static final String DIST_TYPE_MANDATORY = "mandatory";
|
||||
@@ -84,8 +79,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
|
||||
private IndexedContainer originalSelectedTableContainer;
|
||||
|
||||
private Map<CheckBox, Boolean> mandatoryCheckboxMap;
|
||||
|
||||
@Override
|
||||
protected void createRequiredComponents() {
|
||||
|
||||
@@ -152,9 +145,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
twinColumnLayout.setComponentAlignment(sourceTable, Alignment.MIDDLE_LEFT);
|
||||
twinColumnLayout.setComponentAlignment(selectButtonLayout, Alignment.MIDDLE_CENTER);
|
||||
twinColumnLayout.setComponentAlignment(selectedTable, Alignment.MIDDLE_RIGHT);
|
||||
twinColumnLayout.setExpandRatio(sourceTable, 0.45f);
|
||||
twinColumnLayout.setExpandRatio(selectButtonLayout, 0.07f);
|
||||
twinColumnLayout.setExpandRatio(selectedTable, 0.48f);
|
||||
twinColumnLayout.setExpandRatio(sourceTable, 0.45F);
|
||||
twinColumnLayout.setExpandRatio(selectButtonLayout, 0.07F);
|
||||
twinColumnLayout.setExpandRatio(selectedTable, 0.48F);
|
||||
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
|
||||
return twinColumnLayout;
|
||||
}
|
||||
@@ -226,7 +219,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
|
||||
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
|
||||
sourceTable.setColumnHeaders(i18n.get("header.dist.twintable.available"));
|
||||
sourceTable.setColumnExpandRatio(DIST_TYPE_NAME, 1.0f);
|
||||
sourceTable.setColumnExpandRatio(DIST_TYPE_NAME, 1.0F);
|
||||
getSourceTableData();
|
||||
addTooltip();
|
||||
sourceTable.select(sourceTable.firstItemId());
|
||||
@@ -413,7 +406,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkMandatoryAndAddMandatoryModuleType(final DistributionSetType updateDistSetType,
|
||||
private static void checkMandatoryAndAddMandatoryModuleType(final DistributionSetType updateDistSetType,
|
||||
final Boolean isMandatory, final SoftwareModuleType swModuleType) {
|
||||
if (isMandatory) {
|
||||
updateDistSetType.addMandatoryModuleType(swModuleType);
|
||||
@@ -488,7 +481,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private LazyQueryContainer getDistSetTypeLazyQueryContainer() {
|
||||
private static LazyQueryContainer getDistSetTypeLazyQueryContainer() {
|
||||
|
||||
final LazyQueryContainer disttypeContainer = HawkbitCommonUtil.createLazyQueryContainer(
|
||||
new BeanQueryFactory<DistributionSetTypeBeanQuery>(DistributionSetTypeBeanQuery.class));
|
||||
|
||||
@@ -13,11 +13,9 @@ package org.eclipse.hawkbit.ui.filter;
|
||||
* mechanism. The filter expression can evaluate if e.g. Targets should
|
||||
* currently be added to the target list or if the current enabled filtered will
|
||||
* filter the target and not show the newly created target.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface FilterExpression {
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,7 +43,6 @@ import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||
import org.eclipse.hawkbit.ui.utils.I18N;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SpringContextHelper;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.vaadin.spring.events.EventBus;
|
||||
@@ -83,9 +82,7 @@ public class BulkUploadHandler extends CustomComponent
|
||||
private final transient DeploymentManagement deploymentManagement;
|
||||
private final transient DistributionSetManagement distributionSetManagement;
|
||||
|
||||
private final UINotification uINotification;
|
||||
|
||||
protected File tempFile = null;
|
||||
protected File tempFile;
|
||||
private Upload upload;
|
||||
|
||||
private final ProgressBar progressBar;
|
||||
@@ -93,8 +90,8 @@ public class BulkUploadHandler extends CustomComponent
|
||||
private final TargetBulkTokenTags targetBulkTokenTags;
|
||||
|
||||
private final Label targetsCountLabel;
|
||||
private long failedTargetCount = 0;
|
||||
private long successfullTargetCount = 0;
|
||||
private long failedTargetCount;
|
||||
private long successfullTargetCount;
|
||||
|
||||
private final transient Executor executor;
|
||||
private transient EventBus.SessionEventBus eventBus;
|
||||
@@ -109,12 +106,11 @@ public class BulkUploadHandler extends CustomComponent
|
||||
* @param targetManagement
|
||||
* @param managementUIState
|
||||
* @param deploymentManagement
|
||||
* @param uINotification
|
||||
* @param i18n
|
||||
*/
|
||||
public BulkUploadHandler(final TargetBulkUpdateWindowLayout targetBulkUpdateWindowLayout,
|
||||
final TargetManagement targetManagement, final ManagementUIState managementUIState,
|
||||
final DeploymentManagement deploymentManagement, final UINotification uINotification, final I18N i18n) {
|
||||
final DeploymentManagement deploymentManagement, final I18N i18n) {
|
||||
this.targetBulkUpdateWindowLayout = targetBulkUpdateWindowLayout;
|
||||
this.comboBox = targetBulkUpdateWindowLayout.getDsNamecomboBox();
|
||||
this.descTextArea = targetBulkUpdateWindowLayout.getDescTextArea();
|
||||
@@ -122,7 +118,6 @@ public class BulkUploadHandler extends CustomComponent
|
||||
this.progressBar = targetBulkUpdateWindowLayout.getProgressBar();
|
||||
this.managementUIState = managementUIState;
|
||||
this.deploymentManagement = deploymentManagement;
|
||||
this.uINotification = uINotification;
|
||||
this.targetsCountLabel = targetBulkUpdateWindowLayout.getTargetsCountLabel();
|
||||
this.targetBulkTokenTags = targetBulkUpdateWindowLayout.getTargetBulkTokenTags();
|
||||
this.i18n = i18n;
|
||||
@@ -396,7 +391,7 @@ public class BulkUploadHandler extends CustomComponent
|
||||
|
||||
}
|
||||
|
||||
private void setTargetValues(final Target target, final String name, final String description) {
|
||||
private static void setTargetValues(final Target target, final String name, final String description) {
|
||||
if (null == name) {
|
||||
target.setName(target.getControllerId());
|
||||
} else {
|
||||
|
||||
@@ -178,7 +178,7 @@ public class TargetBulkUpdateWindowLayout extends CustomComponent {
|
||||
|
||||
private BulkUploadHandler getBulkUploadHandler() {
|
||||
final BulkUploadHandler bulkUploadHandler = new BulkUploadHandler(this, targetManagement, managementUIState,
|
||||
deploymentManagement, uINotification, i18n);
|
||||
deploymentManagement, i18n);
|
||||
bulkUploadHandler.buildLayout();
|
||||
bulkUploadHandler.addStyleName(SPUIStyleDefinitions.BULK_UPLOAD_BUTTON);
|
||||
return bulkUploadHandler;
|
||||
|
||||
@@ -56,6 +56,11 @@ import com.vaadin.ui.themes.ValoTheme;
|
||||
@UIScope
|
||||
public final class DashboardMenu extends CustomComponent {
|
||||
|
||||
private static final String STYLE_VISIBLE = "valo-menu-visible";
|
||||
public static final String ID = "dashboard-menu";
|
||||
public static final String REPORTS_BADGE_ID = "dashboard-menu-reports-badge";
|
||||
public static final String NOTIFICATIONS_BADGE_ID = "dashboard-menu-notifications-badge";
|
||||
|
||||
@Autowired
|
||||
private I18N i18n;
|
||||
|
||||
@@ -67,11 +72,6 @@ public final class DashboardMenu extends CustomComponent {
|
||||
|
||||
private static final long serialVersionUID = 5394474618559481462L;
|
||||
|
||||
public static final String ID = "dashboard-menu";
|
||||
public static final String REPORTS_BADGE_ID = "dashboard-menu-reports-badge";
|
||||
public static final String NOTIFICATIONS_BADGE_ID = "dashboard-menu-notifications-badge";
|
||||
private static final String STYLE_VISIBLE = "valo-menu-visible";
|
||||
|
||||
// this should be resolved when we introduce event bus on UI to just inform
|
||||
// the buttons directly via events
|
||||
private final List<ValoMenuItemButton> menuButtons = new ArrayList<>();
|
||||
|
||||
@@ -44,8 +44,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UINotification;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
|
||||
import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
|
||||
@@ -80,8 +78,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
|
||||
private static final long serialVersionUID = 2999293468801479916L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AddUpdateRolloutWindowLayout.class);
|
||||
|
||||
private static final String MESSAGE_ROLLOUT_FIELD_VALUE_RANGE = "message.rollout.field.value.range";
|
||||
|
||||
private static final String MESSAGE_ENTER_NUMBER = "message.enter.number";
|
||||
@@ -154,6 +150,13 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
|
||||
buildLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the window.
|
||||
*
|
||||
* @param rolloutId
|
||||
* the rollout id
|
||||
* @return the window
|
||||
*/
|
||||
public CommonDialogWindow getWindow(final Long rolloutId) {
|
||||
window = getWindow();
|
||||
populateData(rolloutId);
|
||||
|
||||
Reference in New Issue
Block a user