profoundjs 6.1.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/htdocs/profoundui/proddata/css/logic.css +21 -2
- package/htdocs/profoundui/proddata/css/profoundui.css +16 -0
- package/htdocs/profoundui/proddata/js/designer.js +3893 -3813
- package/htdocs/profoundui/proddata/js/key_management.js +15 -21
- package/htdocs/profoundui/proddata/js/rich-display-react-component.js +42 -42
- package/htdocs/profoundui/proddata/js/rich-display-vue-component.js +27 -27
- package/htdocs/profoundui/proddata/js/runtime.js +1493 -1489
- package/htdocs/profoundui/proddata/js/soapclient.js +388 -395
- package/index.js +4 -4
- package/package.json +9 -1
- package/profound.jse +1 -1
- package/setup/call.js +1 -1
- package/setup/completeInstall.js +26 -56
- package/setup/convertStartJS.js +40 -30
- package/setup/encrypt_client_file.js +4 -0
- package/setup/install.js +1 -1
- package/setup/install_utils.js +15 -30
- package/setup/lic_client.js +9 -0
- package/setup/modules/papisamples/.noderun/settings.json +5 -0
- package/setup/modules/papisamples/APISample.api.json +313 -0
- package/setup/modules/papisamples/APISample.js +55 -0
- package/setup/modules/papisamples/APISample.json +751 -0
- package/setup/modules/papisamples/README.md +17 -0
- package/setup/modules/papisamples/hobbyshop.csv +6 -0
- package/setup/modules/papisamples/readCSVFile.js +136 -0
- package/setup/modules/puiscreens.json +6 -5
- package/setup/pjsdist.savf +0 -0
- package/setup/removeExtraComponents.js +4 -6
- package/setup/setup.js +87 -59
- package/views/cloud.css +19 -6
- package/views/key.ejs +32 -2
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
{
|
|
2
|
+
"apiFileID": "52f8ae4f-486d-4b49-9106-650deff196b9",
|
|
3
|
+
"apiType": "rest",
|
|
4
|
+
"routes": [
|
|
5
|
+
{
|
|
6
|
+
"apiRouteID": "d9c2b7e1-13e4-4ce6-a088-f338d6a16371",
|
|
7
|
+
"name": "API Get",
|
|
8
|
+
"enableCors": true,
|
|
9
|
+
"summary": "Get operation for API Sample App",
|
|
10
|
+
"method": "get",
|
|
11
|
+
"inputs": [
|
|
12
|
+
{
|
|
13
|
+
"type": "string",
|
|
14
|
+
"from": "query",
|
|
15
|
+
"name": "rowid",
|
|
16
|
+
"description": "Retrieve the row ID provided. If 0 or empty, will retrieve all rows instead.",
|
|
17
|
+
"example": ""
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"path": "/apisample",
|
|
21
|
+
"subcategory": "",
|
|
22
|
+
"outputs": [
|
|
23
|
+
{
|
|
24
|
+
"type": "string",
|
|
25
|
+
"name": "msg"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "string",
|
|
29
|
+
"name": "error"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"name": "result",
|
|
34
|
+
"children": []
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"description": "Request a single row if an input parameter was specified. Otherwise, return all records.",
|
|
38
|
+
"steps": [
|
|
39
|
+
{
|
|
40
|
+
"text": "Get row ID",
|
|
41
|
+
"answers": {
|
|
42
|
+
"plugin": "Program Data:set-work-variable",
|
|
43
|
+
"work_variable": "queryID",
|
|
44
|
+
"value": "input[\"rowid\"]",
|
|
45
|
+
"comment": "retrieve row ID from query"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"text": "Send CSV data response",
|
|
50
|
+
"answers": {
|
|
51
|
+
"plugin": "Custom:code",
|
|
52
|
+
"custom-code": "/**\r\n * Return one or all records from a file, depending on arguments.\r\n */\r\nconst path = require(\"path\");\r\n\r\nconst f_fileRead = require(\"./readCSVFile.js\").fileRead;\r\nconst fHScsv = path.join(__dirname, \"hobbyshop.csv\");\r\n\r\ntry {\r\n // define the file to be updated\r\n var iLength = iRowID = 0;\r\n let fileData = await f_fileRead(fHScsv);\r\n\r\n iLength = fileData.length; // get the current file length\r\n iRowID = parseInt(queryID, 10); // try to get the data passed from the parameters \r\n\r\n // No row ID provided; read the whole file\r\n if (isNaN(iRowID) || iRowID === 0) {\r\n fileData = fileData.data;\r\n output[\"result\"] = fileData;\r\n output[\"msg\"] = \"All records returned\";\r\n }\r\n // check if the ID provided is available in the file's rows - reject if it doesn't\r\n else if((iRowID <= 0) || (iRowID > iLength)){\r\n output[\"error\"] = 'Error: Row ID ' + iRowID + ' does not exist';\r\n }\r\n // Respond with just a single row from the file.\r\n else {\r\n fileData = fileData.data[iRowID - 1];\r\n output[\"result\"] = fileData;\r\n output[\"msg\"] = \"One record returned\";\r\n }\r\n}\r\ncatch (err){\r\n output[\"error\"] = String(err);\r\n}",
|
|
53
|
+
"comment": "READ - Retrieve a line of data from the CSV using the rowid passed. If the rowid is 0 or empty, all rows will be retrieved."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"apiRouteID": "7a90b4ad-baff-4796-9e40-7af86efb1b91",
|
|
60
|
+
"name": "API Post",
|
|
61
|
+
"enableCors": true,
|
|
62
|
+
"summary": "Post operation for API Sample App",
|
|
63
|
+
"method": "post",
|
|
64
|
+
"inputs": [
|
|
65
|
+
{
|
|
66
|
+
"type": "string",
|
|
67
|
+
"from": "body",
|
|
68
|
+
"name": "rowid",
|
|
69
|
+
"description": "Retrieve the row ID provided. If 0 or empty, will retrieve all rows instead.",
|
|
70
|
+
"example": ""
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "string",
|
|
74
|
+
"from": "body",
|
|
75
|
+
"name": "pname",
|
|
76
|
+
"description": "product name of item to be added"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"from": "body",
|
|
81
|
+
"name": "price",
|
|
82
|
+
"description": "price of item to be added",
|
|
83
|
+
"example": ""
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"from": "body",
|
|
88
|
+
"name": "quantity",
|
|
89
|
+
"description": "quantity of item to be added",
|
|
90
|
+
"example": ""
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"path": "/apisample",
|
|
94
|
+
"subcategory": "",
|
|
95
|
+
"outputs": [
|
|
96
|
+
{
|
|
97
|
+
"type": "string",
|
|
98
|
+
"name": "msg",
|
|
99
|
+
"description": "Message about the operation"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "string",
|
|
103
|
+
"name": "error"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"type": "object",
|
|
107
|
+
"name": "result",
|
|
108
|
+
"description": "The file after the POST operation succeeded",
|
|
109
|
+
"children": []
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"description": "Add a new row to the end of the file.",
|
|
113
|
+
"steps": [
|
|
114
|
+
{
|
|
115
|
+
"text": "Get Row ID",
|
|
116
|
+
"answers": {
|
|
117
|
+
"plugin": "Program Data:set-work-variable",
|
|
118
|
+
"work_variable": "rowID",
|
|
119
|
+
"value": "input[\"rowid\"]",
|
|
120
|
+
"comment": "retrieve row ID from query"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"text": "Get Product Name",
|
|
125
|
+
"answers": {
|
|
126
|
+
"plugin": "Program Data:set-work-variable",
|
|
127
|
+
"work_variable": "prodName",
|
|
128
|
+
"value": "input[\"pname\"]",
|
|
129
|
+
"comment": "get product name"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"text": "Get Product Price",
|
|
134
|
+
"answers": {
|
|
135
|
+
"plugin": "Program Data:set-work-variable",
|
|
136
|
+
"work_variable": "prodPrice",
|
|
137
|
+
"value": "input[\"price\"]",
|
|
138
|
+
"comment": "get product price"
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"text": "Get Product Quantity",
|
|
143
|
+
"answers": {
|
|
144
|
+
"plugin": "Program Data:set-work-variable",
|
|
145
|
+
"work_variable": "prodCount",
|
|
146
|
+
"value": "input[\"quantity\"]",
|
|
147
|
+
"comment": "get product quantity"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"text": "Record new entry onto CSV",
|
|
152
|
+
"answers": {
|
|
153
|
+
"plugin": "Custom:code",
|
|
154
|
+
"custom-code": "/**\r\n * API: post.\r\n * Add a new row to the end of CSV file.\r\n */\r\nconst path = require(\"path\");\r\nconst f_fileRead = require(\"./readCSVFile.js\").fileRead;\r\nconst f_appendFile = require(\"fs\").appendFile;\r\nconst fHScsv = path.join(__dirname, \"hobbyshop.csv\");\r\n\r\ntry {\r\n // define the file to be updated\r\n let iLine = 1; // File ID entries will start at One\r\n const pr_fileDat = await f_fileRead(fHScsv);\r\n // get the current line and length of the CSV file\r\n iLine = pr_fileDat.length;\r\n\r\n // Use the values from the previous low-code steps. Values\r\n prodName = prodName.trim();\r\n\r\n strpost = prodName + \",\" + prodPrice + \",\" + prodCount;\r\n if (prodName.length < 1) {\r\n // send the error //return an error if data passed is empty\r\n output[\"error\"] = \"Error: Product Name missing\";\r\n }\r\n else if (prodPrice == \"\") {\r\n // send the error //return an error if data passed is empty\r\n output[\"error\"] = \"Error: Product Price missing\";\r\n }\r\n else if (prodCount == \"\") {\r\n // send the error //return an error if data passed is empty\r\n output[\"error\"] = \"Error: Product Count missing\";\r\n }\r\n else {\r\n // iLine will serve as the ID of the entry to be added\r\n iLine += 1;\r\n // Wrap the asynchronous append operation in a promise so that it can be awaited, and code run in sequence.\r\n const message = await new Promise((resolve, reject) => {\r\n const entryStr = \"\\n\" + iLine + \",\" + strpost;\r\n f_appendFile(fHScsv, entryStr, (err) => {\r\n if (err) reject(new Error('File not found - creating file instead: \" + fHScsv + \"'));\r\n else resolve(\"Record added to end of file: \" + iLine + \",\" + strpost);\r\n });\r\n });\r\n\r\n output[\"msg\"] = message;\r\n const dataObj = await f_fileRead(fHScsv); // re-read the file to get the updated data.\r\n output[\"result\"] = dataObj.data;\r\n }\r\n}\r\ncatch (err) {\r\n output[\"error\"] = String(err);\r\n}\r\n",
|
|
155
|
+
"comment": "CREATE - Add new CSV row entry based on data passed. Returns an error if at least the name, price or quantity fields are empty."
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"apiRouteID": "76f3ac1c-e279-4806-a451-aa2db4bc6e98",
|
|
162
|
+
"name": "API Put",
|
|
163
|
+
"enableCors": true,
|
|
164
|
+
"summary": "Put operation for API Sample App",
|
|
165
|
+
"method": "put",
|
|
166
|
+
"inputs": [
|
|
167
|
+
{
|
|
168
|
+
"type": "string",
|
|
169
|
+
"from": "query",
|
|
170
|
+
"name": "rowid",
|
|
171
|
+
"description": "Retrieve the row ID provided. If 0 or empty, will retrieve all rows instead.",
|
|
172
|
+
"example": ""
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"type": "string",
|
|
176
|
+
"from": "query",
|
|
177
|
+
"name": "pname",
|
|
178
|
+
"example": "",
|
|
179
|
+
"description": "item name to be updated to this value"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"type": "integer",
|
|
183
|
+
"from": "query",
|
|
184
|
+
"name": "price",
|
|
185
|
+
"example": "",
|
|
186
|
+
"description": "item price to be updated to this value"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"type": "integer",
|
|
190
|
+
"from": "query",
|
|
191
|
+
"name": "quantity",
|
|
192
|
+
"description": "item quantity to be updated to this value",
|
|
193
|
+
"example": ""
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"path": "/apisample",
|
|
197
|
+
"subcategory": "",
|
|
198
|
+
"outputs": [
|
|
199
|
+
{
|
|
200
|
+
"type": "string",
|
|
201
|
+
"name": "msg"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"type": "string",
|
|
205
|
+
"name": "error"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"type": "object",
|
|
209
|
+
"name": "result"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"steps": [
|
|
213
|
+
{
|
|
214
|
+
"text": "Get Row ID",
|
|
215
|
+
"answers": {
|
|
216
|
+
"plugin": "Program Data:set-work-variable",
|
|
217
|
+
"work_variable": "queryID",
|
|
218
|
+
"value": "input[\"rowid\"]",
|
|
219
|
+
"comment": "retrieve row ID from query"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"text": "Get Product Name",
|
|
224
|
+
"answers": {
|
|
225
|
+
"plugin": "Program Data:set-work-variable",
|
|
226
|
+
"work_variable": "prodName",
|
|
227
|
+
"value": "input[\"pname\"]",
|
|
228
|
+
"comment": "Get Product Name"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"text": "Get Product Price",
|
|
233
|
+
"answers": {
|
|
234
|
+
"plugin": "Program Data:set-work-variable",
|
|
235
|
+
"work_variable": "prodPrice",
|
|
236
|
+
"value": "input[\"price\"]",
|
|
237
|
+
"comment": "Get Product Price"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"text": "Get Product Quantity",
|
|
242
|
+
"answers": {
|
|
243
|
+
"plugin": "Program Data:set-work-variable",
|
|
244
|
+
"work_variable": "prodCount",
|
|
245
|
+
"value": "input[\"quantity\"]",
|
|
246
|
+
"comment": "Get Product Quantity"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"text": "Update CSV data",
|
|
251
|
+
"answers": {
|
|
252
|
+
"plugin": "Custom:code",
|
|
253
|
+
"custom-code": "/**\r\n * API: PUT\r\n * Update one record in the file.\r\n */\r\nconst path = require(\"path\");\r\nconst f_fileRead = require(\"./readCSVFile.js\").fileRead;\r\nconst f_fileUpdate = require(\"./readCSVFile.js\").fileUpdate;\r\nconst fHScsv = path.join(__dirname, \"hobbyshop.csv\");\r\n\r\ntry {\r\n // define the file to be updated\r\n let strpost = \"-\";\r\n let iLine = iID = 1; // File ID entries will start at One\r\n let iLineData = \"\";\r\n // Read the file to get the number of lines in it.\r\n const pr_fileDat = await f_fileRead(fHScsv);\r\n\r\n iID = parseInt(queryID, 10);\r\n\r\n // get the current line and length of the API file\r\n iLine = pr_fileDat.length;\r\n // check if the ID provided is available in the file's rows - reject if it doesn't\r\n if (isNaN(iID)) {\r\n output[\"error\"] = \"Please specify a Row ID to update.\";\r\n }\r\n else if ((iID <= 0) || (iID > iLine)) {\r\n output[\"error\"] = \"Error: Row ID \" + iID + \" does not exist\";\r\n }\r\n else {\r\n // get the current line's data & store into an array\r\n iLineData = await f_fileRead(fHScsv, iID);\r\n const arrData = [iLineData.data[0].ID, iLineData.data[0].Name, iLineData.data[0].Price, iLineData.data[0].Quantity];\r\n\r\n // remove the first entry since the row ID is not needed\r\n arrData.shift();\r\n\r\n // check if query entries are not empty, then replace those rows:\r\n if (prodName != \"\") arrData[0] = prodName;\r\n if (prodPrice != \"\") arrData[1] = prodPrice;\r\n if (prodCount != \"\") arrData[2] = prodCount;\r\n\r\n if (prodName.length === 0 && prodPrice.length === 0 && prodCount.length === 0) {\r\n output[\"error\"] = \"Please specify a name, price, or quantity to update.\";\r\n }\r\n else {\r\n strpost = arrData.toString();\r\n\r\n // Row ID exists - get a string of the file contents with the specified row updated.\r\n output[\"msg\"] = await f_fileUpdate(fHScsv, iID, strpost);\r\n\r\n // Fetch the file contents and place them in the output data.\r\n const dataObj = await f_fileRead(fHScsv, 0);\r\n output[\"result\"] = dataObj.data;\r\n }\r\n }\r\n}\r\ncatch (err) {\r\n output[\"error\"] = String(err);\r\n}\r\n",
|
|
254
|
+
"comment": "UPDATE - Update CSV row data based on row ID and data passed. Returns an error if the row ID does not exist on the file or is not a number."
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
]
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"apiRouteID": "40eeece8-f5d1-4331-83b0-7693ad0a286d",
|
|
261
|
+
"name": "API Delete",
|
|
262
|
+
"enableCors": true,
|
|
263
|
+
"summary": "Delete operation for API Sample App",
|
|
264
|
+
"method": "delete",
|
|
265
|
+
"inputs": [
|
|
266
|
+
{
|
|
267
|
+
"type": "string",
|
|
268
|
+
"from": "query",
|
|
269
|
+
"name": "rowid",
|
|
270
|
+
"description": "Delete the row ID provided. If 0 or empty, will return an error instead.",
|
|
271
|
+
"example": ""
|
|
272
|
+
}
|
|
273
|
+
],
|
|
274
|
+
"path": "/apisample",
|
|
275
|
+
"subcategory": "",
|
|
276
|
+
"outputs": [
|
|
277
|
+
{
|
|
278
|
+
"type": "string",
|
|
279
|
+
"name": "msg",
|
|
280
|
+
"description": "message describing the APIs response"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"type": "string",
|
|
284
|
+
"name": "error"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"type": "object",
|
|
288
|
+
"name": "result",
|
|
289
|
+
"description": "The records from the file after the row was deleted."
|
|
290
|
+
}
|
|
291
|
+
],
|
|
292
|
+
"steps": [
|
|
293
|
+
{
|
|
294
|
+
"text": "Get Row ID",
|
|
295
|
+
"answers": {
|
|
296
|
+
"plugin": "Program Data:set-work-variable",
|
|
297
|
+
"work_variable": "queryID",
|
|
298
|
+
"value": "input[\"rowid\"]",
|
|
299
|
+
"comment": "retrieve row ID from query"
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"text": "Delete entry from CSV",
|
|
304
|
+
"answers": {
|
|
305
|
+
"plugin": "Custom:code",
|
|
306
|
+
"custom-code": "/**\r\n * API: DELETE\r\n * Delete a record from the file.\r\n */\r\nconst path = require(\"path\");\r\nconst f_fileRead = require(\"./readCSVFile.js\").fileRead;\r\nconst f_delete = require(\"./readCSVFile.js\").lineDelete;\r\nconst fHScsv = path.join(__dirname, \"hobbyshop.csv\");\r\n\r\ntry {\r\n let iLength = iID = 1; // File ID entries will start at One\r\n\r\n const fileData = await f_fileRead(fHScsv);\r\n // Get the current line and length of the API file.\r\n iLength = fileData.length;\r\n\r\n iID = parseInt(queryID, 10); // params from post data is sent as URL query\r\n\r\n // Check if the ID provided is available in the file's rows - reject if it doesn't\r\n if (isNaN(iID)) {\r\n output[\"error\"] = \"Error: please specify a Row ID\";\r\n }\r\n else if ((iID <= 0) || (iID > iLength)) {\r\n output[\"error\"] = \"Error: Row ID \" + iID + \" does not exist\";\r\n }\r\n // Row ID exists - update the file\r\n else {\r\n output[\"msg\"] = await f_delete(fHScsv, iID);\r\n\r\n // Fetch the file contents and place them in the output data.\r\n const dataObj = await f_fileRead(fHScsv, 0);\r\n output[\"result\"] = dataObj.data;\r\n }\r\n}\r\ncatch (err) {\r\n output[\"error\"] = String(err);\r\n}\r\n",
|
|
307
|
+
"comment": "DELETE - Remove CSV row data based on row ID passed. Returns an error if the row ID does not exist or is not a number."
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
]
|
|
311
|
+
}
|
|
312
|
+
]
|
|
313
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Server-side program to provide the interface to the APISample.json Rich
|
|
2
|
+
// Display File user interface.
|
|
3
|
+
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const fileRead = require("./readCSVFile").fileRead;
|
|
6
|
+
|
|
7
|
+
async function f_APISample() {
|
|
8
|
+
// Setup an object named "display" that has built in methods for reading and writing from
|
|
9
|
+
// the screen; i.e. accepting requests from the browser and sending responses.
|
|
10
|
+
pjs.defineDisplay("display", "APISample.json");
|
|
11
|
+
|
|
12
|
+
let records = {};
|
|
13
|
+
|
|
14
|
+
// A field object whose properties correspond to fields defined on the display. Gets values
|
|
15
|
+
// from the user's interactions with the display.
|
|
16
|
+
const fields = {
|
|
17
|
+
exit: false,
|
|
18
|
+
tbURL: "/run/papisamples/wsapi/apisample"
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Keep the program running until the user clicks the Exit button.
|
|
22
|
+
while (!fields.exit) {
|
|
23
|
+
// Display any information from the POST operation once.
|
|
24
|
+
if (typeof fields.postMessage === "string" && fields.postMessage.length > 0) {
|
|
25
|
+
fields.message = fields.postMessage;
|
|
26
|
+
fields.postMessage = "";
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
fields.message = "";
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (typeof fields.postResults === "string" && fields.postResults.length > 0) {
|
|
33
|
+
fields.tbResults = fields.postResults;
|
|
34
|
+
fields.postResults = "";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
fields.tbResults = "";
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Read the CSV file and display the results in the grid.
|
|
41
|
+
try {
|
|
42
|
+
const fHScsv = path.join(__dirname, "hobbyshop.csv");
|
|
43
|
+
records = await fileRead(fHScsv);
|
|
44
|
+
display.grHobbyShop.replaceRecords(records.data);
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.log(err);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// run the main screen
|
|
51
|
+
display.mainscreen.execute(fields);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
exports.default = f_APISample;
|