Search in sources :

Example 21 with UICommand

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

the class OptionsModel method onEdit.

private void onEdit() {
    if (getWindow() != null) {
        return;
    }
    final EditOptionsModel model = new EditOptionsModel();
    model.setTitle(constants.editOptionsTitle());
    // $NON-NLS-1$
    model.setHashName("edit_options");
    setWindow(model);
    UICommand okCommand = UICommand.createDefaultOkUiCommand(constants.ok(), this);
    model.getCommands().add(okCommand);
    UICommand cancelCommand = UICommand.createCancelUiCommand(constants.cancel(), this);
    model.getCommands().add(cancelCommand);
    AsyncDataProvider.getInstance().getUserProfile(model.asyncQuery(returnValue -> {
        UserProfile profile = returnValue.getReturnValue();
        if (profile != null) {
            setUserProfile(profile);
            model.getPublicKey().setEntity(profile.getSshPublicKey());
        }
    }));
}
Also used : UserProfileParameters(org.ovirt.engine.core.common.action.UserProfileParameters) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) UserProfile(org.ovirt.engine.core.common.businessentities.UserProfile) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 22 with UICommand

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

the class PoolListModel method displayHighPerformanceConfirmationPopup.

protected void displayHighPerformanceConfirmationPopup() {
    final PoolModel model = (PoolModel) getWindow();
    if (model == null || model.getProgress() != null) {
        return;
    }
    VmHighPerformanceConfigurationModel confirmModel = new VmHighPerformanceConfigurationModel();
    // Handle CPU Pinning topology
    final boolean isVmAssignedToSpecificHosts = !model.getIsAutoAssign().getEntity();
    final boolean isVmCpuPinningSet = model.getCpuPinning().getIsChangable() && model.getCpuPinning().getEntity() != null && !model.getCpuPinning().getEntity().isEmpty();
    confirmModel.addRecommendationForCpuPinning(isVmAssignedToSpecificHosts, isVmCpuPinningSet);
    // Handle Huge Pages
    KeyValueModel keyValue = model.getCustomPropertySheet();
    // $NON-NLS-1$
    final boolean isVmHugePagesSet = keyValue != null && keyValue.getUsedKeys().contains("hugepages");
    confirmModel.addRecommendationForHugePages(isVmHugePagesSet);
    // Handle KSM (Kernel Same Page Merging)
    confirmModel.addRecommendationForKsm(model.getSelectedCluster().isEnableKsm(), model.getSelectedCluster().getName());
    if (!confirmModel.getRecommendationsList().isEmpty()) {
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().configurationChangesForHighPerformancePoolTitle());
        confirmModel.setHelpTag(HelpTag.configuration_changes_for_high_performance_pool);
        // $NON-NLS-1$
        confirmModel.setHashName("configuration_changes_for_high_performance_pool");
        confirmModel.getCommands().add(// $NON-NLS-1$
        new UICommand("OnSave_Phase2", PoolListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
        confirmModel.getCommands().add(// $NON-NLS-1$
        UICommand.createCancelUiCommand("CancelConfirmation", PoolListModel.this));
        setConfirmWindow(null);
        setConfirmWindow(confirmModel);
    } else {
        savePoolPostValidation();
    }
}
Also used : VmHighPerformanceConfigurationModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmHighPerformanceConfigurationModel) KeyValueModel(org.ovirt.engine.ui.uicommonweb.models.vms.key_value.KeyValueModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 23 with UICommand

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

the class QuotaUserListModel method remove.

public void remove() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeQuotaAssignmentFromUsersTitle());
    model.setHelpTag(HelpTag.remove_quota_assignment_from_user);
    // $NON-NLS-1$
    model.setHashName("remove_quota_assignment_from_user");
    ArrayList<String> list = new ArrayList<>();
    for (Permission item : getSelectedItems()) {
        list.add(item.getOwnerName());
    }
    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) Permission(org.ovirt.engine.core.common.businessentities.Permission) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 24 with UICommand

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

the class ManageBackupModel method validateSingleArchitecture.

protected boolean validateSingleArchitecture() {
    // Checks if there are selected VMs of multiple architectures
    ArchitectureType firstArch = null;
    boolean multipleArchs = false;
    for (T item : getSelectedItems()) {
        ArchitectureType arch = getArchitectureFromItem(item);
        if (firstArch == null) {
            firstArch = arch;
        } else {
            if (!firstArch.equals(arch)) {
                multipleArchs = true;
                break;
            }
        }
    }
    if (multipleArchs) {
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().invalidImportTitle());
        confirmModel.setHelpTag(HelpTag.multiple_archs_dialog);
        // $NON-NLS-1$
        confirmModel.setHashName("multiple_archs_dialog");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().invalidImportMsg());
        // $NON-NLS-1$
        UICommand command = UICommand.createDefaultOkUiCommand("multipleArchsOK", this);
        confirmModel.getCommands().add(command);
        setConfirmWindow(confirmModel);
        return false;
    }
    return true;
}
Also used : ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 25 with UICommand

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

the class RegisterDiskModel method init.

public void init() {
    ICommandTarget target = (ICommandTarget) getEntity();
    // $NON-NLS-1$
    UICommand actionCommand = new UICommand("OnExecute", this);
    actionCommand.setTitle(constants.ok());
    actionCommand.setIsDefault(true);
    getCommands().add(actionCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = new UICommand("Cancel", target);
    cancelCommand.setTitle(constants.cancel());
    cancelCommand.setIsCancel(true);
    getCommands().add(cancelCommand);
}
Also used : ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

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