Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
13c80c28
Commit
13c80c28
authored
Aug 23, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.configs 2.speedup
parent
8af5b504
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
34 deletions
+49
-34
debugfs.js
src/debugfs-webgui/debugfs.js
+24
-12
debugfs.php
src/debugfs-webgui/debugfs.php
+25
-22
No files found.
src/debugfs-webgui/debugfs.js
View file @
13c80c28
...
...
@@ -143,7 +143,7 @@ function init(){
$
(
"#controls_"
+
index
).
addClass
(
"hidden_content"
);
debugfs_data
[
index
].
state
=
0
;
}
update_debugfs_config
();
update_debugfs_config
(
index
);
});
$
(
".flags_cb"
).
change
(
function
(){
...
...
@@ -334,29 +334,35 @@ function init_ui_controls(record,index){
url
:
"debugfs.php?cmd=reread&file="
+
file
,
queue
:
true
,
success
:
function
(
data
){
//console.log("Welcome "+id+" & "+file);
rec
=
jQuery
.
parseJSON
(
data
);
target
=
$
(
"#content_"
+
id
).
find
(
"#content_td"
);
//apply existing checkboxes to rec
oldrec
=
debugfs_data
[
id
];
j
=
dropdown_active_config
(
rec
,
id
);
//to save to active config
j
=
dropdown_active_config
(
oldrec
,
id
);
//console.log("Ze Jay is "+j);
lnew
=
rec
.
configs
[
j
].
lines
.
length
;
lnew
=
rec
.
configs
[
0
].
lines
.
length
;
lold
=
debugfs_data
[
id
].
configs
[
j
].
lines
.
length
;
//restore checkboxes
for
(
var
i
=
0
;
i
<
lnew
;
i
++
){
if
(
i
<
lold
)
{
rec
.
configs
[
j
].
lines
[
i
].
flags
=
oldrec
.
configs
[
j
].
lines
[
i
].
flags
;
rec
.
configs
[
0
].
lines
[
i
].
flags
=
oldrec
.
configs
[
j
].
lines
[
i
].
flags
;
}
else
{
rec
.
configs
[
j
].
lines
[
i
].
flags
=
oldrec
.
configs
[
j
].
lines
[
lold
-
1
].
flags
;
rec
.
configs
[
0
].
lines
[
i
].
flags
=
oldrec
.
configs
[
j
].
lines
[
lold
-
1
].
flags
;
}
}
//copy back
oldrec
.
configs
[
j
].
lines
=
JSON
.
parse
(
JSON
.
stringify
(
rec
.
configs
[
0
].
lines
));
//update debugfs_data
debugfs_data
[
id
].
configs
[
j
]
=
rec
.
configs
[
j
];
fill_content
(
rec
.
configs
[
j
].
lines
,
id
,
target
);
fill_content
(
oldrec
.
configs
[
j
].
lines
,
id
,
target
);
fill_content_rebind_events
();
}
});
...
...
@@ -496,17 +502,23 @@ function dropdown_select_config(index,config_index){
$
(
"#dropdown_"
+
index
).
html
(
record
.
configs
[
config_index
].
name
+
caret
);
record
.
configs
[
ac
].
state
=
0
;
record
.
configs
[
config_index
].
state
=
1
;
var
target
=
$
(
"#content_"
+
index
).
find
(
"#content_td"
);
fill_content
(
record
.
configs
[
config_index
].
lines
,
index
,
target
);
fill_content_rebind_events
();
//restore checkboxes!
update_debugfs_config
();
update_debugfs_config
(
index
);
}
}
function
update_debugfs_config
(){
function
update_debugfs_config
(
index
){
var
file
=
debugfs_data
[
index
].
file
;
console
.
log
(
"syncing debugfs config"
);
//console.log(debugfs_data);
$
.
ajax
({
type
:
"POST"
,
url
:
"debugfs.php?cmd=sync
"
,
url
:
"debugfs.php?cmd=sync
&file="
+
file
,
data
:
JSON
.
stringify
(
debugfs_data
),
dataType
:
"json"
});
...
...
src/debugfs-webgui/debugfs.php
View file @
13c80c28
...
...
@@ -100,55 +100,56 @@ function update_config($data){
function
apply_config_to_control
(){
global
$tmp_config
,
$DEBUGFSFILE
;
$longstring
=
""
;
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
foreach
(
$arr_config
as
$
k0
=>
$
v0
){
foreach
(
$arr_config
as
$v0
){
if
(
$v0
[
'state'
]
==
1
){
foreach
(
$v0
[
'configs'
]
as
$
k1
=>
$
v1
){
foreach
(
$v0
[
'configs'
]
as
$v1
){
if
(
$v1
[
'state'
]
==
1
){
foreach
(
$v1
[
'lines'
]
as
$
k2
=>
$
v2
){
foreach
(
$v1
[
'lines'
]
as
$v2
){
$file
=
$v2
[
'file'
];
$lineno
=
$v2
[
'lineno'
];
$flag
=
$v2
[
'flags'
];
if
(
$flag
==
"p"
)
$sign
=
"+"
;
else
$sign
=
"-"
;
exec
(
"echo -n 'file
$file
line
$lineno
${sign}p' >
$DEBUGFSFILE
"
);
$newstring
=
"file
$file
line
$lineno
${sign}p;"
;
//there's a limit
if
(
strlen
(
$longstring
.
$newstring
)
>
4095
){
exec
(
"echo -n '
$longstring
' >
$DEBUGFSFILE
"
);
$longstring
=
$newstring
;
}
else
{
$longstring
.=
$newstring
;
}
//echo "echo -n 'file $file line $lineno ${sign}p'\n";
}
}
}
}
}
exec
(
"echo -n '
$longstring
' >
$DEBUGFSFILE
"
);
echo
"Done"
;
}
function
apply_flag
(
$flag
){
global
$tmp_config
,
$DEBUGFSFILE
;
//add short command for all here
$longstring
=
""
;
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
foreach
(
$arr_config
as
$
k0
=>
$
v0
){
foreach
(
$arr_config
as
$v0
){
if
(
$v0
[
'state'
]
==
1
){
foreach
(
$v0
[
'configs'
]
as
$
k1
=>
$
v1
){
foreach
(
$v0
[
'configs'
]
as
$v1
){
if
(
$v1
[
'state'
]
==
1
){
$cmd
=
"echo -n 'file "
.
$v0
[
'file'
]
.
"
$flag
' >
$DEBUGFSFILE
"
;
exec
(
$cmd
);
/*
foreach($v1['lines'] as $k2 => $v2){
$file = $v2['file'];
$lineno = $v2['lineno'];
$cmd = "echo -n 'file $file line $lineno $flag' > $DEBUGFSFILE";
//echo "$cmd\n";
exec($cmd);
//echo "echo -n 'file $file line $lineno ${sign}p'\n";
$newstring
=
"file "
.
$v0
[
'file'
]
.
"
$flag
;"
;
if
(
strlen
(
$longstring
.
$newstring
)
>
4095
){
exec
(
"echo -n '
$longstring
' >
$DEBUGFSFILE
"
);
$longstring
=
$newstring
;
}
else
{
$longstring
.=
$newstring
;
}
*/
}
}
}
}
exec
(
"echo -n '
$longstring
' >
$DEBUGFSFILE
"
);
echo
"Done"
;
}
...
...
@@ -266,8 +267,10 @@ if ($cmd=="save"){
if
(
$cmd
==
"sync"
){
//list saved configs here
$file
=
$_GET
[
'file'
];
$data
=
file_get_contents
(
"php://input"
);
update_config
(
$data
);
apply_config_to_control
();
}
if
(
$cmd
==
"savetofs"
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment