Search in sources :

Example 91 with ConfirmationModel

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

the class VmDevicesListModel method onHotUnplug.

public void onHotUnplug(VmDeviceFeEntity deviceEntity) {
    if (getEntity() == null) {
        return;
    }
    if (deviceEntity == null || deviceEntity.getVmDevice().getType() != VmDeviceGeneralType.MEMORY) {
        return;
    }
    final Optional<Integer> memorySizeOptional = VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(deviceEntity.getVmDevice());
    if (!memorySizeOptional.isPresent()) {
        return;
    }
    final int memorySizeMb = memorySizeOptional.get();
    setSelectedItem(deviceEntity);
    ConfirmationModel confirmationModel = new ConfirmationModel();
    confirmationModel.setTitle(constants.memoryHotUnplug());
    confirmationModel.setHelpTag(HelpTag.template_not_found_on_export_domain);
    confirmationModel.setMessage(messages.memoryHotUnplugConfirmation(memorySizeMb, getEntity().getName()));
    confirmationModel.getCommands().add(memoryHotUnplugCommand);
    confirmationModel.getCommands().add(cancelMemoryHotUnplugCommand);
    setConfirmWindow(confirmationModel);
}
Also used : ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 92 with ConfirmationModel

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

the class VmDiskListModel method confirmUnplug.

private void confirmUnplug() {
    ConfirmationModel model = new ConfirmationModel();
    model.setTitle(ConstantsManager.getInstance().getConstants().deactivateVmDisksTitle());
    model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDeactivateVMDisksMsg());
    // $NON-NLS-1$
    model.setHashName("deactivate_vm_disk");
    setWindow(model);
    ArrayList<String> items = new ArrayList<>();
    for (Disk selected : getSelectedItems()) {
        items.add(selected.getDiskAlias());
    }
    model.setItems(items);
    // $NON-NLS-1$
    UICommand unPlug = UICommand.createDefaultOkUiCommand("OnUnplug", this);
    model.getCommands().add(unPlug);
    // $NON-NLS-1$
    UICommand cancel = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancel);
}
Also used : ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 93 with ConfirmationModel

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

the class EditVmInterfaceModel method confirmSave.

private void confirmSave() {
    // Check if the nic was unplugged
    if (getNic().isPlugged() && !getPlugged().getEntity()) {
        ConfirmationModel model = new ConfirmationModel();
        model.setTitle(ConstantsManager.getInstance().getConstants().unplugVnicTitle());
        model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantUnplugVnicMsg());
        // $NON-NLS-1$
        model.setHashName("unplug_vnic");
        getSourceModel().setConfirmWindow(model);
        UICommand approveCommand = UICommand.createDefaultOkUiCommand(ON_APPROVE_COMMAND, this);
        model.getCommands().add(approveCommand);
        // $NON-NLS-1$
        UICommand cancel = UICommand.createCancelUiCommand(ABORT_COMMAMD, this);
        model.getCommands().add(cancel);
    } else {
        onSave();
    }
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 94 with ConfirmationModel

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

the class UserModule method getPermissionListProvider.

@Provides
@Singleton
public SearchableDetailModelProvider<Permission, UserListModel, UserPermissionListModel> getPermissionListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<UserRolesPopupPresenterWidget> popupProvider, final Provider<RolePermissionsRemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> mainModelProvider, final Provider<UserPermissionListModel> modelProvider) {
    SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel> result = new SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel>(eventBus, defaultConfirmPopupProvider) {

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand, Model windowModel) {
            UserPermissionListModel model = getModel();
            if (lastExecutedCommand == model.getAddRoleToUserCommand()) {
                return popupProvider.get();
            } else {
                return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
        }

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
                return removeConfirmPopupProvider.get();
            } else {
                return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
        }
    };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
}
Also used : Permission(org.ovirt.engine.core.common.businessentities.Permission) UserPermissionListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserPermissionListModel) UserGeneralModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGeneralModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UserQuotaListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserQuotaListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) UserEventNotifierListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventNotifierListModel) UserEventListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventListModel) UserGroupListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGroupListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UserPermissionListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserPermissionListModel) SearchableDetailTabModelProvider(org.ovirt.engine.ui.common.uicommon.model.SearchableDetailTabModelProvider) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 95 with ConfirmationModel

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

the class UserModule method getUserListProvider.

// Main List Model
@Provides
@Singleton
public MainModelProvider<DbUser, UserListModel> getUserListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<AssignTagsPopupPresenterWidget> assignTagsPopupProvider, final Provider<PermissionsPopupPresenterWidget> popupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> modelProvider) {
    MainViewModelProvider<DbUser, UserListModel> result = new MainViewModelProvider<DbUser, UserListModel>(eventBus, defaultConfirmPopupProvider) {

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserListModel source, UICommand lastExecutedCommand, Model windowModel) {
            UserListModel model = getModel();
            if (lastExecutedCommand == model.getAssignTagsCommand()) {
                return assignTagsPopupProvider.get();
            } else if (lastExecutedCommand == model.getAddCommand()) {
                return popupProvider.get();
            } else {
                return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
        }

        @Override
        public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
                return removeConfirmPopupProvider.get();
            } else {
                return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
        }
    };
    result.setModelProvider(modelProvider);
    return result;
}
Also used : MainViewModelProvider(org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider) UserPermissionListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserPermissionListModel) UserGeneralModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGeneralModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UserQuotaListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserQuotaListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) UserEventNotifierListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventNotifierListModel) UserEventListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserEventListModel) UserGroupListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserGroupListModel) UserListModel(org.ovirt.engine.ui.uicommonweb.models.users.UserListModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

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