Search in sources :

Example 6 with ExportVmModel

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

the class TemplateListModel method postExportGetMissingTemplates.

private void postExportGetMissingTemplates(ArrayList<String> missingTemplatesFromVms) {
    ExportVmModel model = (ExportVmModel) getWindow();
    if (!missingTemplatesFromVms.isEmpty()) {
        model.stopProgress();
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().baseTemplatesNotFoundOnExportDomainTitle());
        confirmModel.setHelpTag(HelpTag.base_template_not_found_on_export_domain);
        // $NON-NLS-1$
        confirmModel.setHashName("base_template_not_found_on_export_domain");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().theFollowingTemplatesAreMissingOnTargetExportDomainForTemplateVersionsMsg());
        confirmModel.setItems(missingTemplatesFromVms);
        // $NON-NLS-1$
        UICommand tempVar = UICommand.createDefaultOkUiCommand("OnExportNoTemplates", this);
        confirmModel.getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
        confirmModel.getCommands().add(tempVar2);
    } else {
        doExport();
    }
}
Also used : ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 7 with ExportVmModel

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

the class TemplateListModel method postGetTemplatesNotPresentOnExportDomain.

private void postGetTemplatesNotPresentOnExportDomain(StoragePool storagePool) {
    ExportVmModel model = (ExportVmModel) getWindow();
    Guid storageDomainId = model.getStorage().getSelectedItem().getId();
    if (storagePool != null) {
        AsyncDataProvider.getInstance().getAllTemplatesFromExportDomain(new AsyncQuery<>(templatesDiskSet -> {
            ArrayList<String> verTempMissingBase = new ArrayList<>();
            // check if relevant templates are already there
            for (Object selectedItem : getSelectedItems()) {
                VmTemplate template = (VmTemplate) selectedItem;
                // only relevant for template versions
                if (!template.isBaseTemplate()) {
                    boolean hasMatch = false;
                    for (VmTemplate a : templatesDiskSet.keySet()) {
                        if (template.getBaseTemplateId().equals(a.getId())) {
                            hasMatch = true;
                            break;
                        }
                    }
                    if (!template.getBaseTemplateId().equals(Guid.Empty) && !hasMatch) {
                        verTempMissingBase.add(template.getName());
                    }
                }
            }
            postExportGetMissingTemplates(verTempMissingBase);
        }), storagePool.getId(), storageDomainId);
    }
}
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) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ArrayList(java.util.ArrayList) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) Guid(org.ovirt.engine.core.compat.Guid)

Example 8 with ExportVmModel

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

the class TemplateListModel method getTemplatesNotPresentOnExportDomain.

private void getTemplatesNotPresentOnExportDomain() {
    ExportVmModel model = (ExportVmModel) getWindow();
    Guid storageDomainId = model.getStorage().getSelectedItem().getId();
    AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> {
        StoragePool storagePool = storagePools.size() > 0 ? storagePools.get(0) : null;
        postGetTemplatesNotPresentOnExportDomain(storagePool);
    }), storageDomainId);
}
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) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) Guid(org.ovirt.engine.core.compat.Guid)

Example 9 with ExportVmModel

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

the class VmBaseListModel method postExportGetStorageDomainList.

private void postExportGetStorageDomainList(List<StorageDomain> storageDomains) {
    ExportVmModel model = (ExportVmModel) getWindow();
    model.getStorage().setItems(storageDomains);
    model.getStorage().setSelectedItem(Linq.firstOrNull(storageDomains));
    boolean noActiveStorage = true;
    for (StorageDomain a : storageDomains) {
        if (a.getStatus() == StorageDomainStatus.Active) {
            noActiveStorage = false;
            break;
        }
    }
    if (entitiesSelectedOnDifferentDataCenters()) {
        model.getCollapseSnapshots().setIsChangeable(false);
        model.getForceOverride().setIsChangeable(false);
        model.setMessage(entityResideOnSeveralDCsMakeSureTheExportedVMResideOnSameDcMsg());
        // $NON-NLS-1$
        UICommand tempVar = new UICommand("Cancel", this);
        tempVar.setTitle(ConstantsManager.getInstance().getConstants().close());
        tempVar.setIsDefault(true);
        tempVar.setIsCancel(true);
        model.getCommands().add(tempVar);
        model.stopProgress();
    } else if (storageDomains.isEmpty()) {
        model.getCollapseSnapshots().setIsChangeable(false);
        model.getForceOverride().setIsChangeable(false);
        model.setMessage(thereIsNoExportDomainBackupEntityAttachExportDomainToVmsDcMsg());
        // $NON-NLS-1$
        UICommand tempVar2 = new UICommand("Cancel", this);
        tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
        tempVar2.setIsDefault(true);
        tempVar2.setIsCancel(true);
        model.getCommands().add(tempVar2);
        model.stopProgress();
    } else if (noActiveStorage) {
        model.getCollapseSnapshots().setIsChangeable(false);
        model.getForceOverride().setIsChangeable(false);
        model.setMessage(ConstantsManager.getInstance().getConstants().theRelevantExportDomainIsNotActivePleaseActivateItMsg());
        // $NON-NLS-1$
        UICommand tempVar3 = new UICommand("Cancel", this);
        tempVar3.setTitle(ConstantsManager.getInstance().getConstants().close());
        tempVar3.setIsDefault(true);
        tempVar3.setIsCancel(true);
        model.getCommands().add(tempVar3);
        model.stopProgress();
    } else {
        showWarningOnExistingEntities(model, getEntityExportDomain());
        // $NON-NLS-1$
        UICommand tempVar4 = UICommand.createDefaultOkUiCommand("OnExport", this);
        model.getCommands().add(tempVar4);
        // $NON-NLS-1$
        UICommand tempVar5 = UICommand.createCancelUiCommand("Cancel", this);
        model.getCommands().add(tempVar5);
    }
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ExportVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

ExportVmModel (org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel)9 ArrayList (java.util.ArrayList)6 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)6 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)5 Guid (org.ovirt.engine.core.compat.Guid)5 List (java.util.List)4 Map (java.util.Map)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)4 ActionType (org.ovirt.engine.core.common.action.ActionType)4 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)4 VM (org.ovirt.engine.core.common.businessentities.VM)4 VmType (org.ovirt.engine.core.common.businessentities.VmType)4 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)4 VmWatchdogType (org.ovirt.engine.core.common.businessentities.VmWatchdogType)4 QueryType (org.ovirt.engine.core.common.queries.QueryType)4 Frontend (org.ovirt.engine.ui.frontend.Frontend)4 IconUtils (org.ovirt.engine.ui.uicommonweb.IconUtils)4 BuilderExecutor (org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor)4 FullUnitToVmBaseBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder)4 UnitToGraphicsDeviceParamsBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder)4