Page 2 of 3

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 11:33 am
by HansR
mcrossley wrote: Sat 18 Feb 2023 11:29 am Sorry it has taken so long to get back to this. I put the day file you posted above into my copy of CMX, and....
It deleted the extra 23/01/23 lines without any error!

As I cannot reproduce the error, I am going to need a bit more diagnostics from you or Hans.

1. Take a copy of your dayfile.txt first.

2. You will need to load the browser developer tools, and when you send the delete to CMX, on the network tab, could you find the line that has:
Name = "dayfile"
Path = "/api/edit/dayfile"

3. Open that entry by clicking it, and select the Payload tab. Cut and paste the contents of that tab here please.

4. Stop CMX, restore the backed up copy of the dayfile, and restart CMX.

Thanks
Will do. My problem is with the monthly log where I wanted to delete several lines and couldn't.
I assume it has the same instructions only with another filename?

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 11:53 am
by mcrossley
Yes please

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 11:58 am
by HansR
http://192.168.x.y:8998/api/data/logfil ... 6720445656

The actual line I want to delete is 4768 in a logfile of 29 pages for 17th of feb (5 minute interval)

Payload tab:

Code: Select all

from: 2023-2-17
to: 2023-2-17
draw: 40
start: 160
length: 10
search%5Bvalue%5D: 
search%5Bregex%5D: false
_: 1676720445656

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 1:28 pm
by mcrossley
Hi Hans, that is the data fetch, it's the delete I need. The relevant data will be in the body of the POST.

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 2:01 pm
by HansR
OK. I got confused, the datalogs are as below (first the Delete, then the Edit)
For a delete I get:

Code: Select all

http://192.168.178.143:8998/api/edit/datalogs

Payload: {"action":"Delete","lines":],"extra":"false","data": ]}: 

When I push the delete button I get the line shown in my previous post.

------

For an edit I get:

Code: Select all

http://192.168.178.143:8998/api/edit/datalogs

Payload: {"action":"Edit","lines":[4768],"extra":"false","data": [["17-02-23","13:20","11,9","87","9,8","20,1","90,4","143","0,0","0,5","1011,6","138,4","15,9","60","13,0","11,9","11,9","0,0","145","0,19","19,99","8,0","394","0,0","109","0,0","0,5","9,5","13,1"]]}: 

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 2:21 pm
by mcrossley
Hmm, so the "lines" and "data" are both badly formed, which means the row data is not being passed to the function.

Does your datalogs.js file have the first line as: // Last modified: 2022/11/23 16:10:52

I wonder - Which OS is the client running on? I'm beginning to suspect a Linux issue.

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 2:35 pm
by HansR
mcrossley wrote: Sat 18 Feb 2023 2:21 pm Does your datalogs.js file have the first line as: // Last modified: 2022/11/23 16:10:52
// Last modified: 2022/11/23 16:10:52
mcrossley wrote: Sat 18 Feb 2023 2:21 pm I wonder - Which OS is the client running on? I'm beginning to suspect a Linux issue.
Well, CMX runs on the RPi but the client (I regard my interface as the client) runs on Win10/Chrome.
I could try FF... putting words into action: FF acts exactly the same.
Apart from some transfer issues I don't really see something of Linux in the execution of the code.

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 2:55 pm
by mcrossley
For deletes, the js uses the OS default multi-select method.

I'll have to create a debug version of the JS for you which will output some messages/dumps of variables that may help....

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 5:43 pm
by mcrossley
Could you use the attached files and post the output from the dev tools console when deleting in either the dayfile or data logs please?

Meantime I have tried Edge and Firefox and they both work for me.

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 6:23 pm
by HansR
Well, this is it. Can't get the formatting as in the copnsole itself, hope you can do something with it. I need to redo, let me know.
Notice the violation at 19:12

Code: Select all

19:12:10.196 jquery-latest.min.js:2 XHR finished loading: GET "http://192.168.178.143:8998/api/data/logfile?from=2023-2-17&to=2023-2-17&draw=2&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1676743920109".
send @ jquery-latest.min.js:2
ajax @ jquery-latest.min.js:2
La @ datatables.min.js:65
Fb @ datatables.min.js:65
fa @ datatables.min.js:57
ja @ datatables.min.js:59
oc @ datatables.min.js:138
(anonymous) @ datatables.min.js:139
iterator @ datatables.min.js:129
(anonymous) @ datatables.min.js:139
(anonymous) @ datatables.min.js:132
load @ datalogs.js:250
onclick @ datalogs.html:81
19:12:14.254 jquery-latest.min.js:2 XHR finished loading: GET "http://192.168.178.143:8998/api/data/logfile?from=2023-2-17&to=2023-2-17&draw=3&start=160&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1676743920110".
send @ jquery-latest.min.js:2
ajax @ jquery-latest.min.js:2
La @ datatables.min.js:65
Fb @ datatables.min.js:65
fa @ datatables.min.js:57
e @ datatables.min.js:79
(anonymous) @ pagination_input.js:148
dispatch @ jquery-latest.min.js:2
v.handle @ jquery-latest.min.js:2
19:13:26.010 jquery-latest.min.js:2 XHR finished loading: GET "http://192.168.178.143:8998/api/data/logfile?from=2023-2-17&to=2023-2-17&draw=4&start=160&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&_=1676743920111".
send @ jquery-latest.min.js:2
ajax @ jquery-latest.min.js:2
La @ datatables.min.js:65
Fb @ datatables.min.js:65
fa @ datatables.min.js:57
(anonymous) @ datatables.min.js:136
iterator @ datatables.min.js:129
(anonymous) @ datatables.min.js:136
(anonymous) @ datatables.min.js:132
_deleteRowCallback @ dataTables.altEditor.free.js:864
(anonymous) @ dataTables.altEditor.free.js:536
c @ jquery-latest.min.js:2
fireWith @ jquery-latest.min.js:2
l @ jquery-latest.min.js:2
(anonymous) @ jquery-latest.min.js:2
load (async)
send @ jquery-latest.min.js:2
ajax @ jquery-latest.min.js:2
onDeleteRow @ datalogs.js:183
_deleteRow @ dataTables.altEditor.free.js:534
(anonymous) @ dataTables.altEditor.free.js:222
dispatch @ jquery-latest.min.js:2
v.handle @ jquery-latest.min.js:2
19:12:04.133 [Violation] Forced reflow while executing JavaScript took 39ms
19:13:25.522 datalogs.js:182 onDeleteRow: rowdata[0]= 4768
19:13:25.574 jquery-latest.min.js:2 XHR finished loading: POST "http://192.168.178.143:8998/api/edit/datalogs".
send @ jquery-latest.min.js:2
ajax @ jquery-latest.min.js:2
onDeleteRow @ datalogs.js:183
_deleteRow @ dataTables.altEditor.free.js:534
(anonymous) @ dataTables.altEditor.free.js:222
dispatch @ jquery-latest.min.js:2
v.handle @ jquery-latest.min.js:2

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 7:16 pm
by mcrossley
It does thanks. It shows that multiselect does not appear to be enabled.

Can you select multiple rows in the table?

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 7:27 pm
by HansR
mcrossley wrote: Sat 18 Feb 2023 7:16 pm It does thanks. It shows that multiselect does not appear to be enabled.

Can you select multiple rows in the table?
Yes (at least it looks like multiple selection: they become dark).
Btw: i did the above with only 1 row. I did try more rows but the effect was the same: no deletion.

Do you want a similar console output for multiple lines?

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 7:38 pm
by mcrossley
You could try. Btw that seems to be some debug console output rather than the standard console?

Can you also try...

In the JS file you will find an option (from memory)...

multiselect: 'os',

You could try changing that to...

multiselect: true

And see if that makes any difference.

It seems you can select multiple lines, but the script is sending the data as if single select is enabled. With multiselect it should send an array even if only a single row is selected.

Re: Deleting Lines in Dayfile Editor

Posted: Sat 18 Feb 2023 8:31 pm
by HansR
mcrossley wrote: Sat 18 Feb 2023 7:38 pm You could try. Btw that seems to be some debug console output rather than the standard console?
console.log and console.debug are bothe shown in Chrome, I can select which messages to see, I show all now (see below).
mcrossley wrote: Sat 18 Feb 2023 7:38 pm Can you also try...

In the JS file you will find an option (from memory)...

multiselect: 'os',

You could try changing that to...

multiselect: true

And see if that makes any difference.
It is just Select (multiselect does not exist)

No difference
mcrossley wrote: Sat 18 Feb 2023 7:38 pm It seems you can select multiple lines, but the script is sending the data as if single select is enabled. With multiselect it should send an array even if only a single row is selected.
Does not show.

Below with "select: true" and two rows selected. Note that when the delete button is pressed it finds only the first row of the selected two. All messages from the console:

Code: Select all

content-scripts.js:1 INS: content-ads.js loaded:  http://192.168.178.143:8998/datalogs.html
21:27:42.573 content-scripts.js:1 TSS: content-tss.js loaded:  http://192.168.178.143:8998/datalogs.html
21:27:42.575 content-scripts.js:1 INS: content-blocked-items.js loaded:  http://192.168.178.143:8998/datalogs.html
21:27:42.828 content-scripts.js:1 CONTENT_SHELL: Page allowed. Skipping shell injection blocks
21:27:42.829 content-scripts.js:1 GET TAB ID RESPONSE:  {tabId: 1056909269}
21:27:42.990 jquery-latest.min.js:2 [Violation] 'setTimeout' handler took 133ms
21:27:43.016 content-scripts.js:1 TSS: excluded result:  {excluded: true}
21:27:43.016 content-scripts.js:1 TSS: Excluding content tss (trigger: send-mesage)
521:28:28.725 XHR finished loading: GET "<URL>".
21:28:27.634 datalogs.js:182 onDeleteRow: rowdata[0]= 4768
21:28:27.689 jquery-latest.min.js:2 XHR finished loading: POST "http://192.168.178.143:8998/api/edit/datalogs".
send @ jquery-latest.min.js:2
ajax @ jquery-latest.min.js:2
onDeleteRow @ datalogs.js:183
_deleteRow @ dataTables.altEditor.free.js:534
(anonymous) @ dataTables.altEditor.free.js:222
dispatch @ jquery-latest.min.js:2
v.handle @ jquery-latest.min.js:2
EDIT: My last contribution for tonight.

Re: Deleting Lines in Dayfile Editor

Posted: Sun 19 Feb 2023 12:25 am
by apple8
Thanks Hans for providing the information. I woke this morning to see your progress that would be a challenge for me to provide.

I am using Win10 and Edge.