Search in sources :

Example 1 with VnicInstanceType

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

the class ProfilesInstanceTypeEditor method createGhostValue.

@Override
protected VnicInstanceType createGhostValue() {
    VmNetworkInterface vnic = new VmNetworkInterface();
    vnic.setName(AsyncDataProvider.getInstance().getNewNicName(vnics));
    vnics.add(vnic);
    VnicInstanceType vnicWithProfile = new VnicInstanceType(vnic);
    vnicWithProfile.setItems(vnicProfiles);
    return vnicWithProfile;
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) VnicInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType)

Example 2 with VnicInstanceType

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

the class ProfilesInstanceTypeEditor method init.

@Override
protected void init(VnicInstancesModel model) {
    vnicProfiles = model.getVnicProfiles().getItems();
    if (vnicProfiles == null) {
        vnicProfiles = new ArrayList<>();
    }
    Iterable<VnicInstanceType> values = model.getItems();
    vnics.clear();
    if (values != null) {
        for (VnicInstanceType value : values) {
            vnics.add(value.getNetworkInterface());
        }
    }
    super.init(model);
}
Also used : VnicInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType)

Example 3 with VnicInstanceType

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

the class VmInstanceTypeManager method updateNetworkInterfaces.

private void updateNetworkInterfaces(final ProfileBehavior behavior, final List<VmNetworkInterface> argNics) {
    AsyncQuery<List<VnicProfileView>> query = new AsyncQuery<>(profiles -> {
        List<VnicInstanceType> vnicInstanceTypes = new ArrayList<>();
        List<VmNetworkInterface> nics = (argNics == null) ? new ArrayList<VmNetworkInterface>() : argNics;
        for (VmNetworkInterface nic : nics) {
            final VnicInstanceType vnicInstanceType = new VnicInstanceType(nic);
            vnicInstanceType.setItems(profiles);
            behavior.initSelectedProfile(vnicInstanceType, vnicInstanceType.getNetworkInterface());
            vnicInstanceTypes.add(vnicInstanceType);
        }
        getModel().getNicsWithLogicalNetworks().getVnicProfiles().setItems(profiles);
        getModel().getNicsWithLogicalNetworks().setItems(vnicInstanceTypes);
        getModel().getNicsWithLogicalNetworks().setSelectedItem(Linq.firstOrNull(vnicInstanceTypes));
    });
    behavior.initProfiles(getModel().getSelectedCluster().getId(), getModel().getSelectedDataCenter().getId(), query);
}
Also used : VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) AsyncQuery(org.ovirt.engine.ui.frontend.AsyncQuery) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) VnicInstanceType(org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType)

Aggregations

VnicInstanceType (org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType)3 VmNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AsyncQuery (org.ovirt.engine.ui.frontend.AsyncQuery)1