Search in sources :

Example 51 with EntityModel

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

the class UnitVmModel method setBootSequence.

public void setBootSequence(BootSequence value) {
    ArrayList<BootSequence> items = new ArrayList<>();
    for (char a : value.toString().toCharArray()) {
        items.add(BootSequence.valueOf(String.valueOf(a)));
    }
    EntityModel<BootSequence> firstBootDevice = null;
    for (EntityModel<BootSequence> item : getFirstBootDevice().getItems()) {
        if (item.getEntity() == Linq.firstOrNull(items)) {
            firstBootDevice = item;
        }
    }
    getFirstBootDevice().setSelectedItem(firstBootDevice);
    Iterable<EntityModel<BootSequence>> secondDeviceOptions = getSecondBootDevice().getItems();
    if (items.size() > 1) {
        BootSequence last = items.get(items.size() - 1);
        for (EntityModel<BootSequence> a : secondDeviceOptions) {
            if (a.getEntity() != null && a.getEntity() == last) {
                getSecondBootDevice().setSelectedItem(a);
                break;
            }
        }
    } else {
        for (EntityModel<BootSequence> a : secondDeviceOptions) {
            if (a.getEntity() == null) {
                getSecondBootDevice().setSelectedItem(a);
                break;
            }
        }
    }
}
Also used : BootSequence(org.ovirt.engine.core.common.businessentities.BootSequence) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 52 with EntityModel

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

the class UnitVmModel method setRngDevice.

public void setRngDevice(VmRngDevice dev) {
    maybeSetEntity(rngBytes, dev.getBytes() == null ? null : dev.getBytes());
    maybeSetEntity(rngPeriod, dev.getPeriod() == null ? null : dev.getPeriod());
    maybeSetEntity(rngSourceUrandom, dev.getSource() == VmRngDevice.Source.RANDOM);
    maybeSetEntity(rngSourceHwrng, dev.getSource() == VmRngDevice.Source.HWRNG);
    // is invalid
    if (!Boolean.TRUE.equals(rngSourceUrandom.getEntity()) && !Boolean.TRUE.equals(rngSourceHwrng.getEntity())) {
        getBehavior().deactivateInstanceTypeManager();
        EntityModel[] entityModels = { rngSourceUrandom, rngSourceHwrng };
        for (EntityModel entityModel : entityModels) {
            if (entityModel.getIsAvailable() && entityModel.getIsChangable()) {
                // select first available
                entityModel.setEntity(Boolean.TRUE);
                break;
            }
        }
        getBehavior().activateInstanceTypeManager();
    }
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 53 with EntityModel

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

the class UnitVmModel method initFirstBootDevice.

private void initFirstBootDevice() {
    EntityModel tempVar = new EntityModel();
    tempVar.setTitle(ConstantsManager.getInstance().getConstants().hardDiskTitle());
    tempVar.setEntity(BootSequence.C);
    EntityModel hardDiskOption = tempVar;
    List<EntityModel<BootSequence>> firstBootDeviceItems = new ArrayList<>();
    firstBootDeviceItems.add(hardDiskOption);
    EntityModel tempVar2 = new EntityModel();
    tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cdromTitle());
    tempVar2.setEntity(BootSequence.D);
    firstBootDeviceItems.add(tempVar2);
    EntityModel tempVar3 = new EntityModel();
    tempVar3.setTitle(ConstantsManager.getInstance().getConstants().networkPXETitle());
    tempVar3.setEntity(BootSequence.N);
    firstBootDeviceItems.add(tempVar3);
    getFirstBootDevice().setItems(firstBootDeviceItems);
    getFirstBootDevice().setSelectedItem(hardDiskOption);
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList)

Example 54 with EntityModel

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

the class ErrataDetailModelForm method initialize.

public void initialize() {
    driver.initialize(this);
    formBuilder.addFormItem(new FormItem(constants.errataId(), id, 0, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataDateIssued(), issued, 1, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataType(), type, 2, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataSeverity(), severity, 3, 0) {

        @Override
        public boolean getIsAvailable() {
            EntityModel<Erratum> model = getModel();
            return model != null && model.getEntity() != null && model.getEntity().getSeverity() != null;
        }
    }, 2, 10);
    formBuilder.addFormItem(new FormItem(constants.description(), description, 4, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.solution(), solution, 5, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.summary(), summary, 6, 0), 2, 10);
    formBuilder.addFormItem(new FormItem(constants.errataPackages(), packages, 7, 0), 2, 10);
}
Also used : FormItem(org.ovirt.engine.ui.common.widget.form.FormItem) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 55 with EntityModel

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

the class HostListModel method onInstall.

public void onInstall() {
    final VDS host = getSelectedItem();
    InstallModel model = (InstallModel) getWindow();
    if (!model.validate(host.isOvirtVintageNode())) {
        model.setValidationFailed(new EntityModel<>(true));
        return;
    }
    final UpdateVdsActionParameters param = new UpdateVdsActionParameters();
    param.setvds(host);
    param.setVdsId(host.getId());
    param.setPassword(model.getUserPassword().getEntity());
    param.setReinstallOrUpgrade(true);
    param.setInstallHost(true);
    param.setoVirtIsoFile(null);
    param.setOverrideFirewall(model.getOverrideIpTables().getEntity());
    param.setActivateHost(model.getActivateHostAfterInstall().getEntity());
    param.setAuthMethod(model.getAuthenticationMethod());
    // Explicitly set null, to be clear we don't want to update fence agents.
    param.setFenceAgents(null);
    param.setHostedEngineDeployConfiguration(new HostedEngineDeployConfiguration(model.getHostedEngineHostModel().getSelectedItem()));
    Provider<?> networkProvider = (Provider<?>) model.getNetworkProviders().getSelectedItem();
    if (networkProvider == null) {
        param.getVdsStaticData().setOpenstackNetworkProviderId(null);
    } else {
        param.getVdsStaticData().setOpenstackNetworkProviderId(networkProvider.getId());
        param.setNetworkMappings((String) model.getInterfaceMappings().getEntity());
    }
    AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(returnValue -> Frontend.getInstance().runAction(ActionType.InstallVds, param, result -> {
        ActionReturnValue returnValue1 = result.getReturnValue();
        if (returnValue1 != null && returnValue1.getSucceeded()) {
            cancel();
        }
    })), host.getClusterId());
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) TagModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagModel) RpmVersion(org.ovirt.engine.core.compat.RpmVersion) Arrays(java.util.Arrays) AttachEntityToTagParameters(org.ovirt.engine.core.common.action.AttachEntityToTagParameters) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) SetHaMaintenanceParameters(org.ovirt.engine.core.common.action.SetHaMaintenanceParameters) Inject(com.google.inject.Inject) Provider(org.ovirt.engine.core.common.businessentities.Provider) TagListModel(org.ovirt.engine.ui.uicommonweb.models.tags.TagListModel) Event(org.ovirt.engine.ui.uicompat.Event) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Map(java.util.Map) Tags(org.ovirt.engine.core.common.businessentities.Tags) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) VdsActionParameters(org.ovirt.engine.core.common.action.VdsActionParameters) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) ActionUtils(org.ovirt.engine.core.common.ActionUtils) RoleType(org.ovirt.engine.core.common.businessentities.RoleType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) VdsPowerDownParameters(org.ovirt.engine.core.common.action.VdsPowerDownParameters) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Set(java.util.Set) BusinessEntitiesDefinitions(org.ovirt.engine.core.common.businessentities.BusinessEntitiesDefinitions) StringHelper(org.ovirt.engine.core.compat.StringHelper) FrontendUrlUtils(org.ovirt.engine.ui.frontend.utils.FrontendUrlUtils) VdsSpmStatus(org.ovirt.engine.core.common.businessentities.VdsSpmStatus) DbUser(org.ovirt.engine.core.common.businessentities.aaa.DbUser) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) HostGeneralModel.createUpgradeModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostGeneralModel.createUpgradeModel) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) HostErrataCountModel(org.ovirt.engine.ui.uicommonweb.models.HostErrataCountModel) FenceAgent(org.ovirt.engine.core.common.businessentities.pm.FenceAgent) Uri(org.ovirt.engine.ui.uicommonweb.Uri) VdcObjectType(org.ovirt.engine.core.common.VdcObjectType) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) QueryType(org.ovirt.engine.core.common.queries.QueryType) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) HostGlusterSwiftListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterSwiftListModel) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) HashMap(java.util.HashMap) 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) HostGlusterStorageDevicesListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.HostGlusterStorageDevicesListModel) HashSet(java.util.HashSet) FenceVdsManualyParameters(org.ovirt.engine.core.common.action.FenceVdsManualyParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) ChangeVDSClusterParameters(org.ovirt.engine.core.common.action.ChangeVDSClusterParameters) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel) NumaSupportModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.NumaSupportModel) Permission(org.ovirt.engine.core.common.businessentities.Permission) Window(com.google.gwt.user.client.Window) ForceSelectSPMParameters(org.ovirt.engine.core.common.action.ForceSelectSPMParameters) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) ReversibleFlow(org.ovirt.engine.ui.uicompat.ReversibleFlow) RemoveVdsParameters(org.ovirt.engine.core.common.action.RemoveVdsParameters) ExternalComputeResource(org.ovirt.engine.core.common.businessentities.ExternalComputeResource) Model(org.ovirt.engine.ui.uicommonweb.models.Model) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) JsSingleValueStringObject(org.ovirt.engine.ui.frontend.utils.JsSingleValueStringObject) ApproveVdsParameters(org.ovirt.engine.core.common.action.hostdeploy.ApproveVdsParameters) HaMaintenanceMode(org.ovirt.engine.core.common.businessentities.HaMaintenanceMode) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) TaskListModel(org.ovirt.engine.ui.uicommonweb.models.events.TaskListModel) FenceVdsActionParameters(org.ovirt.engine.core.common.action.FenceVdsActionParameters) FenceProxySourceTypeHelper(org.ovirt.engine.core.common.utils.pm.FenceProxySourceTypeHelper) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) HostAffinityLabelListModel(org.ovirt.engine.ui.uicommonweb.models.configure.labels.list.HostAffinityLabelListModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) TagAssigningModel(org.ovirt.engine.ui.uicommonweb.TagAssigningModel) HostDeviceListModel(org.ovirt.engine.ui.uicommonweb.models.vms.hostdev.HostDeviceListModel) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) Comparator(java.util.Comparator) Collections(java.util.Collections) VDS(org.ovirt.engine.core.common.businessentities.VDS) MaintenanceNumberOfVdssParameters(org.ovirt.engine.core.common.action.MaintenanceNumberOfVdssParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VDS(org.ovirt.engine.core.common.businessentities.VDS) UpdateVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.UpdateVdsActionParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) HostedEngineDeployConfiguration(org.ovirt.engine.core.common.businessentities.HostedEngineDeployConfiguration) Provider(org.ovirt.engine.core.common.businessentities.Provider) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)

Aggregations

EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)105 ArrayList (java.util.ArrayList)56 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)27 List (java.util.List)26 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)23 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)22 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)22 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)22 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)19 ActionType (org.ovirt.engine.core.common.action.ActionType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)17 Guid (org.ovirt.engine.core.compat.Guid)17 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 QueryType (org.ovirt.engine.core.common.queries.QueryType)16 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)13