Search in sources :

Example 11 with VmGuestAgentInterface

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

the class VmInterfaceListGroupItem method createGuestAgentContainerPanel.

private Container createGuestAgentContainerPanel(VmNetworkInterface networkInterface, List<VmGuestAgentInterface> allGuestAgentData) {
    Row content = new Row();
    Column column = new Column(ColumnSize.MD_12);
    content.add(column);
    for (VmGuestAgentInterface guestAgentInterface : allGuestAgentData) {
        if (guestAgentInterface.getMacAddress() != null && guestAgentInterface.getMacAddress().equals(networkInterface.getMacAddress())) {
            DListElement dl = Document.get().createDLElement();
            dl.addClassName(DL_HORIZONTAL);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.nameVmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getInterfaceName()), dl);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv4VmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getIpv4Addresses() != null ? String.join(COMMA_DELIMITER, guestAgentInterface.getIpv4Addresses()) : constants.notAvailableLabel()), dl);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv6VmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getIpv6Addresses() != null ? String.join(COMMA_DELIMITER, guestAgentInterface.getIpv6Addresses()) : constants.notAvailableLabel()), dl);
            addDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), SafeHtmlUtils.fromString(guestAgentInterface.getMacAddress()), dl);
            column.getElement().appendChild(dl);
        }
    }
    if (allGuestAgentData.isEmpty()) {
        Span noDataSpan = new Span();
        noDataSpan.setText(constants.notAvailableLabel());
        column.add(noDataSpan);
    }
    return createItemContainerPanel(content);
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) Column(org.gwtbootstrap3.client.ui.Column) Row(org.gwtbootstrap3.client.ui.Row) DListElement(com.google.gwt.dom.client.DListElement) Span(org.gwtbootstrap3.client.ui.html.Span)

Example 12 with VmGuestAgentInterface

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

the class VmInterfaceListGroupItem method addNetworkMainInfo.

protected void addNetworkMainInfo(VmNetworkInterface networkInterface, HasWidgets targetPanel) {
    DListElement dl = Document.get().createDLElement();
    FlowPanel infoPanel = new FlowPanel();
    StringJoiner ipv4AddressJoiner = new StringJoiner(COMMA_DELIMITER);
    StringJoiner ipv6AddressJoiner = new StringJoiner(COMMA_DELIMITER);
    for (VmGuestAgentInterface guestAgentInterface : allGuestAgentData) {
        if (guestAgentInterface.getMacAddress() != null && networkInterface.getMacAddress().equals(guestAgentInterface.getMacAddress())) {
            if (guestAgentInterface.getIpv4Addresses() != null) {
                ipv4AddressJoiner.add(String.join(COMMA_DELIMITER, guestAgentInterface.getIpv4Addresses()));
            }
            if (guestAgentInterface.getIpv6Addresses() != null) {
                ipv6AddressJoiner.add(String.join(COMMA_DELIMITER, guestAgentInterface.getIpv6Addresses()));
            }
        }
    }
    String ipv4Address = ipv4AddressJoiner.toString();
    if (ipv4Address.isEmpty()) {
        ipv4Address = constants.notAvailableLabel();
    }
    String ipv6Address = ipv6AddressJoiner.toString();
    if (ipv6Address.isEmpty()) {
        ipv6Address = constants.notAvailableLabel();
    }
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.networkNameInterface()), SafeHtmlUtils.fromString(networkInterface.getNetworkName() != null ? networkInterface.getNetworkName() : constants.unAvailablePropertyLabel()), dl);
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv4VmGuestAgent()), SafeHtmlUtils.fromString(ipv4Address), dl);
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv6VmGuestAgent()), SafeHtmlUtils.fromString(ipv6Address), dl);
    addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), SafeHtmlUtils.fromString(networkInterface.getMacAddress()), dl);
    infoPanel.getElement().appendChild(dl);
    targetPanel.add(infoPanel);
}
Also used : VmGuestAgentInterface(org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) DListElement(com.google.gwt.dom.client.DListElement) StringJoiner(java.util.StringJoiner)

Aggregations

VmGuestAgentInterface (org.ovirt.engine.core.common.businessentities.VmGuestAgentInterface)12 ArrayList (java.util.ArrayList)7 DListElement (com.google.gwt.dom.client.DListElement)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 StringJoiner (java.util.StringJoiner)1 Column (org.gwtbootstrap3.client.ui.Column)1 Row (org.gwtbootstrap3.client.ui.Row)1 Span (org.gwtbootstrap3.client.ui.html.Span)1 Test (org.junit.Test)1 Ip (org.ovirt.engine.api.model.Ip)1 IpVersion (org.ovirt.engine.api.model.IpVersion)1 ReportedDevice (org.ovirt.engine.api.model.ReportedDevice)1