Search in sources :

Example 6 with UICommand

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

the class ClusterGuideModel method updateOptionsNonLocalFS.

private void updateOptionsNonLocalFS() {
    if (hosts == null || allHosts == null || !isUpHostCheckCompleted()) {
        return;
    }
    if (getEntity() == null) {
        stopProgress();
        setWindow(null);
        return;
    }
    // Add host action.
    UICommand addHostAction = new UICommand(ADD_HOST, this);
    if (hosts.size() > 1) {
        hosts.remove(0);
    }
    if (hosts.isEmpty()) {
        addHostAction.setTitle(clusterConfigureHostsActionTitle);
        getCompulsoryActions().add(addHostAction);
    } else if (isAnyUpHostInCluster()) {
        addHostAction.setTitle(clusterAddAnotherHostActionTitle);
        getOptionalActions().add(addHostAction);
    }
    if (getEntity().getStoragePoolId() == null) {
        addHostAction.getExecuteProhibitionReasons().add(ConstantsManager.getInstance().getConstants().theClusterIsntAttachedToADcClusterGuide());
        addHostAction.setIsExecutionAllowed(false);
        return;
    }
    ArrayList<VDS> availableHosts = new ArrayList<>();
    for (VDS vds : allHosts) {
        if (!getEntity().getId().equals(vds.getClusterId()) && (vds.getStatus() == VDSStatus.Maintenance || vds.getStatus() == VDSStatus.PendingApproval) && vds.getSupportedClusterVersionsSet() != null && vds.getSupportedClusterVersionsSet().contains(getEntity().getCompatibilityVersion())) {
            availableHosts.add(vds);
        }
    }
    // Select host action.
    UICommand selectHostAction = new UICommand(SELECT_HOST, this);
    if (availableHosts.size() > 0) {
        if (hosts.isEmpty()) {
            selectHostAction.setTitle(selectHostsActionTitle);
            getCompulsoryActions().add(selectHostAction);
        } else if (isAnyUpHostInCluster()) {
            selectHostAction.setTitle(selectHostsActionTitle);
            getOptionalActions().add(selectHostAction);
        }
    }
    stopProgress();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 7 with UICommand

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

the class ClusterGuideModel method onConfirmPMHost.

public void onConfirmPMHost() {
    HostModel model = (HostModel) getWindow();
    if (!model.validate()) {
        return;
    }
    if (!model.getIsPm().getEntity() && ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().powerManagementConfigurationTitle());
        confirmModel.setHelpTag(HelpTag.power_management_configuration);
        // $NON-NLS-1$
        confirmModel.setHashName("power_management_configuration");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youHavntConfigPmMsg());
        // $NON-NLS-1$
        UICommand tempVar = UICommand.createDefaultOkUiCommand("OnAddHost", this);
        confirmModel.getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmWithFocus", this);
        confirmModel.getCommands().add(tempVar2);
    } else {
        onAddHost();
    }
}
Also used : HostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel) NewHostModel(org.ovirt.engine.ui.uicommonweb.models.hosts.NewHostModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 8 with UICommand

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

the class ClusterGuideModel method updateOptionsLocalFS.

private void updateOptionsLocalFS() {
    UICommand addHostAction = new UICommand(ADD_HOST, this);
    addHostAction.setTitle(clusterAddAnotherHostActionTitle);
    UICommand selectHost = new UICommand(SELECT_HOST, this);
    selectHost.setTitle(selectHostsActionTitle);
    if (localStorageHost != null) {
        String hasHostReason = ConstantsManager.getInstance().getConstants().thisClusterBelongsToALocalDcWhichAlreadyContainHostClusterGuide();
        addHostAction.getExecuteProhibitionReasons().add(hasHostReason);
        addHostAction.setIsExecutionAllowed(false);
        selectHost.getExecuteProhibitionReasons().add(hasHostReason);
        selectHost.setIsExecutionAllowed(false);
        getNote().setIsAvailable(true);
        getNote().setEntity(ConstantsManager.getInstance().getConstants().attachLocalStorageDomainToFullyConfigure());
    }
    getCompulsoryActions().add(addHostAction);
    getOptionalActions().add(selectHost);
    stopProgress();
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 9 with UICommand

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

the class ClusterListModel method remove.

public void remove() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeClusterTitle());
    model.setHelpTag(HelpTag.remove_cluster);
    // $NON-NLS-1$
    model.setHashName("remove_cluster");
    ArrayList<String> list = new ArrayList<>();
    for (Cluster a : getSelectedItems()) {
        list.add(a.getName());
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : ArrayList(java.util.ArrayList) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 10 with UICommand

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

the class ClusterListModel method onSaveConfirmCV.

private void onSaveConfirmCV(ClusterModel model) {
    if (!model.getVersion().getSelectedItem().equals(getSelectedItem().getCompatibilityVersion())) {
        final ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(constants.changeClusterCompatibilityVersionTitle());
        confirmModel.setHelpTag(HelpTag.change_cluster_compatibility_version);
        // $NON-NLS-1$
        confirmModel.setHashName("change_cluster_compatibility_version");
        // $NON-NLS-1$
        UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSaveConfirmCpuThreads", this);
        getConfirmWindow().getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
        getConfirmWindow().getCommands().add(tempVar2);
        checkForActiveVms(model, confirmModel);
    } else {
        onSaveConfirmCpuThreads();
    }
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Aggregations

UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)257 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)134 ArrayList (java.util.ArrayList)105 List (java.util.List)49 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)49 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)49 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)48 ActionType (org.ovirt.engine.core.common.action.ActionType)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)47 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)44 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)41 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)36 Guid (org.ovirt.engine.core.compat.Guid)36 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)33 QueryType (org.ovirt.engine.core.common.queries.QueryType)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)30 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)29 Linq (org.ovirt.engine.ui.uicommonweb.Linq)28 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)26 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)24