Skip to content

Commit 41e3ca5

Browse files
Release 4.1.0 (#3)
# Release 4.1.0 ## New features - Check if persistent data to load provides all relevant parameters. Otherwise add default values ## Bugfix - Did not clear old registered events before loading new parameters - Legacy bindings of ValueDisplay elements within UI did not work if deployed with VS Code AppSpace SDK - UI differs if deployed via Appstudio or VS Code AppSpace SDK - Fullscreen icon of iFrame was visible
1 parent 573ef7c commit 41e3ca5

12 files changed

Lines changed: 124 additions & 52 deletions

File tree

CHANGELOG.md

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

4+
## Release 4.1.0
5+
6+
### New features
7+
- Check if persistent data to load provides all relevant parameters. Otherwise add default values
8+
9+
### Bugfix
10+
- Did not clear old registered events before loading new parameters
11+
- Legacy bindings of ValueDisplay elements within UI did not work if deployed with VS Code AppSpace SDK
12+
- UI differs if deployed via Appstudio or VS Code AppSpace SDK
13+
- Fullscreen icon of iFrame was visible
14+
415
## Release 4.0.0
516

617
### New features

CSK_Module_FTPClient/pages/pages/CSK_Module_FTPClient/CSK_Module_FTPClient.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969

7070
.myCustomButton_CSK_Module_FTPClient {
7171
border-radius: 30px;
72-
padding-right: 0px;
72+
padding: 11px;
7373
}

CSK_Module_FTPClient/pages/pages/CSK_Module_FTPClient/CSK_Module_FTPClient.html

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<layout-row id="RowLayout13">
77
<layout-column id="ColumnLayout15" style="align-items: stretch">
88
<layout-row id="RowLayout14" style="align-items: baseline">
9-
<davinci-value-display id="VD_Title" class="myCustomLabel_CSK_Module_FTPClient" value="FTP Client">
10-
</davinci-value-display>
9+
<h1 id="Heading_Title" class="myCustomLabel_CSK_Module_FTPClient">
10+
FTP Client
11+
</h1>
1112
<davinci-value-display id="VD_Version">
12-
<crown-edpws-binding property="value" name="CSK_FTPClient/OnNewStatusModuleVersion"
13-
update-on-resume>
14-
</crown-edpws-binding>
13+
<crown-on property="value" crown-event="CSK_FTPClient/OnNewStatusModuleVersion">
14+
</crown-on>
1515
</davinci-value-display>
1616
</layout-row>
1717
</layout-column>
@@ -64,9 +64,10 @@
6464
style="justify-content: center; align-items: center">
6565
<davinci-button id="B_LoadConfig"
6666
class="myCustomButton_CSK_Module_FTPClient"
67-
type="outline" icon-position="append"
68-
title="Load configured parameters from CSK_PersistentData module."
69-
icon="action/history">
67+
type="outline"
68+
title="Load configured parameters from CSK_PersistentData module.">
69+
<davinci-icon icon="action/history">
70+
</davinci-icon>
7071
<span></span>
7172
<crown-binding event="submit"
7273
name="CSK_FTPClient/loadParameters"
@@ -80,9 +81,10 @@
8081
</davinci-button>
8182
<davinci-button id="B_SaveConfig"
8283
class="myCustomButton_CSK_Module_FTPClient"
83-
type="outline" icon-position="append"
84-
title="Save current configured parameters of this module within CSK_PersistentData module."
85-
icon="content/save">
84+
type="outline"
85+
title="Save current configured parameters of this module within CSK_PersistentData module.">
86+
<davinci-icon icon="content/save">
87+
</davinci-icon>
8688
<span></span>
8789
<crown-binding event="submit"
8890
name="CSK_FTPClient/sendParameters"
@@ -306,8 +308,8 @@
306308
<stacked-pane id="SP_Connected" value="true">
307309
<davinci-button id="Button_Disconnect"
308310
class="myCustomButton_CSK_Module_FTPClient"
309-
type="accent" icon-position="append"
310-
title="Disconnect" icon="av/stop">
311+
type="accent" title="Disconnect">
312+
<davinci-icon icon="av/stop"></davinci-icon>
311313
<span>Disconnect</span>
312314
<crown-binding event="submit"
313315
name="CSK_FTPClient/disconnectFTPClient"
@@ -318,8 +320,8 @@
318320
<stacked-pane id="SP_Disconnected" value="false">
319321
<davinci-button id="Button_Connect"
320322
class="myCustomButton_CSK_Module_FTPClient"
321-
type="outline" icon-position="append"
322-
title="Connect" icon="av/play_arrow">
323+
type="outline" title="Connect">
324+
<davinci-icon icon="av/play_arrow"></davinci-icon>
323325
<span>Connect</span>
324326
<crown-binding event="submit"
325327
name="CSK_FTPClient/connectFTPClient"
@@ -416,8 +418,8 @@
416418
<layout-row id="RowLayout8" style="justify-content: center">
417419
<davinci-button id="Button_ADD"
418420
class="myCustomButton_CSK_Module_FTPClient"
419-
type="outline" icon-position="append" title="Add data"
420-
icon="content/add">
421+
type="outline" title="Add data">
422+
<davinci-icon icon="content/add"></davinci-icon>
421423
<span></span>
422424
<crown-binding event="submit"
423425
name="CSK_FTPClient/addRegistrationViaUI"
@@ -430,8 +432,8 @@
430432
</davinci-button>
431433
<davinci-button id="Button_DELETE"
432434
class="myCustomButton_CSK_Module_FTPClient"
433-
type="outline" icon-position="append"
434-
title="Delete data" icon="action/delete">
435+
type="outline" title="Delete data">
436+
<davinci-icon icon="action/delete"></davinci-icon>
435437
<span></span>
436438
<crown-binding event="submit"
437439
name="CSK_FTPClient/deleteRegistrationViaUI"

CSK_Module_FTPClient/pages/src/converter.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ export function convertToList(value) {
55
export function changeStyle(theme) {
66
const style: HTMLStyleElement = document.createElement('style');
77
style.id ='blub'
8+
9+
const toggleSW = document.querySelectorAll("davinci-toggle-switch")
10+
toggleSW.forEach((userItem) => {
11+
const shadowToggle = userItem.shadowRoot
12+
const finalToggleSW = shadowToggle?.querySelector('div')
13+
finalToggleSW?.classList.add('hasIcon')
14+
});
15+
816
if (theme == 'CSK_Style'){
917
var headerToolbar = `.sopasjs-ui-header-toolbar-wrapper { background-color: #FFFFFF; }`
1018
var uiHeader = `.sopasjs-ui-header>.app-logo { margin-right:0px; }`

CSK_Module_FTPClient/pages/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ document.addEventListener('sopasjs-ready', () => {
1212
page_Setup.remove();
1313

1414
setTimeout(() => {
15+
const element = document.querySelector("div.sjs-wrapper > div > div.sjs-fullscreen-toggle")
16+
if(element) {
17+
element.parentElement.removeChild(element)
18+
}
1519
document.title = 'CSK_Module_FTPClient'
1620
}, 500);
1721
})

CSK_Module_FTPClient/project.mf.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ If TRUE it will send the content in its own thread, but other apps can further r
322322
</crown>
323323
</crown>
324324
<meta key="author">SICK AG</meta>
325-
<meta key="version">4.0.0</meta>
325+
<meta key="version">4.1.0</meta>
326326
<meta key="priority">low</meta>
327327
<meta key="copy-protected">false</meta>
328328
<meta key="read-protected">false</meta>

CSK_Module_FTPClient/scripts/Communication/FTPClient/FTPClient_Controller.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,9 @@ local function loadParameters()
438438
local data = CSK_PersistentData.getParameter(ftpClient_Model.parametersName)
439439
if data then
440440
_G.logger:info(nameOfModule .. ": Loaded parameters from CSK_PersistentData module.")
441-
ftpClient_Model.parameters = ftpClient_Model.helperFuncs.convertContainer2Table(data)
442441
ftpClient_Model.deregisterAllEvents()
442+
ftpClient_Model.parameters = ftpClient_Model.helperFuncs.convertContainer2Table(data)
443+
ftpClient_Model.parameters = ftpClient_Model.helperFuncs.checkParameters(ftpClient_Model.parameters, ftpClient_Model.helperFuncs.defaultParameters.getParameters())
443444
ftpClient_Model.registerAllEvents()
444445
if ftpClient_Model.parameters.isConnected then
445446
CSK_FTPClient.connectFTPClient()

CSK_Module_FTPClient/scripts/Communication/FTPClient/FTPClient_Model.lua

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,7 @@ ftpClient_Model.version = Engine.getCurrentAppVersion() -- Version of module
5151

5252
-- Parameters to be saved permanently if wanted
5353
ftpClient_Model.parameters = {}
54-
ftpClient_Model.parameters.flowConfigPriority = CSK_FlowConfig ~= nil or false -- Status if FlowConfig should have priority for FlowConfig relevant configurations
55-
ftpClient_Model.parameters.serverIP = '192.168.0.201' -- IP of FTP server
56-
ftpClient_Model.parameters.imageName = 'unknown' -- Use to give a name for the image to send
57-
ftpClient_Model.parameters.isConnected = false -- Status if FTP connection should be established
58-
ftpClient_Model.parameters.mode = 'FTP' -- FTP / SFTP -- Mode of FTP connection
59-
if ftpClient_Model.parameters.mode == 'SFTP' then
60-
if _G.availableAPIs.specific == true then
61-
ftpClient_Model.ftpClient:setSecurityProtocol('SFTP')
62-
end
63-
ftpClient_Model.parameters.port = 22 -- FTP = 21 / SFTP = 22 -- FTP port to use
64-
else
65-
ftpClient_Model.parameters.port = 21 -- FTP = 21 / SFTP = 22
66-
end
67-
68-
ftpClient_Model.parameters.user = 'unknown' -- FTP user
69-
ftpClient_Model.parameters.password = 'pass'-- FTP password for user
70-
ftpClient_Model.parameters.passiveMode = true -- FTP passive mode
71-
ftpClient_Model.parameters.asyncMode = false -- asyncMode
72-
ftpClient_Model.parameters.verboseMode = false -- verbose Mode of FTP connection
73-
74-
ftpClient_Model.parameters.registeredEvents = {} -- Events to listen for incoming data to store on FTP server
75-
-- Sample of data content of entries within the "registeredEvents"
76-
-- ftpClient_Model.parameters.registeredEvents[id].eventName -- Name of event
77-
-- ftpClient_Model.parameters.registeredEvents[id].dataType -- Type of data to save
78-
-- ftpClient_Model.parameters.registeredEvents[id].autoFilename -- Status if filename should be created by timestamp
54+
ftpClient_Model.parameters = ftpClient_Model.helperFuncs.defaultParameters.getParameters() -- Load default parameters
7955

8056
--**************************************************************************
8157
--********************** End Global Scope **********************************
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---@diagnostic disable: redundant-parameter, undefined-global
2+
3+
--***************************************************************
4+
-- Inside of this script, you will find the relevant parameters
5+
-- for this module and its default values
6+
--***************************************************************
7+
8+
local functions = {}
9+
10+
local function getParameters()
11+
12+
local ftpClientParameters = {}
13+
14+
ftpClientParameters.flowConfigPriority = CSK_FlowConfig ~= nil or false -- Status if FlowConfig should have priority for FlowConfig relevant configurations
15+
ftpClientParameters.serverIP = '192.168.0.201' -- IP of FTP server
16+
ftpClientParameters.imageName = 'unknown' -- Use to give a name for the image to send
17+
ftpClientParameters.isConnected = false -- Status if FTP connection should be established
18+
ftpClientParameters.mode = 'FTP' -- FTP / SFTP -- Mode of FTP connection
19+
if ftpClientParameters.mode == 'SFTP' then
20+
if _G.availableAPIs.specific == true then
21+
ftpClient_Model.ftpClient:setSecurityProtocol('SFTP')
22+
end
23+
ftpClientParameters.port = 22 -- FTP = 21 / SFTP = 22 -- FTP port to use
24+
else
25+
ftpClientParameters.port = 21 -- FTP = 21 / SFTP = 22
26+
end
27+
28+
ftpClientParameters.user = 'unknown' -- FTP user
29+
ftpClientParameters.password = 'pass'-- FTP password for user
30+
ftpClientParameters.passiveMode = true -- FTP passive mode
31+
ftpClientParameters.asyncMode = false -- asyncMode
32+
ftpClientParameters.verboseMode = false -- verbose Mode of FTP connection
33+
34+
ftpClientParameters.registeredEvents = {} -- Events to listen for incoming data to store on FTP server
35+
-- Sample of data content of entries within the "registeredEvents"
36+
-- ftpClientParameters.registeredEvents[id].eventName -- Name of event
37+
-- ftpClientParameters.registeredEvents[id].dataType -- Type of data to save
38+
-- ftpClientParameters.registeredEvents[id].autoFilename -- Status if filename should be created by timestamp
39+
40+
return ftpClientParameters
41+
end
42+
functions.getParameters = getParameters
43+
44+
return functions

CSK_Module_FTPClient/scripts/Communication/FTPClient/helper/funcs.lua

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
--**********************Start Global Scope *********************************
88
--**************************************************************************
99

10+
local nameOfModule = 'CSK_FTPClient'
11+
1012
local funcs = {}
13+
-- Default parameters for instances of module
14+
funcs.defaultParameters = require('Communication/FTPClient/FTPClient_Parameters')
1115

1216
--**************************************************************************
1317
--********************** End Global Scope **********************************
@@ -152,6 +156,27 @@ local function createSpecificJsonList(content, selectedParam)
152156
end
153157
funcs.createSpecificJsonList = createSpecificJsonList
154158

159+
--- Function to compare table content. Optionally will fill missing values within content table with values of defaultTable
160+
---@param content auto Data to check
161+
---@param defaultTable auto Reference data
162+
---@return auto[] content Update of data
163+
local function checkParameters(content, defaultTable)
164+
for key, value in pairs(defaultTable) do
165+
if type(value) == 'table' then
166+
if content[key] == nil then
167+
_G.logger:info(nameOfModule .. ": Created missing parameters table '" .. tostring(key) .. "'")
168+
content[key] = {}
169+
end
170+
content[key] = checkParameters(content[key], defaultTable[key])
171+
elseif content[key] == nil then
172+
_G.logger:info(nameOfModule .. ": Missing parameter '" .. tostring(key) .. "'. Adding default value '" .. tostring(defaultTable[key]) .. "'")
173+
content[key] = defaultTable[key]
174+
end
175+
end
176+
return content
177+
end
178+
funcs.checkParameters = checkParameters
179+
155180
return funcs
156181

157182
--**************************************************************************

0 commit comments

Comments
 (0)