Skip to content

Commit 121d115

Browse files
DNS functionality added (#2)
# Version 2.1.0 ## New features - Added the possibility to configure nameservers via the UI --------- Co-authored-by: Andreas Verdenhalven <andreas.verdenhalven@sick.de>
1 parent ca7f799 commit 121d115

11 files changed

Lines changed: 1097 additions & 121 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
5+
## Release 2.1.0
6+
7+
### Improvements
8+
- Possibility to configure nameservers via the UI
9+
410
## Release 2.0.0
511

612
### Improvements

CSK_Module_DeviceNetworkConfig/pages/pages/CSK_Module_DeviceNetworkConfig/CSK_Module_DeviceNetworkConfig.html

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
auto-commit>
4242
</crown-binding>
4343
</davinci-button>
44+
<h3 id="Heading32">Interface settings</h3>
4445
<curie-table id="InterfacesTable" selectable
4546
select-mode="highlight_row">
4647
<curie-table-column id="Interface" header="Interface">
@@ -168,7 +169,68 @@
168169
name="CSK_DeviceNetworkConfig/applyConfig" auto-commit>
169170
</crown-binding>
170171
</davinci-button>
171-
<h1 id="Heading11">Tools</h1>
172+
<h3 id="Heading31">DNS settings</h3>
173+
<p>To delete a nameserver, please select a DNS entry from the list and press "Remove".<br>
174+
A maximum of three nameserves can be added.<br>
175+
Nameservers that are added automatically via DHCP cannot be deleted.<br><br>
176+
<b>Please note that the DNS entries can only be persisted, if the app "CSK_Module_PersistentData" is loaded.</b></p>
177+
<layout-row id="RowLayout12">
178+
<layout-column id="ColumnLayout4" style="align-items: stretch">
179+
<layout-row id="RowLayout10">
180+
<layout-column id="ColumnLayout11" style="align-items: stretch">
181+
<davinci-text-field id="TF_DnsEntry" type="text"
182+
label="IP address of the DNS" pattern="">
183+
<crown-on property="error"
184+
crown-event="CSK_DeviceNetworkConfig/OnDNSIPError">
185+
</crown-on>
186+
<crown-set event="change"
187+
crown-function="CSK_DeviceNetworkConfig/setDNS"
188+
protocol="crownMSGPACK" crown-path="dns">
189+
</crown-set>
190+
</davinci-text-field>
191+
</layout-column>
192+
<layout-column id="ColumnLayout12" style="align-items: stretch">
193+
<davinci-button id="BTN_AddDns" type="primary" icon-position="append"
194+
title="Add the defined DNS" icon="image/control_point">
195+
<span>Add</span>
196+
<crown-set event="submit"
197+
crown-function="CSK_DeviceNetworkConfig/addDNS"
198+
protocol="crownMSGPACK">
199+
</crown-set>
200+
</davinci-button>
201+
</layout-column>
202+
</layout-row>
203+
<layout-row id="RowLayout11" style="align-items: flex-end">
204+
<layout-column id="ColumnLayout5" style="align-items: stretch">
205+
<curie-table id="DT_DnsList" select-mode="highlight_row" selectable>
206+
<curie-table-column id="dns" header="Nameserver">
207+
</curie-table-column>
208+
<crown-set event="row-selected"
209+
crown-function="CSK_DeviceNetworkConfig/selectDNSViaUI"
210+
protocol="crownMSGPACK" crown-path="selectedRow">
211+
</crown-set>
212+
<crown-on property="data"
213+
crown-event="CSK_DeviceNetworkConfig/OnNewDNS">
214+
</crown-on>
215+
</curie-table>
216+
</layout-column>
217+
<layout-column id="ColumnLayout6" style="align-items: stretch">
218+
<davinci-button id="BTN_RemoveDns" type="primary"
219+
icon-position="append" title="Remove the selected DNS entry">
220+
<span>Remove</span>
221+
<crown-set event="submit"
222+
crown-function="CSK_DeviceNetworkConfig/removeDNS"
223+
protocol="crownMSGPACK">
224+
</crown-set>
225+
</davinci-button>
226+
</layout-column>
227+
</layout-row>
228+
</layout-column>
229+
<layout-column id="ColumnLayout3"
230+
style="align-items: stretch; flex-grow: 2">
231+
</layout-column>
232+
</layout-row>
233+
<h3 id="Heading33">Tools</h3>
172234
<layout-row id="RowLayout3">
173235
<davinci-text-field id="TF_PingIP" type="text" label="Ping"
174236
placeholder="IPv4 address">
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
{
2-
"version": "1.0",
3-
"pages": []
2+
"version": "1.0",
3+
"pages": [
4+
{
5+
"category": "CSK Module Device Network Config",
6+
"pages": [
7+
{
8+
"path": "CSK_Module_DeviceNetworkConfig/CSK_Module_DeviceNetworkConfig.html",
9+
"name": "Network Configuration"
10+
}
11+
]
12+
}
13+
]
414
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
export function InvalidUpstreamIPv4Display(inState) {
2+
const status = document.getElementById('UpstreamIPv4Error')
3+
if ( status ) {
4+
if ( inState !== false ) {
5+
status.textContent = ''
6+
7+
return null
8+
} else {
9+
status.textContent = 'Invalid IPv4 address!'
10+
11+
return 'Invalid IPv4 address!'
12+
}
13+
} else {
14+
console.log( 'Could not get status for upstream IPv4 address error display!' )
15+
}
16+
17+
return null
18+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Customize icons for navigation tree
3+
*
4+
* List of available icons ("Font Awesome" collection)
5+
* <https://fontawesome.com/v4.7.0/icons/>
6+
*/
7+
document.addEventListener('sopasjs-ready', () => {
8+
// "Configuration" page
9+
const page_1 = document.querySelector('div.sopasjs-ui-navbar-wrapper > div > ul > li:nth-child(3) > a > i');
10+
page_1.classList.remove('fa-file');
11+
page_1.classList.add('fa-wrench');
12+
})

CSK_Module_DeviceNetworkConfig/project.mf.xml

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,31 @@ See following descriptions of events/functions regarding further information.
9595
<desc>Notify details of executed ping command.</desc>
9696
<param desc="Ping details." multiplicity="1" name="details" type="string"/>
9797
</event>
98+
<event name="OnNewDNS">
99+
<trait>released</trait>
100+
<desc>Notify a new nameserver.</desc>
101+
<param desc="Name server list" multiplicity="1" name="dnsServerList" type="string"/>
102+
</event>
103+
<event name="OnDataLoadedOnReboot">
104+
<desc>Event to call if module tried to load parameters and should be ready.</desc>
105+
</event>
106+
<event name="OnNewStatusLoadParameterOnReboot">
107+
<desc>Notify status if parameters should be loaded on app/device boot up.</desc>
108+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
109+
</event>
110+
<event name="OnNewParameterName">
111+
<desc>Notify name of persistent data parameter.</desc>
112+
<param desc="Parameter name" multiplicity="1" name="name" type="string"/>
113+
</event>
114+
<event name="OnPersistentDataModuleAvailable">
115+
<desc>Notify status if features of CSK_PersistendData module are available.</desc>
116+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
117+
</event>
118+
<event name="OnDNSIPError">
119+
<trait>released</trait>
120+
<desc>Highlights the DNS 'IP' in UI if format of IP is not correct.</desc>
121+
<param desc="Status" multiplicity="1" name="isError" type="bool"/>
122+
</event>
98123
<function name="pageCalled">
99124
<desc>Function to register "OnResume" of the module UI (only as helper function).</desc>
100125
<return desc="Empty string (only needed to simplify binding)." multiplicity="1" name="empty" type="string"/>
@@ -144,10 +169,42 @@ See following descriptions of events/functions regarding further information.
144169
<desc>Preset IP to ping (see 'ping' function).</desc>
145170
<param desc="IP" multiplicity="1" name="ping_ip" type="string"/>
146171
</function>
172+
<function name="selectDNSViaUI">
173+
<trait>released</trait>
174+
<desc>Select nameserver entry via table in UI.</desc>
175+
<param desc="The string with chosen row's content in JSON format." multiplicity="1" name="selectedRow" type="string"/>
176+
</function>
177+
<function name="setDNS">
178+
<trait>released</trait>
179+
<desc>Set IP address of the nameserver.</desc>
180+
<param desc="Nameserver IP" multiplicity="1" name="dns" type="string"/>
181+
</function>
182+
<function name="addDNS">
183+
<trait>released</trait>
184+
<desc>Add a new nameserver IP.</desc>
185+
</function>
186+
<function name="removeDNS">
187+
<trait>released</trait>
188+
<desc>Remove the selected nameserver IP.</desc>
189+
</function>
190+
<function name="setParameterName">
191+
<desc>Function to set the name of the parameters if saved/loaded via the CSK_PersistentData module.</desc>
192+
<param desc="Name of the parameter." multiplicity="1" name="name" type="string"/>
193+
</function>
194+
<function name="sendParameters">
195+
<desc>Send parameters to CSK_PersistentData module if possible to save them.</desc>
196+
</function>
197+
<function name="loadParameters">
198+
<desc>Load parameters for this module from the CSK_PersistentData module if possible and use them.</desc>
199+
</function>
200+
<function name="setLoadOnReboot">
201+
<desc>Configure if this module should load its saved parameters at app/device boot up.</desc>
202+
<param desc="Status" multiplicity="1" name="status" type="bool"/>
203+
</function>
147204
</serves>
148205
</crown>
149206
<meta key="author">SICK AG</meta>
150-
<meta key="version">2.0.0</meta>
207+
<meta key="version">2.1.0</meta>
151208
<meta key="priority">low</meta>
152209
<meta key="copy-protected">false</meta>
153210
<meta key="read-protected">false</meta>

0 commit comments

Comments
 (0)