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);
}
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()));
}
}
}
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);
}
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();
}
}
}
Aggregations