Search in sources :

Example 1 with GlusterVolumeOptionInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo in project ovirt-engine by oVirt.

the class GlusterVolumeOptionsInfoReturn method prepareOptionHelpEntity.

private GlusterVolumeOptionInfo prepareOptionHelpEntity(Map<String, Object> map) {
    GlusterVolumeOptionInfo entity = new GlusterVolumeOptionInfo();
    entity.setKey(map.get("name").toString());
    entity.setDefaultValue(map.get("defaultValue").toString());
    entity.setDescription(map.get("description").toString());
    return entity;
}
Also used : GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo)

Example 2 with GlusterVolumeOptionInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo in project ovirt-engine by oVirt.

the class VolumeParameterModel method selectedKeyChanged.

private void selectedKeyChanged() {
    String key = getKeyList().getSelectedItem();
    GlusterVolumeOptionInfo selectedOption = optionsMap.get(key);
    if (selectedOption != null) {
        if (selectedOption.getDescription() == null || selectedOption.getDescription().equals(NULL_CONST)) {
            getDescription().setEntity(null);
        } else {
            getDescription().setEntity(selectedOption.getDescription());
        }
        if (getIsNew()) {
            if (selectedOption.getDefaultValue() == null || selectedOption.getDefaultValue().equals(NULL_CONST)) {
                getValue().setEntity(null);
            } else {
                getValue().setEntity(selectedOption.getDefaultValue());
            }
        }
    } else if (getIsNew()) {
        getDescription().setEntity(null);
        getValue().setEntity(null);
    }
}
Also used : GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo)

Example 3 with GlusterVolumeOptionInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo in project ovirt-engine by oVirt.

the class GetGlusterVolumeOptionsInfoQueryTest method setupExpectedGlusterVolumeOptionInfo.

private void setupExpectedGlusterVolumeOptionInfo() {
    parameters = new GlusterParameters(CLUSTER_ID);
    expected = new ArrayList<>();
    GlusterVolumeOptionInfo option = new GlusterVolumeOptionInfo();
    option.setKey("cluster.self-heal-window-size");
    option.setDefaultValue("1");
    option.setDescription("Maximum number blocks per file for which self-heal process would be applied simultaneously.");
    expected.add(option);
}
Also used : GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo) GlusterParameters(org.ovirt.engine.core.common.queries.gluster.GlusterParameters)

Example 4 with GlusterVolumeOptionInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo in project ovirt-engine by oVirt.

the class VolumeParameterListModel method getCifsVolumeOption.

private GlusterVolumeOptionInfo getCifsVolumeOption() {
    GlusterVolumeOptionInfo cifsOption = new GlusterVolumeOptionInfo();
    // $NON-NLS-1$
    cifsOption.setKey("user.cifs");
    return cifsOption;
}
Also used : GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo)

Example 5 with GlusterVolumeOptionInfo

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo in project ovirt-engine by oVirt.

the class VolumeParameterListModel method editParameter.

private void editParameter() {
    if (getWindow() != null) {
        return;
    }
    GlusterVolumeEntity volume = getEntity();
    if (volume == null) {
        return;
    }
    VolumeParameterModel volumeParameterModel = new VolumeParameterModel();
    volumeParameterModel.setTitle(ConstantsManager.getInstance().getConstants().editOptionVolume());
    volumeParameterModel.setHelpTag(HelpTag.edit_option);
    // $NON-NLS-1$
    volumeParameterModel.setHashName("edit_option");
    volumeParameterModel.setIsNew(false);
    setWindow(volumeParameterModel);
    volumeParameterModel.getKeyList().setIsChangeable(false);
    volumeParameterModel.startProgress();
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        VolumeParameterModel innerParameterModel = (VolumeParameterModel) getWindow();
        if (!returnValue.getSucceeded()) {
            innerParameterModel.setOptionsMap(new HashMap<String, GlusterVolumeOptionInfo>());
            innerParameterModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingVolumeOptionList());
        } else {
            innerParameterModel.setOptionsMap(getOptionsMap((Set<GlusterVolumeOptionInfo>) returnValue.getReturnValue()));
        }
        GlusterVolumeOptionEntity selectedOption = getSelectedItem();
        // $NON-NLS-1$
        innerParameterModel.getDescription().setEntity("");
        innerParameterModel.getKeyList().setSelectedItem(selectedOption.getKey());
        innerParameterModel.getValue().setEntity(selectedOption.getValue());
        innerParameterModel.stopProgress();
        // $NON-NLS-1$
        UICommand command = UICommand.createDefaultOkUiCommand("OnSetParameter", VolumeParameterListModel.this);
        innerParameterModel.getCommands().add(command);
        // $NON-NLS-1$
        command = UICommand.createCancelUiCommand("OnCancel", VolumeParameterListModel.this);
        innerParameterModel.getCommands().add(command);
    });
    asyncQuery.setHandleFailure(true);
    AsyncDataProvider.getInstance().getGlusterVolumeOptionInfoList(asyncQuery, volume.getClusterId());
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Set(java.util.Set) GlusterVolumeOptionInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

GlusterVolumeOptionInfo (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionInfo)7 Set (java.util.Set)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 HashMap (java.util.HashMap)1 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)1 GlusterParameters (org.ovirt.engine.core.common.queries.gluster.GlusterParameters)1