Search in sources :

Example 6 with UnitVmModel

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

the class TemplateListModel method onSaveVm.

private void onSaveVm() {
    UnitVmModel model = (UnitVmModel) getWindow();
    String name = model.getName().getEntity();
    setcurrentVm(new VM());
    validateVm(model, name);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Example 7 with UnitVmModel

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

the class TemplateListModel method vmInitLoaded.

private void vmInitLoaded(VmTemplate template) {
    UnitVmModel model = createModel(createBehavior(template));
    model.setIsAdvancedModeLocalStorageKey(getEditTemplateAdvancedModelKey());
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().editTemplateTitle());
    model.setHelpTag(HelpTag.edit_template);
    // $NON-NLS-1$
    model.setHashName("edit_template");
    model.getVmType().setSelectedItem(template.getVmType());
    model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList());
    model.initialize();
    VmBasedWidgetSwitchModeCommand switchModeCommand = new VmBasedWidgetSwitchModeCommand();
    switchModeCommand.init(model);
    model.getCommands().add(switchModeCommand);
    // $NON-NLS-1$
    UICommand onSaveCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
    model.getCommands().add(onSaveCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancelCommand);
    model.getIsHighlyAvailable().setEntity(template.isAutoStartup());
    if (template.getDefaultDisplayType() == DisplayType.none) {
        model.getIsHeadlessModeEnabled().setEntity(true);
    }
}
Also used : UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VmBasedWidgetSwitchModeCommand(org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Example 8 with UnitVmModel

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

the class InstanceTypeListModel method buildVmStatic.

private void buildVmStatic(VmBase vmBase) {
    UnitVmModel model = (UnitVmModel) getWindow();
    BuilderExecutor.build(model, vmBase, new HwOnlyCoreUnitToVmBaseBuilder(), new NameUnitToVmBaseBuilder(), new UsbPolicyUnitToVmBaseBuilder(), new MigrationOptionsUnitToVmBaseBuilder());
    // from CommonUnitToVmBaseBuilder
    vmBase.setAutoStartup(model.getIsHighlyAvailable().getEntity());
    vmBase.setPriority(model.getPriority().getSelectedItem().getEntity());
}
Also used : UsbPolicyUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UsbPolicyUnitToVmBaseBuilder) NameUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.NameUnitToVmBaseBuilder) MigrationOptionsUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.MigrationOptionsUnitToVmBaseBuilder) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) HwOnlyCoreUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.HwOnlyCoreUnitToVmBaseBuilder)

Example 9 with UnitVmModel

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

the class InstanceTypeListModel method postInstanceTypeNameUniqueCheck.

private void postInstanceTypeNameUniqueCheck() {
    UnitVmModel model = (UnitVmModel) getWindow();
    VM vm = new VM();
    buildVmStatic(vm.getStaticData());
    vm.setVmDescription(model.getDescription().getEntity());
    AddVmTemplateParameters addInstanceTypeParameters = new AddVmTemplateParameters(vm, model.getName().getEntity(), model.getDescription().getEntity());
    addInstanceTypeParameters.setTemplateType(VmEntityType.INSTANCE_TYPE);
    addInstanceTypeParameters.setVmTemplateId(null);
    addInstanceTypeParameters.setPublicUse(true);
    addInstanceTypeParameters.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
    addInstanceTypeParameters.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
    addInstanceTypeParameters.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
    addInstanceTypeParameters.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
    if (model.getIsHeadlessModeEnabled().getEntity()) {
        addInstanceTypeParameters.getVm().setDefaultDisplayType(DisplayType.none);
    }
    setVmWatchdogToParams(model, addInstanceTypeParameters);
    setRngDeviceToParams(model, addInstanceTypeParameters);
    BuilderExecutor.build(model, addInstanceTypeParameters, new UnitToGraphicsDeviceParamsBuilder());
    getWindow().startProgress();
    Frontend.getInstance().runAction(ActionType.AddVmTemplate, addInstanceTypeParameters, new UnitVmModelNetworkAsyncCallback(model, addInstanceTypeNetworkManager), this);
}
Also used : UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) UnitVmModelNetworkAsyncCallback(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModelNetworkAsyncCallback) VM(org.ovirt.engine.core.common.businessentities.VM) AddVmTemplateParameters(org.ovirt.engine.core.common.action.AddVmTemplateParameters) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Example 10 with UnitVmModel

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

the class VmIconUnitAndVmToParameterBuilder method build.

@Override
protected void build(Pair<UnitVmModel, VM> source, VmManagementParametersBase destination) {
    final UnitVmModel newModel = source.getFirst();
    final VM oldVm = source.getSecond();
    final String newIcon = newModel.getIcon().getEntity().getIcon();
    final String originalIcon = IconCache.getInstance().getIcon(oldVm.getStaticData().getLargeIconId());
    if (!newIcon.equals(originalIcon) && IconUtils.isCustom(newIcon)) {
        destination.setVmLargeIcon(newIcon);
    }
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)

Aggregations

UnitVmModel (org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel)13 VM (org.ovirt.engine.core.common.businessentities.VM)6 UnitToGraphicsDeviceParamsBuilder (org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder)6 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)5 UpdateVmTemplateParameters (org.ovirt.engine.core.common.action.UpdateVmTemplateParameters)4 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 VmBasedWidgetSwitchModeCommand (org.ovirt.engine.ui.uicommonweb.models.vms.VmBasedWidgetSwitchModeCommand)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 ActionType (org.ovirt.engine.core.common.action.ActionType)3 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)3 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)3 VmType (org.ovirt.engine.core.common.businessentities.VmType)3 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)3 VmWatchdogType (org.ovirt.engine.core.common.businessentities.VmWatchdogType)3 QueryType (org.ovirt.engine.core.common.queries.QueryType)3 Guid (org.ovirt.engine.core.compat.Guid)3 Frontend (org.ovirt.engine.ui.frontend.Frontend)3