Search in sources :

Example 46 with ConfirmationModel

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

the class StorageListModel method forceCreationWarning.

private void forceCreationWarning(ArrayList<String> usedLunsMessages) {
    StorageModel storageModel = (StorageModel) getWindow();
    SanStorageModelBase sanStorageModelBase = (SanStorageModelBase) storageModel.getCurrentStorageItem();
    sanStorageModelBase.setForce(true);
    ConfirmationModel model = new ConfirmationModel();
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().forceStorageDomainCreation());
    model.setMessage(ConstantsManager.getInstance().getConstants().lunsAlreadyInUse());
    model.setHelpTag(HelpTag.force_storage_domain_creation);
    // $NON-NLS-1$
    model.setHashName("force_storage_domain_creation");
    model.setItems(usedLunsMessages);
    // $NON-NLS-1$
    UICommand command = UICommand.createDefaultOkUiCommand("OnSaveSanStorage", this);
    model.getCommands().add(command);
    // $NON-NLS-1$
    command = createCancelCommand("CancelConfirm");
    model.getCommands().add(command);
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 47 with ConfirmationModel

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

the class TemplateListModel method onSave.

private void onSave() {
    final UnitVmModel model = (UnitVmModel) getWindow();
    if (!model.validate()) {
        return;
    }
    final String name = model.getName().getEntity();
    boolean isBaseTemplate = false;
    if (model.getBehavior().isExistingTemplateBehavior()) {
        isBaseTemplate = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate().isBaseTemplate();
    } else if (model.getBehavior().isBlankTemplateBehavior()) {
        isBaseTemplate = true;
    }
    if (isBaseTemplate) {
        AsyncDataProvider.getInstance().isTemplateNameUnique(new AsyncQuery<>(isNameUnique -> {
            if (model.getBehavior().isExistingTemplateBehavior()) {
                selectedItem = ((TemplateVmModelBehavior) model.getBehavior()).getVmTemplate();
            } else {
                selectedItem = ((ExistingBlankTemplateModelBehavior) model.getBehavior()).getVmTemplate();
            }
            if (!isNameUnique && name.compareToIgnoreCase(selectedItem.getName()) != 0) {
                model.getName().getInvalidityReasons().add(ConstantsManager.getInstance().getConstants().nameMustBeUniqueInvalidReason());
                model.getName().setIsValid(false);
                model.setValidTab(TabName.GENERAL_TAB, false);
                model.fireValidationCompleteEvent();
                return;
            }
            String selectedCpu = model.getCustomCpu().getSelectedItem();
            if (selectedCpu != null && !selectedCpu.isEmpty() && !model.getCustomCpu().getItems().contains(selectedCpu)) {
                ConfirmationModel confirmModel = new ConfirmationModel();
                confirmModel.setTitle(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuTitle());
                confirmModel.setMessage(ConstantsManager.getInstance().getConstants().vmUnsupportedCpuMessage());
                confirmModel.setHelpTag(HelpTag.edit_unsupported_cpu);
                // $NON-NLS-1$
                confirmModel.setHashName("edit_unsupported_cpu");
                confirmModel.getCommands().add(// $NON-NLS-1$
                new UICommand("postNameUniqueCheck", TemplateListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
                confirmModel.getCommands().add(// $NON-NLS-1$
                UICommand.createCancelUiCommand("CancelConfirmation", TemplateListModel.this));
                setConfirmWindow(confirmModel);
            } else {
                postNameUniqueCheck();
            }
        }), name, model.getSelectedDataCenter() == null ? null : model.getSelectedDataCenter().getId());
    } else {
        postNameUniqueCheck();
    }
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) FullUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder) VmType(org.ovirt.engine.core.common.businessentities.VmType) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ActionType(org.ovirt.engine.core.common.action.ActionType) VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) ActionUtils(org.ovirt.engine.core.common.ActionUtils) Collection(java.util.Collection) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) List(java.util.List) VersionNameUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.VersionNameUnitToVmBaseBuilder) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) VmModelBehaviorBase(org.ovirt.engine.ui.uicommonweb.models.vms.VmModelBehaviorBase) UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) UpdateVmTemplateParameters(org.ovirt.engine.core.common.action.UpdateVmTemplateParameters) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) MoveOrCopyParameters(org.ovirt.engine.core.common.action.MoveOrCopyParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) VmTemplateManagementParameters(org.ovirt.engine.core.common.action.VmTemplateManagementParameters) VmWatchdog(org.ovirt.engine.core.common.businessentities.VmWatchdog) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) TemplateVmModelBehavior(org.ovirt.engine.ui.uicommonweb.models.vms.TemplateVmModelBehavior) VmTemplateStatus(org.ovirt.engine.core.common.businessentities.VmTemplateStatus) VmBasedWidgetSwitchModeCommand(org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand) IconUtils(org.ovirt.engine.ui.uicommonweb.IconUtils) IconCache(org.ovirt.engine.ui.uicommonweb.models.vms.IconCache) VM(org.ovirt.engine.core.common.businessentities.VM) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) NewVmFromTemplateModelBehavior(org.ovirt.engine.ui.uicommonweb.models.vms.NewVmFromTemplateModelBehavior) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) TemplateVmModelBehavior(org.ovirt.engine.ui.uicommonweb.models.vms.TemplateVmModelBehavior) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Example 48 with ConfirmationModel

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

the class StorageDataCenterListModel method onDetach.

private void onDetach() {
    final ConfirmationModel model = (ConfirmationModel) getWindow();
    if (!model.validate()) {
        return;
    }
    setdetachPrms(new ArrayList<ActionParametersBase>());
    setremovePrms(new ArrayList<ActionParametersBase>());
    for (Object item : getSelectedItems()) {
        StorageDomain storageDomain = (StorageDomain) item;
        if (storageDomain.getStorageType() != StorageType.LOCALFS) {
            DetachStorageDomainFromPoolParameters param = new DetachStorageDomainFromPoolParameters();
            param.setStorageDomainId(getEntity().getId());
            if (storageDomain.getStoragePoolId() != null) {
                param.setStoragePoolId(storageDomain.getStoragePoolId());
            }
            getdetachPrms().add(param);
        } else {
            AsyncDataProvider.getInstance().getLocalStorageHost(new AsyncQuery<>(locaVds -> {
                StorageDomain storage = getEntity();
                RemoveStorageDomainParameters tempVar = new RemoveStorageDomainParameters(storage.getId());
                tempVar.setVdsId(locaVds != null ? locaVds.getId() : null);
                tempVar.setDoFormat(model.getForce().getEntity());
                RemoveStorageDomainParameters removeStorageDomainParameters = tempVar;
                getremovePrms().add(removeStorageDomainParameters);
                if (getremovePrms().size() + getdetachPrms().size() == getSelectedItems().size()) {
                    Frontend.getInstance().runMultipleAction(ActionType.RemoveStorageDomain, getremovePrms());
                }
            }), storageDomain.getStoragePoolName());
        }
        if (getdetachPrms().size() > 0) {
            Frontend.getInstance().runMultipleAction(ActionType.DetachStorageDomainFromPool, getdetachPrms());
        }
    }
    cancel();
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) ActionUtils(org.ovirt.engine.core.common.ActionUtils) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) List(java.util.List) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) Comparator(java.util.Comparator) Collections(java.util.Collections) DeactivateStorageDomainWithOvfUpdateParameters(org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 49 with ConfirmationModel

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

the class StorageDataCenterListModel method detach.

private void detach() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle());
    model.setHelpTag(HelpTag.detach_storage);
    // $NON-NLS-1$
    model.setHashName("detach_storage");
    model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachStorageFromDcsMsg());
    ArrayList<String> items = new ArrayList<>();
    boolean shouldAddressWarnning = false;
    for (Object item : getSelectedItems()) {
        StorageDomain a = (StorageDomain) item;
        items.add(a.getStoragePoolName());
        if (a.getStorageDomainType().isDataDomain()) {
            shouldAddressWarnning = true;
            break;
        }
    }
    model.setItems(items);
    if (containsLocalStorage(model)) {
        model.getForce().setIsAvailable(true);
        model.getForce().setIsChangeable(true);
        model.setForceLabel(ConstantsManager.getInstance().getConstants().storageRemovePopupFormatLabel());
        shouldAddressWarnning = false;
        model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString()));
    }
    if (shouldAddressWarnning) {
        model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote());
    }
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnDetach", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 50 with ConfirmationModel

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

the class VmBackupModel method onRemove.

private void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    model.startProgress();
    AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(pools -> {
        if (pools != null && pools.size() > 0) {
            StoragePool pool = pools.get(0);
            ArrayList<ActionParametersBase> list = new ArrayList<>();
            for (VM vm : getSelectedItems()) {
                list.add(new RemoveVmFromImportExportParameters(vm.getId(), getEntity().getId(), pool.getId()));
            }
            Frontend.getInstance().runMultipleAction(ActionType.RemoveVmFromImportExport, list, result -> {
                ConfirmationModel localModel = (ConfirmationModel) result.getState();
                localModel.stopProgress();
                cancel();
                onEntityChanged();
            }, getWindow());
        }
    }), getEntity().getId());
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) GetAllFromExportDomainQueryParameters(org.ovirt.engine.core.common.queries.GetAllFromExportDomainQueryParameters) VmAppListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmAppListModel) ArchitectureType(org.ovirt.engine.core.common.businessentities.ArchitectureType) RemoveVmFromImportExportParameters(org.ovirt.engine.core.common.action.RemoveVmFromImportExportParameters) Inject(com.google.inject.Inject) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) LexoNumericNameableComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericNameableComparator) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) StringHelper(org.ovirt.engine.core.compat.StringHelper) VM(org.ovirt.engine.core.common.businessentities.VM) Provider(com.google.inject.Provider) ImportVmData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportVmData) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) ImportVmFromExportDomainModel(org.ovirt.engine.ui.uicommonweb.models.vms.ImportVmFromExportDomainModel) Collections(java.util.Collections) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) RemoveVmFromImportExportParameters(org.ovirt.engine.core.common.action.RemoveVmFromImportExportParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

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