Gilad Chaplik has uploaded a new change for review. Change subject: webadmin: error in custom properties sheet ......................................................................
webadmin: error in custom properties sheet current custom properties sheet doesn't handle cases where no properties stored in DB. Change-Id: Ia939952c367b6416ed90bb295f1485ce4ac63368 Bug-Url: https://bugzilla.redhat.com/924201 Signed-off-by: Gilad Chaplik <gchap...@redhat.com> --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java 3 files changed, 32 insertions(+), 21 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/04/13304/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java index c348672..bcf7a2e 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/pools/PoolListModel.java @@ -19,11 +19,11 @@ import org.ovirt.engine.core.common.businessentities.VDSGroup; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VmOsType; +import org.ovirt.engine.core.common.businessentities.VmPool; import org.ovirt.engine.core.common.businessentities.VmPoolType; import org.ovirt.engine.core.common.businessentities.VmTemplate; import org.ovirt.engine.core.common.businessentities.VmType; import org.ovirt.engine.core.common.businessentities.storage_pool; -import org.ovirt.engine.core.common.businessentities.VmPool; import org.ovirt.engine.core.common.interfaces.SearchType; import org.ovirt.engine.core.common.mode.ApplicationMode; import org.ovirt.engine.core.common.queries.GetVmdataByPoolIdParameters; @@ -74,6 +74,7 @@ private UICommand privateEditCommand; + @Override public UICommand getEditCommand() { return privateEditCommand; @@ -147,19 +148,21 @@ new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { - PoolListModel model = (PoolListModel) target; - if (returnValue != null) - { + if (returnValue != null) { model.setCustomPropertiesKeysList(new HashMap<Version, ArrayList<String>>()); HashMap<Version, String> dictionary = (HashMap<Version, String>) returnValue; - for (Map.Entry<Version, String> keyValuePair : dictionary.entrySet()) - { - model.getCustomPropertiesKeysList().put(keyValuePair.getKey(), - new ArrayList<String>()); - for (String s : keyValuePair.getValue().split("[;]", -1)) //$NON-NLS-1$ - { - model.getCustomPropertiesKeysList().get(keyValuePair.getKey()).add(s); + for (Map.Entry<Version, String> keyValuePair : dictionary.entrySet()) { + String[] split = keyValuePair.getValue().split("[;]", -1); //$NON-NLS-1$ + if (split.length == 1 && (split[0] == null || split[0].isEmpty())) { + model.getCustomPropertiesKeysList().put(keyValuePair.getKey(), + null); + } else { + model.getCustomPropertiesKeysList().put(keyValuePair.getKey(), + new ArrayList<String>()); + for (String s : split) { + model.getCustomPropertiesKeysList().get(keyValuePair.getKey()).add(s); + } } } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java index eec3413..3773652 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmListModel.java @@ -496,19 +496,21 @@ new INewAsyncCallback() { @Override public void OnSuccess(Object target, Object returnValue) { - VmListModel model = (VmListModel) target; - if (returnValue != null) - { + if (returnValue != null) { model.setCustomPropertiesKeysList(new HashMap<Version, ArrayList<String>>()); HashMap<Version, String> dictionary = (HashMap<Version, String>) returnValue; - for (Map.Entry<Version, String> keyValuePair : dictionary.entrySet()) - { - model.getCustomPropertiesKeysList().put(keyValuePair.getKey(), - new ArrayList<String>()); - for (String s : keyValuePair.getValue().split("[;]", -1)) //$NON-NLS-1$ - { - model.getCustomPropertiesKeysList().get(keyValuePair.getKey()).add(s); + for (Map.Entry<Version, String> keyValuePair : dictionary.entrySet()) { + String[] split = keyValuePair.getValue().split("[;]", -1); //$NON-NLS-1$ + if (split.length == 1 && (split[0] == null || split[0].isEmpty())) { + model.getCustomPropertiesKeysList().put(keyValuePair.getKey(), + null); + } else { + model.getCustomPropertiesKeysList().put(keyValuePair.getKey(), + new ArrayList<String>()); + for (String s : split) { + model.getCustomPropertiesKeysList().get(keyValuePair.getKey()).add(s); + } } } } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java index 1f292a2..905c112 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/key_value/KeyValueModel.java @@ -139,6 +139,9 @@ } public void setKeyValueString(List<String> lines) { + if (lines == null) { + return; + } allKeyValueMap = new HashMap<String, String>(); allRegExKeys = new HashMap<String, List<String>>(); RegexValidation regexValidation = new RegexValidation(); @@ -258,6 +261,9 @@ @Override public String getEntity() { StringBuilder builder = new StringBuilder(); + if (getKeyValueLines().getItems() == null) { + return ""; + } for (KeyValueLineModel keyValueLineModel : (List<KeyValueLineModel>) getKeyValueLines().getItems()) { String key = (String) keyValueLineModel.getKeys().getSelectedItem(); if (key.equals(NO_KEYS) || key.equals(SELECT_KEY)) { -- To view, visit http://gerrit.ovirt.org/13304 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia939952c367b6416ed90bb295f1485ce4ac63368 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gilad Chaplik <gchap...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches