Search in sources :

Example 51 with ConfirmationModel

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

the class TagListModel method onRemove.

public void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.RemoveTag, new TagsActionParametersBase(getSelectedItem().getId()), result -> {
        TagListModel tagListModel = (TagListModel) result.getState();
        ActionReturnValue returnVal = result.getReturnValue();
        boolean success = returnVal != null && returnVal.getSucceeded();
        if (success) {
            tagListModel.getSearchCommand().execute();
        }
        tagListModel.cancel();
        tagListModel.stopProgress();
    }, this);
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) TagsActionParametersBase(org.ovirt.engine.core.common.action.TagsActionParametersBase)

Example 52 with ConfirmationModel

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

the class AbstractDiskModel method onForceSave.

private void onForceSave() {
    ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
    if (confirmationModel != null && !confirmationModel.validate()) {
        return;
    }
    cancelConfirm();
    getSanStorageModelBase().setForce(true);
    onSave();
}
Also used : ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 53 with ConfirmationModel

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

the class AbstractDiskModel method forceCreationWarning.

protected void forceCreationWarning(ArrayList<String> usedLunsMessages) {
    ConfirmationModel confirmationModel = new ConfirmationModel();
    setConfirmWindow(confirmationModel);
    confirmationModel.setTitle(constants.forceStorageDomainCreation());
    confirmationModel.setMessage(constants.lunsAlreadyPartOfSD());
    confirmationModel.setHelpTag(HelpTag.force_lun_disk_creation);
    // $NON-NLS-1$
    confirmationModel.setHashName("force_lun_disk_creation");
    confirmationModel.setItems(usedLunsMessages);
    // $NON-NLS-1$
    UICommand forceSaveCommand = new UICommand("OnForceSave", this);
    forceSaveCommand.setTitle(constants.ok());
    forceSaveCommand.setIsDefault(true);
    confirmationModel.getCommands().add(forceSaveCommand);
    // $NON-NLS-1$
    UICommand cancelconfirmCommand = new UICommand("CancelConfirm", this);
    cancelconfirmCommand.setTitle(constants.cancel());
    cancelconfirmCommand.setIsCancel(true);
    confirmationModel.getCommands().add(cancelconfirmCommand);
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 54 with ConfirmationModel

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

the class UserListModel method remove.

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

Example 55 with ConfirmationModel

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

the class UserPermissionListModel method onRemove.

private void onRemove() {
    if (getSelectedItems() != null && getSelectedItems().size() > 0) {
        ConfirmationModel model = (ConfirmationModel) getWindow();
        if (model.getProgress() != null) {
            return;
        }
        ArrayList<ActionParametersBase> list = new ArrayList<>();
        for (Object perm : getSelectedItems()) {
            PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
            tempVar.setPermission((Permission) perm);
            list.add(tempVar);
        }
        model.startProgress();
        Frontend.getInstance().runMultipleAction(ActionType.RemovePermission, list, result -> {
            ConfirmationModel localModel = (ConfirmationModel) result.getState();
            localModel.stopProgress();
            cancel();
        }, model);
    } else {
        cancel();
    }
}
Also used : PermissionsOperationsParameters(org.ovirt.engine.core.common.action.PermissionsOperationsParameters) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

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