Search in sources :

Example 1 with HostMaintenanceConfirmationModel

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

the class HostListModel method maintenance.

private void maintenance(boolean isMaintenanceReasonVisible, boolean supportsGlusterService) {
    if (getConfirmWindow() != null) {
        return;
    }
    HostMaintenanceConfirmationModel model = new HostMaintenanceConfirmationModel();
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().maintenanceHostsTitle());
    model.setHelpTag(HelpTag.maintenance_host);
    // $NON-NLS-1$
    model.setHashName("maintenance_host");
    model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantToPlaceFollowingHostsIntoMaintenanceModeMsg());
    model.setReasonVisible(isMaintenanceReasonVisible);
    if (supportsGlusterService) {
        model.getStopGlusterServices().setIsAvailable(true);
        model.getStopGlusterServices().setEntity(false);
        model.getForce().setIsAvailable(true);
        model.getForce().setEntity(false);
        model.setForceLabel(ConstantsManager.getInstance().getConstants().ignoreGlusterQuorumChecks());
    }
    // model.Items = SelectedItems.Cast<VDS>().Select(a => a.vds_name);
    ArrayList<String> vdss = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VDS vds = (VDS) item;
        vdss.add(vds.getName());
    }
    model.setItems(vdss);
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnMaintenance", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirm", this);
    model.getCommands().add(tempVar2);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 2 with HostMaintenanceConfirmationModel

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

the class HostListModel method onMaintenance.

public void onMaintenance() {
    HostMaintenanceConfirmationModel model = (HostMaintenanceConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<Guid> vdss = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VDS vds = (VDS) item;
        vdss.add(vds.getId());
    }
    MaintenanceNumberOfVdssParameters params = new MaintenanceNumberOfVdssParameters(vdss, false, model.getReason().getEntity(), model.getStopGlusterServices().getEntity(), model.getForce().getEntity());
    cancelConfirm();
    Frontend.getInstance().runAction(ActionType.MaintenanceNumberOfVdss, params);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) MaintenanceNumberOfVdssParameters(org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters) ArrayList(java.util.ArrayList) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) Guid(org.ovirt.engine.core.compat.Guid)

Example 3 with HostMaintenanceConfirmationModel

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

the class HostMaintenanceConfirmationPopupView method edit.

@Override
public void edit(HostMaintenanceConfirmationModel object) {
    driver.edit(object);
    // Bind "Latch.IsAvailable"
    object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("IsAvailable".equals(args.propertyName)) {
            // $NON-NLS-1$
            EntityModel entity = (EntityModel) sender;
            if (entity.getIsAvailable()) {
                latch.setVisible(true);
            }
        }
    });
    if (object.getForceLabel() != null) {
        force.setLabel(object.getForceLabel());
    }
    force.asCheckBox().setValue(object.getForce().getEntity());
    // Bind "Force.Label"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("ForceLabel".equals(args.propertyName)) {
            // $NON-NLS-1$
            ConfirmationModel entity = (ConfirmationModel) sender;
            force.setLabel(entity.getForceLabel());
        }
    });
    setNote(object.getNote());
    // Bind "Note"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("Note".equals(args.propertyName)) {
            // $NON-NLS-1$
            ConfirmationModel entity = (ConfirmationModel) sender;
            setNote(entity.getNote());
        }
    });
    // Bind "ReasonVisible"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("ReasonVisible".equals(args.propertyName)) {
            // $NON-NLS-1$
            updateReasonVisibility((HostMaintenanceConfirmationModel) sender);
        }
    });
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel)

Aggregations

HostMaintenanceConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel)3 ArrayList (java.util.ArrayList)2 VDS (org.ovirt.engine.core.common.businessentities.VDS)2 JsSingleValueStringObject (org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject)2 MaintenanceNumberOfVdssParameters (org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters)1 Guid (org.ovirt.engine.core.compat.Guid)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1