Search in sources :

Example 1 with HostSetupNetworksModel

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

the class HostSetupNetworksPopupView method edit.

@Override
public void edit(HostSetupNetworksModel uicommonModel) {
    driver.edit(uicommonModel);
    uicommonModel.getNicsChangedEvent().addListener((ev, sender, args) -> {
        // this is called after both networks and nics were retrieved
        HostSetupNetworksModel model = (HostSetupNetworksModel) sender;
        if (!keepStatusText) {
            initStatusPanel();
        }
        keepStatusText = false;
        int scrollPosition = nicScrollPanel.getVerticalScrollPosition();
        updateNetworks(model.getNetworkModels());
        updateLabels(model.getNewNetworkLabelModel(), model.getLabelModels());
        updateNics(model.getNicModels());
        nicScrollPanel.setVerticalScrollPosition(scrollPosition);
        // mark as rendered
        rendered = true;
    });
    uicommonModel.getOperationCandidateEvent().addListener((ev, sender, args) -> {
        NetworkOperation candidate = args.getCandidate();
        NetworkItemModel<?> op1 = args.getOp1();
        NetworkItemModel<?> op2 = args.getOp2();
        if (candidate == null) {
            setErrorStatus(constants.noValidActionSetupNetwork());
        } else {
            if (candidate.isErroneousOperation()) {
                setErrorStatus(candidate.getMessage(op1, op2));
            } else {
                if (candidate.isDisplayNetworkAffected(op1, op2)) {
                    setWarningStatus(messages.moveDisplayNetworkWarning(candidate.getMessage(op1, op2)));
                } else if (candidate.isRequiredNetworkAffected(op1, op2)) {
                    setWarningStatus(messages.detachRequiredNetworkWarning(candidate.getMessage(op1, op2)));
                } else {
                    setValidStatus(candidate.getMessage(op1, op2));
                }
            }
        }
    });
    internalNetworkList.setSetupModel(uicommonModel);
    externalNetworkList.setSetupModel(uicommonModel);
    labelsList.setSetupModel(uicommonModel);
}
Also used : HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel) NetworkOperation(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkOperation)

Example 2 with HostSetupNetworksModel

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

the class ItemInfoPopup method addLldpInfo.

private void addLldpInfo(NetworkInterfaceModel nic) {
    HostSetupNetworksModel model = nic.getSetupModel();
    String name = nic.getOriginalIface().getName();
    LldpInfo lldpInfo = model.getNetworkLldpByName(name);
    insertHorizontalLine();
    addRow(templates.strongTextWithColor(constants.linkLayerInfo(), SafeStylesUtils.forTrustedColor(WHITE_TEXT_COLOR)));
    if (lldpInfo != null) {
        if (lldpInfo.isEnabled()) {
            List<Tlv> filteredTlvs = lldpInfo.getTlvs().stream().filter(this::isTlvImportant).collect(Collectors.toList());
            if (!filteredTlvs.isEmpty()) {
                filteredTlvs.stream().forEach(tlv -> tlv.getProperties().entrySet().stream().forEach(entry -> addRow(entry.getKey(), entry.getValue())));
            } else {
                addRow(SafeHtmlUtils.fromSafeConstant(constants.noImportantLLDP()));
            }
        } else {
            addRow(SafeHtmlUtils.fromSafeConstant(constants.lldpInfoDisabled()));
        }
    } else {
        if (model.isNetworkLldpInfoPresent()) {
            addRow(SafeHtmlUtils.fromSafeConstant(constants.noLldpInfoAvailable()));
        } else {
            addRow(SafeHtmlUtils.fromSafeConstant(constants.fetchingLldpInfo()));
        }
    }
}
Also used : EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) ImageResource(com.google.gwt.resources.client.ImageResource) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) FlexTable(com.google.gwt.user.client.ui.FlexTable) SafeStylesUtils(com.google.gwt.safecss.shared.SafeStylesUtils) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol) ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) Network(org.ovirt.engine.core.common.businessentities.network.Network) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv) AbstractImagePrototype(com.google.gwt.user.client.ui.AbstractImagePrototype) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) ApplicationResources(org.ovirt.engine.ui.webadmin.ApplicationResources) NetworkItemModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel) Linq(org.ovirt.engine.ui.uicommonweb.Linq) DecoratedPopupPanel(com.google.gwt.user.client.ui.DecoratedPopupPanel) ApplicationMessages(org.ovirt.engine.ui.webadmin.ApplicationMessages) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) StringHelper(org.ovirt.engine.core.compat.StringHelper) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) TlvSpecificType(org.ovirt.engine.core.common.businessentities.network.TlvSpecificType) Collectors(java.util.stream.Collectors) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) ReportedConfigurations(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations) ApplicationTemplates(org.ovirt.engine.ui.webadmin.ApplicationTemplates) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) InterfacePropertiesAccessor(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor) NetworkLabelModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv)

Example 3 with HostSetupNetworksModel

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

the class NetworkHostListModel method setupNetworks.

public void setupNetworks() {
    if (getWindow() != null) {
        return;
    }
    HostSetupNetworksModel setupNetworksWindowModel = new HostSetupNetworksModel(this, getSelectedItem().getSecond());
    setWindow(setupNetworksWindowModel);
}
Also used : HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel)

Example 4 with HostSetupNetworksModel

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

the class NetworkGroup method doDrag.

private void doDrag(DragDropEventBase<?> event, boolean isDrop) {
    HostSetupNetworksModel setupModel = nicModel.getSetupModel();
    String dragDropEventData = NetworkItemPanel.getDragDropEventData(event, isDrop);
    String type = NetworkItemPanel.getType(dragDropEventData);
    String data = NetworkItemPanel.getData(dragDropEventData);
    if (!StringHelper.isNullOrEmpty(data)) {
        if (setupModel.candidateOperation(data, type, nicModel.getName(), HostSetupNetworksModel.NIC, isDrop)) {
            table.getElement().addClassName(style.networkGroupDragOver());
            // allow drag/drop (look at http://www.w3.org/TR/html5/dnd.html#dndevents)
            event.preventDefault();
        }
    }
}
Also used : HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel)

Aggregations

HostSetupNetworksModel (org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel)4 ImageResource (com.google.gwt.resources.client.ImageResource)1 SafeStylesUtils (com.google.gwt.safecss.shared.SafeStylesUtils)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)1 AbstractImagePrototype (com.google.gwt.user.client.ui.AbstractImagePrototype)1 DecoratedPopupPanel (com.google.gwt.user.client.ui.DecoratedPopupPanel)1 FlexTable (com.google.gwt.user.client.ui.FlexTable)1 Widget (com.google.gwt.user.client.ui.Widget)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)1 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)1 LldpInfo (org.ovirt.engine.core.common.businessentities.network.LldpInfo)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 ReportedConfiguration (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration)1 ReportedConfigurations (org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations)1 Tlv (org.ovirt.engine.core.common.businessentities.network.Tlv)1 TlvSpecificType (org.ovirt.engine.core.common.businessentities.network.TlvSpecificType)1