Search in sources :

Example 1 with HostInterface

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

the class HostNetworkInterfaceBondedListViewItem method createSlavesAdditionalInfo.

private IsWidget createSlavesAdditionalInfo() {
    FlowPanel panel = new FlowPanel();
    List<HostInterface> slaves = getEntity().getInterfaces();
    slavesExpand = new ExpandableListViewItem(SafeHtmlUtils.fromString(messages.slaves(slaves.size())));
    getClickHandlerRegistrations().add(slavesExpand.addClickHandler(this));
    panel.add(slavesExpand);
    return panel;
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) ExpandableListViewItem(org.ovirt.engine.ui.common.widget.listgroup.ExpandableListViewItem) HostInterface(org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterface)

Example 2 with HostInterface

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

the class HostNetworkInterfaceBondedListViewItem method createSlavesContainer.

private Container createSlavesContainer() {
    Row content = new Row();
    Column gridColumn = new Column(ColumnSize.SM_12);
    content.add(gridColumn);
    Container container = createItemContainerPanel(content);
    CellTable<HostInterface> slavesTable = new CellTable<>(MAX_SLAVES, (Resources) GWT.create(CellTablePopupTableResources.class));
    slavesTable.getElement().addClassName(Styles.TABLE);
    slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_STRIPED);
    slavesTable.getElement().addClassName(PatternflyConstants.PF_TABLE_BORDERED);
    ListDataProvider<HostInterface> logicalNetworkDataProvider = new ListDataProvider<>();
    logicalNetworkDataProvider.addDataDisplay(slavesTable);
    logicalNetworkDataProvider.setList(getEntity().getInterfaces());
    // Setup columns
    TextColumn<HostInterface> name = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getName();
        }
    };
    slavesTable.addColumn(name, constants.macInterface());
    TextColumn<HostInterface> macAddress = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getInterface().getMacAddress() != null ? hostInterface.getInterface().getMacAddress() : constants.unAvailablePropertyLabel();
        }
    };
    slavesTable.addColumn(macAddress, constants.macInterface());
    TextColumn<HostInterface> speed = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return hostInterface.getInterface().hasSpeed() ? String.valueOf(hostInterface.getInterface().getSpeed()) : constants.unAvailablePropertyLabel();
        }
    };
    slavesTable.addColumn(speed, constants.speedInterface());
    TextColumn<HostInterface> rxRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return rateRenderer.render(new Double[] { hostInterface.getRxRate(), hostInterface.getSpeed().doubleValue() });
        }
    };
    slavesTable.addColumn(rxRate, templates.sub(constants.rxRate(), constants.mbps()));
    TextColumn<HostInterface> txRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return rateRenderer.render(new Double[] { hostInterface.getTxRate(), hostInterface.getSpeed().doubleValue() });
        }
    };
    slavesTable.addColumn(txRate, templates.sub(constants.txRate(), constants.mbps()));
    TextColumn<HostInterface> rxTotal = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return totalRenderer.render(hostInterface.getRxTotal());
        }
    };
    slavesTable.addColumn(rxTotal, templates.sub(constants.rxTotal(), constants.mbps()));
    TextColumn<HostInterface> txTotal = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return totalRenderer.render(hostInterface.getTxTotal());
        }
    };
    slavesTable.addColumn(txTotal, templates.sub(constants.txTotal(), constants.mbps()));
    TextColumn<HostInterface> dropRate = new TextColumn<HostInterface>() {

        @Override
        public String getValue(HostInterface hostInterface) {
            return String.valueOf(hostInterface.getRxDrop() + hostInterface.getTxDrop());
        }
    };
    slavesTable.addColumn(dropRate, templates.sub(constants.dropsInterface(), constants.pkts()));
    gridColumn.add(slavesTable);
    return container;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) Container(org.gwtbootstrap3.client.ui.Container) Column(org.gwtbootstrap3.client.ui.Column) TextColumn(com.google.gwt.user.cellview.client.TextColumn) CellTable(com.google.gwt.user.cellview.client.CellTable) HostInterface(org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterface) Row(org.gwtbootstrap3.client.ui.Row) TextColumn(com.google.gwt.user.cellview.client.TextColumn)

Example 3 with HostInterface

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

the class HostNetworkInterfaceBondedListViewItem method createActiveBondTooltipMessage.

private String createActiveBondTooltipMessage(Bond bond, HostInterfaceLineModel lineModel) {
    List<String> bondProperties = new ArrayList<>();
    String adPartnerMac = Objects.toString(bond.getAdPartnerMac(), "");
    bondProperties.add(messages.bondAdPartnerMac(adPartnerMac));
    String adAggregatorId = Objects.toString(bond.getAdAggregatorId(), "");
    bondProperties.add(messages.bondAdAggregatorId(adAggregatorId));
    for (HostInterface nic : lineModel.getInterfaces()) {
        String nicName = nic.getName();
        String nicAggregatorId = Objects.toString(nic.getInterface().getAdAggregatorId(), "");
        bondProperties.add(messages.bondSlaveAdAggregatorId(nicName, nicAggregatorId));
    }
    // $NON-NLS-1$
    return String.join("\n", bondProperties);
}
Also used : ArrayList(java.util.ArrayList) HostInterface(org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterface)

Aggregations

HostInterface (org.ovirt.engine.ui.uicommonweb.models.hosts.HostInterface)3 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 ListDataProvider (com.google.gwt.view.client.ListDataProvider)1 ArrayList (java.util.ArrayList)1 Column (org.gwtbootstrap3.client.ui.Column)1 Container (org.gwtbootstrap3.client.ui.Container)1 Row (org.gwtbootstrap3.client.ui.Row)1 ExpandableListViewItem (org.ovirt.engine.ui.common.widget.listgroup.ExpandableListViewItem)1