Add require textfielder to rollouts and remove colorpicker

Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
SirWayne
2016-06-28 15:02:36 +02:00
parent ad4c89e8a0
commit 4fdeb1661a
4 changed files with 18 additions and 102 deletions

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,7 +32,6 @@ 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;
@@ -266,37 +263,6 @@ public class CreateUpdateSoftwareTypeLayout extends CreateUpdateTypeLayout
}
/**
* 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
public void addColorChangeListener(final ColorChangeListener listener) {
LOG.debug("inside addColorChangeListener");

View File

@@ -219,7 +219,7 @@ public class CommonDialogWindow extends Window implements Serializable {
if (String.class.equals(field.getType())) {
orginalValue = Strings.emptyToNull((String) orginalValue);
currentValue = Strings.emptyToNull((String) orginalValue);
currentValue = Strings.emptyToNull((String) currentValue);
}
if (!Objects.equals(orginalValue, currentValue)) {
return true;

View File

@@ -654,33 +654,6 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
return requiredFields;
}
@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);
}
tagPreviewBtnClicked = !tagPreviewBtnClicked;
}
@Override
protected void createOptionGroup(final boolean hasCreatePermission, final boolean hasUpdatePermission) {
@@ -688,14 +661,5 @@ public class CreateUpdateDistSetTypeLayout extends CreateUpdateTypeLayout
optiongroup.setId(SPUIDefinitions.CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID);
}
// @Override
// public String getOriginalTypeKey() {
// return originalTypeKey;
// }
//
// @Override
// public void setOriginalTypeKey(final String originalTypeKey) {
// this.originalTypeKey = originalTypeKey;
// }
}

View File

@@ -146,22 +146,6 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
private TextArea targetFilterQuery;
private String originalDistributionSet;
private Object originalActionGroup;
private String originalRolloutName;
private String originalErrorThreshold;
private String originalTriggerThreshold;
private String originalDescription;
private String originalTargetFilterQueryCombo;
private String originalNoOfGroups;
/**
* Create components and layout.
*/
@@ -172,7 +156,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
}
public CommonDialogWindow getWindow() {
resetComponents();
window = SPUIWindowDecorator.getWindow(i18n.get("caption.configure.rollout"), null,
SPUIDefinitions.CREATE_UPDATE_WINDOW, this, event -> onRolloutSave(), event -> onDiscard(),
uiProperties.getLinks().getDocumentation().getRolloutView(), this, i18n);
@@ -222,20 +206,35 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
addComponent(getMandatoryLabel("textfield.name"), 0, 0);
addComponent(rolloutName, 1, 0);
rolloutName.setRequired(true);
addComponent(getMandatoryLabel("prompt.distribution.set"), 0, 1);
addComponent(distributionSet, 1, 1);
distributionSet.setRequired(true);
addComponent(getMandatoryLabel("prompt.target.filter"), 0, 2);
addComponent(targetFilterQueryCombo, 1, 2);
targetFilterQueryCombo.setRequired(true);
addComponent(totalTargetsLabel, 2, 2);
addComponent(getMandatoryLabel("prompt.number.of.groups"), 0, 3);
addComponent(noOfGroups, 1, 3);
noOfGroups.setRequired(true);
addComponent(groupSizeLabel, 2, 3);
addComponent(getMandatoryLabel("prompt.tigger.threshold"), 0, 4);
addComponent(triggerThreshold, 1, 4);
triggerThreshold.setRequired(true);
addComponent(getPercentHintLabel(), 2, 4);
addComponent(getMandatoryLabel("prompt.error.threshold"), 0, 5);
addComponent(errorThreshold, 1, 5);
errorThreshold.setRequired(true);
addComponent(errorThresholdOptionGroup, 2, 5);
addComponent(getLabel("textfield.description"), 0, 6);
addComponent(description, 1, 6, 2, 6);
addComponent(actionTypeOptionGroupLayout, 0, 7, 2, 7);
@@ -752,20 +751,7 @@ public class AddUpdateRolloutWindowLayout extends GridLayout {
totalTargetsLabel.setValue(getTotalTargetMessage());
totalTargetsLabel.setVisible(true);
setOriginalValues();
}
private void setOriginalValues() {
originalDistributionSet = distributionSet.getValue().toString();
originalActionGroup = actionTypeOptionGroupLayout.getActionTypeOptionGroup().getValue();
originalRolloutName = rolloutName.getValue();
originalTriggerThreshold = triggerThreshold.getValue();
originalErrorThreshold = errorThreshold.getValue();
originalDescription = description.getValue();
originalNoOfGroups = noOfGroups.getValue();
if (targetFilterQueryCombo.getValue() != null) {
originalTargetFilterQueryCombo = targetFilterQueryCombo.getValue().toString();
}
window.setOrginaleValues();
}
private void disableRequiredFieldsOnEdit() {