Search in sources :

Example 1 with HostVLan

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

the class HostNetworkInterfaceListViewItem method createDetailAdditionalInfo.

private IsWidget createDetailAdditionalInfo() {
    FlowPanel panel = new FlowPanel();
    List<HostVLan> logicalNetworks = calculateLogicalNetworks(getEntity());
    List<IsWidget> icons = new ArrayList<>();
    if (containsManagement(logicalNetworks)) {
        icons.add(createManagementStatusPanel());
    }
    if (containsOutOfSync(logicalNetworks)) {
        icons.add(createNeedsSyncStatusPanel());
    }
    String logicalNetworksText = logicalNetworks.size() == 1 ? constants.logicalNetwork() : messages.logicalNetworks(logicalNetworks.size());
    logicalNetworkExpand = new ExpandableListViewItem(SafeHtmlUtils.fromString(logicalNetworksText), icons);
    getClickHandlerRegistrations().add(logicalNetworkExpand.addClickHandler(this));
    panel.add(logicalNetworkExpand);
    return panel;
}
Also used : IsWidget(com.google.gwt.user.client.ui.IsWidget) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) ArrayList(java.util.ArrayList) ExpandableListViewItem(org.ovirt.engine.ui.common.widget.listgroup.ExpandableListViewItem) HostVLan(org.ovirt.engine.ui.uicommonweb.models.hosts.HostVLan)

Example 2 with HostVLan

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

the class HostNetworkInterfaceListViewItem method calculateLogicalNetworks.

private List<HostVLan> calculateLogicalNetworks(HostInterfaceLineModel entity) {
    List<HostVLan> logicalNetworks = new ArrayList<>();
    VdsNetworkInterface mainInterface = getNetworkInterface();
    if (mainInterface != null && mainInterface.getNetworkName() != null && !mainInterface.getNetworkName().isEmpty()) {
        HostVLan main = new HostVLan();
        main.setInterface(mainInterface);
        main.setNetworkName(mainInterface.getNetworkName());
        main.setIpv4Address(mainInterface.getIpv4Address());
        main.setIpv6Address(mainInterface.getIpv6Address());
        logicalNetworks.add(main);
    }
    if (entity.getVLans() != null) {
        logicalNetworks.addAll(entity.getVLans());
    }
    return logicalNetworks;
}
Also used : ArrayList(java.util.ArrayList) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) HostVLan(org.ovirt.engine.ui.uicommonweb.models.hosts.HostVLan)

Example 3 with HostVLan

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

the class HostNetworkInterfaceListViewItem method createLogicalNetworkContainer.

private Container createLogicalNetworkContainer() {
    List<HostVLan> logicalNetworks = calculateLogicalNetworks(getEntity());
    Row content = new Row();
    Column gridColumn = new Column(ColumnSize.SM_12);
    content.add(gridColumn);
    Container container = createItemContainerPanel(content);
    CellTable<HostVLan> logicalNetworkTable = new CellTable<>(MAX_LOGICAL_NETWORKS, (Resources) GWT.create(CellTablePopupTableResources.class));
    logicalNetworkTable.getElement().addClassName(Styles.TABLE);
    logicalNetworkTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
    logicalNetworkTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
    ListDataProvider<HostVLan> logicalNetworkDataProvider = new ListDataProvider<>();
    logicalNetworkDataProvider.addDataDisplay(logicalNetworkTable);
    logicalNetworkDataProvider.setList(logicalNetworks);
    final HostVLanNameRenderer renderer = new HostVLanNameRenderer();
    // Setup columns
    AbstractIconTypeColumn<HostVLan> management = new AbstractIconTypeColumn<HostVLan>() {

        @Override
        public IconType getValue(HostVLan logicalNetwork) {
            if (logicalNetwork.getInterface() != null && logicalNetwork.getInterface().getIsManagement()) {
                return IconType.INSTITUTION;
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(HostVLan logicalNetwork) {
            return SafeHtmlUtils.fromSafeConstant(constants.managementNetworkLabel());
        }
    };
    IconTypeHeader managementHeader = new IconTypeHeader(IconType.INSTITUTION, ICON_COLOR, SafeHtmlUtils.fromSafeConstant(constants.managementNetworkLabel()));
    management.getCell().setColor(SafeHtmlUtils.fromSafeConstant(ICON_COLOR));
    logicalNetworkTable.addColumn(management, managementHeader);
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(management, "40px");
    AbstractIconTypeColumn<HostVLan> sync = new AbstractIconTypeColumn<HostVLan>() {

        @Override
        public IconType getValue(HostVLan logicalNetwork) {
            if (logicalNetwork != null && logicalNetwork.getInterface() != null && isOutOfSync(logicalNetwork.getInterface().getNetworkImplementationDetails())) {
                return IconType.CHAIN_BROKEN;
            }
            return null;
        }

        @Override
        public SafeHtml getTooltip(HostVLan logicalNetwork) {
            return SafeHtmlUtils.fromSafeConstant(constants.hostOutOfSync());
        }
    };
    IconTypeHeader syncHeader = new IconTypeHeader(IconType.CHAIN_BROKEN, ICON_COLOR, SafeHtmlUtils.fromSafeConstant(constants.hostOutOfSync()));
    sync.getCell().setColor(SafeHtmlUtils.fromSafeConstant(RED));
    logicalNetworkTable.addColumn(sync, syncHeader);
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(sync, "40px");
    TextColumn<HostVLan> vlan = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            if (logicalNetwork == null || logicalNetwork.getName() == null || logicalNetwork.getName().isEmpty()) {
                return "";
            }
            return renderer.render(logicalNetwork);
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(vlan, "175px");
    logicalNetworkTable.addColumn(vlan, constants.vlanInterface());
    TextColumn<HostVLan> networkName = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getNetworkName();
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(networkName, "175px");
    logicalNetworkTable.addColumn(networkName, constants.networkNameInterface());
    TextColumn<HostVLan> ipv4 = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getIpv4Address() != null ? logicalNetwork.getIpv4Address() : "";
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(ipv4, "175px");
    logicalNetworkTable.addColumn(ipv4, constants.ipv4AddressInterface());
    TextColumn<HostVLan> ipv6 = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return logicalNetwork.getIpv6Address() != null ? logicalNetwork.getIpv6Address() : "";
        }
    };
    // $NON-NLS-1$
    logicalNetworkTable.setColumnWidth(ipv6, "175px");
    logicalNetworkTable.addColumn(ipv6, constants.ipv6AddressInterface());
    TextColumn<HostVLan> emptyTail = new TextColumn<HostVLan>() {

        @Override
        public String getValue(HostVLan logicalNetwork) {
            return "";
        }
    };
    logicalNetworkTable.addColumn(emptyTail, "");
    gridColumn.add(logicalNetworkTable);
    return container;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) HostVLanNameRenderer(org.ovirt.engine.ui.webadmin.widget.renderer.HostVLanNameRenderer) Container(org.gwtbootstrap3.client.ui.Container) Column(org.gwtbootstrap3.client.ui.Column) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn) CellTable(com.google.gwt.user.cellview.client.CellTable) IconTypeHeader(org.ovirt.engine.ui.common.widget.table.header.IconTypeHeader) HostVLan(org.ovirt.engine.ui.uicommonweb.models.hosts.HostVLan) Row(org.gwtbootstrap3.client.ui.Row) AbstractIconTypeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Aggregations

HostVLan (org.ovirt.engine.ui.uicommonweb.models.hosts.HostVLan)3 ArrayList (java.util.ArrayList)2 CellTable (com.google.gwt.user.cellview.client.CellTable)1 TextColumn (com.google.gwt.user.cellview.client.TextColumn)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 IsWidget (com.google.gwt.user.client.ui.IsWidget)1 ListDataProvider (com.google.gwt.view.client.ListDataProvider)1 Column (org.gwtbootstrap3.client.ui.Column)1 Container (org.gwtbootstrap3.client.ui.Container)1 Row (org.gwtbootstrap3.client.ui.Row)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 ExpandableListViewItem (org.ovirt.engine.ui.common.widget.listgroup.ExpandableListViewItem)1 AbstractIconTypeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractIconTypeColumn)1 IconTypeHeader (org.ovirt.engine.ui.common.widget.table.header.IconTypeHeader)1 HostVLanNameRenderer (org.ovirt.engine.ui.webadmin.widget.renderer.HostVLanNameRenderer)1