Search in sources :

Example 76 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeBrickListModel method onAddBricks.

private void onAddBricks() {
    VolumeBrickModel volumeBrickModel = (VolumeBrickModel) getWindow();
    if (volumeBrickModel == null) {
        return;
    }
    if (!volumeBrickModel.validate()) {
        return;
    }
    GlusterVolumeEntity volumeEntity = getEntity();
    if (volumeEntity == null) {
        return;
    }
    ArrayList<GlusterBrickEntity> brickList = new ArrayList<>();
    for (Object model : volumeBrickModel.getBricks().getItems()) {
        GlusterBrickEntity brickEntity = (GlusterBrickEntity) ((EntityModel) model).getEntity();
        brickEntity.setVolumeId(volumeEntity.getId());
        brickList.add(brickEntity);
    }
    volumeBrickModel.setMessage(null);
    if (!validateReplicaStripeCount(volumeEntity, volumeBrickModel)) {
        return;
    }
    if (brickList.size() == 0) {
        volumeBrickModel.setMessage(ConstantsManager.getInstance().getConstants().emptyAddBricksMsg());
        return;
    }
    if (!VolumeBrickModel.validateBrickCount(volumeEntity.getVolumeType(), volumeEntity.getBricks().size() + brickList.size(), volumeBrickModel.getReplicaCountValue(), volumeBrickModel.getStripeCountValue(), false)) {
        volumeBrickModel.setMessage(VolumeBrickModel.getValidationFailedMsg(volumeEntity.getVolumeType(), false));
        return;
    }
    if ((volumeEntity.getVolumeType() == GlusterVolumeType.REPLICATE || volumeEntity.getVolumeType() == GlusterVolumeType.DISTRIBUTED_REPLICATE) && !volumeBrickModel.validateReplicateBricks(volumeEntity.getReplicaCount(), volumeEntity.getBricks())) {
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().addBricksReplicateConfirmationTitle());
        confirmModel.setHelpTag(HelpTag.add_bricks_confirmation);
        // $NON-NLS-1$
        confirmModel.setHashName("add_bricks_confirmation");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().addBricksToReplicateVolumeFromSameServerMsg());
        // $NON-NLS-1$
        UICommand okCommand = new UICommand("OnAddBricksInternal", this);
        okCommand.setTitle(ConstantsManager.getInstance().getConstants().yes());
        okCommand.setIsDefault(true);
        getConfirmWindow().getCommands().add(okCommand);
        // $NON-NLS-1$
        UICommand cancelCommand = new UICommand("CancelConfirmation", this);
        cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().no());
        cancelCommand.setIsCancel(true);
        getConfirmWindow().getCommands().add(cancelCommand);
    } else {
        onAddBricksInternal();
    }
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 77 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeGeoRepListModel method showGeoRepSessionDetails.

public void showGeoRepSessionDetails(GlusterGeoRepSession session) {
    ArrayList<GlusterGeoRepSessionDetails> details = session.getSessionDetails();
    if (getWindow() != null) {
        return;
    }
    if (details == null || details.size() == 0) {
        final UIConstants constants = ConstantsManager.getInstance().getConstants();
        final ConfirmationModel cModel = new ConfirmationModel();
        cModel.setTitle(constants.geoReplicationSessionDetailsTitle());
        // $NON-NLS-1$
        UICommand okCommand = new UICommand("closeConfirmWindow", this);
        okCommand.setTitle(constants.ok());
        okCommand.setIsCancel(true);
        cModel.getCommands().add(okCommand);
        setConfirmWindow(cModel);
        cModel.setMessage(constants.geoRepSessionStatusDetailFetchFailed());
    } else {
        populateStatus(details);
    }
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 78 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeParameterListModel method resetAllParameters.

private void resetAllParameters() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().resetAllOptionsTitle());
    model.setHelpTag(HelpTag.reset_all_options);
    // $NON-NLS-1$
    model.setHashName("reset_all_options");
    model.setMessage(ConstantsManager.getInstance().getConstants().resetAllOptionsMsg());
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnResetAllParameters", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("OnCancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 79 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeParameterListModel method resetParameter.

private void resetParameter() {
    if (getWindow() != null) {
        return;
    }
    if (getSelectedItem() == null) {
        return;
    }
    GlusterVolumeOptionEntity selectedOption = getSelectedItem();
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().resetOptionVolumeTitle());
    model.setHelpTag(HelpTag.reset_option);
    // $NON-NLS-1$
    model.setHashName("reset_option");
    model.setMessage(ConstantsManager.getInstance().getConstants().resetOptionVolumeMsg());
    ArrayList<String> list = new ArrayList<>();
    list.add(selectedOption.getKey());
    model.setItems(list);
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnResetParameter", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("OnCancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : ArrayList(java.util.ArrayList) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 80 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeParameterListModel method onResetAllParameters.

private void onResetAllParameters() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getEntity() == null) {
        return;
    }
    GlusterVolumeEntity volume = getEntity();
    ResetGlusterVolumeOptionsParameters parameters = new ResetGlusterVolumeOptionsParameters(volume.getId(), null, false);
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.ResetGlusterVolumeOptions, parameters, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ResetGlusterVolumeOptionsParameters(org.ovirt.engine.core.common.action.gluster.ResetGlusterVolumeOptionsParameters)

Aggregations

ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)184 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)112 ArrayList (java.util.ArrayList)105 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)54 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)23 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)22 List (java.util.List)21 ActionType (org.ovirt.engine.core.common.action.ActionType)20 Frontend (org.ovirt.engine.ui.frontend.Frontend)20 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)20 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)20 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)18 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)17 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)17 QueryType (org.ovirt.engine.core.common.queries.QueryType)17 Guid (org.ovirt.engine.core.compat.Guid)17 Model (org.ovirt.engine.ui.uicommonweb.models.Model)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)14