Skip to content

Commit

Permalink
feat: add front end support for WPA Enterprise (#4852)
Browse files Browse the repository at this point in the history
* feat: add front end support for WPA Enterprise

* fix: constrain net.wifi version

* fix: copyright header

* fix: copyright header

* fix: copyright header

* refactor: removed char

* feat: conditionally enable and disable UI elements

* feat: added password validation

* fix: hid check password button
  • Loading branch information
GregoryIvo authored and pierantoniomerlino committed Sep 26, 2023
1 parent d34d9a9 commit 0a8afa3
Show file tree
Hide file tree
Showing 18 changed files with 1,009 additions and 78 deletions.
2 changes: 1 addition & 1 deletion kura/org.eclipse.kura.web2/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Import-Package: com.eclipsesource.json;version="0.9.5",
org.eclipse.kura.net.status.modem;version="[1.0,2.0)",
org.eclipse.kura.net.status.wifi;version="[1.0,2.0)",
org.eclipse.kura.net.status.vlan;version="[1.0,2.0)",
org.eclipse.kura.net.wifi;version="[2.2,3.0)",
org.eclipse.kura.net.wifi;version="[2.4,2.5)",
org.eclipse.kura.net.vlan;version="[1.0,2.0)",
org.eclipse.kura.position;version="[1.0,2.0)",
org.eclipse.kura.rest.configuration.api;version="[1.0,2.0)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ interface NetworkTabsUiUiBinder extends UiBinder<Widget, NetworkTabsUi> {
AnchorListItem ip6TabAnchorItem;
AnchorListItem dhcp4NatTabAnchorItem;
AnchorListItem wirelessTabAnchorItem;
AnchorListItem net8021xTabAnchorItem;
AnchorListItem modemTabAnchorItem;
AnchorListItem modemGpsTabAnchorItem;
AnchorListItem modemAntennaTabAnchorItem;
Expand All @@ -74,6 +75,7 @@ interface NetworkTabsUiUiBinder extends UiBinder<Widget, NetworkTabsUi> {
TabIp6Ui ip6Tab;
TabDhcp4NatUi dhcp4NatTab;
TabWirelessUi wirelessTab;
Tab8021xUi set8021xTab;
TabModemUi modemTab;
TabModemGpsUi modemGpsTab;
TabModemAntennaUi modemAntennaTab;
Expand Down Expand Up @@ -122,6 +124,7 @@ private void initTabs() {

initIp4Tab();
initIp6Tab();
initWireless8021xTab();
initWirelessTab();
initModemTab();
initModemGpsTab();
Expand Down Expand Up @@ -161,7 +164,8 @@ private void initIp6Tab() {

private void initWirelessTab() {
this.wirelessTabAnchorItem = new AnchorListItem(MSGS.netWifiWireless());
this.wirelessTab = new TabWirelessUi(this.session, this.ip4Tab, this);
this.wirelessTab = new TabWirelessUi(this.session, this.ip4Tab, this.set8021xTab, this.net8021xTabAnchorItem,
this);

this.wirelessTabAnchorItem.addClickHandler(event -> {
setSelected(NetworkTabsUi.this.wirelessTabAnchorItem);
Expand All @@ -171,6 +175,18 @@ private void initWirelessTab() {
});
}

private void initWireless8021xTab() {
this.net8021xTabAnchorItem = new AnchorListItem(MSGS.netWifiWireless8021x());
this.set8021xTab = new Tab8021xUi(this.session, this);

this.net8021xTabAnchorItem.addClickHandler(event -> {
setSelected(NetworkTabsUi.this.net8021xTabAnchorItem);
NetworkTabsUi.this.selectedTab = NetworkTabsUi.this.set8021xTab;
NetworkTabsUi.this.content.clear();
NetworkTabsUi.this.content.add(NetworkTabsUi.this.set8021xTab);
});
}

private void initModemTab() {
this.modemTabAnchorItem = new AnchorListItem(MSGS.netModemCellular());
this.modemTab = new TabModemUi(this.session, this.ip4Tab, this);
Expand Down Expand Up @@ -250,6 +266,7 @@ public void setNetInterface(GwtNetInterfaceConfig selection) {
this.ip6Tab.setNetInterface(selection);
this.dhcp4NatTab.setNetInterface(selection);
this.wirelessTab.setNetInterface(selection);
this.set8021xTab.setNetInterface(selection);
this.modemTab.setNetInterface(selection);
this.modemGpsTab.setNetInterface(selection);
this.modemAntennaTab.setNetInterface(selection);
Expand All @@ -263,6 +280,7 @@ public void updateTabs() {
removeAllTabs();

insertTab(this.ip4TabAnchorItem);

if (this.isNet2) {
insertTab(this.ip6TabAnchorItem);
}
Expand All @@ -276,6 +294,7 @@ private void removeAllTabs() {
removeTab(this.ip4TabAnchorItem);
removeTab(this.ip6TabAnchorItem);
removeTab(this.wirelessTabAnchorItem);
removeTab(this.net8021xTabAnchorItem);
removeTab(this.dhcp4NatTabAnchorItem);
removeTab(this.modemTabAnchorItem);
removeTab(this.modemGpsTabAnchorItem);
Expand Down Expand Up @@ -328,6 +347,10 @@ private void showWirelessTabs() {
this.wirelessTabAnchorItem.setEnabled(true);

insertTab(this.wirelessTabAnchorItem);
if (this.isNet2) {
insertTab(this.net8021xTabAnchorItem);
}

insertTab(this.dhcp4NatTabAnchorItem);
}

Expand Down Expand Up @@ -363,6 +386,7 @@ private boolean isModemLTE() {

private void removeOptionalTabs() {
this.visibleTabs.remove(this.wirelessTabAnchorItem);
this.visibleTabs.remove(this.net8021xTabAnchorItem);
this.visibleTabs.remove(this.dhcp4NatTabAnchorItem);
this.visibleTabs.remove(this.modemTabAnchorItem);
this.visibleTabs.remove(this.modemGpsTabAnchorItem);
Expand Down Expand Up @@ -398,6 +422,9 @@ private void refreshAllVisibleTabs() {
if (this.visibleTabs.contains(this.modemAntennaTabAnchorItem)) {
this.modemAntennaTab.refresh();
}
if (this.visibleTabs.contains(this.net8021xTabAnchorItem)) {
this.set8021xTab.refresh();
}
}

/*
Expand Down Expand Up @@ -437,6 +464,10 @@ public boolean isDirty() {
return true;
}

if (this.visibleTabs.contains(this.net8021xTabAnchorItem) && this.set8021xTab.isDirty()) {
return true;
}

return false;
}

Expand All @@ -446,6 +477,7 @@ public void setDirty(boolean isDirty) {
this.hardwareTab.setDirty(isDirty);
this.dhcp4NatTab.setDirty(isDirty);
this.wirelessTab.setDirty(isDirty);
this.set8021xTab.setDirty(isDirty);
this.modemTab.setDirty(isDirty);
this.modemGpsTab.setDirty(isDirty);
this.modemAntennaTab.setDirty(isDirty);
Expand All @@ -457,6 +489,7 @@ public void refresh() {
this.hardwareTab.refresh();
this.dhcp4NatTab.refresh();
this.wirelessTab.refresh();
this.set8021xTab.refresh();
this.modemTab.refresh();
this.modemGpsTab.refresh();
this.modemAntennaTab.refresh();
Expand Down Expand Up @@ -497,6 +530,9 @@ public GwtNetInterfaceConfig getUpdatedInterface() {
if (this.visibleTabs.contains(this.modemAntennaTabAnchorItem)) {
this.modemAntennaTab.getUpdatedNetInterface(updatedNetIf);
}
if (this.visibleTabs.contains(this.net8021xTabAnchorItem)) {
this.set8021xTab.getUpdatedNetInterface(updatedNetIf);
}

return updatedNetIf;
}
Expand Down Expand Up @@ -542,6 +578,11 @@ public boolean isValid() {
return false;
}

if (this.visibleTabs.contains(this.net8021xTabAnchorItem) && this.net8021xTabAnchorItem.isEnabled()
&& !this.set8021xTab.isValid()) {
return false;
}

return true;
}

Expand Down Expand Up @@ -574,13 +615,15 @@ private void setSelected(AnchorListItem item) {
this.ip6TabAnchorItem.setActive(false);
this.dhcp4NatTabAnchorItem.setActive(false);
this.wirelessTabAnchorItem.setActive(false);
this.net8021xTabAnchorItem.setActive(false);
this.modemTabAnchorItem.setActive(false);
this.modemGpsTabAnchorItem.setActive(false);
this.modemAntennaTabAnchorItem.setActive(false);
item.setActive(true);
}

class InterfaceConfigWrapper {

private GwtNetInterfaceConfig config;

public InterfaceConfigWrapper(GwtNetInterfaceConfig config) {
Expand All @@ -604,8 +647,7 @@ public boolean isGpsSupported() {
}

public boolean isLoopback() {
return this.config.getHwTypeEnum() == GwtNetIfType.LOOPBACK
|| this.config.getName().startsWith("mon.wlan");
return this.config.getHwTypeEnum() == GwtNetIfType.LOOPBACK || this.config.getName().startsWith("mon.wlan");
}
}
}
Loading

0 comments on commit 0a8afa3

Please sign in to comment.