Search in sources :

Example 1 with NetworkView

use of org.ovirt.engine.core.common.businessentities.network.NetworkView in project ovirt-engine by oVirt.

the class NetworkListModel method updateDetailsAvailability.

@Override
protected void updateDetailsAvailability() {
    super.updateDetailsAvailability();
    NetworkView network = getSelectedItem();
    if (network == null || !network.isExternal()) {
        externalSubnetListModel.setIsAvailable(false);
    } else {
        AsyncDataProvider.getInstance().getProviderById(new AsyncQuery<>(provider -> {
            boolean available = provider != null ? !provider.getIsUnmanaged() : false;
            externalSubnetListModel.setIsAvailable(available);
        }), network.getProvidedBy().getProviderId());
    }
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) NetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NetworkModel) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) Inject(com.google.inject.Inject) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) EditNetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.EditNetworkModel) ArrayList(java.util.ArrayList) NewNetworkModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.NewNetworkModel) RemoveNetworksModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.RemoveNetworksModel) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) Network(org.ovirt.engine.core.common.businessentities.network.Network) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) List(java.util.List) Provider(com.google.inject.Provider) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView) NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView)

Example 2 with NetworkView

use of org.ovirt.engine.core.common.businessentities.network.NetworkView in project ovirt-engine by oVirt.

the class NetworkProfileListModel method updateActionAvailability.

private void updateActionAvailability() {
    NetworkView network = getEntity();
    getNewCommand().setIsExecutionAllowed(network != null && network.isVmNetwork());
    getEditCommand().setIsExecutionAllowed(getSelectedItems() != null && getSelectedItems().size() == 1);
    getRemoveCommand().setIsExecutionAllowed(getSelectedItems() != null && getSelectedItems().size() > 0);
}
Also used : NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView)

Example 3 with NetworkView

use of org.ovirt.engine.core.common.businessentities.network.NetworkView in project ovirt-engine by oVirt.

the class NetworkViewDaoTest method testGetAllForProvider.

/**
 * Ensures the right set of networks are returned for the given provider.
 */
@Test
public void testGetAllForProvider() {
    List<NetworkView> result = dao.getAllForProvider(FixturesTool.PROVIDER_ID);
    assertNotNull(result);
    assertFalse(result.isEmpty());
    for (NetworkView network : result) {
        assertEquals(FixturesTool.PROVIDER_ID, network.getProvidedBy().getProviderId());
        assertEquals(FixturesTool.PROVIDER_NAME, network.getProviderName());
    }
}
Also used : NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView) Test(org.junit.Test)

Example 4 with NetworkView

use of org.ovirt.engine.core.common.businessentities.network.NetworkView in project ovirt-engine by oVirt.

the class NetworkExternalSubnetListModel method adjustActionButtonsForNetworkReadOnlyProperty.

private void adjustActionButtonsForNetworkReadOnlyProperty() {
    NetworkView networkView = getEntity();
    if (!networkView.isExternal()) {
        setCommandExecutionAllowed(true);
        return;
    }
    Guid providerGuid = networkView.getProvidedBy().getProviderId();
    Frontend.getInstance().runQuery(QueryType.GetProviderById, new IdQueryParameters(providerGuid), createProviderReadOnlyCallback());
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Guid(org.ovirt.engine.core.compat.Guid) NetworkView(org.ovirt.engine.core.common.businessentities.network.NetworkView)

Aggregations

NetworkView (org.ovirt.engine.core.common.businessentities.network.NetworkView)4 Guid (org.ovirt.engine.core.compat.Guid)2 Inject (com.google.inject.Inject)1 Provider (com.google.inject.Provider)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.junit.Test)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 SearchType (org.ovirt.engine.core.common.interfaces.SearchType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryType (org.ovirt.engine.core.common.queries.QueryType)1 SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)1 SearchObjects (org.ovirt.engine.core.searchbackend.SearchObjects)1 Linq (org.ovirt.engine.ui.uicommonweb.Linq)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)1 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)1 HasEntity (org.ovirt.engine.ui.uicommonweb.models.HasEntity)1