Merge branch 'master' into feature_ui_metadata

Conflicts:
	hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/common/CommonDialogWindow.java
	hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/distributions/dstable/DistributionSetDetails.java
	hawkbit-ui/src/main/resources/messages_en.properties
	
Resolved the conflicts.
This commit is contained in:
gah6kor
2016-07-15 14:40:55 +02:00
83 changed files with 2020 additions and 1717 deletions

View File

@@ -10,6 +10,8 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
import java.io.Serializable;
import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -18,18 +20,17 @@ import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
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.springframework.beans.factory.annotation.Autowired;
import org.vaadin.addons.lazyquerycontainer.BeanQueryFactory;
import org.vaadin.spring.events.EventBus;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.ComboBox;
@@ -38,8 +39,6 @@ import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
/**
@@ -66,8 +65,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
@Autowired
private transient EntityFactory entityFactory;
private Label mandatoryLabel;
private TextField nameTextField;
private TextField versionTextField;
@@ -80,14 +77,20 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
private CommonDialogWindow window;
private String oldDescriptionValue;
private String oldVendorValue;
private Boolean editSwModule = Boolean.FALSE;
private Long baseSwModuleId;
private FormLayout formLayout;
/**
* Initialize Distribution Add and Edit Window.
*/
@PostConstruct
void init() {
createRequiredComponents();
}
/**
* Create window for new software module.
*
@@ -95,11 +98,7 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
* module.
*/
public CommonDialogWindow createAddSoftwareModuleWindow() {
editSwModule = Boolean.FALSE;
createRequiredComponents();
createWindow();
return window;
return createUpdateSoftwareModuleWindow(null);
}
/**
@@ -110,17 +109,11 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
* @return reference of {@link com.vaadin.ui.Window} to update software
* module.
*/
public Window createUpdateSoftwareModuleWindow(final Long baseSwModuleId) {
editSwModule = Boolean.TRUE;
public CommonDialogWindow createUpdateSoftwareModuleWindow(final Long baseSwModuleId) {
this.baseSwModuleId = baseSwModuleId;
createRequiredComponents();
createWindow();
/* populate selected target values to edit. */
resetComponents();
populateValuesOfSwModule();
nameTextField.setEnabled(false);
versionTextField.setEnabled(false);
typeComboBox.setEnabled(false);
createWindow();
return window;
}
@@ -145,13 +138,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"),
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
descTextArea.setId(SPUIComponentIdProvider.ADD_SW_MODULE_DESCRIPTION);
addDescriptionTextChangeListener();
addVendorTextChangeListener();
/* Label for mandatory symbol */
mandatoryLabel = new Label(i18n.get("label.mandatory.field"));
mandatoryLabel.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
mandatoryLabel.addStyleName(ValoTheme.LABEL_SMALL);
typeComboBox = SPUIComponentProvider.getComboBox(i18n.get("upload.swmodule.type"), "", "", null, null, true,
null, i18n.get("upload.swmodule.type"));
@@ -159,46 +145,34 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
typeComboBox.setStyleName(SPUIDefinitions.COMBO_BOX_SPECIFIC_STYLE + " " + ValoTheme.COMBOBOX_TINY);
typeComboBox.setNewItemsAllowed(Boolean.FALSE);
typeComboBox.setImmediate(Boolean.TRUE);
populateTypeNameCombo();
resetOldValues();
}
/**
*
*/
private void populateTypeNameCombo() {
typeComboBox.setContainerDataSource(HawkbitCommonUtil.createLazyQueryContainer(
new BeanQueryFactory<SoftwareModuleTypeBeanQuery>(SoftwareModuleTypeBeanQuery.class)));
typeComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
}
private void resetOldValues() {
oldDescriptionValue = null;
oldVendorValue = null;
private void resetComponents() {
vendorTextField.clear();
nameTextField.clear();
versionTextField.clear();
descTextArea.clear();
typeComboBox.clear();
editSwModule = Boolean.FALSE;
}
/**
* Build the window content and get an instance of customDialogWindow
*
*/
private void createWindow() {
final Label madatoryStarLabel = new Label("*");
madatoryStarLabel.setStyleName("v-caption v-required-field-indicator");
madatoryStarLabel.setWidth(null);
/*
* The main layout of the window contains mandatory info, textboxes
* (controller Id, name & description) and action buttons layout
*/
addStyleName("lay-color");
setSizeUndefined();
final FormLayout formLayout = new FormLayout();
formLayout.addComponent(mandatoryLabel);
formLayout = new FormLayout();
formLayout.setCaption(null);
formLayout.addComponent(typeComboBox);
formLayout.addComponent(nameTextField);
formLayout.addComponent(versionTextField);
@@ -207,24 +181,17 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
setCompositionRoot(formLayout);
/* add main layout to the window */
window = SPUIComponentProvider.getWindow(i18n.get("upload.caption.add.new.swmodule"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveOrUpdate(), event -> closeThisWindow(), null);
window = SPUIWindowDecorator.getWindow(i18n.get("upload.caption.add.new.swmodule"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveOrUpdate(), null, null, formLayout, i18n);
window.getButtonsLayout().removeStyleName("actionButtonsMargin");
nameTextField.focus();
nameTextField.setEnabled(!editSwModule);
versionTextField.setEnabled(!editSwModule);
typeComboBox.setEnabled(!editSwModule);
typeComboBox.focus();
}
private void addDescriptionTextChangeListener() {
descTextArea.addTextChangeListener(event -> window.setSaveButtonEnabled(hasDescriptionChanged(event)));
}
private void addVendorTextChangeListener() {
vendorTextField.addTextChangeListener(event -> window.setSaveButtonEnabled(hasVendorChanged(event)));
}
/**
* Add new SW module.
*/
private void addNewBaseSoftware() {
final String name = HawkbitCommonUtil.trimAndNullIfEmpty(nameTextField.getValue());
final String version = HawkbitCommonUtil.trimAndNullIfEmpty(versionTextField.getValue());
@@ -232,10 +199,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
final String description = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final String type = typeComboBox.getValue() != null ? typeComboBox.getValue().toString() : null;
if (!mandatoryCheck(name, version, type)) {
return;
}
if (HawkbitCommonUtil.isDuplicate(name, version, type)) {
uiNotifcation.displayValidationError(
i18n.get("message.duplicate.softwaremodule", new Object[] { name, version }));
@@ -248,8 +211,6 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
new Object[] { newBaseSoftwareModule.getName() + ":" + newBaseSoftwareModule.getVersion() }));
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.NEW_ENTITY, newBaseSoftwareModule));
}
// close the window
closeThisWindow();
}
}
@@ -269,13 +230,16 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
eventBus.publish(this, new SoftwareModuleEvent(BaseEntityEventType.UPDATED_ENTITY, newSWModule));
}
closeThisWindow();
}
/**
* fill the data of a softwareModule in the content of the window
*/
private void populateValuesOfSwModule() {
if (baseSwModuleId == null) {
return;
}
editSwModule = Boolean.TRUE;
final SoftwareModule swModle = softwareManagement.findSoftwareModuleById(baseSwModuleId);
nameTextField.setValue(swModle.getName());
versionTextField.setValue(swModle.getVersion());
@@ -283,49 +247,10 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
: HawkbitCommonUtil.trimAndNullIfEmpty(swModle.getVendor()));
descTextArea.setValue(swModle.getDescription() == null ? HawkbitCommonUtil.SP_STRING_EMPTY
: HawkbitCommonUtil.trimAndNullIfEmpty(swModle.getDescription()));
oldDescriptionValue = descTextArea.getValue();
oldVendorValue = vendorTextField.getValue();
if (swModle.getType().isDeleted()) {
typeComboBox.addItem(swModle.getType().getName());
}
typeComboBox.setValue(swModle.getType().getName());
window.setSaveButtonEnabled(Boolean.FALSE);
}
/**
* Method to close window.
*/
private void closeThisWindow() {
window.close();
UI.getCurrent().removeWindow(window);
}
/**
* Validation check - Mandatory.
*
* @param name
* as String
* @param version
* as version
* @return boolena as flag
*/
private boolean mandatoryCheck(final String name, final String version, final String type) {
boolean isValid = true;
if (name == null || version == null || type == null) {
if (name == null) {
nameTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
}
if (version == null) {
versionTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
}
if (type == null) {
typeComboBox.addStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR);
}
uiNotifcation.displayValidationError(i18n.get("message.mandatory.check"));
isValid = false;
}
return isValid;
}
private void saveOrUpdate() {
@@ -336,12 +261,8 @@ public class SoftwareModuleAddUpdateWindow extends CustomComponent implements Se
}
}
private boolean hasDescriptionChanged(final TextChangeEvent event) {
return !(event.getText().equals(oldDescriptionValue) && vendorTextField.getValue().equals(oldVendorValue));
}
private boolean hasVendorChanged(final TextChangeEvent event) {
return !(event.getText().equals(oldVendorValue) && descTextArea.getValue().equals(oldDescriptionValue));
public FormLayout getFormLayout() {
return formLayout;
}
}

View File

@@ -51,7 +51,6 @@ import com.vaadin.ui.UI;
/**
* Header of Software module table.
*
*/
@SpringComponent
@ViewScope

View File

@@ -11,13 +11,11 @@ package org.eclipse.hawkbit.ui.artifacts.smtype;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent;
import org.eclipse.hawkbit.ui.artifacts.event.SoftwareModuleTypeEvent.SoftwareModuleTypeEnum;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.common.SoftwareModuleTypeBeanQuery;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -34,12 +32,10 @@ import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.components.colorpicker.ColorChangeListener;
import com.vaadin.ui.components.colorpicker.ColorSelector;
import com.vaadin.ui.themes.ValoTheme;
/**
@@ -48,8 +44,7 @@ import com.vaadin.ui.themes.ValoTheme;
*/
@SpringComponent
@ViewScope
public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
implements ColorChangeListener, ColorSelector {
public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout {
private static final long serialVersionUID = -5169398523815919367L;
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateSoftwareTypeLayout.class);
@@ -69,7 +64,7 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
@Override
protected void addListeners() {
super.addListeners();
optiongroup.addValueChangeListener(this::createOptionValueChanged);
optiongroup.addValueChangeListener(this::optionValueChanged);
}
@Override
@@ -95,7 +90,6 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TYPE_DESC, false, "",
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
tagDesc.setId(SPUIDefinitions.NEW_SOFTWARE_TYPE_DESC);
tagDesc.setImmediate(true);
tagDesc.setNullRepresentation("");
@@ -113,10 +107,8 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
}
@Override
public void createWindow() {
reset();
window = SPUIComponentProvider.getWindow(i18n.get("caption.add.type"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, this::save, this::discard, null);
protected String getWindowCaption() {
return i18n.get("caption.add.type");
}
/**
@@ -126,15 +118,16 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
* ValueChangeEvent
*/
@Override
protected void createOptionValueChanged(final ValueChangeEvent event) {
protected void optionValueChanged(final ValueChangeEvent event) {
super.createOptionValueChanged(event);
super.optionValueChanged(event);
if (updateTypeStr.equals(event.getProperty().getValue())) {
assignOptiongroup.setEnabled(false);
} else {
assignOptiongroup.setEnabled(true);
}
assignOptiongroup.select(singleAssignStr);
}
/**
@@ -176,7 +169,6 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
} else {
assignOptiongroup.setValue(singleAssignStr);
}
setColorPickerComponentsColor(selectedTypeTag.getColour());
}
}
@@ -198,10 +190,6 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
@Override
protected void save(final ClickEvent event) {
if (!mandatoryValuesPresent()) {
return;
}
final SoftwareModuleType existingSMTypeByKey = swTypeManagementService
.findSoftwareModuleTypeByKey(typeKey.getValue());
final SoftwareModuleType existingSMTypeByName = swTypeManagementService
@@ -211,7 +199,6 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
createNewSWModuleType();
}
} else {
updateSWModuleType(existingSMTypeByName);
}
}
@@ -233,22 +220,14 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
SoftwareModuleType newSWType = entityFactory.generateSoftwareModuleType(typeKeyValue, typeNameValue,
typeDescValue, assignNumber);
newSWType.setColour(colorPicked);
if (null != typeDescValue) {
newSWType.setDescription(typeDescValue);
}
newSWType.setDescription(typeDescValue);
newSWType.setColour(colorPicked);
newSWType = swTypeManagementService.createSoftwareModuleType(newSWType);
uiNotification.displaySuccess(i18n.get("message.save.success", new Object[] { newSWType.getName() }));
closeWindow();
eventBus.publish(this,
new SoftwareModuleTypeEvent(SoftwareModuleTypeEnum.ADD_SOFTWARE_MODULE_TYPE, newSWType));
} else {
uiNotification.displayValidationError(i18n.get("message.error.missing.typenameorkey"));
}
}
@@ -258,51 +237,15 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
final String typeDescValue = HawkbitCommonUtil.trimAndNullIfEmpty(tagDesc.getValue());
if (null != typeNameValue) {
existingType.setName(typeNameValue);
existingType.setDescription(null != typeDescValue ? typeDescValue : null);
existingType.setDescription(typeDescValue);
existingType.setColour(ColorPickerHelper.getColorPickedString(getColorPickerLayout().getSelPreview()));
swTypeManagementService.updateSoftwareModuleType(existingType);
uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { existingType.getName() }));
closeWindow();
eventBus.publish(this,
new SoftwareModuleTypeEvent(SoftwareModuleTypeEnum.UPDATE_SOFTWARE_MODULE_TYPE, existingType));
} else {
uiNotification.displayValidationError(i18n.get("message.tag.update.mandatory"));
}
}
/**
* Open color picker on click of preview button. Auto select the color based
* on target tag if already selected.
*/
@Override
protected void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
final String selectedOption = (String) optiongroup.getValue();
if (StringUtils.isNotEmpty(selectedOption) && selectedOption.equalsIgnoreCase(updateTypeStr)) {
if (null != tagNameComboBox.getValue()) {
final SoftwareModuleType typeSelected = swTypeManagementService
.findSoftwareModuleTypeByName(tagNameComboBox.getValue().toString());
if (null != typeSelected) {
getColorPickerLayout().setSelectedColor(typeSelected.getColour() != null
? ColorPickerHelper.rgbToColorConverter(typeSelected.getColour())
: ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR));
}
} else {
getColorPickerLayout().setSelectedColor(
ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR));
}
}
getColorPickerLayout().getSelPreview().setColor(getColorPickerLayout().getSelectedColor());
mainLayout.addComponent(colorPickerLayout, 1, 0);
mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER);
} else {
mainLayout.removeComponent(colorPickerLayout);
}
tagPreviewBtnClicked = !tagPreviewBtnClicked;
}
@Override

View File

@@ -13,6 +13,7 @@ import java.util.Set;
import org.eclipse.hawkbit.ui.common.CoordinatesToColor;
import org.eclipse.hawkbit.ui.management.tag.SpColorPickerPreview;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import com.vaadin.shared.ui.colorpicker.Color;
import com.vaadin.ui.AbstractColorPicker.Coordinates2Color;
@@ -47,6 +48,7 @@ public class ColorPickerLayout extends GridLayout {
setColumns(2);
setRows(4);
setId(SPUIComponentIdProvider.COLOR_PICKER_LAYOUT);
init();
@@ -71,6 +73,7 @@ public class ColorPickerLayout extends GridLayout {
colorSelect.setWidth("220px");
redSlider = createRGBSlider("", "red");
redSlider.setId(SPUIComponentIdProvider.COLOR_PICKER_RED_SLIDER);
greenSlider = createRGBSlider("", "green");
blueSlider = createRGBSlider("", "blue");

View File

@@ -23,6 +23,7 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleBorderWithIcon;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmallNoBorder;
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
@@ -101,6 +102,8 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private CommonDialogWindow metadataWindow;
private E selectedEntity;
private HorizontalLayout mainLayout ;
@PostConstruct
private void init() {
@@ -118,21 +121,21 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
* metadata to be selected
* @return @link{CommonDialogWindow}
*/
public CommonDialogWindow getWindow(final E entity, final M metaData) {
selectedEntity = entity;
String nameVersion = HawkbitCommonUtil.getFormattedNameVersion(entity.getName(), entity.getVersion());
metadataWindow = SPUIComponentProvider.getWindow(getMetadataCaption(nameVersion), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> onSave(), event -> onCancel(), null);
metadataWindow.setId(SPUIComponentIdProvider.METADATA_POPUP_ID);
metadataWindow.setHeight(550, Unit.PIXELS);
metadataWindow.setWidth(800, Unit.PIXELS);
metadataWindow.getMainLayout().setSizeFull();
metadataWindow.setResizable(true);
metadataWindow.addWindowModeChangeListener(event -> onResize(event));
metadataWindow.getButtonsLayout().addComponent(discardButton, 1);
setUpDetails(entity.getId(), metaData);
return metadataWindow;
}
public CommonDialogWindow getWindow(final E entity, final M metaData) {
selectedEntity = entity;
String nameVersion = HawkbitCommonUtil.getFormattedNameVersion(entity.getName(), entity.getVersion());
metadataWindow = SPUIWindowDecorator.getWindow(getMetadataCaption(nameVersion), null,
SPUIDefinitions.CUSTOM_METADATA_WINDOW, this, event -> onSave(), event -> onCancel(), null, mainLayout, i18n);
metadataWindow.setId(SPUIComponentIdProvider.METADATA_POPUP_ID);
metadataWindow.setHeight(550, Unit.PIXELS);
metadataWindow.setWidth(800, Unit.PIXELS);
metadataWindow.getMainLayout().setSizeFull();
metadataWindow.setResizable(true);
metadataWindow.addWindowModeChangeListener(event -> onResize(event));
((HorizontalLayout)metadataWindow.getButtonsLayout()).addComponent(discardButton, 1);
setUpDetails(entity.getId(), metaData);
return metadataWindow;
}
public E getSelectedEntity() {
return selectedEntity;
@@ -200,7 +203,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
metadataFieldsLayout.setSpacing(true);
metadataFieldsLayout.setExpandRatio(valueTextArea, 1F);
HorizontalLayout mainLayout = new HorizontalLayout();
mainLayout = new HorizontalLayout();
mainLayout.addComponent(tableLayout);
mainLayout.addComponent(metadataFieldsLayout);
mainLayout.setExpandRatio(tableLayout, 0.5F);
@@ -544,5 +547,7 @@ public abstract class AbstractMetadataPopupLayout<E extends NamedVersionedEntity
private void setDiscardButtonEnabled(Boolean enable) {
discardButton.setEnabled(enable);
}
}

View File

@@ -10,162 +10,517 @@ package org.eclipse.hawkbit.ui.common;
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.ui.artifacts.smtable.SoftwareModuleAddUpdateWindow;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleBorderWithIcon;
import org.eclipse.hawkbit.ui.layouts.AbstractCreateUpdateTagLayout;
import org.eclipse.hawkbit.ui.management.targettable.TargetAddUpdateWindowLayout;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import org.vaadin.hene.flexibleoptiongroup.FlexibleOptionGroupItemComponent;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.vaadin.data.Container.ItemSetChangeEvent;
import com.vaadin.data.Container.ItemSetChangeListener;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.data.Validator;
import com.vaadin.data.validator.NullValidator;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.event.FieldEvents.TextChangeNotifier;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.AbstractComponent;
import com.vaadin.ui.AbstractField;
import com.vaadin.ui.AbstractLayout;
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.Field;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* Superclass for pop-up-windows including a minimize and close icon in the
* upper right corner and a save and cancel button at the bottom.
*
* Table pop-up-windows including a minimize and close icon in the upper right
* corner and a save and cancel button at the bottom. Is not intended to reuse.
*
*/
public class CommonDialogWindow extends Window {
public class CommonDialogWindow extends Window implements Serializable {
private static final long serialVersionUID = -1321949234316858703L;
private static final long serialVersionUID = 1L;
private final VerticalLayout mainLayout = new VerticalLayout();
private final VerticalLayout mainLayout = new VerticalLayout();
private final String caption;
private final String caption;
private final Component content;
private final Component content;
private final String helpLink;
private final String helpLink;
private Button saveButton;
private Button saveButton;
private Button cancelButton;
private Button cancelButton;
private HorizontalLayout buttonsLayout;
private HorizontalLayout buttonsLayout;
protected ValueChangeListener buttonEnableListener;
protected ValueChangeListener buttonEnableListener;
private final ClickListener saveButtonClickListener;
private final ClickListener saveButtonClickListener;
private final ClickListener cancelButtonClickListener;
private final ClickListener cancelButtonClickListener;
/**
* Constructor.
*
* @param caption
* the caption
* @param content
* the content
* @param helpLink
* the helpLinks
* @param saveButtonClickListener
* the saveButtonClickListener
* @param cancelButtonClickListener
* the cancelButtonClickListener
*/
public CommonDialogWindow(final String caption, final Component content, final String helpLink,
final ClickListener saveButtonClickListener, final ClickListener cancelButtonClickListener) {
checkNotNull(saveButtonClickListener);
checkNotNull(cancelButtonClickListener);
this.caption = caption;
this.content = content;
this.helpLink = helpLink;
this.saveButtonClickListener = saveButtonClickListener;
this.cancelButtonClickListener = cancelButtonClickListener;
private final ClickListener close = event -> close();
init();
}
private final transient Map<Component, Object> orginalValues;
private final void init() {
private final List<AbstractField<?>> allComponents;
if (content instanceof AbstractOrderedLayout) {
((AbstractOrderedLayout) content).setSpacing(true);
((AbstractOrderedLayout) content).setMargin(true);
}
private final I18N i18n;
if (null != content) {
mainLayout.addComponent(content);
mainLayout.setExpandRatio(content, 1.0F);
}
final HorizontalLayout buttonLayout = createActionButtonsLayout();
mainLayout.addComponent(buttonLayout);
mainLayout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER);
/**
* Constructor.
*
* @param caption
* the caption
* @param content
* the content
* @param helpLink
* the helpLinks
* @param saveButtonClickListener
* the saveButtonClickListener
* @param cancelButtonClickListener
* the cancelButtonClickListener
*/
public CommonDialogWindow(final String caption, final Component content, final String helpLink,
final ClickListener saveButtonClickListener, final ClickListener cancelButtonClickListener,
final AbstractLayout layout, final I18N i18n) {
checkNotNull(saveButtonClickListener);
this.caption = caption;
this.content = content;
this.helpLink = helpLink;
this.saveButtonClickListener = saveButtonClickListener;
this.cancelButtonClickListener = cancelButtonClickListener;
this.orginalValues = new HashMap<>();
this.allComponents = getAllComponents(layout);
this.i18n = i18n;
init();
}
setCaption(caption);
setCaptionAsHtml(true);
setContent(mainLayout);
setResizable(false);
center();
setModal(true);
addStyleName("fontsize");
}
@Override
public void close() {
super.close();
orginalValues.clear();
removeListeners();
allComponents.clear();
this.saveButton.setEnabled(false);
}
private HorizontalLayout createActionButtonsLayout() {
private void removeListeners() {
for (final AbstractField<?> field : allComponents) {
removeTextListener(field);
removeValueChangeListener(field);
removeItemSetChangeistener(field);
}
}
buttonsLayout = new HorizontalLayout();
buttonsLayout.setSizeUndefined();
buttonsLayout.setSpacing(true);
createSaveButton();
private void removeItemSetChangeistener(final AbstractField<?> field) {
if (!(field instanceof Table)) {
return;
}
for (final Object listener : field.getListeners(ItemSetChangeEvent.class)) {
if (listener instanceof ChangeListener) {
((Table) field).removeItemSetChangeListener((ChangeListener) listener);
}
}
}
createCancelButton();
buttonsLayout.addStyleName("actionButtonsMargin");
private void removeTextListener(final AbstractField<?> field) {
if (!(field instanceof TextChangeNotifier)) {
return;
}
for (final Object listener : field.getListeners(TextChangeEvent.class)) {
if (listener instanceof ChangeListener) {
((TextChangeNotifier) field).removeTextChangeListener((ChangeListener) listener);
}
}
}
addHelpLink();
private void removeValueChangeListener(final AbstractField<?> field) {
for (final Object listener : field.getListeners(ValueChangeEvent.class)) {
if (listener instanceof ChangeListener) {
field.removeValueChangeListener((ChangeListener) listener);
}
}
}
return buttonsLayout;
}
private final void init() {
private void createCancelButton() {
cancelButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.CANCEL_BUTTON, "Cancel", "", "", true,
FontAwesome.TIMES, SPUIButtonStyleBorderWithIcon.class);
cancelButton.setSizeUndefined();
cancelButton.addStyleName("default-color");
cancelButton.addClickListener(cancelButtonClickListener);
if (content instanceof AbstractOrderedLayout) {
((AbstractOrderedLayout) content).setSpacing(true);
((AbstractOrderedLayout) content).setMargin(true);
}
if (content instanceof GridLayout) {
addStyleName("marginTop");
}
buttonsLayout.addComponent(cancelButton);
buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);
buttonsLayout.setExpandRatio(cancelButton, 1.0F);
}
if (null != content) {
mainLayout.addComponent(content);
mainLayout.setExpandRatio(content, 1.0F);
}
private void createSaveButton() {
saveButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.SAVE_BUTTON, "Save", "", "", true,
FontAwesome.SAVE, SPUIButtonStyleBorderWithIcon.class);
saveButton.setSizeUndefined();
saveButton.addStyleName("default-color");
saveButton.addClickListener(saveButtonClickListener);
buttonsLayout.addComponent(saveButton);
buttonsLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
buttonsLayout.setExpandRatio(saveButton, 1.0F);
}
createMandatoryLabel();
private void addHelpLink() {
final HorizontalLayout buttonLayout = createActionButtonsLayout();
mainLayout.addComponent(buttonLayout);
mainLayout.setComponentAlignment(buttonLayout, Alignment.TOP_CENTER);
if (StringUtils.isEmpty(helpLink)) {
return;
}
final Link helpLinkComponent = SPUIComponentProvider.getHelpLink(helpLink);
buttonsLayout.addComponent(helpLinkComponent);
buttonsLayout.setComponentAlignment(helpLinkComponent, Alignment.MIDDLE_RIGHT);
}
setCaption(caption);
setCaptionAsHtml(true);
setContent(mainLayout);
setResizable(false);
center();
setModal(true);
addStyleName("fontsize");
setOrginaleValues();
addListeners();
}
/**
* saves the original values in a Map so we can use them for detecting
* changes
*/
public final void setOrginaleValues() {
for (final AbstractField<?> field : allComponents) {
Object value = field.getValue();
if (field instanceof Table) {
value = Sets.newHashSet(((Table) field).getContainerDataSource().getItemIds());
}
orginalValues.put(field, value);
}
saveButton.setEnabled(isSaveButtonEnabledAfterValueChange(null, null));
}
protected void addListeners() {
addComponenetListeners();
addCloseListenerForSaveButton();
addCloseListenerForCancelButton();
}
protected void addCloseListenerForSaveButton() {
saveButton.addClickListener(close);
}
protected void addCloseListenerForCancelButton() {
cancelButton.addClickListener(close);
}
protected void addComponenetListeners() {
for (final AbstractField<?> field : allComponents) {
if (field instanceof TextChangeNotifier) {
((TextChangeNotifier) field).addTextChangeListener(new ChangeListener(field));
}
if (field instanceof Table) {
((Table) field).addItemSetChangeListener(new ChangeListener(field));
} else {
field.addValueChangeListener(new ChangeListener(field));
}
}
}
private boolean isSaveButtonEnabledAfterValueChange(final Component currentChangedComponent,
final Object newValue) {
return isMandatoryFieldNotEmptyAndValid(currentChangedComponent, newValue)
&& isValuesChanged(currentChangedComponent, newValue);
}
private boolean isValuesChanged(final Component currentChangedComponent, final Object newValue) {
for (final AbstractField<?> field : allComponents) {
Object originalValue = orginalValues.get(field);
if (field instanceof CheckBox && originalValue == null) {
originalValue = Boolean.FALSE;
}
final Object currentValue = getCurrentVaue(currentChangedComponent, newValue, field);
if (!isValueEquals(field, originalValue, currentValue)) {
return true;
}
}
return false;
}
private boolean isValueEquals(final AbstractField<?> field, final Object orginalValue, final Object currentValue) {
if (Set.class.equals(field.getType())) {
return CollectionUtils.isEqualCollection(CollectionUtils.emptyIfNull((Collection<?>) orginalValue),
CollectionUtils.emptyIfNull((Collection<?>) currentValue));
}
if (String.class.equals(field.getType())) {
return Objects.equals(Strings.emptyToNull((String) orginalValue),
Strings.emptyToNull((String) currentValue));
}
return Objects.equals(orginalValue, currentValue);
}
private Object getCurrentVaue(final Component currentChangedComponent, final Object newValue,
final AbstractField<?> field) {
Object currentValue = field.getValue();
if (field instanceof Table) {
currentValue = ((Table) field).getContainerDataSource().getItemIds();
}
if (field.equals(currentChangedComponent)) {
currentValue = newValue;
}
return currentValue;
}
private boolean shouldMandatoryLabelShown() {
for (final AbstractField<?> field : allComponents) {
if (field.isRequired()) {
return true;
}
}
return false;
}
private boolean isMandatoryFieldNotEmptyAndValid(final Component currentChangedComponent, final Object newValue) {
boolean valid = true;
final List<AbstractField<?>> requiredComponents = allComponents.stream().filter(field -> field.isRequired())
.collect(Collectors.toList());
requiredComponents.addAll(allComponents.stream().filter(this::hasNullValidator).collect(Collectors.toList()));
for (final AbstractField field : requiredComponents) {
Object value = getCurrentVaue(currentChangedComponent, newValue, field);
if (String.class.equals(field.getType())) {
value = Strings.emptyToNull((String) value);
}
if (Set.class.equals(field.getType())) {
value = emptyToNull((Collection<?>) value);
}
if (value == null) {
return false;
}
// We need to loop through the entire loop for validity testing.
// Otherwise the UI will only mark the
// first field with errors and then stop. If there are several
// fields with errors, this is bad.
field.setValue(value);
if (!field.isValid()) {
valid = false;
}
}
return valid;
}
private static Object emptyToNull(final Collection<?> c) {
return (c == null || c.isEmpty()) ? null : c;
}
private boolean hasNullValidator(final Component component) {
if (component instanceof AbstractField<?>) {
final AbstractField<?> fieldComponent = (AbstractField<?>) component;
for (final Validator validator : fieldComponent.getValidators()) {
if (validator instanceof NullValidator) {
return true;
}
}
}
return false;
}
private List<AbstractField<?>> getAllComponents(final AbstractLayout abstractLayout) {
final List<AbstractField<?>> components = new ArrayList<>();
final Iterator<Component> iterate = abstractLayout.iterator();
while (iterate.hasNext()) {
final Component c = iterate.next();
if (c instanceof AbstractLayout) {
components.addAll(getAllComponents((AbstractLayout) c));
}
if (c instanceof AbstractField) {
components.add((AbstractField<?>) c);
}
if (c instanceof FlexibleOptionGroupItemComponent) {
components.add(((FlexibleOptionGroupItemComponent) c).getOwner());
}
}
return components;
}
private HorizontalLayout createActionButtonsLayout() {
buttonsLayout = new HorizontalLayout();
buttonsLayout.setSizeUndefined();
buttonsLayout.setSpacing(true);
createSaveButton();
createCancelButton();
buttonsLayout.addStyleName("actionButtonsMargin");
addHelpLink();
return buttonsLayout;
}
private void createMandatoryLabel() {
if (!shouldMandatoryLabelShown()) {
return;
}
final Label mandatoryLabel = new Label(i18n.get("label.mandatory.field"));
mandatoryLabel.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_TINY);
if (content instanceof TargetAddUpdateWindowLayout) {
((TargetAddUpdateWindowLayout) content).getFormLayout().addComponent(mandatoryLabel);
} else if (content instanceof SoftwareModuleAddUpdateWindow) {
((SoftwareModuleAddUpdateWindow) content).getFormLayout().addComponent(mandatoryLabel);
} else if (content instanceof AbstractCreateUpdateTagLayout) {
((AbstractCreateUpdateTagLayout) content).getMainLayout().addComponent(mandatoryLabel);
}
mainLayout.addComponent(mandatoryLabel);
}
private void createCancelButton() {
cancelButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.CANCEL_BUTTON, "Cancel", "", "", true,
FontAwesome.TIMES, SPUIButtonStyleBorderWithIcon.class);
cancelButton.setSizeUndefined();
cancelButton.addStyleName("default-color");
if (cancelButtonClickListener != null) {
cancelButton.addClickListener(cancelButtonClickListener);
}
buttonsLayout.addComponent(cancelButton);
buttonsLayout.setComponentAlignment(cancelButton, Alignment.MIDDLE_LEFT);
buttonsLayout.setExpandRatio(cancelButton, 1.0F);
}
private void createSaveButton() {
saveButton = SPUIComponentProvider.getButton(SPUIComponentIdProvider.SAVE_BUTTON, "Save", "", "", true,
FontAwesome.SAVE, SPUIButtonStyleBorderWithIcon.class);
saveButton.setSizeUndefined();
saveButton.addStyleName("default-color");
saveButton.addClickListener(saveButtonClickListener);
saveButton.setEnabled(false);
buttonsLayout.addComponent(saveButton);
buttonsLayout.setComponentAlignment(saveButton, Alignment.MIDDLE_RIGHT);
buttonsLayout.setExpandRatio(saveButton, 1.0F);
}
private void addHelpLink() {
if (StringUtils.isEmpty(helpLink)) {
return;
}
final Link helpLinkComponent = SPUIComponentProvider.getHelpLink(helpLink);
buttonsLayout.addComponent(helpLinkComponent);
buttonsLayout.setComponentAlignment(helpLinkComponent, Alignment.MIDDLE_RIGHT);
}
public void setSaveButtonEnabled(final boolean enabled) {
saveButton.setEnabled(enabled);
}
public HorizontalLayout getButtonsLayout() {
return buttonsLayout;
}
public VerticalLayout getMainLayout() {
return mainLayout;
}
public AbstractComponent getButtonsLayout() {
return this.buttonsLayout;
}
private class ChangeListener implements ValueChangeListener, TextChangeListener, ItemSetChangeListener {
private final Field<?> field;
public ChangeListener(final Field<?> field) {
super();
this.field = field;
}
@Override
public void textChange(final TextChangeEvent event) {
saveButton.setEnabled(isSaveButtonEnabledAfterValueChange(field, event.getText()));
}
@Override
public void valueChange(final ValueChangeEvent event) {
saveButton.setEnabled(isSaveButtonEnabledAfterValueChange(field, field.getValue()));
}
@Override
public void containerItemSetChange(final ItemSetChangeEvent event) {
if (!(field instanceof Table)) {
return;
}
final Table table = (Table) field;
saveButton.setEnabled(
isSaveButtonEnabledAfterValueChange(table, table.getContainerDataSource().getItemIds()));
}
}
/**
* Adds the component manually to the allComponents-List and adds a
* ValueChangeListener to it. Necessary in Update Distribution Type as the
* CheckBox concerned is an ItemProperty...
*
* @param component
* AbstractField
*/
public void updateAllComponents(final AbstractField component) {
allComponents.add(component);
component.addValueChangeListener(new ChangeListener(component));
}
public VerticalLayout getMainLayout() {
return mainLayout;
}
public void setSaveButtonEnabled(final boolean enabled) {
saveButton.setEnabled(enabled);
}
public void setCancelButtonEnabled(final boolean enabled) {
cancelButton.setEnabled(enabled);
}
}

View File

@@ -0,0 +1,26 @@
package org.eclipse.hawkbit.ui.common;
import org.eclipse.hawkbit.ui.utils.I18N;
import com.vaadin.event.FieldEvents.BlurListener;
import com.vaadin.ui.AbstractLayout;
import com.vaadin.ui.Component;
import com.vaadin.ui.Button.ClickListener;
public class CustomCommonDialogWindow extends CommonDialogWindow {
private static final long serialVersionUID = -4453608850403359992L;
public CustomCommonDialogWindow(final String caption, final Component content, final String helpLink,
final ClickListener saveButtonClickListener, final ClickListener cancelButtonClickListener,
final AbstractLayout layout, final I18N i18n) {
super(caption, content, helpLink, saveButtonClickListener, cancelButtonClickListener, layout, i18n);
}
@Override
protected void addListeners() {
addComponenetListeners();
addCloseListenerForCancelButton();
}
}

View File

@@ -89,13 +89,15 @@ public class DistributionSetMetadatadetailslayout extends Table{
*/
public void populateDSMetadata(final DistributionSet distributionSet) {
removeAllItems();
if (null != distributionSet) {
selectedDistSetId = distributionSet.getId();
final List<DistributionSetMetadata> dsMetadataList = distributionSet.getMetadata();
if (null != dsMetadataList && !dsMetadataList.isEmpty()) {
dsMetadataList.forEach(dsMetadata -> setDSMetadataProperties(dsMetadata));
}
}
if (null == distributionSet) {
return;
}
selectedDistSetId = distributionSet.getId();
final List<DistributionSetMetadata> dsMetadataList = distributionSet.getMetadata();
if (null != dsMetadataList && !dsMetadataList.isEmpty()) {
dsMetadataList.forEach(dsMetadata -> setDSMetadataProperties(dsMetadata));
}
}
/**

View File

@@ -41,129 +41,130 @@ import com.vaadin.ui.themes.ValoTheme;
@ViewScope
public class SoftwareModuleMetadatadetailslayout extends Table {
private static final long serialVersionUID = 2913758299611838818L;
private static final long serialVersionUID = 2913758299611838818L;
private static final String METADATA_KEY = "Key";
private static final String METADATA_KEY = "Key";
private SpPermissionChecker permissionChecker;
private SpPermissionChecker permissionChecker;
private SoftwareManagement softwareManagement;
private SoftwareManagement softwareManagement;
private SwMetadataPopupLayout swMetadataPopupLayout;
private SwMetadataPopupLayout swMetadataPopupLayout;
private I18N i18n;
private I18N i18n;
private Long selectedSWModuleId;
private Long selectedSWModuleId;
private transient EntityFactory entityFactory;
private transient EntityFactory entityFactory;
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
this.entityFactory = entityFactory;
createSWMMetadataTable();
addCustomGeneratedColumns();
}
public void init(final I18N i18n, final SpPermissionChecker permissionChecker,
final SoftwareManagement softwareManagement, final SwMetadataPopupLayout swMetadataPopupLayout,
final EntityFactory entityFactory) {
this.i18n = i18n;
this.permissionChecker = permissionChecker;
this.softwareManagement = softwareManagement;
this.swMetadataPopupLayout = swMetadataPopupLayout;
this.entityFactory = entityFactory;
createSWMMetadataTable();
addCustomGeneratedColumns();
}
/**
* Populate software module metadata table.
*
* @param swModule
*/
public void populateSMMetadata(final SoftwareModule swModule) {
removeAllItems();
if (null != swModule) {
selectedSWModuleId = swModule.getId();
final List<SoftwareModuleMetadata> swMetadataList = swModule.getMetadata();
if (null != swMetadataList && !swMetadataList.isEmpty()) {
swMetadataList.forEach(swMetadata -> setSWMetadataProperties(swMetadata));
}
}
}
/**
* Create metadata.
*
* @param metadataKeyName
*/
public void createMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
final Item item = metadataContainer.addItem(metadataKeyName);
item.getItemProperty(METADATA_KEY).setValue(metadataKeyName);
/**
* Populate software module metadata table.
*
* @param swModule
*/
public void populateSMMetadata(final SoftwareModule swModule) {
removeAllItems();
if (null == swModule) {
return;
}
selectedSWModuleId = swModule.getId();
final List<SoftwareModuleMetadata> swMetadataList = swModule.getMetadata();
if (null != swMetadataList && !swMetadataList.isEmpty()) {
swMetadataList.forEach(swMetadata -> setSWMetadataProperties(swMetadata));
}
}
}
/**
* Create metadata.
*
* @param metadataKeyName
*/
public void createMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
final Item item = metadataContainer.addItem(metadataKeyName);
item.getItemProperty(METADATA_KEY).setValue(metadataKeyName);
/**
* Delete metadata.
*
* @param metadataKeyName
*/
public void deleteMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
metadataContainer.removeItem(metadataKeyName);
}
}
private void createSWMMetadataTable() {
addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
addStyleName(ValoTheme.TABLE_NO_STRIPES);
addStyleName(SPUIStyleDefinitions.SW_MODULE_TABLE);
setSelectable(false);
setImmediate(true);
setContainerDataSource(getSwModuleMetadataContainer());
setColumnHeaderMode(ColumnHeaderMode.EXPLICIT);
addSMMetadataTableHeader();
setSizeFull();
//same as height of other tabs in details tabsheet
setHeight(116,Unit.PIXELS);
}
/**
* Delete metadata.
*
* @param metadataKeyName
*/
public void deleteMetadata(final String metadataKeyName) {
final IndexedContainer metadataContainer = (IndexedContainer) getContainerDataSource();
metadataContainer.removeItem(metadataKeyName);
}
private IndexedContainer getSwModuleMetadataContainer() {
final IndexedContainer container = new IndexedContainer();
container.addContainerProperty(METADATA_KEY, String.class, "");
setColumnAlignment(METADATA_KEY, Align.LEFT);
return container;
}
private void createSWMMetadataTable() {
addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
addStyleName(ValoTheme.TABLE_NO_STRIPES);
addStyleName(SPUIStyleDefinitions.SW_MODULE_TABLE);
setSelectable(false);
setImmediate(true);
setContainerDataSource(getSwModuleMetadataContainer());
setColumnHeaderMode(ColumnHeaderMode.EXPLICIT);
addSMMetadataTableHeader();
setSizeFull();
//same as height of other tabs in details tabsheet
setHeight(116,Unit.PIXELS);
}
private void addSMMetadataTableHeader() {
setColumnHeader(METADATA_KEY, i18n.get("header.key"));
}
private IndexedContainer getSwModuleMetadataContainer() {
final IndexedContainer container = new IndexedContainer();
container.addContainerProperty(METADATA_KEY, String.class, "");
setColumnAlignment(METADATA_KEY, Align.LEFT);
return container;
}
private void addSMMetadataTableHeader() {
setColumnHeader(METADATA_KEY, i18n.get("header.key"));
}
private void setSWMetadataProperties(final SoftwareModuleMetadata swMetadata) {
final Item item = getContainerDataSource().addItem(swMetadata.getKey());
item.getItemProperty(METADATA_KEY).setValue(swMetadata.getKey());
}
private void setSWMetadataProperties(final SoftwareModuleMetadata swMetadata) {
final Item item = getContainerDataSource().addItem(swMetadata.getKey());
item.getItemProperty(METADATA_KEY).setValue(swMetadata.getKey());
}
private void addCustomGeneratedColumns() {
addGeneratedColumn(METADATA_KEY, (source, itemId, columnId) -> customMetadataDetailButton((String) itemId));
}
private void addCustomGeneratedColumns() {
addGeneratedColumn(METADATA_KEY, (source, itemId, columnId) -> customMetadataDetailButton((String) itemId));
}
private Button customMetadataDetailButton(final String metadataKey) {
final Button viewLink = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey, "View"
+ metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
viewLink.setData(metadataKey);
if (permissionChecker.hasUpdateDistributionPermission()) {
viewLink.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
+ " " + "text-style");
viewLink.addClickListener(event -> showMetadataDetails(selectedSWModuleId, metadataKey));
}
return viewLink;
}
private Button customMetadataDetailButton(final String metadataKey) {
final Button viewLink = SPUIComponentProvider.getButton(getDetailLinkId(metadataKey), metadataKey, "View"
+ metadataKey + " Metadata details", null, false, null, SPUIButtonStyleSmallNoBorder.class);
viewLink.setData(metadataKey);
if (permissionChecker.hasUpdateDistributionPermission()) {
viewLink.addStyleName(ValoTheme.BUTTON_TINY + " " + ValoTheme.BUTTON_LINK + " " + "on-focus-no-border link"
+ " " + "text-style");
viewLink.addClickListener(event -> showMetadataDetails(selectedSWModuleId, metadataKey));
}
return viewLink;
}
private static String getDetailLinkId(final String name) {
return new StringBuilder(SPUIComponentIdProvider.SW_METADATA_DETAIL_LINK).append('.').append(name).toString();
}
private static String getDetailLinkId(final String name) {
return new StringBuilder(SPUIComponentIdProvider.SW_METADATA_DETAIL_LINK).append('.').append(name).toString();
}
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId);
/* display the window */
UI.getCurrent().addWindow(
swMetadataPopupLayout.getWindow(swmodule,
entityFactory.generateSoftwareModuleMetadata(swmodule, metadataKey, "")));
}
private void showMetadataDetails(final Long selectedSWModuleId, final String metadataKey) {
SoftwareModule swmodule = softwareManagement.findSoftwareModuleById(selectedSWModuleId);
/* display the window */
UI.getCurrent().addWindow(
swMetadataPopupLayout.getWindow(swmodule,
entityFactory.generateSoftwareModuleMetadata(swmodule, metadataKey, "")));
}
}
}

View File

@@ -22,7 +22,8 @@ import com.vaadin.ui.Button.ClickEvent;
*/
public abstract class AbstractFilterMultiButtonClick extends AbstractFilterButtonClickBehaviour {
protected final Set<Button> alreadyClickedButtons = new HashSet<>();
private static final long serialVersionUID = 1L;
protected final transient Set<Button> alreadyClickedButtons = new HashSet<>();
/*
* (non-Javadoc)

View File

@@ -95,9 +95,6 @@ public abstract class AbstractTable<E extends NamedEntity, I> extends Table {
if (values == null) {
values = Collections.emptySet();
}
if (values.contains(null)) {
LOG.warn("Null values in table content. How could this happen?");
}
return values;
}

View File

@@ -43,10 +43,6 @@ import com.vaadin.ui.themes.ValoTheme;
/**
* Abstract class for target/ds tag token layout.
*
*
*
*
*/
public abstract class AbstractTagToken<T extends BaseEntity> implements Serializable {
@@ -58,9 +54,9 @@ public abstract class AbstractTagToken<T extends BaseEntity> implements Serializ
protected IndexedContainer container;
protected final Map<Long, TagData> tagDetails = new HashMap<>();
protected final transient Map<Long, TagData> tagDetails = new HashMap<>();
protected final Map<Long, TagData> tokensAdded = new HashMap<>();
protected final transient Map<Long, TagData> tokensAdded = new HashMap<>();
protected CssLayout tokenLayout = new CssLayout();

View File

@@ -14,7 +14,6 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.UserDetailsFormatter;
import org.eclipse.hawkbit.ui.decorators.SPUIButtonDecorator;
import org.eclipse.hawkbit.ui.decorators.SPUIComboBoxDecorator;
@@ -33,10 +32,8 @@ import com.vaadin.server.FontAwesome;
import com.vaadin.server.Resource;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.Link;
@@ -140,24 +137,6 @@ public final class SPUIComponentProvider {
return SPUILabelDecorator.getDeocratedLabel(name, type);
}
/**
* Get window component.
*
* @param caption
* window caption
* @param id
* window id
* @param type
* type of window
* @return Window
*/
public static CommonDialogWindow getWindow(final String caption, final String id, final String type,
final Component content, final ClickListener saveButtonClickListener,
final ClickListener cancelButtonClickListener, final String helpLink) {
return SPUIWindowDecorator.getDeocratedWindow(caption, id, type, content, saveButtonClickListener,
cancelButtonClickListener, helpLink);
}
/**
* Get window component.
*
@@ -204,6 +183,8 @@ public final class SPUIComponentProvider {
/**
* Get Label UI component. *
*
* @param caption
* set the caption of the textArea
* @param style
* set style
* @param styleName

View File

@@ -9,9 +9,12 @@
package org.eclipse.hawkbit.ui.decorators;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.CustomCommonDialogWindow;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUIStyleDefinitions;
import com.vaadin.ui.AbstractLayout;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Component;
import com.vaadin.ui.Window;
@@ -42,27 +45,36 @@ public final class SPUIWindowDecorator {
* window type
* @return Window
*/
public static CommonDialogWindow getDeocratedWindow(final String caption, final String id, final String type,
public static CommonDialogWindow getWindow(final String caption, final String id, final String type,
final Component content, final ClickListener saveButtonClickListener,
final ClickListener cancelButtonClickListener, final String helpLink) {
final ClickListener cancelButtonClickListener, final String helpLink, final AbstractLayout layout,
final I18N i18n) {
CommonDialogWindow window = null;
if (SPUIDefinitions.CUSTOM_METADATA_WINDOW.equals(type)) {
window = new CustomCommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener, layout, i18n);
window.setDraggable(true);
window.setClosable(true);
} else {
window = new CommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener, layout, i18n);
if (null != id) {
window.setId(id);
}
if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
window.setDraggable(false);
window.setClosable(true);
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
final CommonDialogWindow window = new CommonDialogWindow(caption, content, helpLink, saveButtonClickListener,
cancelButtonClickListener);
if (null != id) {
window.setId(id);
}
if (SPUIDefinitions.CONFIRMATION_WINDOW.equals(type)) {
window.setDraggable(false);
window.setClosable(true);
window.addStyleName(SPUIStyleDefinitions.CONFIRMATION_WINDOW_CAPTION);
} else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setDraggable(true);
window.setClosable(true);
}
return window;
}
} else if (SPUIDefinitions.CREATE_UPDATE_WINDOW.equals(type)) {
window.setDraggable(true);
window.setClosable(true);
}
}
return window;
}
/**
* Decorates window based on type.
*

View File

@@ -9,6 +9,7 @@
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;
@@ -16,7 +17,6 @@ import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerConstants;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
@@ -49,8 +49,6 @@ import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Table;
import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.components.colorpicker.ColorChangeListener;
import com.vaadin.ui.components.colorpicker.ColorSelector;
import com.vaadin.ui.themes.ValoTheme;
/**
@@ -58,8 +56,7 @@ import com.vaadin.ui.themes.ValoTheme;
*/
@SpringComponent
@ViewScope
public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
implements ColorChangeListener, ColorSelector {
public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout {
private static final long serialVersionUID = -5169398523815877767L;
private static final Logger LOG = LoggerFactory.getLogger(CreateUpdateDistSetTypeLayout.class);
@@ -82,8 +79,12 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
private Table sourceTable;
private Table selectedTable;
private IndexedContainer selectedTablecontainer;
private IndexedContainer sourceTablecontainer;
private IndexedContainer selectedTableContainer;
private IndexedContainer sourceTableContainer;
private IndexedContainer originalSelectedTableContainer;
private Map<CheckBox, Boolean> mandatoryCheckboxMap;
@Override
protected void createRequiredComponents() {
@@ -103,7 +104,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.DIST_SET_TYPE_DESC, false, "",
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
tagDesc.setId(SPUIDefinitions.NEW_DISTRIBUTION_TYPE_DESC);
tagDesc.setImmediate(true);
tagDesc.setNullRepresentation("");
@@ -159,9 +159,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
return twinColumnLayout;
}
/**
*
*/
private void buildSelectedTable() {
selectedTable = new Table();
@@ -176,13 +173,14 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
selectedTable.addStyleName("dist_type_twin-table");
selectedTable.setSizeFull();
createSelectedTableContainer();
selectedTable.setContainerDataSource(selectedTablecontainer);
selectedTable.setContainerDataSource(selectedTableContainer);
addTooltTipToSelectedTable();
selectedTable.setImmediate(true);
selectedTable.setVisibleColumns(DIST_TYPE_NAME, DIST_TYPE_MANDATORY);
selectedTable.setColumnHeaders(i18n.get("header.dist.twintable.selected"), STAR);
selectedTable.setColumnExpandRatio(DIST_TYPE_NAME, 0.75f);
selectedTable.setColumnExpandRatio(DIST_TYPE_MANDATORY, 0.25f);
selectedTable.setColumnExpandRatio(DIST_TYPE_NAME, 0.75F);
selectedTable.setColumnExpandRatio(DIST_TYPE_MANDATORY, 0.25F);
selectedTable.setRequired(true);
}
private void addTooltTipToSelectedTable() {
@@ -218,14 +216,13 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
sourceTable.addStyleName(ValoTheme.TABLE_NO_VERTICAL_LINES);
sourceTable.addStyleName(ValoTheme.TABLE_SMALL);
sourceTable.setImmediate(true);
// sourceTable
sourceTable.setSizeFull();
sourceTable.addStyleName("dist_type_twin-table");
sourceTable.setSortEnabled(false);
sourceTablecontainer = new IndexedContainer();
sourceTablecontainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
sourceTablecontainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
sourceTable.setContainerDataSource(sourceTablecontainer);
sourceTableContainer = new IndexedContainer();
sourceTableContainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
sourceTableContainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
sourceTable.setContainerDataSource(sourceTableContainer);
sourceTable.setVisibleColumns(new Object[] { DIST_TYPE_NAME });
sourceTable.setColumnHeaders(i18n.get("header.dist.twintable.available"));
@@ -237,20 +234,29 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
private void createSelectedTableContainer() {
selectedTablecontainer = new IndexedContainer();
selectedTablecontainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
selectedTablecontainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
selectedTablecontainer.addContainerProperty(DIST_TYPE_MANDATORY, CheckBox.class, null);
selectedTableContainer = new IndexedContainer();
selectedTableContainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
selectedTableContainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
selectedTableContainer.addContainerProperty(DIST_TYPE_MANDATORY, CheckBox.class, null);
}
private void createOriginalSelectedTableContainer() {
originalSelectedTableContainer = new IndexedContainer();
originalSelectedTableContainer.addContainerProperty(DIST_TYPE_NAME, String.class, "");
originalSelectedTableContainer.addContainerProperty(DIST_TYPE_DESCRIPTION, String.class, "");
originalSelectedTableContainer.addContainerProperty(DIST_TYPE_MANDATORY, CheckBox.class, null);
}
@SuppressWarnings("unchecked")
private void addSMType() {
final Set<Long> selectedIds = (Set<Long>) sourceTable.getValue();
if (null != selectedIds && !selectedIds.isEmpty()) {
for (final Long id : selectedIds) {
addTargetTableData(id);
}
if (selectedIds == null) {
return;
}
for (final Long id : selectedIds) {
addTargetTableData(id);
}
}
@@ -258,23 +264,24 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
@SuppressWarnings("unchecked")
final Set<Long> selectedIds = (Set<Long>) selectedTable.getValue();
if (null != selectedIds && !selectedIds.isEmpty()) {
for (final Long id : selectedIds) {
addSourceTableData(id);
selectedTable.removeItem(id);
}
if (selectedIds == null) {
return;
}
for (final Long id : selectedIds) {
addSourceTableData(id);
selectedTable.removeItem(id);
}
}
@SuppressWarnings("unchecked")
private void getSourceTableData() {
sourceTablecontainer.removeAllItems();
sourceTableContainer.removeAllItems();
final Iterable<SoftwareModuleType> moduleTypeBeans = softwareManagement
.findSoftwareModuleTypesAll(new PageRequest(0, 1_000));
Item saveTblitem;
for (final SoftwareModuleType swTypeTag : moduleTypeBeans) {
saveTblitem = sourceTablecontainer.addItem(swTypeTag.getId());
saveTblitem = sourceTableContainer.addItem(swTypeTag.getId());
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(swTypeTag.getName());
saveTblitem.getItemProperty(DIST_TYPE_DESCRIPTION).setValue(swTypeTag.getDescription());
}
@@ -307,11 +314,13 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
private void getSelectedTableItemData(final Long id) {
Item saveTblitem;
if (null != selectedTablecontainer) {
saveTblitem = selectedTablecontainer.addItem(id);
if (selectedTableContainer != null) {
saveTblitem = selectedTableContainer.addItem(id);
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(
sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_NAME).getValue());
saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(new CheckBox());
final CheckBox mandatoryCheckBox = new CheckBox();
window.updateAllComponents(mandatoryCheckBox);
saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(mandatoryCheckBox);
saveTblitem.getItemProperty(DIST_TYPE_DESCRIPTION).setValue(
sourceTable.getContainerDataSource().getItem(id).getItemProperty(DIST_TYPE_DESCRIPTION).getValue());
}
@@ -320,10 +329,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
@SuppressWarnings("unchecked")
private void addSourceTableData(final Long selectedId) {
if (null != sourceTablecontainer) {
if (sourceTableContainer != null) {
Item saveTblitem;
saveTblitem = sourceTablecontainer.addItem(selectedId);
selectedTable.getContainerDataSource().getItem(selectedId).getItemProperty(DIST_TYPE_NAME);
saveTblitem = sourceTableContainer.addItem(selectedId);
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(selectedTable.getContainerDataSource()
.getItem(selectedId).getItemProperty(DIST_TYPE_NAME).getValue());
saveTblitem.getItemProperty(DIST_TYPE_DESCRIPTION).setValue(selectedTable.getContainerDataSource()
@@ -353,20 +361,14 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
final SoftwareModuleType swModuleType = softwareManagement.findSoftwareModuleTypeByName(distTypeName);
checkMandatoryAndAddMandatoryModuleType(newDistType, isMandatory, swModuleType);
}
if (null != typeDescValue) {
newDistType.setDescription(typeDescValue);
}
newDistType.setDescription(typeDescValue);
newDistType.setColour(colorPicked);
newDistType = distributionSetManagement.createDistributionSetType(newDistType);
uiNotification.displaySuccess(i18n.get("message.save.success", new Object[] { newDistType.getName() }));
closeWindow();
eventBus.publish(this,
new DistributionSetTypeEvent(DistributionSetTypeEnum.ADD_DIST_SET_TYPE, newDistType));
} else {
uiNotification.displayValidationError(i18n.get("message.error.missing.typenameorkey"));
}
}
@@ -386,7 +388,7 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
if (null != typeNameValue) {
updateDistSetType.setName(typeNameValue);
updateDistSetType.setKey(typeKeyValue);
updateDistSetType.setDescription(null != typeDescValue ? typeDescValue : null);
updateDistSetType.setDescription(typeDescValue);
if (distributionSetManagement.countDistributionSetsByType(existingType) <= 0 && null != itemIds
&& !itemIds.isEmpty()) {
@@ -404,21 +406,17 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
distributionSetManagement.updateDistributionSetType(updateDistSetType);
uiNotification
.displaySuccess(i18n.get("message.update.success", new Object[] { updateDistSetType.getName() }));
closeWindow();
eventBus.publish(this,
new DistributionSetTypeEvent(DistributionSetTypeEnum.UPDATE_DIST_SET_TYPE, updateDistSetType));
} else {
uiNotification.displayValidationError(i18n.get("message.tag.update.mandatory"));
}
}
private void checkMandatoryAndAddMandatoryModuleType(final DistributionSetType updateDistSetType,
final Boolean isMandatory, final SoftwareModuleType swModuleType) {
if (isMandatory) {
updateDistSetType.addMandatoryModuleType(swModuleType);
} else {
updateDistSetType.addOptionalModuleType(swModuleType);
}
@@ -440,32 +438,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
return distSetType;
}
/*
* (non-Javadoc)
*
* @see com.vaadin.ui.components.colorpicker.HasColorChangeListener#
* addColorChangeListener(com.vaadin
* .ui.components.colorpicker.ColorChangeListener)
*/
@Override
public void addColorChangeListener(final ColorChangeListener listener) {
LOG.info("in side addColorChangeListener() ");
}
/*
* (non-Javadoc)
*
* @see com.vaadin.ui.components.colorpicker.HasColorChangeListener#
* removeColorChangeListener(com.
* vaadin.ui.components.colorpicker.ColorChangeListener)
*/
@Override
public void removeColorChangeListener(final ColorChangeListener listener) {
LOG.info("in side removeColorChangeListener() ");
}
/**
* reset the components.
*/
@@ -484,9 +456,9 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
* ValueChangeEvent
*/
@Override
protected void createOptionValueChanged(final ValueChangeEvent event) {
protected void optionValueChanged(final ValueChangeEvent event) {
super.createOptionValueChanged(event);
super.optionValueChanged(event);
if (updateTypeStr.equals(event.getProperty().getValue())) {
selectedTable.getContainerDataSource().removeAllItems();
@@ -552,18 +524,17 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
if (null != selectedTypeTag) {
tagDesc.setValue(selectedTypeTag.getDescription());
typeKey.setValue(selectedTypeTag.getKey());
if (distributionSetManagement.countDistributionSetsByType(selectedTypeTag) <= 0) {
distTypeSelectLayout.setEnabled(true);
selectedTable.setEnabled(true);
window.setSaveButtonEnabled(true);
} else {
uiNotification.displayValidationError(
selectedTypeTag.getName() + " " + i18n.get("message.error.dist.set.type.update"));
distTypeSelectLayout.setEnabled(false);
selectedTable.setEnabled(false);
window.setSaveButtonEnabled(false);
}
createOriginalSelectedTableContainer();
for (final SoftwareModuleType swModuleType : selectedTypeTag.getOptionalModuleTypes()) {
addTargetTableforUpdate(swModuleType, false);
}
@@ -583,65 +554,41 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
@SuppressWarnings("unchecked")
private void addTargetTableforUpdate(final SoftwareModuleType swModuleType, final boolean mandatory) {
Item saveTblitem;
if (null != selectedTablecontainer) {
saveTblitem = selectedTablecontainer.addItem(swModuleType.getId());
sourceTable.removeItem(swModuleType.getId());
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(swModuleType.getName());
saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(new CheckBox("", mandatory));
if (selectedTableContainer == null) {
return;
}
final Item saveTblitem = selectedTableContainer.addItem(swModuleType.getId());
sourceTable.removeItem(swModuleType.getId());
saveTblitem.getItemProperty(DIST_TYPE_NAME).setValue(swModuleType.getName());
final CheckBox mandatoryCheckbox = new CheckBox("", mandatory);
mandatoryCheckbox.setId(swModuleType.getName());
saveTblitem.getItemProperty(DIST_TYPE_MANDATORY).setValue(mandatoryCheckbox);
final Item originalItem = originalSelectedTableContainer.addItem(swModuleType.getId());
originalItem.getItemProperty(DIST_TYPE_NAME).setValue(swModuleType.getName());
originalItem.getItemProperty(DIST_TYPE_MANDATORY).setValue(mandatoryCheckbox);
window.updateAllComponents(mandatoryCheckbox);
}
@Override
protected void save(final ClickEvent event) {
if (mandatoryValuesPresent()) {
final DistributionSetType existingDistTypeByKey = distributionSetManagement
.findDistributionSetTypeByKey(typeKey.getValue());
final DistributionSetType existingDistTypeByName = distributionSetManagement
.findDistributionSetTypeByName(tagName.getValue());
if (optiongroup.getValue().equals(createTypeStr)) {
if (!checkIsDuplicateByKey(existingDistTypeByKey) && !checkIsDuplicate(existingDistTypeByName)) {
createNewDistributionSetType();
}
} else {
updateDistributionSetType(existingDistTypeByKey);
final DistributionSetType existingDistTypeByKey = distributionSetManagement
.findDistributionSetTypeByKey(typeKey.getValue());
final DistributionSetType existingDistTypeByName = distributionSetManagement
.findDistributionSetTypeByName(tagName.getValue());
if (optiongroup.getValue().equals(createTypeStr)) {
if (!checkIsDuplicateByKey(existingDistTypeByKey) && !checkIsDuplicate(existingDistTypeByName)) {
createNewDistributionSetType();
}
}
}
@Override
public void createWindow() {
reset();
window = SPUIComponentProvider.getWindow(i18n.get("caption.add.type"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, this::save, this::discard, null);
}
@Override
protected void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
final String selectedOption = (String) optiongroup.getValue();
if (null != selectedOption && selectedOption.equalsIgnoreCase(updateTypeStr)
&& null != tagNameComboBox.getValue()) {
final DistributionSetType existedDistType = distributionSetManagement
.findDistributionSetTypeByKey(tagNameComboBox.getValue().toString());
if (null != existedDistType) {
getColorPickerLayout().setSelectedColor(existedDistType.getColour() != null
? ColorPickerHelper.rgbToColorConverter(existedDistType.getColour())
: ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR));
} else {
getColorPickerLayout().setSelectedColor(
ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR));
}
}
getColorPickerLayout().getSelPreview().setColor(getColorPickerLayout().getSelectedColor());
mainLayout.addComponent(colorPickerLayout, 1, 0);
mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER);
} else {
mainLayout.removeComponent(colorPickerLayout);
updateDistributionSetType(existingDistTypeByKey);
}
tagPreviewBtnClicked = !tagPreviewBtnClicked;
}
@Override
protected String getWindowCaption() {
return i18n.get("caption.add.type");
}
@Override

View File

@@ -96,7 +96,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
private VerticalLayout tagsLayout;
Map<String, StringBuilder> assignedSWModule = new HashMap<>();
private final Map<String, StringBuilder> assignedSWModule = new HashMap<>();
@EventBusListenerMethod(scope = EventScope.SESSION)
@@ -297,8 +297,7 @@ public class DistributionSetDetails extends AbstractNamedVersionedEntityTableDet
@Override
protected void onEdit(final ClickEvent event) {
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
distributionAddUpdateWindowLayout.populateValuesOfDistribution(getSelectedBaseEntityId());
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(getSelectedBaseEntityId());
newDistWindow.setCaption(getI18n().get("caption.update.dist"));
UI.getCurrent().addWindow(newDistWindow);
newDistWindow.setVisible(Boolean.TRUE);

View File

@@ -152,7 +152,7 @@ public class DistributionSetTableHeader extends AbstractTableHeader {
@Override
protected void addNewItem(final ClickEvent event) {
final Window newDistWindow = addUpdateWindowLayout.getWindow();
final Window newDistWindow = addUpdateWindowLayout.getWindow(null);
newDistWindow.setCaption(i18n.get("caption.add.new.dist"));
UI.getCurrent().addWindow(newDistWindow);
newDistWindow.setVisible(Boolean.TRUE);

View File

@@ -20,17 +20,16 @@ import org.eclipse.hawkbit.ui.colorpicker.ColorPickerHelper;
import org.eclipse.hawkbit.ui.colorpicker.ColorPickerLayout;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
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.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import com.google.common.base.Strings;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.server.Page;
@@ -87,7 +86,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
protected CommonDialogWindow window;
protected Label colorLabel;
protected Label madatoryLabel;
protected TextField tagName;
protected TextArea tagDesc;
protected Button tagColorPreviewBtn;
@@ -99,17 +97,13 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
protected GridLayout mainLayout;
protected VerticalLayout contentLayout;
protected boolean tagPreviewBtnClicked = false;
protected boolean tagPreviewBtnClicked;
private String colorPicked;
protected String tagNameValue;
protected String tagDescValue;
protected void createWindow() {
reset();
setWindow(SPUIComponentProvider.getWindow(i18n.get("caption.add.tag"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, this::save, this::discard, null));
}
protected abstract String getWindowCaption();
/**
* Save new tag / update new tag.
@@ -142,7 +136,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
setSizeUndefined();
createRequiredComponents();
buildLayout();
createWindow();
addListeners();
eventBus.subscribe(this);
}
@@ -157,7 +150,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
createTagStr = i18n.get("label.create.tag");
updateTagStr = i18n.get("label.update.tag");
comboLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.tag"), null);
madatoryLabel = getMandatoryLabel();
colorLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.tag.color"), null);
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
@@ -169,7 +161,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
tagDesc = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "",
ValoTheme.TEXTFIELD_TINY + " " + SPUIDefinitions.TAG_DESC, false, "", i18n.get("textfield.description"),
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
tagDesc.setId(SPUIDefinitions.NEW_TARGET_TAG_DESC);
tagDesc.setImmediate(true);
tagDesc.setNullRepresentation("");
@@ -178,6 +169,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
i18n.get("label.combobox.tag"));
tagNameComboBox.addStyleName(SPUIDefinitions.FILTER_TYPE_COMBO_STYLE);
tagNameComboBox.setImmediate(true);
tagNameComboBox.setId(SPUIComponentIdProvider.DIST_TAG_COMBO);
tagColorPreviewBtn = new Button();
tagColorPreviewBtn.setId(SPUIComponentIdProvider.TAG_COLOR_PREVIEW_ID);
@@ -200,7 +192,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
formLayout.addComponent(optiongroup);
formLayout.addComponent(comboLayout);
formLayout.addComponent(madatoryLabel);
formLayout.addComponent(tagName);
formLayout.addComponent(tagDesc);
formLayout.addStyleName("form-lastrow");
@@ -215,6 +206,10 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
mainLayout.setSizeFull();
mainLayout.addComponent(contentLayout, 0, 0);
colorPickerLayout.setVisible(false);
mainLayout.addComponent(colorPickerLayout, 1, 0);
mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER);
setCompositionRoot(mainLayout);
tagName.focus();
}
@@ -234,13 +229,10 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
protected void previewButtonClicked() {
if (!tagPreviewBtnClicked) {
setColor();
mainLayout.getComponent(1, 0);
mainLayout.addComponent(colorPickerLayout, 1, 0);
mainLayout.setComponentAlignment(colorPickerLayout, Alignment.MIDDLE_CENTER);
} else {
mainLayout.removeComponent(colorPickerLayout);
}
tagPreviewBtnClicked = !tagPreviewBtnClicked;
colorPickerLayout.setVisible(tagPreviewBtnClicked);
}
private void setColor() {
@@ -270,12 +262,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
}
}
protected Label getMandatoryLabel() {
final Label label = new Label(i18n.get("label.mandatory.field"));
label.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_SMALL);
return label;
}
private void tagNameChosen(final ValueChangeEvent event) {
final String tagSelected = (String) event.getProperty().getValue();
if (null != tagSelected) {
@@ -283,6 +269,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
} else {
resetTagNameField();
}
window.setOrginaleValues();
}
protected void resetTagNameField() {
@@ -290,7 +277,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
tagName.clear();
tagDesc.clear();
restoreComponentStyles();
mainLayout.removeComponent(colorPickerLayout);
colorPickerLayout.setSelectedColor(colorPickerLayout.getDefaultColor());
colorPickerLayout.getSelPreview().setColor(colorPickerLayout.getSelectedColor());
tagPreviewBtnClicked = false;
@@ -327,7 +313,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
getPreviewButtonColor(ColorPickerConstants.DEFAULT_COLOR);
colorPickerLayout.getSelPreview()
.setColor(ColorPickerHelper.rgbToColorConverter(ColorPickerConstants.DEFAULT_COLOR));
mainLayout.removeComponent(colorPickerLayout);
window.setOrginaleValues();
}
/**
@@ -342,9 +328,9 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
// hide target name combo
comboLayout.removeComponent(comboLabel);
comboLayout.removeComponent(tagNameComboBox);
mainLayout.removeComponent(colorPickerLayout);
// Default green color
colorPickerLayout.setVisible(false);
colorPickerLayout.setSelectedColor(colorPickerLayout.getDefaultColor());
colorPickerLayout.getSelPreview().setColor(colorPickerLayout.getSelectedColor());
tagPreviewBtnClicked = false;
@@ -389,6 +375,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
*/
protected void createDynamicStyleForComponents(final TextField tagName, final TextArea tagDesc,
final String taregtTagColor) {
tagName.removeStyleName(SPUIDefinitions.TAG_NAME);
tagDesc.removeStyleName(SPUIDefinitions.TAG_DESC);
getTargetDynamicStyles(taregtTagColor);
@@ -435,11 +422,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
createDynamicStyleForComponents(tagName, tagDesc, colorPickedPreview);
colorPickerLayout.getColorSelect().setColor(colorPickerLayout.getSelPreview().getColor());
}
}
protected void closeWindow() {
window.close();
UI.getCurrent().removeWindow(window);
}
/**
@@ -448,6 +431,7 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
protected void createOptionGroup(final boolean hasCreatePermission, final boolean hasUpdatePermission) {
optiongroup = new OptionGroup("Select Action");
optiongroup.setId(SPUIComponentIdProvider.OPTION_GROUP);
optiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
optiongroup.addStyleName("custom-option-group");
optiongroup.setNullSelectionAllowed(false);
@@ -472,27 +456,17 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
}
}
@Override
public void addColorChangeListener(final ColorChangeListener listener) {
}
@Override
public void removeColorChangeListener(final ColorChangeListener listener) {
}
public ColorPickerLayout getColorPickerLayout() {
return colorPickerLayout;
}
public CommonDialogWindow getWindow() {
reset();
window = SPUIWindowDecorator.getWindow(getWindowCaption(), null, SPUIDefinitions.CREATE_UPDATE_WINDOW, this,
this::save, this::discard, null, mainLayout, i18n);
return window;
}
public void setWindow(final CommonDialogWindow window) {
this.window = window;
}
/**
* Value change listeners implementations of sliders.
*/
@@ -565,7 +539,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
tagManagement.updateDistributionSetTag((DistributionSetTag) targetObj);
}
uiNotification.displaySuccess(i18n.get("message.update.success", new Object[] { targetObj.getName() }));
closeWindow();
} else {
uiNotification.displayValidationError(i18n.get("message.tag.update.mandatory"));
}
@@ -587,27 +560,6 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
getPreviewButtonColor(previewColor);
}
/**
*
* @return
*/
protected Boolean mandatoryValuesPresent() {
if (Strings.isNullOrEmpty(tagName.getValue())) {
if (optiongroup.getValue().equals(createTagStr)) {
displayValidationError(SPUILabelDefinitions.MISSING_TAG_NAME);
}
if (optiongroup.getValue().equals(updateTagStr)) {
if (null == tagNameComboBox.getValue()) {
displayValidationError(i18n.get(MESSAGE_ERROR_MISSING_TAGNAME));
} else {
displayValidationError(SPUILabelDefinitions.MISSING_TAG_NAME);
}
}
return Boolean.FALSE;
}
return Boolean.TRUE;
}
protected Boolean checkIsDuplicate(final Tag existingTag) {
if (existingTag != null) {
displayValidationError(i18n.get("message.tag.duplicate.check", new Object[] { existingTag.getName() }));
@@ -644,4 +596,16 @@ public abstract class AbstractCreateUpdateTagLayout extends CustomComponent
return formLayout;
}
public GridLayout getMainLayout() {
return mainLayout;
}
@Override
public void addColorChangeListener(final ColorChangeListener listener) {
}
@Override
public void removeColorChangeListener(final ColorChangeListener listener) {
}
}

View File

@@ -17,9 +17,7 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
import com.google.common.base.Strings;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.server.Page;
import com.vaadin.shared.ui.colorpicker.Color;
@@ -33,12 +31,10 @@ import com.vaadin.ui.components.colorpicker.ColorSelector;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* Superclass defining common properties and methods for creating/updating
* types.
*
*/
public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
public abstract class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
private static final long serialVersionUID = 5732904956185988397L;
@@ -52,7 +48,7 @@ public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
@Override
protected void addListeners() {
super.addListeners();
optiongroup.addValueChangeListener(this::createOptionValueChanged);
optiongroup.addValueChangeListener(this::optionValueChanged);
}
@Override
@@ -61,7 +57,6 @@ public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
createTypeStr = i18n.get("label.create.type");
updateTypeStr = i18n.get("label.update.type");
comboLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.type"), null);
madatoryLabel = getMandatoryLabel();
colorLabel = SPUIComponentProvider.getLabel(i18n.get("label.choose.type.color"), null);
colorLabel.addStyleName(SPUIDefinitions.COLOR_LABEL_STYLE);
@@ -137,7 +132,8 @@ public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
* @param event
* ValueChangeEvent
*/
protected void createOptionValueChanged(final ValueChangeEvent event) {
@Override
protected void optionValueChanged(final ValueChangeEvent event) {
if (updateTypeStr.equals(event.getProperty().getValue())) {
tagName.clear();
@@ -151,7 +147,6 @@ public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
} else {
typeKey.setEnabled(true);
tagName.setEnabled(true);
window.setSaveButtonEnabled(true);
tagName.clear();
tagDesc.clear();
typeKey.clear();
@@ -203,6 +198,7 @@ public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
protected void createOptionGroup(final boolean hasCreatePermission, final boolean hasUpdatePermission) {
optiongroup = new OptionGroup("Select Action");
optiongroup.setId(SPUIComponentIdProvider.OPTION_GROUP);
optiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);
optiongroup.addStyleName("custom-option-group");
optiongroup.setNullSelectionAllowed(false);
@@ -285,24 +281,6 @@ public class CreateUpdateTypeLayout extends AbstractCreateUpdateTagLayout {
return Boolean.FALSE;
}
@Override
protected Boolean mandatoryValuesPresent() {
if (Strings.isNullOrEmpty(tagName.getValue()) || Strings.isNullOrEmpty(typeKey.getValue())) {
if (optiongroup.getValue().equals(createTypeStr)) {
displayValidationError(SPUILabelDefinitions.MISSING_TYPE_NAME_KEY);
}
if (optiongroup.getValue().equals(updateTypeStr)) {
if (null == tagNameComboBox.getValue()) {
displayValidationError(i18n.get("message.error.missing.tagName"));
} else {
displayValidationError(SPUILabelDefinitions.MISSING_TAG_NAME);
}
}
return Boolean.FALSE;
}
return Boolean.TRUE;
}
@Override
protected void save(final ClickEvent event) {
// is implemented in the inherited class

View File

@@ -8,9 +8,7 @@
*/
package org.eclipse.hawkbit.ui.management.dstable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
@@ -26,6 +24,7 @@ import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.DistributionSetTypeBeanQuery;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
import org.eclipse.hawkbit.ui.management.event.DistributionTableEvent;
import org.eclipse.hawkbit.ui.management.event.DragEvent;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
@@ -43,26 +42,18 @@ import org.vaadin.addons.lazyquerycontainer.LazyQueryContainer;
import org.vaadin.addons.lazyquerycontainer.LazyQueryDefinition;
import org.vaadin.spring.events.EventBus;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Property.ValueChangeListener;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.CheckBox;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.Component;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.themes.ValoTheme;
/**
*
*
* WindowContent for adding/editing a Distribution
*/
@SpringComponent
@ViewScope
@@ -92,24 +83,12 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
private TextField distNameTextField;
private TextField distVersionTextField;
private Label madatoryLabel;
private TextArea descTextArea;
private CheckBox reqMigStepCheckbox;
private ComboBox distsetTypeNameComboBox;
private boolean editDistribution = Boolean.FALSE;
private Long editDistId;
private CommonDialogWindow addDistributionWindow;
private String originalDistName;
private String originalDistVersion;
private String originalDistDescription;
private Boolean originalReqMigStep;
private String originalDistSetType;
private final List<Component> changedComponents = new ArrayList<>();
private ValueChangeListener reqMigStepCheckboxListerner;
private TextChangeListener descTextAreaListener;
private TextChangeListener distNameTextFieldListener;
private TextChangeListener distVersionTextFieldListener;
private ValueChangeListener distsetTypeNameComboBoxListener;
private CommonDialogWindow window;
private FormLayout formLayout;
@@ -123,16 +102,10 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
}
private void buildLayout() {
/*
* The main layout of the window contains mandatory info, textboxes
* (controller Id, name & description) and action buttons layout
*/
addStyleName("lay-color");
setSizeUndefined();
formLayout = new FormLayout();
formLayout.addComponent(madatoryLabel);
formLayout.addComponent(distsetTypeNameComboBox);
formLayout.addComponent(distNameTextField);
formLayout.addComponent(distVersionTextField);
@@ -140,7 +113,6 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
formLayout.addComponent(reqMigStepCheckbox);
setCompositionRoot(formLayout);
distNameTextField.focus();
}
@@ -164,6 +136,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
distsetTypeNameComboBox.setImmediate(true);
distsetTypeNameComboBox.setNullSelectionAllowed(false);
distsetTypeNameComboBox.setId(SPUIComponentIdProvider.DIST_ADD_DISTSETTYPE);
populateDistSetTypeNameCombo();
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style",
ValoTheme.TEXTAREA_TINY, false, null, i18n.get("textfield.description"),
@@ -171,10 +144,6 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
descTextArea.setId(SPUIComponentIdProvider.DIST_ADD_DESC);
descTextArea.setNullRepresentation("");
/* Label for mandatory symbol */
madatoryLabel = new Label(i18n.get("label.mandatory.field"));
madatoryLabel.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_SMALL);
reqMigStepCheckbox = SPUIComponentProvider.getCheckBox(i18n.get("checkbox.dist.required.migration.step"),
"dist-checkbox-style", null, false, "");
reqMigStepCheckbox.addStyleName(ValoTheme.CHECKBOX_SMALL);
@@ -200,27 +169,17 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
return disttypeContainer;
}
private void enableSaveButton() {
addDistributionWindow.setSaveButtonEnabled(true);
}
private DistributionSetType getDefaultDistributionSetType() {
final TenantMetaData tenantMetaData = systemManagement.getTenantMetadata();
return tenantMetaData.getDefaultDsType();
}
private void disableSaveButton() {
addDistributionWindow.setSaveButtonEnabled(false);
}
private void saveDistribution() {
/* add new or update target */
if (editDistribution) {
updateDistribution();
} else {
addNewDistribution();
}
}
/**
@@ -232,7 +191,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final String distSetTypeName = HawkbitCommonUtil
.trimAndNullIfEmpty((String) distsetTypeNameComboBox.getValue());
if (mandatoryCheck(name, version, distSetTypeName) && duplicateCheck(name, version)) {
if (duplicateCheck(name, version)) {
final DistributionSet currentDS = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId);
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
@@ -250,23 +209,9 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
notificationMessage.displayValidationError(
i18n.get("message.distribution.no.update", currentDS.getName() + ":" + currentDS.getVersion()));
}
closeThisWindow();
}
}
private void addListeners() {
reqMigStepCheckboxListerner = event -> checkValueChanged(originalReqMigStep, event);
descTextAreaListener = event -> checkValueChanged(originalDistDescription, event);
distNameTextFieldListener = event -> checkValueChanged(originalDistName, event);
distVersionTextFieldListener = event -> checkValueChanged(originalDistVersion, event);
distsetTypeNameComboBoxListener = event -> checkValueChanged(originalDistSetType, event);
reqMigStepCheckbox.addValueChangeListener(reqMigStepCheckboxListerner);
descTextArea.addTextChangeListener(descTextAreaListener);
distNameTextField.addTextChangeListener(distNameTextFieldListener);
distVersionTextField.addTextChangeListener(distVersionTextFieldListener);
distsetTypeNameComboBox.addValueChangeListener(distsetTypeNameComboBoxListener);
}
/**
* Add new Distribution set.
*/
@@ -277,7 +222,7 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
final String distSetTypeName = HawkbitCommonUtil
.trimAndNullIfEmpty((String) distsetTypeNameComboBox.getValue());
if (mandatoryCheck(name, version, distSetTypeName) && duplicateCheck(name, version)) {
if (duplicateCheck(name, version)) {
final String desc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
final boolean isMigStepReq = reqMigStepCheckbox.getValue();
DistributionSet newDist = entityFactory.generateDistributionSet();
@@ -287,21 +232,11 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
notificationMessage.displaySuccess(i18n.get("message.new.dist.save.success",
new Object[] { newDist.getName(), newDist.getVersion() }));
/* close the window */
closeThisWindow();
eventBus.publish(this, new DistributionTableEvent(BaseEntityEventType.NEW_ENTITY, newDist));
}
}
/**
* Close window.
*/
private void closeThisWindow() {
addDistributionWindow.close();
UI.getCurrent().removeWindow(addDistributionWindow);
}
/**
* Set Values for Distribution set.
*
@@ -345,47 +280,6 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
}
}
/**
* Mandatory Check.
*
* @param name
* as String
* @param version
* as String
* @param selectedJVM
* as String
* @param selectedAgentHub
* as String
* @param selectedOs
* as String
* @return boolean as flag
*/
private boolean mandatoryCheck(final String name, final String version, final String distSetTypeName) {
if (name == null || version == null || distSetTypeName == null) {
if (name == null) {
distNameTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
}
if (version == null) {
distVersionTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
}
if (distSetTypeName == null) {
distsetTypeNameComboBox.addStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR);
}
notificationMessage.displayValidationError(i18n.get("message.mandatory.check"));
return false;
}
return true;
}
private void discardDistribution() {
/* Just close this window */
distsetTypeNameComboBox.removeValueChangeListener(distsetTypeNameComboBoxListener);
closeThisWindow();
}
/**
* clear all the fields.
*/
@@ -398,139 +292,52 @@ public class DistributionAddUpdateWindowLayout extends CustomComponent {
distsetTypeNameComboBox.removeStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR);
descTextArea.clear();
reqMigStepCheckbox.clear();
if (addDistributionWindow != null) {
addDistributionWindow.setSaveButtonEnabled(true);
}
removeListeners();
changedComponents.clear();
}
private void populateRequiredComponents() {
populateDistSetTypeNameCombo();
}
private void removeListeners() {
reqMigStepCheckbox.removeValueChangeListener(reqMigStepCheckboxListerner);
descTextArea.removeTextChangeListener(descTextAreaListener);
distNameTextField.removeTextChangeListener(distNameTextFieldListener);
distVersionTextField.removeTextChangeListener(distVersionTextFieldListener);
}
public void setOriginalDistName(final String originalDistName) {
this.originalDistName = originalDistName;
}
public void setOriginalDistVersion(final String originalDistVersion) {
this.originalDistVersion = originalDistVersion;
}
public void setOriginalDistDescription(final String originalDistDescription) {
this.originalDistDescription = originalDistDescription;
}
private void checkValueChanged(final String originalValue, final TextChangeEvent event) {
if (editDistribution) {
final String newValue = event.getText();
if (!originalValue.equalsIgnoreCase(newValue)) {
changedComponents.add(event.getComponent());
} else {
changedComponents.remove(event.getComponent());
}
enableDisableSaveButton();
}
}
private void checkValueChanged(final Boolean originalValue, final ValueChangeEvent event) {
if (editDistribution) {
if (!originalValue.equals(event.getProperty().getValue())) {
changedComponents.add(reqMigStepCheckbox);
} else {
changedComponents.remove(reqMigStepCheckbox);
}
enableDisableSaveButton();
}
}
private void checkValueChanged(final String originalValue, final ValueChangeEvent event) {
if (editDistribution) {
if (!originalValue.equals(event.getProperty().getValue())) {
changedComponents.add(distsetTypeNameComboBox);
} else {
changedComponents.remove(distsetTypeNameComboBox);
}
enableDisableSaveButton();
}
}
private void enableDisableSaveButton() {
if (changedComponents.isEmpty()) {
disableSaveButton();
} else {
enableSaveButton();
}
}
private void setOriginalReqMigStep(final Boolean originalReqMigStep) {
this.originalReqMigStep = originalReqMigStep;
}
/**
* populate data.
*
* @param editDistId
*/
public void populateValuesOfDistribution(final Long editDistId) {
private void populateValuesOfDistribution(final Long editDistId) {
this.editDistId = editDistId;
editDistribution = Boolean.TRUE;
addDistributionWindow.setSaveButtonEnabled(false);
if (editDistId == null) {
return;
}
final DistributionSet distSet = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId);
if (distSet != null) {
distNameTextField.setValue(distSet.getName());
distVersionTextField.setValue(distSet.getVersion());
if (distSet.getType().isDeleted()) {
distsetTypeNameComboBox.addItem(distSet.getType().getName());
}
distsetTypeNameComboBox.setValue(distSet.getType().getName());
reqMigStepCheckbox.setValue(distSet.isRequiredMigrationStep());
if (distSet.getDescription() != null) {
descTextArea.setValue(distSet.getDescription());
}
setOriginalDistName(distSet.getName());
setOriginalDistVersion(distSet.getVersion());
setOriginalDistDescription(distSet.getDescription());
setOriginalReqMigStep(distSet.isRequiredMigrationStep());
setOriginalDistSetTYpe(distSet.getType().getName());
addListeners();
if (distSet == null) {
return;
}
editDistribution = Boolean.TRUE;
distNameTextField.setValue(distSet.getName());
distVersionTextField.setValue(distSet.getVersion());
if (distSet.getType().isDeleted()) {
distsetTypeNameComboBox.addItem(distSet.getType().getName());
}
distsetTypeNameComboBox.setValue(distSet.getType().getName());
reqMigStepCheckbox.setValue(distSet.isRequiredMigrationStep());
if (distSet.getDescription() != null) {
descTextArea.setValue(distSet.getDescription());
}
}
public CommonDialogWindow getWindow() {
public CommonDialogWindow getWindow(final Long editDistId) {
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
populateRequiredComponents();
resetComponents();
addDistributionWindow = SPUIComponentProvider.getWindow(i18n.get("caption.add.new.dist"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveDistribution(), event -> discardDistribution(),
null);
addDistributionWindow.getButtonsLayout().removeStyleName("actionButtonsMargin");
return addDistributionWindow;
populateDistSetTypeNameCombo();
populateValuesOfDistribution(editDistId);
window = SPUIWindowDecorator.getWindow(i18n.get("caption.add.new.dist"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveDistribution(), null, null, formLayout, i18n);
window.getButtonsLayout().removeStyleName("actionButtonsMargin");
return window;
}
/**
* Populate DistributionSet Type name combo.
*/
public void populateDistSetTypeNameCombo() {
private void populateDistSetTypeNameCombo() {
distsetTypeNameComboBox.setContainerDataSource(getDistSetTypeLazyQueryContainer());
distsetTypeNameComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
distsetTypeNameComboBox.setValue(getDefaultDistributionSetType().getName());
}
/**
* @param originalDistSetTYpe
* the originalDistSetTYpe to set
*/
public void setOriginalDistSetTYpe(final String originalDistSetType) {
this.originalDistSetType = originalDistSetType;
}
}

View File

@@ -117,8 +117,7 @@ public class DistributionDetails extends AbstractNamedVersionedEntityTableDetail
@Override
protected void onEdit(final ClickEvent event) {
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
distributionAddUpdateWindowLayout.populateValuesOfDistribution(getSelectedBaseEntityId());
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(getSelectedBaseEntityId());
newDistWindow.setCaption(getI18n().get("caption.update.dist"));
UI.getCurrent().addWindow(newDistWindow);
newDistWindow.setVisible(Boolean.TRUE);

View File

@@ -154,7 +154,7 @@ public class DistributionTableHeader extends AbstractTableHeader {
@Override
protected void addNewItem(final ClickEvent event) {
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow();
final Window newDistWindow = distributionAddUpdateWindowLayout.getWindow(null);
newDistWindow.setCaption(i18n.get("caption.add.new.dist"));
UI.getCurrent().addWindow(newDistWindow);
newDistWindow.setVisible(Boolean.TRUE);

View File

@@ -32,9 +32,7 @@ import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.UI;
/**
*
* Class for Create/Update Tag Layout of distribution set
*
*/
@SpringComponent
@ViewScope
@@ -87,16 +85,13 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
*/
@Override
public void save(final ClickEvent event) {
if (mandatoryValuesPresent()) {
final DistributionSetTag existingDistTag = tagManagement.findDistributionSetTag(tagName.getValue());
if (optiongroup.getValue().equals(createTagStr)) {
if (!checkIsDuplicate(existingDistTag)) {
createNewTag();
}
} else {
updateExistingTag(existingDistTag);
final DistributionSetTag existingDistTag = tagManagement.findDistributionSetTag(tagName.getValue());
if (optiongroup.getValue().equals(createTagStr)) {
if (!checkIsDuplicate(existingDistTag)) {
createNewTag();
}
} else {
updateExistingTag(existingDistTag);
}
}
@@ -181,4 +176,9 @@ public class CreateUpdateDistributionTagLayoutWindow extends AbstractCreateUpdat
setOptionGroupDefaultValue(permChecker.hasCreateDistributionPermission(),
permChecker.hasUpdateDistributionPermission());
}
@Override
protected String getWindowCaption() {
return i18n.get("caption.add.tag");
}
}

View File

@@ -17,6 +17,7 @@ import javax.annotation.PostConstruct;
import org.eclipse.hawkbit.repository.model.Action.ActionType;
import org.eclipse.hawkbit.ui.utils.I18N;
import org.eclipse.hawkbit.ui.utils.SPDateTimeUtil;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.hene.flexibleoptiongroup.FlexibleOptionGroup;
import org.vaadin.hene.flexibleoptiongroup.FlexibleOptionGroupItemComponent;
@@ -78,6 +79,7 @@ public class ActionTypeOptionGroupLayout extends HorizontalLayout {
private void createOptionGroup() {
actionTypeOptionGroup = new FlexibleOptionGroup();
actionTypeOptionGroup.setId(SPUIComponentIdProvider.ROLLOUT_ACTION_BUTTON_ID);
actionTypeOptionGroup.addItem(ActionTypeOption.SOFT);
actionTypeOptionGroup.addItem(ActionTypeOption.FORCED);
actionTypeOptionGroup.addItem(ActionTypeOption.AUTO_FORCED);

View File

@@ -10,6 +10,8 @@ package org.eclipse.hawkbit.ui.management.tag;
import java.lang.reflect.Field;
import org.eclipse.hawkbit.ui.utils.SPUIComponentIdProvider;
import com.google.common.base.Throwables;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
@@ -44,7 +46,7 @@ public final class SpColorPickerPreview extends ColorPickerPreview implements Te
try {
final Field textField = ColorPickerPreview.class.getDeclaredField("field");
textField.setAccessible(true);
((TextField) textField.get(this)).setId("color-preview-field");
((TextField) textField.get(this)).setId(SPUIComponentIdProvider.COLOR_PREVIEW_FIELD);
((TextField) textField.get(this)).addTextChangeListener(this);
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e) {
Throwables.propagate(e);

View File

@@ -18,6 +18,7 @@ import org.eclipse.hawkbit.repository.model.TargetIdName;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.table.BaseEntityEventType;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
import org.eclipse.hawkbit.ui.management.event.DragEvent;
import org.eclipse.hawkbit.ui.management.event.TargetTableEvent;
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
@@ -31,30 +32,23 @@ import org.eclipse.hawkbit.ui.utils.UINotification;
import org.springframework.beans.factory.annotation.Autowired;
import org.vaadin.spring.events.EventBus;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeListener;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.VaadinSessionScope;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.FormLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
import com.vaadin.ui.themes.ValoTheme;
/**
* Add and Update Target.
*
*
*
*/
@SpringComponent
@VaadinSessionScope
public class TargetAddUpdateWindowLayout extends CustomComponent {
private static final long serialVersionUID = -6659290471705262389L;
@Autowired
private I18N i18n;
@@ -66,122 +60,61 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
@Autowired
private transient UINotification uINotification;
@Autowired
private transient EntityFactory entityFactory;
private TextField controllerIDTextField;
private TextField nameTextField;
private TextArea descTextArea;
private Label madatoryLabel;
private boolean editTarget = Boolean.FALSE;
private String controllerId;
private FormLayout formLayout;
private CommonDialogWindow window;
private String oldTargetName;
private String oldTargetDesc;
/**
* Initialize the Add Update Window Component for Target.
*/
public void init() {
/* create components */
createRequiredComponents();
/* display components in layout */
buildLayout();
/* register all listeners related to the Window */
addListeners();
setCompositionRoot(formLayout);
}
private void createRequiredComponents() {
/* Textfield for controller Id */
controllerIDTextField = SPUIComponentProvider.getTextField( i18n.get("prompt.target.id"), "", ValoTheme.TEXTFIELD_TINY, true, null,
i18n.get("prompt.target.id"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
controllerIDTextField = SPUIComponentProvider.getTextField(i18n.get("prompt.target.id"), "",
ValoTheme.TEXTFIELD_TINY, true, null, i18n.get("prompt.target.id"), true,
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
controllerIDTextField.setId(SPUIComponentIdProvider.TARGET_ADD_CONTROLLER_ID);
/* Textfield for target name */
nameTextField = SPUIComponentProvider.getTextField( i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY, false, null,
i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
nameTextField = SPUIComponentProvider.getTextField(i18n.get("textfield.name"), "", ValoTheme.TEXTFIELD_TINY,
false, null, i18n.get("textfield.name"), true, SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
nameTextField.setId(SPUIComponentIdProvider.TARGET_ADD_NAME);
/* Textarea for target description */
descTextArea = SPUIComponentProvider.getTextArea( i18n.get("textfield.description"), "text-area-style", ValoTheme.TEXTFIELD_TINY, false, null,
i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
descTextArea = SPUIComponentProvider.getTextArea(i18n.get("textfield.description"), "text-area-style",
ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"),
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
descTextArea.setId(SPUIComponentIdProvider.TARGET_ADD_DESC);
descTextArea.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
/* Label for mandatory symbol */
madatoryLabel = new Label(i18n.get("label.mandatory.field"));
madatoryLabel.setStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_SMALL);
}
private void buildLayout() {
/*
* The main layout of the window contains mandatory info, textboxes
* (controller Id, name & description) and action buttons layout
*/
setSizeUndefined();
formLayout = new FormLayout();
formLayout.addComponent(madatoryLabel);
formLayout.addComponent(controllerIDTextField);
formLayout.addComponent(nameTextField);
formLayout.addComponent(descTextArea);
if (Boolean.TRUE.equals(editTarget)) {
madatoryLabel.setVisible(Boolean.FALSE);
}
controllerIDTextField.focus();
}
private void addListeners() {
addTargetNameChangeListner();
addTargetDescChangeListner();
}
private void addTargetNameChangeListner() {
nameTextField.addTextChangeListener(new TextChangeListener() {
/**
*
*/
private static final long serialVersionUID = 1761855781481115921L;
@Override
public void textChange(final TextChangeEvent event) {
if (event.getText().equals(oldTargetName) && descTextArea.getValue().equals(oldTargetDesc)) {
window.setSaveButtonEnabled(false);
} else {
window.setSaveButtonEnabled(true);
}
}
});
}
private void addTargetDescChangeListner() {
descTextArea.addTextChangeListener(new TextChangeListener() {
/**
*
*/
private static final long serialVersionUID = 5770734934988115068L;
@Override
public void textChange(final TextChangeEvent event) {
if (event.getText().equals(oldTargetDesc) && nameTextField.getValue().equals(oldTargetName)) {
window.setSaveButtonEnabled(false);
} else {
window.setSaveButtonEnabled(true);
}
}
});
}
/**
* Update the Target if modified.
*/
@@ -199,10 +132,6 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
uINotification.displaySuccess(i18n.get("message.update.success", new Object[] { latestTarget.getName() }));
// publishing through event bus
eventBus.publish(this, new TargetTableEvent(BaseEntityEventType.UPDATED_ENTITY, latestTarget));
/* close the window */
closeThisWindow();
/* update details in table */
}
private void saveTargetListner() {
@@ -213,13 +142,9 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
}
}
private void discardTargetListner() {
closeThisWindow();
}
private void addNewTarget() {
final String newControlllerId = HawkbitCommonUtil.trimAndNullIfEmpty(controllerIDTextField.getValue());
if (mandatoryCheck(newControlllerId) && duplicateCheck(newControlllerId)) {
if (duplicateCheck(newControlllerId)) {
final String newName = HawkbitCommonUtil.trimAndNullIfEmpty(nameTextField.getValue());
final String newDesc = HawkbitCommonUtil.trimAndNullIfEmpty(descTextArea.getValue());
@@ -236,15 +161,20 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
/* display success msg */
uINotification.displaySuccess(i18n.get("message.save.success", new Object[] { newTarget.getName() }));
/* close the window */
closeThisWindow();
}
}
public Window getWindow() {
eventBus.publish(this, DragEvent.HIDE_DROP_HINT);
window = SPUIComponentProvider.getWindow(i18n.get("caption.add.new.target"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveTargetListner(), event -> discardTargetListner(), null);
window = SPUIWindowDecorator.getWindow(i18n.get("caption.add.new.target"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> saveTargetListner(), null, null, formLayout, i18n);
return window;
}
public Window getWindow(final String entityId) {
populateValuesOfTarget(entityId);
getWindow();
window.addStyleName("target-update-window");
return window;
}
@@ -254,39 +184,23 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
public void resetComponents() {
nameTextField.clear();
nameTextField.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
controllerIDTextField.setEnabled(true);
controllerIDTextField.setReadOnly(false);
controllerIDTextField.setEnabled(Boolean.TRUE);
controllerIDTextField.removeStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
controllerIDTextField.clear();
descTextArea.clear();
editTarget = Boolean.FALSE;
}
private void closeThisWindow() {
editTarget = Boolean.FALSE;
window.close();
UI.getCurrent().removeWindow(window);
}
private void setTargetValues(final Target target, final String name, final String description) {
target.setName(name == null ? target.getControllerId() : name);
target.setDescription(description);
}
private boolean mandatoryCheck(final String newControlllerId) {
if (newControlllerId == null) {
controllerIDTextField.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR);
uINotification.displayValidationError("Mandatory details are missing");
return false;
} else {
return true;
}
}
private boolean duplicateCheck(final String newControlllerId) {
final Target existingTarget = targetManagement.findTargetByControllerID(newControlllerId.trim());
if (existingTarget != null) {
uINotification.displayValidationError(i18n.get("message.target.duplicate.check"));
uINotification.displayValidationError(
i18n.get("message.target.duplicate.check", new Object[] { newControlllerId }));
return false;
} else {
return true;
@@ -296,22 +210,21 @@ public class TargetAddUpdateWindowLayout extends CustomComponent {
/**
* @param controllerId
*/
public void populateValuesOfTarget(final String controllerId) {
private void populateValuesOfTarget(final String controllerId) {
resetComponents();
this.controllerId = controllerId;
editTarget = Boolean.TRUE;
final Target target = targetManagement.findTargetByControllerID(controllerId);
controllerIDTextField.setValue(target.getControllerId());
controllerIDTextField.setReadOnly(Boolean.TRUE);
controllerIDTextField.setEnabled(Boolean.FALSE);
nameTextField.setValue(target.getName());
if (target.getDescription() != null) {
descTextArea.setValue(target.getDescription());
}
window.setSaveButtonEnabled(Boolean.FALSE);
}
oldTargetDesc = descTextArea.getValue();
oldTargetName = nameTextField.getValue();
window.addStyleName("target-update-window");
public FormLayout getFormLayout() {
return formLayout;
}
}

View File

@@ -44,7 +44,7 @@ import com.google.common.base.Strings;
public class TargetBeanQuery extends AbstractBeanQuery<ProxyTarget> {
private static final long serialVersionUID = -5645680058303167558L;
private Sort sort = new Sort(SPUIDefinitions.TARGET_TABLE_CREATE_AT_SORT_ORDER, "createdAt");
private Collection<TargetUpdateStatus> status = null;
private transient Collection<TargetUpdateStatus> status = null;
private String[] targetTags = null;
private Long distributionId = null;
private String searchText = null;

View File

@@ -106,8 +106,13 @@ public class TargetDetails extends AbstractTableDetailsLayout<Target> {
if (getSelectedBaseEntity() == null) {
return;
}
targetAddUpdateWindowLayout.getWindow(getSelectedBaseEntity().getControllerId());
// targetAddUpdateWindowLayout.populateValuesOfTarget(getSelectedBaseEntity().getControllerId());
openWindow();
}
private void openWindow() {
final Window newDistWindow = targetAddUpdateWindowLayout.getWindow();
targetAddUpdateWindowLayout.populateValuesOfTarget(getSelectedBaseEntity().getControllerId());
newDistWindow.setCaption(getI18n().get("caption.update.dist"));
UI.getCurrent().addWindow(newDistWindow);
newDistWindow.setVisible(Boolean.TRUE);

View File

@@ -102,15 +102,13 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
@Override
public void save(final ClickEvent event) {
if (mandatoryValuesPresent()) {
final TargetTag existingTag = tagManagement.findTargetTag(tagName.getValue());
if (optiongroup.getValue().equals(createTagStr)) {
if (!checkIsDuplicate(existingTag)) {
createNewTag();
}
} else {
updateExistingTag(existingTag);
final TargetTag existingTag = tagManagement.findTargetTag(tagName.getValue());
if (optiongroup.getValue().equals(createTagStr)) {
if (!checkIsDuplicate(existingTag)) {
createNewTag();
}
} else {
updateExistingTag(existingTag);
}
}
@@ -131,7 +129,6 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
}
newTargetTag = tagManagement.createTargetTag(newTargetTag);
displaySuccess(newTargetTag.getName());
closeWindow();
} else {
displayValidationError(i18n.get(MESSAGE_ERROR_MISSING_TAGNAME));
}
@@ -150,4 +147,9 @@ public class CreateUpdateTargetTagLayoutWindow extends AbstractCreateUpdateTagLa
setOptionGroupDefaultValue(permChecker.hasCreateTargetPermission(), permChecker.hasUpdateTargetPermission());
}
@Override
protected String getWindowCaption() {
return i18n.get("caption.add.tag");
}
}

View File

@@ -31,6 +31,7 @@ import org.eclipse.hawkbit.ui.UiProperties;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
import org.eclipse.hawkbit.ui.decorators.SPUIWindowDecorator;
import org.eclipse.hawkbit.ui.filtermanagement.TargetFilterBeanQuery;
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout;
import org.eclipse.hawkbit.ui.management.footer.ActionTypeOptionGroupLayout.ActionTypeOption;
@@ -56,8 +57,10 @@ import com.vaadin.data.Container;
import com.vaadin.data.Item;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.data.Validator;
import com.vaadin.data.util.converter.StringToIntegerConverter;
import com.vaadin.data.validator.IntegerRangeValidator;
import com.vaadin.data.validator.RegexpValidator;
import com.vaadin.data.validator.NullValidator;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.ComboBox;
@@ -66,13 +69,10 @@ import com.vaadin.ui.Label;
import com.vaadin.ui.OptionGroup;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.UI;
import com.vaadin.ui.themes.ValoTheme;
/**
*
* Rollout add or update popup layout.
*
*/
@SpringComponent
@ViewScope
@@ -86,8 +86,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private static final String MESSAGE_ENTER_NUMBER = "message.enter.number";
private static final String NUMBER_REGEXP = "[-]?[0-9]*\\.?,?[0-9]+";
@Autowired
private ActionTypeOptionGroupLayout actionTypeOptionGroupLayout;
@@ -115,8 +113,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
@Autowired
private transient EventBus.SessionEventBus eventBus;
private Label mandatoryLabel;
private TextField rolloutName;
private ComboBox distributionSet;
@@ -135,7 +131,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private OptionGroup errorThresholdOptionGroup;
private CommonDialogWindow addUpdateRolloutWindow;
private CommonDialogWindow window;
private Boolean editRolloutEnabled;
@@ -147,22 +143,28 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private TextArea targetFilterQuery;
private final NullValidator nullValidator = new NullValidator(null, false);
/**
* Create components and layout.
*/
public void init() {
setSizeUndefined();
createRequiredComponents();
buildLayout();
}
public CommonDialogWindow getWindow() {
public CommonDialogWindow getWindow(final Long rolloutId) {
window = getWindow();
populateData(rolloutId);
return window;
}
addUpdateRolloutWindow = SPUIComponentProvider.getWindow(i18n.get("caption.configure.rollout"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> onRolloutSave(), event -> onDiscard(),
uiProperties.getLinks().getDocumentation().getRolloutView());
return addUpdateRolloutWindow;
public CommonDialogWindow getWindow() {
resetComponents();
return SPUIWindowDecorator.getWindow(i18n.get("caption.configure.rollout"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> onRolloutSave(), null,
uiProperties.getLinks().getDocumentation().getRolloutView(), this, i18n);
}
/**
@@ -179,10 +181,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
setDefaultSaveStartGroupOption();
totalTargetsLabel.setVisible(false);
groupSizeLabel.setVisible(false);
removeComponent(targetFilterQuery);
if (getComponent(1, 3) == null) {
addComponent(targetFilterQueryCombo, 1, 3);
}
removeComponent(1, 2);
addComponent(targetFilterQueryCombo, 1, 2);
actionTypeOptionGroupLayout.selectDefaultOption();
totalTargetsCount = 0L;
rolloutForEdit = null;
@@ -206,37 +206,60 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
setSizeUndefined();
setRows(9);
setColumns(3);
setStyleName("marginTop");
addComponent(mandatoryLabel, 1, 0, 2, 0);
addComponent(getLabel("textfield.name"), 0, 1);
addComponent(rolloutName, 1, 1);
addComponent(getLabel("prompt.distribution.set"), 0, 2);
addComponent(distributionSet, 1, 2);
addComponent(getLabel("prompt.target.filter"), 0, 3);
addComponent(targetFilterQueryCombo, 1, 3);
addComponent(totalTargetsLabel, 2, 3);
addComponent(getLabel("prompt.number.of.groups"), 0, 4);
addComponent(noOfGroups, 1, 4);
addComponent(groupSizeLabel, 2, 4);
addComponent(getLabel("prompt.tigger.threshold"), 0, 5);
addComponent(triggerThreshold, 1, 5);
addComponent(getPercentHintLabel(), 2, 5);
addComponent(getLabel("prompt.error.threshold"), 0, 6);
addComponent(errorThreshold, 1, 6);
addComponent(errorThresholdOptionGroup, 2, 6);
addComponent(getLabel("textfield.description"), 0, 7);
addComponent(description, 1, 7, 2, 7);
addComponent(actionTypeOptionGroupLayout, 0, 8, 2, 8);
addComponent(getMandatoryLabel("textfield.name"), 0, 0);
addComponent(rolloutName, 1, 0);
rolloutName.addValidator(nullValidator);
addComponent(getMandatoryLabel("prompt.distribution.set"), 0, 1);
addComponent(distributionSet, 1, 1);
distributionSet.addValidator(nullValidator);
addComponent(getMandatoryLabel("prompt.target.filter"), 0, 2);
addComponent(targetFilterQueryCombo, 1, 2);
targetFilterQueryCombo.addValidator(nullValidator);
targetFilterQuery.removeValidator(nullValidator);
addComponent(totalTargetsLabel, 2, 2);
addComponent(getMandatoryLabel("prompt.number.of.groups"), 0, 3);
addComponent(noOfGroups, 1, 3);
noOfGroups.addValidator(nullValidator);
addComponent(groupSizeLabel, 2, 3);
addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 4);
addComponent(triggerThreshold, 1, 4);
triggerThreshold.addValidator(nullValidator);
addComponent(getPercentHintLabel(), 2, 4);
addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 5);
addComponent(errorThreshold, 1, 5);
errorThreshold.addValidator(nullValidator);
addComponent(errorThresholdOptionGroup, 2, 5);
addComponent(getLabel("textfield.description"), 0, 6);
addComponent(description, 1, 6, 2, 6);
addComponent(actionTypeOptionGroupLayout, 0, 7, 2, 7);
rolloutName.focus();
}
private Label getMandatoryLabel(final String key) {
final Label mandatoryLabel = getLabel(i18n.get(key));
mandatoryLabel.setContentMode(ContentMode.HTML);
mandatoryLabel.setValue(mandatoryLabel.getValue().concat(" <span style='color:#ed473b'>*</span>"));
return mandatoryLabel;
}
private Label getLabel(final String key) {
return SPUIComponentProvider.getLabel(i18n.get(key), SPUILabelDefinitions.SP_LABEL_SIMPLE);
}
private TextField getTextfield(final String key) {
return SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, true, null, i18n.get(key), true,
return SPUIComponentProvider.getTextField(null, "", ValoTheme.TEXTFIELD_TINY, false, null, i18n.get(key), true,
SPUILabelDefinitions.TEXT_FIELD_MAX_LENGTH);
}
@@ -248,7 +271,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void createRequiredComponents() {
mandatoryLabel = createMandatoryLabel();
rolloutName = createRolloutNameField();
distributionSet = createDistributionSetCombo();
populateDistributionSet();
@@ -258,7 +280,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
noOfGroups = createNoOfGroupsField();
groupSizeLabel = createGroupSizeLabel();
triggerThreshold = createTriggerThresold();
triggerThreshold = createTriggerThreshold();
errorThreshold = createErrorThreshold();
description = createDescription();
errorThresholdOptionGroup = createErrorThresholdOptionGroup();
@@ -307,11 +329,11 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
errorThresoldOptions.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
errorThresoldOptions.addStyleName(SPUIStyleDefinitions.ROLLOUT_OPTION_GROUP);
errorThresoldOptions.setSizeUndefined();
errorThresoldOptions.addValueChangeListener(this::onErrorThresoldOptionChange);
errorThresoldOptions.addValueChangeListener(this::listenerOnErrorThresoldOptionChange);
return errorThresoldOptions;
}
private void onErrorThresoldOptionChange(final ValueChangeEvent event) {
private void listenerOnErrorThresoldOptionChange(final ValueChangeEvent event) {
errorThreshold.clear();
errorThreshold.removeAllValidators();
if (event.getProperty().getValue().equals(ERRORTHRESOLDOPTIONS.COUNT.getValue())) {
@@ -324,17 +346,17 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private ComboBox createTargetFilterQueryCombo() {
final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL,
true, "", i18n.get("prompt.target.filter"));
false, "", i18n.get("prompt.target.filter"));
targetFilter.setImmediate(true);
targetFilter.setPageLength(7);
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
targetFilter.setId(SPUIComponentIdProvider.ROLLOUT_TARGET_FILTER_COMBO_ID);
targetFilter.setSizeUndefined();
targetFilter.addValueChangeListener(event -> onTargetFilterChange());
targetFilter.addValueChangeListener(this::onTargetFilterChange);
return targetFilter;
}
private void onTargetFilterChange() {
private void onTargetFilterChange(final ValueChangeEvent event) {
final String filterQueryString = getTargetFilterQuery();
if (!Strings.isNullOrEmpty(filterQueryString)) {
totalTargetsCount = targetManagement.countTargetByTargetFilterQuery(filterQueryString);
@@ -344,7 +366,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
totalTargetsCount = 0L;
totalTargetsLabel.setVisible(false);
}
onGroupNumberChange();
onGroupNumberChange(event);
}
private String getTotalTargetMessage() {
@@ -368,10 +390,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
targetFilterQF);
}
private void onDiscard() {
closeThisWindow();
}
private void onRolloutSave() {
if (editRolloutEnabled) {
editRollout();
@@ -381,7 +399,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void editRollout() {
if (mandatoryCheckForEdit() && validateFields() && duplicateCheckForEdit() && null != rolloutForEdit) {
if (duplicateCheckForEdit() && rolloutForEdit != null) {
rolloutForEdit.setName(rolloutName.getValue());
rolloutForEdit.setDescription(description.getValue());
final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue();
@@ -399,7 +417,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
final Rollout updatedRollout = rolloutManagement.updateRollout(rolloutForEdit);
uiNotification
.displaySuccess(i18n.get("message.update.success", new Object[] { updatedRollout.getName() }));
closeThisWindow();
eventBus.publish(this, RolloutEvent.UPDATE_ROLLOUT);
}
}
@@ -427,11 +444,10 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private void createRollout() {
if (mandatoryCheck() && validateFields() && duplicateCheck()) {
if (duplicateCheck()) {
final Rollout rolloutToCreate = saveRollout();
uiNotification.displaySuccess(i18n.get("message.save.success", new Object[] { rolloutToCreate.getName() }));
eventBus.publish(this, RolloutEvent.CREATE_ROLLOUT);
closeThisWindow();
}
}
@@ -488,48 +504,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
return true;
}
private void closeThisWindow() {
addUpdateRolloutWindow.close();
UI.getCurrent().removeWindow(addUpdateRolloutWindow);
}
private boolean mandatoryCheck() {
final DistributionSetIdName ds = getDistributionSetSelected();
final String targetFilter = (String) targetFilterQueryCombo.getValue();
final String triggerThresoldValue = triggerThreshold.getValue();
final String errorThresoldValue = errorThreshold.getValue();
if (hasNoNameOrTargetFilter(targetFilter) || ds == null
|| HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|| isThresholdValueMissing(triggerThresoldValue, errorThresoldValue)) {
uiNotification.displayValidationError(i18n.get("message.mandatory.check"));
return false;
}
return true;
}
private boolean mandatoryCheckForEdit() {
final DistributionSetIdName ds = getDistributionSetSelected();
final String targetFilter = targetFilterQuery.getValue();
final String triggerThresoldValue = triggerThreshold.getValue();
final String errorThresoldValue = errorThreshold.getValue();
if (hasNoNameOrTargetFilter(targetFilter) || ds == null
|| HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|| isThresholdValueMissing(triggerThresoldValue, errorThresoldValue)) {
uiNotification.displayValidationError(i18n.get("message.mandatory.check"));
return false;
}
return true;
}
private boolean hasNoNameOrTargetFilter(final String targetFilter) {
return getRolloutName() == null || targetFilter == null;
}
private boolean isThresholdValueMissing(final String triggerThresoldValue, final String errorThresoldValue) {
return HawkbitCommonUtil.trimAndNullIfEmpty(triggerThresoldValue) == null
|| HawkbitCommonUtil.trimAndNullIfEmpty(errorThresoldValue) == null;
}
private boolean duplicateCheck() {
if (rolloutManagement.findRolloutByName(getRolloutName()) != null) {
uiNotification.displayValidationError(
@@ -555,17 +529,23 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private TextField createErrorThreshold() {
final TextField errorField = getTextfield("prompt.error.threshold");
errorField.setNullRepresentation("");
errorField.addValidator(new ThresholdFieldValidator());
errorField.setConverter(new StringToIntegerConverter());
errorField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
errorField.setId(SPUIComponentIdProvider.ROLLOUT_ERROR_THRESOLD_ID);
errorField.setMaxLength(7);
errorField.setSizeUndefined();
return errorField;
}
private TextField createTriggerThresold() {
private TextField createTriggerThreshold() {
final TextField thresholdField = getTextfield("prompt.tigger.threshold");
thresholdField.setId(SPUIComponentIdProvider.ROLLOUT_TRIGGER_THRESOLD_ID);
thresholdField.setNullRepresentation("");
thresholdField.addValidator(new ThresholdFieldValidator());
thresholdField.setConverter(new StringToIntegerConverter());
thresholdField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
thresholdField.setSizeUndefined();
thresholdField.setMaxLength(3);
return thresholdField;
@@ -577,12 +557,15 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
noOfGroupsField.addValidator(new GroupNumberValidator());
noOfGroupsField.setSizeUndefined();
noOfGroupsField.setMaxLength(3);
noOfGroupsField.addValueChangeListener(evevt -> onGroupNumberChange());
noOfGroupsField.setConverter(new StringToIntegerConverter());
noOfGroupsField.setConversionError(i18n.get(MESSAGE_ENTER_NUMBER));
noOfGroupsField.addValueChangeListener(this::onGroupNumberChange);
noOfGroupsField.setNullRepresentation("");
return noOfGroupsField;
}
private void onGroupNumberChange() {
if (noOfGroups.isValid() && !Strings.isNullOrEmpty(noOfGroups.getValue())) {
private void onGroupNumberChange(final ValueChangeEvent event) {
if (event.getProperty().getValue() != null && noOfGroups.isValid()) {
groupSizeLabel.setValue(getTargetPerGroupMessage(String.valueOf(getGroupSize())));
groupSizeLabel.setVisible(true);
} else {
@@ -591,8 +574,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
private ComboBox createDistributionSetCombo() {
final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, true, "",
i18n.get("prompt.distribution.set"));
final ComboBox dsSet = SPUIComponentProvider.getComboBox(null, "", "", null, ValoTheme.COMBOBOX_SMALL, false,
"", i18n.get("prompt.distribution.set"));
dsSet.setImmediate(true);
dsSet.setPageLength(7);
dsSet.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
@@ -612,7 +595,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
return new LazyQueryContainer(
new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
distributionQF);
}
private TextField createRolloutNameField() {
@@ -622,44 +604,42 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
return rolloutNameField;
}
private Label createMandatoryLabel() {
final Label madatoryLbl = new Label(i18n.get("label.mandatory.field"));
madatoryLbl.addStyleName(SPUIStyleDefinitions.SP_TEXTFIELD_ERROR + " " + ValoTheme.LABEL_SMALL);
return madatoryLbl;
}
private String getRolloutName() {
return HawkbitCommonUtil.trimAndNullIfEmpty(rolloutName.getValue());
}
private DistributionSetIdName getDistributionSetSelected() {
return (DistributionSetIdName) distributionSet.getValue();
}
class ErrorThresoldOptionValidator implements Validator {
private static final long serialVersionUID = 9049939751976326550L;
@Override
public void validate(final Object value) {
try {
if (HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|| HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null) {
if (isNoOfGroupsOrTargetFilterEmpty()) {
uiNotification
.displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing"));
} else {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
final int groupSize = getGroupSize();
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0, groupSize)
.validate(Integer.valueOf(value.toString()));
if (value != null) {
final int groupSize = getGroupSize();
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, groupSize), 0,
groupSize).validate(Integer.valueOf(value.toString()));
}
}
}
// suppress the need of preserve original exception, will blow
// up the
// log and not necessary here
catch (@SuppressWarnings("squid:S1166") final InvalidValueException ex) {
LOG.error(ex.getMessage());
catch (final InvalidValueException ex) {
// we have to throw the exception here, otherwise the UI won't
// show the vaadin validation error!
throw ex;
}
}
private boolean isNoOfGroupsOrTargetFilterEmpty() {
return HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|| (HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null
&& targetFilterQuery.getValue() == null);
}
}
private int getGroupSize() {
@@ -672,15 +652,18 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
@Override
public void validate(final Object value) {
try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100)
.validate(Integer.valueOf(value.toString()));
if (value != null) {
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100)
.validate(Integer.valueOf(value.toString()));
}
}
// suppress the need of preserve original exception, will blow
// up the
// log and not necessary here
catch (@SuppressWarnings("squid:S1166") final InvalidValueException ex) {
LOG.error(ex.getMessage());
catch (final InvalidValueException ex) {
// we have to throw the exception here, otherwise the UI won't
// show the vaadin validation error!
throw ex;
}
}
}
@@ -691,15 +674,18 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
@Override
public void validate(final Object value) {
try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500)
.validate(Integer.valueOf(value.toString()));
if (value != null) {
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500)
.validate(Integer.valueOf(value.toString()));
}
}
// suppress the need of preserve original exception, will blow
// up the
// log and not necessary here
catch (@SuppressWarnings("squid:S1166") final InvalidValueException ex) {
LOG.error(ex.getMessage());
catch (final InvalidValueException ex) {
// we have to throw the exception here, otherwise the UI won't
// show the vaadin validation error!
throw ex;
}
}
}
@@ -711,15 +697,18 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
* @param rolloutId
* rollout id
*/
public void populateData(final Long rolloutId) {
resetComponents();
private void populateData(final Long rolloutId) {
if (rolloutId == null) {
return;
}
editRolloutEnabled = Boolean.TRUE;
rolloutForEdit = rolloutManagement.findRolloutById(rolloutId);
rolloutName.setValue(rolloutForEdit.getName());
description.setValue(rolloutForEdit.getDescription());
distributionSet.setValue(DistributionSetIdName.generate(rolloutForEdit.getDistributionSet()));
final List<RolloutGroup> rolloutGroups = rolloutForEdit.getRolloutGroups();
setThresoldValues(rolloutGroups);
setThresholdValues(rolloutGroups);
setActionType(rolloutForEdit);
if (rolloutForEdit.getStatus() != RolloutStatus.READY) {
disableRequiredFieldsOnEdit();
@@ -727,12 +716,16 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
noOfGroups.setEnabled(false);
targetFilterQuery.setValue(rolloutForEdit.getTargetFilterQuery());
removeComponent(targetFilterQueryCombo);
addComponent(targetFilterQuery, 1, 3);
removeComponent(1, 2);
targetFilterQueryCombo.removeValidator(nullValidator);
addComponent(targetFilterQuery, 1, 2);
targetFilterQuery.addValidator(nullValidator);
totalTargetsCount = targetManagement.countTargetByTargetFilterQuery(rolloutForEdit.getTargetFilterQuery());
totalTargetsLabel.setValue(getTotalTargetMessage());
totalTargetsLabel.setVisible(true);
window.setOrginaleValues();
}
private void disableRequiredFieldsOnEdit() {
@@ -771,8 +764,8 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
/**
* @param rolloutGroups
*/
private void setThresoldValues(final List<RolloutGroup> rolloutGroups) {
if (null != rolloutGroups && !rolloutGroups.isEmpty()) {
private void setThresholdValues(final List<RolloutGroup> rolloutGroups) {
if (rolloutGroups != null && !rolloutGroups.isEmpty()) {
errorThreshold.setValue(rolloutGroups.get(0).getErrorConditionExp());
triggerThreshold.setValue(rolloutGroups.get(0).getSuccessConditionExp());
noOfGroups.setValue(String.valueOf(rolloutGroups.size()));
@@ -798,7 +791,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
public String getValue() {
return value;
}
}
enum ERRORTHRESOLDOPTIONS {
@@ -816,6 +808,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
public String getValue() {
return value;
}
}
}

View File

@@ -28,6 +28,7 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.ui.common.CommonDialogWindow;
import org.eclipse.hawkbit.ui.common.grid.AbstractGrid;
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
import org.eclipse.hawkbit.ui.customrenderers.renderers.HtmlButtonRenderer;
@@ -62,14 +63,11 @@ import com.vaadin.server.FontAwesome;
import com.vaadin.spring.annotation.SpringComponent;
import com.vaadin.spring.annotation.ViewScope;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
import com.vaadin.ui.renderers.ClickableRenderer.RendererClickEvent;
import com.vaadin.ui.renderers.HtmlRenderer;
/**
*
* Rollout list grid component.
*
*/
@SpringComponent
@ViewScope
@@ -145,6 +143,7 @@ public class RolloutListGrid extends AbstractGrid {
final LazyQueryContainer rolloutContainer = (LazyQueryContainer) getContainerDataSource();
final Item item = rolloutContainer.getItem(rolloutChangeEvent.getRolloutId());
if (item == null) {
refreshGrid();
return;
}
item.getItemProperty(SPUILabelDefinitions.VAR_STATUS).setValue(rollout.getStatus());
@@ -159,7 +158,6 @@ public class RolloutListGrid extends AbstractGrid {
}
item.getItemProperty(ROLLOUT_RENDERER_DATA)
.setValue(new RolloutRendererData(rollout.getName(), rollout.getStatus().toString()));
}
@Override
@@ -200,7 +198,6 @@ public class RolloutListGrid extends AbstractGrid {
rolloutGridContainer.addContainerProperty(SPUILabelDefinitions.ACTION, String.class,
FontAwesome.CIRCLE_O.getHtml(), false, false);
}
@Override
@@ -292,7 +289,6 @@ public class RolloutListGrid extends AbstractGrid {
for (final Object propertyId : columnsToBeHidden) {
getColumn(propertyId).setHidden(true);
}
}
@Override
@@ -315,7 +311,6 @@ public class RolloutListGrid extends AbstractGrid {
final RolloutRenderer customObjectRenderer = new RolloutRenderer(RolloutRendererData.class);
customObjectRenderer.addClickListener(this::onClickOfRolloutName);
getColumn(ROLLOUT_RENDERER_DATA).setRenderer(customObjectRenderer);
}
private void createRolloutStatusToFontMap() {
@@ -437,8 +432,7 @@ public class RolloutListGrid extends AbstractGrid {
}
private void onUpdate(final ContextMenuData contextMenuData) {
addUpdateRolloutWindow.populateData(contextMenuData.getRolloutId());
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
final CommonDialogWindow addTargetWindow = addUpdateRolloutWindow.getWindow(contextMenuData.getRolloutId());
addTargetWindow.setCaption(i18n.get("caption.update.rollout"));
UI.getCurrent().addWindow(addTargetWindow);
addTargetWindow.setVisible(Boolean.TRUE);
@@ -684,7 +678,6 @@ public class RolloutListGrid extends AbstractGrid {
public Class<String> getPresentationType() {
return String.class;
}
}
}

View File

@@ -91,7 +91,6 @@ public class RolloutListHeader extends AbstractGridHeader {
@Override
protected void addNewItem(final ClickEvent event) {
addUpdateRolloutWindow.resetComponents();
final Window addTargetWindow = addUpdateRolloutWindow.getWindow();
UI.getCurrent().addWindow(addTargetWindow);
addTargetWindow.setVisible(Boolean.TRUE);

View File

@@ -176,6 +176,10 @@ public final class SPUIComponentIdProvider {
* ID - Dist jvm combo.
*/
public static final String DIST_MODULE_COMBO = "dist.module.combo.";
/**
* ID for Distribution Tag ComboBox
*/
public static final String DIST_TAG_COMBO = "dist.tag.combo";
/**
* ID-Dist.PIN.
*/
@@ -302,6 +306,22 @@ public final class SPUIComponentIdProvider {
* tag color preview button id.
*/
public static final String TAG_COLOR_PREVIEW_ID = "tag.color.preview";
/**
* Id for ColorPickerLayout
*/
public static final String COLOR_PICKER_LAYOUT = "color.picker.layout";
/**
* Id for ColorPickerLayout's red slider
*/
public static final String COLOR_PICKER_RED_SLIDER = "color.picker.red.slider";
/**
* Id for Color preview field with the color code
*/
public static final String COLOR_PREVIEW_FIELD = "color-preview-field";
/**
* Id for OptionGroup Create/Update tag
*/
public static final String OPTION_GROUP = "create.update.tag";
/**
* Confirmation dialogue OK button id.
*/
@@ -979,6 +999,11 @@ public final class SPUIComponentIdProvider {
*/
public static final String SW_METADATA_DETAIL_LINK = "softwaremodule.metadata.detail.link";
/**
* Table multiselect for selecting DistType
*/
public static final String SELECT_DIST_TYPE = "select-dist-type";
/**
* /* Private Constructor.
*/

View File

@@ -344,15 +344,6 @@ public final class SPUIDefinitions {
* New Target tag color lable id.
*/
public static final String NEW_TARGET_TAG_COLOR = "target.tag.add.color";
/**
* New Target tag save icon id.
*/
// public static final String NEW_TARGET_TAG_SAVE = "target.tag.add.save";
/**
* New Target tag discard icon id.
*/
// public static final String NEW_TARGET_TAG_DISRACD =
// "target.tag.add.discard";
/**
* New Target tag add icon id.
*/
@@ -1027,6 +1018,11 @@ public final class SPUIDefinitions {
*/
public static final String SOFTWAREMODULE_METADATA_TAB_ID = "swModule.metadata.tab.id";
/***
* Custom window for metadata.
*/
public static final String CUSTOM_METADATA_WINDOW = "custom.metadata.window";
/**
* /** Constructor.
*/

View File

@@ -53,4 +53,7 @@
font-size: 16px;
}
.marginTop {
margin-top: 20px !important;
}
}

View File

@@ -81,18 +81,18 @@ caption.delete.swmodule.accordion.tab = Delete SW Modules
caption.delete.dist.set.type.accordion.tab = Delete Distribution Set Type
caption.delete.sw.module.type.accordion.tab = Delete Software Module Type
caption.attributes = Attributes
caption.panel.dist.installed = Installed distribution set
caption.panel.dist.assigned = Assigned distribution set
caption.panel.dist.installed = Installed Distribution Set
caption.panel.dist.assigned = Assigned Distribution Set
caption.soft.delete.confirmbox = Confirm Software Module Delete Action
caption.cancel.action.confirmbox = Confirm action cancel
caption.cancel.action.confirmbox = Confirm Action Cancellation
caption.forcequit.action.confirmbox = Confirm force quit action
caption.forced.datefield = Force update at time
caption.force.action.confirmbox = Confirm Force Active Action
caption.confirm.abort.action = Confirm abort action
caption.confirm.abort.action = Confirm Abort Action
caption.filter.delete.confirmbox = Confirm Filter Delete Action
caption.metadata.popup = Metadata of
caption.metadata.delete.action.confirmbox = Confirm metadata delete action
caption.metadata.delete.action.confirmbox = Confirm Metadata Delete Action
# Labels prefix with - label
@@ -200,7 +200,7 @@ tooltip.timeforced.item=Soft update until a specific time and then the action wi
tooltip.check.for.mandatory=Check to make Mandatory
tooltip.artifact.icon=Show Artifact Details
tooltip.click.to.edit = Click to edit
tooltip.metadata.icon = Manage metadata
tooltip.metadata.icon = Manage Metadata
# Notification messages prefix with - message
message.save.success = {0} saved successfully
@@ -227,7 +227,7 @@ message.duplicate.softwaremodule = {0} : {1} already exists!
message.tag.delete = Please unclick the tag {0}, then try to delete
message.dist.type.check.delete = Please unclick the distribution type {0}, then try to delete
message.cannot.delete.default.dstype = Default distribution set type cannot be deleted
message.swmodule.type.check.delete = Please unclick the software module type {0}, then try to delete
message.swmodule.type.check.delete = Please unclick the Software Module type {0}, then try to delete
message.targets.already.deleted = Few Target(s) are already deleted.Pending for action
message.dists.already.deleted = Few distribution(s) are already deleted.Pending for action
message.target.deleted.pending = Target(s) already deleted.Pending for action
@@ -269,10 +269,10 @@ message.dists.assign.tag.alreadyassigned = Few of the DistributionSet's are alre
message.dists.tag.assigned = {0} DistributionSet's assigned to Tag {1}
message.dists.tag.unassigned = {0} DistributionSet's un-assigned from Tag {1}
message.dist.no.operation = {0} - already assigned/installed, No operation
message.sm.delete.confirm = Are you sure that you want to delete the selected {0} software module?
message.sm.delete.confirm = Are you sure that you want to delete the selected {0} Software Module?
message.error.os.softmodule = Please select the OS to delete
message.error.ah.softmodule = Please select the Application to delete
message.error.softmodule.deleted = The selected software module is already deleted
message.error.softmodule.deleted = The selected Software Module is already deleted
message.cancel.action = Cancel..
message.cancel.action.success = Action cancelled successfully !
message.cancel.action.failed = Unable to cancel the action !
@@ -291,7 +291,7 @@ message.action.not.allowed = Action not allowed
message.onlyone.distribution.assigned = Only one distribution set can be assigned
message.onlyone.distribution.dropallowed = Only one distribution set can be dropped
message.error.missing.typename = Missing Type Name
message.error.missing.typenameorkey = Missing Type Name or Key or software module type
message.error.missing.typenameorkey = Missing Type Name or Key or Software Module type
message.tag.cannot.be.assigned = Target/DS cannot be assigned to {0}
message.no.targets.assiged.fortag = No targets are assigned to tag {0}
message.error.missing.tagname = Please select tag name
@@ -321,12 +321,12 @@ soft.module.os =OS
#Artifact upload
message.error.noFileSelected = No file selected for upload
message.error.noProvidedName = Please provide custom file name
message.error.noSwModuleSelected = Please select a software module
message.error.noSwModuleSelected = Please select a Software Module
message.no.duplicateFiles = Duplicate files selected
message.no.duplicateFile = Duplicate file selected :
message.delete.artifact = Are you sure that you want to delete artifact {0} ?
message.duplicate.filename = Duplicate file name
message.swModule.deleted = {0} Software module(s) deleted
message.swModule.deleted = {0} Software Module(s) deleted
message.upload.failed = Streaming Failed
message.uploadedfile.size.exceeded = File size exceeded .Allowed size {0} bytes
message.uploadedfile.aborted = File upload aborted
@@ -336,7 +336,7 @@ message.abort.upload = Are you sure that you want to abort the upload?
upload.swModuleTable.header = Software module
upload.swModuleTable.header = Software Module
upload.selectedfile.name = file selected for upload
upload.file.name = File name
upload.sha1 = SHA1 checksum
@@ -354,7 +354,7 @@ upload.reason = Reason
upload.action = Action
upload.result.status = Upload status
upload.file = Upload File
upload.caption.update.swmodule = Update software module
upload.caption.update.swmodule = Update Software Module
caption.tab.details = Details
caption.tab.description = Description
@@ -370,8 +370,8 @@ label.no.tag.assigned = NO TAG
caption.assign.software.dist.accordion.tab = Assign Software Modules
message.software.assignment = {0} Software Module(s) Assignment(s) done
message.dist.inuse = {0} Distribution is already assigned to target
message.software.dist.already.assigned = {0} Distribution already has software module {1}
message.software.dist.type.notallowed = {0} Software module type can not assign to Distribution {1}
message.software.dist.already.assigned = {0} Distribution already has Software Module {1}
message.software.dist.type.notallowed = {0} Software Module type can not assign to Distribution {1}
message.target.assigned = {0} is assigned to {1}
message.dist.type.delete = {0} DistributionType(s) Deleted successfully.
message.sw.module.type.delete = {0} Software Module Type(s) deleted successfully.
@@ -461,7 +461,7 @@ header.caption.mandatory = Mandatory
header.caption.typename = SoftwareModuleType
header.caption.softwaremodule = SoftwareModule
header.caption.unassign = Unassign
message.sw.unassigned = Software module {0} successfully unassigned
message.sw.unassigned = Software Module {0} successfully unassigned
header.caption.upload.details = Upload details
combo.type.tag.name = Type tag name
@@ -484,10 +484,10 @@ rollout.group.label.target.truncated = {0} targets has been truncated in the lis
prompt.number.of.groups = Number of groups
prompt.tigger.threshold = Trigger threshold
prompt.error.threshold = Error threshold
prompt.distribution.set = Distribution set
caption.configure.rollout = Configure rollout
caption.update.rollout = Update rollout
prompt.target.filter = Custom target filter
prompt.distribution.set = Distribution Set
caption.configure.rollout = Configure Rollout
caption.update.rollout = Update Rollout
prompt.target.filter = Custom Target Filter
message.rollout.nonzero.group.number = Number of groups must be greater than zero
message.rollout.max.group.number = Number of groups must not be greater than 500
message.rollout.duplicate.check = Rollout [ {0} ] must be unique, entered value already exists.
@@ -501,8 +501,8 @@ message.rollout.noofgroups.or.targetfilter.missing = Please enter number of grou
message.rollouts = Rollouts
label.target.per.group = Targets per group :
message.dist.already.assigned = Distribution {0} is already assigned to target
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
message.error.creating.rollout = Server error. Error creating Rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting Rollout. Please contact the administrator
#rollout - end
#Menu

View File

@@ -80,19 +80,19 @@ caption.delete.swmodule.accordion.tab = Delete SW Modules
caption.delete.dist.set.type.accordion.tab = Delete Distribution Set Type
caption.delete.sw.module.type.accordion.tab = Delete Software Module Type
caption.attributes = Attributes
caption.panel.dist.installed = Installed distribution set
caption.panel.dist.assigned = Assigned distribution set
caption.panel.dist.installed = Installed Distribution Set
caption.panel.dist.assigned = Assigned Distribution Set
caption.soft.delete.confirmbox = Confirm Software Module Delete Action
caption.cancel.action.confirmbox = Confirm action cancellation
caption.cancel.action.confirmbox = Confirm Action Cancellation
caption.forced.datefield = Force update at time
caption.force.action.confirmbox = Confirm Force Active Action
caption.filter.simple = Simple Filter
caption.filter.custom = Custom Filter
caption.filter.delete.confirmbox = Confirm Filter Delete Action
caption.confirm.abort.action = Confirm abort action
caption.confirm.abort.action = Confirm Abort Action
caption.metadata.popup = Metadata of
caption.metadata.delete.action.confirmbox = Confirm metadata delete action
caption.metadata.delete.action.confirmbox = Confirm Metadata Delete Action
# Labels prefix with - label
label.dist.details.type = Type :
@@ -198,7 +198,7 @@ tooltip.timeforced.item=Soft update until a specific time and then the action wi
tooltip.check.for.mandatory=Check to make Mandatory
tooltip.artifact.icon=Show Artifact Details
tooltip.click.to.edit = Click to edit
tooltip.metadata.icon = Manage metadata
tooltip.metadata.icon = Manage Metadata
# Notification messages prefix with - message
@@ -221,13 +221,13 @@ message.target.unassigned.one = {0} is unassigned from {1}
message.target.unassigned.many = {0} Targets are unassigned from {1}
message.target.assigned.pending = Some target(s) are already assigned.Pending for action
message.cannot.delete = Cannot be deleted
message.check.softwaremodule = Please provide both name and verion!
message.check.softwaremodule = Please provide both name and version!
message.cannot.delete.default.dstype = Default distribution set type cannot be deleted
message.duplicate.softwaremodule = {0} : {1} already exists!
message.cannot.delete.default.dstype = Default distribution set type cannot be deleted
message.tag.delete = Please unclick the tag {0}, then try to delete
message.dist.type.check.delete = Please unclick the distribution type {0}, then try to delete
message.swmodule.type.check.delete = Please unclick the software module type {0}, then try to delete
message.swmodule.type.check.delete = Please unclick the Software Module type {0}, then try to delete
message.targets.already.deleted = Few Target(s) are already deleted.Pending for action
message.dists.already.deleted = Few distribution(s) are already deleted.Pending for action
message.target.deleted.pending = Target(s) already deleted.Pending for action
@@ -250,7 +250,7 @@ message.accessdenied.view = No access to view: {0}
message.no.data = No data available
message.target.assignment = {0} Assignment(s) done
message.target.deleted = {0} Target(s) deleted
message.dist.deleted = {0} Distribution set(s) deleted
message.dist.deleted = {0} Distribution Set(s) deleted
message.tag.update.mandatory = Please select the Tag to update
message.tag.duplicate.check = {0} already exists, please enter another value
message.type.key.duplicate.check = Distribution type with key {0} already exists, please give another value
@@ -269,10 +269,10 @@ message.dists.assign.tag.alreadyassigned = Few of the DistributionSet's are alre
message.dists.tag.assigned = {0} DistributionSet's assigned to Tag {1}
message.dists.tag.unassigned = {0} DistributionSet's un-assigned from Tag {1}
message.dist.no.operation = {0} - already assigned/installed, No operation
message.sm.delete.confirm = Are you sure that you want to delete the selected {0} software module?
message.sm.delete.confirm = Are you sure that you want to delete the selected {0} Software Module?
message.error.os.softmodule = Please select the OS to delete
message.error.ah.softmodule = Please select the Application to delete
message.error.softmodule.deleted = The selected software module is already deleted
message.error.softmodule.deleted = The selected Software Module is already deleted
message.cancel.action = Cancel
message.cancel.action.success = Action cancelled successfully !
message.cancel.action.failed = Unable to cancel the action !
@@ -314,12 +314,12 @@ soft.module.os =OS
#Artifact upload
message.error.noFileSelected = No file selected for upload
message.error.noProvidedName = Please provide custom file name
message.error.noSwModuleSelected = Please select a software module
message.error.noSwModuleSelected = Please select a Software Module
message.no.duplicateFiles = Duplicate files selected
message.no.duplicateFile = Duplicate file selected :
message.delete.artifact = Are you sure that you want to delete artifact {0} ?
message.duplicate.filename = Duplicate file name
message.swModule.deleted = {0} Software module(s) deleted
message.swModule.deleted = {0} Software Module(s) deleted
message.error.missing.tagname = Please select tag name
message.upload.failed = Streaming Failed
message.uploadedfile.size.exceeded = File size exceeded .Allowed size {0} bytes
@@ -330,7 +330,7 @@ message.abort.upload = Are you sure that you want to abort the upload?
upload.swModuleTable.header = Software module
upload.swModuleTable.header = Software Module
upload.selectedfile.name = file selected for upload
upload.file.name = File name
upload.sha1 = SHA1 checksum
@@ -348,7 +348,7 @@ upload.reason = Reason
upload.action = Action
upload.result.status = Upload status
upload.file = Upload File
upload.caption.update.swmodule = Update software module
upload.caption.update.swmodule = Update Software Module
caption.tab.details = Details
caption.tab.description = Description
@@ -359,8 +359,8 @@ label.drop.dist.delete.area = Drop here<br>to delete
caption.assign.software.dist.accordion.tab = Assign Software Modules
message.software.assignment = {0} Assignment(s) done
message.dist.inuse = {0} Distribution is already assigned to target
message.software.dist.already.assigned = {0} Distribution already has software module {1}
message.software.dist.type.notallowed = {0} Software module type can not assign to Distribution {1}
message.software.dist.already.assigned = {0} Distribution already has Software Module {1}
message.software.dist.type.notallowed = {0} Software Module type can not assign to Distribution {1}
message.target.assigned = {0} is assigned to {1}
message.dist.type.delete = {0} DistributionType(s) Deleted successfully.
message.sw.module.type.delete = {0} Software Module Type(s) deleted successfully.
@@ -447,13 +447,13 @@ header.rolloutgroup.target.message = Messages
rollout.group.label.target.truncated = {0} targets has been truncated in the list due the target size limit of {1}
distribution.details.header = Distribution set
distribution.details.header = Distribution Set
target.details.header = Target
header.caption.mandatory = Mandatory
header.caption.typename = SoftwareModuleType
header.caption.softwaremodule = SoftwareModule
header.caption.unassign = Unassign
message.sw.unassigned = Software module {0} successfully unassigned
message.sw.unassigned = Software Module {0} successfully unassigned
header.caption.upload.details = Upload details
header.key = Key
header.value = Value
@@ -471,10 +471,10 @@ menu.title = Software Provisioning
prompt.number.of.groups = Number of groups
prompt.tigger.threshold = Trigger threshold
prompt.error.threshold = Error threshold
prompt.distribution.set = Distribution set
caption.configure.rollout = Configure rollout
caption.update.rollout = Update rollout
prompt.target.filter = Custom target filter
prompt.distribution.set = Distribution Set
caption.configure.rollout = Configure Rollout
caption.update.rollout = Update Rollout
prompt.target.filter = Custom Target Filter
message.rollout.nonzero.group.number = Number of groups must be greater than zero
message.rollout.max.group.number = Number of groups must not be greater than 500
message.rollout.duplicate.check = Rollout [ {0} ] must be unique, entered value already exists.
@@ -488,8 +488,8 @@ message.rollout.noofgroups.or.targetfilter.missing = Please enter number of grou
message.rollouts = Rollouts
label.target.per.group = Targets per group :
message.dist.already.assigned = Distribution {0} is already assigned to target
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
message.error.creating.rollout = Server error. Error creating Rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting Rollout. Please contact the administrator
#Target Filter Management
breadcrumb.target.filter.custom.filters = Custom Filters

View File

@@ -81,17 +81,17 @@ caption.delete.swmodule.accordion.tab = Delete SW Modules
caption.delete.dist.set.type.accordion.tab = Delete Distribution Set Type
caption.delete.sw.module.type.accordion.tab = Delete Software Module Type
caption.attributes = Attributes
caption.panel.dist.installed = Installed distribution set
caption.panel.dist.assigned = Assigned distribution set
caption.panel.dist.installed = Installed Distribution Set
caption.panel.dist.assigned = Assigned Distribution Set
caption.soft.delete.confirmbox = Confirm Software Module Delete Action
caption.cancel.action.confirmbox = Confirm action cancellation
caption.cancel.action.confirmbox = Confirm Action Cancellation
caption.forced.datefield = Force update at time
caption.force.action.confirmbox = Confirm Force Active Action
caption.filter.delete.confirmbox = Confirm Filter Delete Action
caption.metadata.popup = Metadata of
caption.metadata.delete.action.confirmbox = Confirm metadata delete action
caption.metadata.delete.action.confirmbox = Confirm Metadata Delete Action
caption.confirm.abort.action = Confirm abort action
caption.confirm.abort.action = Confirm Abort Action
# Labels prefix with - label
label.dist.details.type = Type :
@@ -198,7 +198,7 @@ tooltip.timeforced.item=Soft update until a specific time and then the action wi
tooltip.check.for.mandatory=Check to make Mandatory
tooltip.artifact.icon=Show Artifact Details
tooltip.click.to.edit = Click to edit
tooltip.metadata.icon = Manage metadata
tooltip.metadata.icon = Manage Metadata
# Notification messages prefix with - message
@@ -221,11 +221,11 @@ message.target.unassigned.one = {0} is unassigned from {1}
message.target.unassigned.many = {0} Targets are unassigned from {1}
message.target.assigned.pending = Some target(s) are already assigned.Pending for action
message.cannot.delete = Cannot be deleted
message.check.softwaremodule = Please provide both name and verion!
message.check.softwaremodule = Please provide both name and version!
message.duplicate.softwaremodule = {0} : {1} already exists!
message.tag.delete = Please unclick the tag {0}, then try to delete
message.dist.type.check.delete = Please unclick the distribution type {0}, then try to delete
message.swmodule.type.check.delete = Please unclick the software module type {0}, then try to delete
message.swmodule.type.check.delete = Please unclick the Software Module type {0}, then try to delete
message.targets.already.deleted = Few Target(s) are already deleted.Pending for action
message.dists.already.deleted = Few distribution(s) are already deleted.Pending for action
message.target.deleted.pending = Target(s) already deleted.Pending for action
@@ -267,10 +267,10 @@ message.dists.assign.tag.alreadyassigned = Few of the DistributionSet's are alre
message.dists.tag.assigned = {0} DistributionSet's assigned to Tag {1}
message.dists.tag.unassigned = {0} DistributionSet's un-assigned from Tag {1}
message.dist.no.operation = {0} - already assigned/installed, No operation
message.sm.delete.confirm = Are you sure that you want to delete the selected {0} software module?
message.sm.delete.confirm = Are you sure that you want to delete the selected {0} Software Module?
message.error.os.softmodule = Please select the OS to delete
message.error.ah.softmodule = Please select the Application to delete
message.error.softmodule.deleted = The selected software module is already deleted
message.error.softmodule.deleted = The selected Software Module is already deleted
message.cancel.action = Cancel
message.cancel.action.success = Action cancelled successfully !
message.cancel.action.failed = Unable to cancel the action !
@@ -285,7 +285,7 @@ message.action.not.allowed = Action not allowed
message.onlyone.distribution.assigned = Only one distribution set can be assigned
message.onlyone.distribution.dropallowed = Only one distribution set can be dropped
message.error.missing.typename = Missing Type Name
message.error.missing.typenameorkey = Missing Type Name or Key or software module type
message.error.missing.typenameorkey = Missing Type Name or Key or Software Module type
message.tag.cannot.be.assigned = Target/DS cannot be assigned to {0}
message.no.targets.assiged.fortag = No targets are assigned to tag {0}
message.error.missing.tagname = Please select tag name
@@ -313,12 +313,12 @@ soft.module.os =OS
#Artifact upload
message.error.noFileSelected = No file selected for upload
message.error.noProvidedName = Please provide custom file name
message.error.noSwModuleSelected = Please select a software module
message.error.noSwModuleSelected = Please select a Software Module
message.no.duplicateFiles = Duplicate files selected
message.no.duplicateFile = Duplicate file selected :
message.delete.artifact = Are you sure that you want to delete artifact {0} ?
message.duplicate.filename = Duplicate file name
message.swModule.deleted = {0} Software module(s) deleted
message.swModule.deleted = {0} Software Module(s) deleted
message.upload.failed = Streaming Failed
message.uploadedfile.size.exceeded = File size exceeded .Allowed size {0} bytes
message.uploadedfile.aborted = File upload aborted
@@ -326,7 +326,7 @@ message.file.not.found = File not found
message.abort.upload = Are you sure that you want to abort the upload?
upload.swModuleTable.header = Software module
upload.swModuleTable.header = Software Module
upload.selectedfile.name = file selected for upload
upload.file.name = File name
upload.sha1 = SHA1 checksum
@@ -344,7 +344,7 @@ upload.reason = Reason
upload.action = Action
upload.result.status = Upload status
upload.file = Upload File
upload.caption.update.swmodule = Update software module
upload.caption.update.swmodule = Update Software Module
caption.tab.details = Details
caption.tab.description = Description
@@ -356,8 +356,8 @@ label.drop.dist.delete.area = Drop here<br>to delete
caption.assign.software.dist.accordion.tab = Assign Software Modules
message.software.assignment = {0} Software Module(s) Assignment(s) done
message.dist.inuse = {0} Distribution is already assigned to target
message.software.dist.already.assigned = {0} Distribution already has software module {1}
message.software.dist.type.notallowed = {0} Software module type can not assign to Distribution {1}
message.software.dist.already.assigned = {0} Distribution already has Software Module {1}
message.software.dist.type.notallowed = {0} Software Module type can not assign to Distribution {1}
message.target.assigned = {0} is assigned to {1}
message.dist.type.delete = {0} DistributionType(s) Deleted successfully.
message.sw.module.type.delete = {0} Software Module Type(s) deleted successfully.
@@ -430,7 +430,7 @@ header.assigned.ds = Assigned DS
header.installed.ds = Installed DS
header.status = Status
header.target.tags = Tags
header.distributionset = Distribution set
header.distributionset = Distribution Set
header.numberofgroups = No. of groups
header.detail.status = Detail status
header.total.targets = Total targets
@@ -444,7 +444,7 @@ header.rolloutgroup.target.message = Messages
rollout.group.label.target.truncated = {0} targets has been truncated in the list due the target size limit of {1}
distribution.details.header = Distribution set
distribution.details.header = Distribution Set
target.details.header = Target
header.caption.mandatory = Mandatory
header.caption.typename = SoftwareModuleType
@@ -465,10 +465,10 @@ menu.title = Software Provisioning
prompt.number.of.groups = Number of groups
prompt.tigger.threshold = Trigger threshold
prompt.error.threshold = Error threshold
prompt.distribution.set = Distribution set
caption.configure.rollout = Configure rollout
caption.update.rollout = Update rollout
prompt.target.filter = Custom target filter
prompt.distribution.set = Distribution Set
caption.configure.rollout = Configure Rollout
caption.update.rollout = Update Rollout
prompt.target.filter = Custom Target Filter
message.rollout.nonzero.group.number = Number of groups must be greater than zero
message.rollout.max.group.number = Number of groups must not be greater than 500
message.rollout.duplicate.check = Rollout [ {0} ] must be unique, entered value already exists.
@@ -482,8 +482,8 @@ message.rollout.noofgroups.or.targetfilter.missing = Please enter number of grou
message.rollouts = Rollouts
label.target.per.group = Targets per group :
message.dist.already.assigned = Distribution {0} is already assigned to target
message.error.creating.rollout = Server error. Error creating rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting rollout. Please contact the administrator
message.error.creating.rollout = Server error. Error creating Rollout. Please contact the administrator
message.error.starting.rollout = Server error. Error starting Rollout. Please contact the administrator
#Target Filter Management
breadcrumb.target.filter.custom.filters = Custom Filters