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
726f0dcb
Commit
726f0dcb
authored
Aug 19, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1. all/none checkbox
parent
e4569ef9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
36 deletions
+58
-36
debugfs.js
src/debugfs-webgui/debugfs.js
+58
-36
No files found.
src/debugfs-webgui/debugfs.js
View file @
726f0dcb
...
@@ -5,9 +5,12 @@ var debugfs_data;
...
@@ -5,9 +5,12 @@ var debugfs_data;
function
init
(){
function
init
(){
$
(
"body"
).
html
(
"<h3>Dynamic Debug, DebugFS:</h3>"
);
$
(
"body"
).
html
(
"<h3>
Linux Kernel
Dynamic Debug, DebugFS:</h3>"
);
var
b0
=
$
(
"<button>"
,{
id
:
"b0"
}).
html
(
"toggle hidden"
);
var
b0
=
$
(
"<button>"
,{
id
:
"b0"
,
title
:
"select/hide files"
}).
html
(
"Edit list"
);
b0
.
prop
(
"state"
,
0
);
b0
.
prop
(
"state"
,
0
);
b0
.
click
(
function
(){
b0
.
click
(
function
(){
...
@@ -18,11 +21,13 @@ function init(){
...
@@ -18,11 +21,13 @@ function init(){
$
(
this
).
prop
(
"state"
,
0
)
$
(
this
).
prop
(
"state"
,
0
)
$
(
".hidden_rows"
).
hide
();
$
(
".hidden_rows"
).
hide
();
$
(
".hidden_content"
).
hide
();
$
(
".hidden_content"
).
hide
();
//$("#content_"+id).hide(); ?!
}
}
});
});
var
b1
=
$
(
"<button>"
,{
id
:
"b1"
}).
css
({
margin
:
"0px 0px 0px 10px"
}).
html
(
"save to persistent storage"
);
var
b1
=
$
(
"<button>"
,{
id
:
"b1"
,
title
:
"Copy /tmp/debugfs.json to /<path-to-debugfs.php>/debugfs.json"
}).
css
({
margin
:
"0px 0px 0px 10px"
}).
html
(
"Save to persistent storage"
);
b1
.
click
(
function
(){
b1
.
click
(
function
(){
$
.
ajax
({
$
.
ajax
({
...
@@ -30,7 +35,10 @@ function init(){
...
@@ -30,7 +35,10 @@ function init(){
});
});
});
});
var
b2
=
$
(
"<button>"
,{
id
:
"b2"
}).
css
({
margin
:
"0px 0px 0px 10px"
}).
html
(
"restore configs for selected files"
);
var
b2
=
$
(
"<button>"
,{
id
:
"b2"
,
title
:
"Apply configuration of the selected files in GUI to DebugFS"
}).
css
({
margin
:
"0px 0px 0px 10px"
}).
html
(
"Apply to debugfs (selected files)"
);
b2
.
click
(
function
(){
b2
.
click
(
function
(){
$
.
ajax
({
$
.
ajax
({
...
@@ -38,9 +46,9 @@ function init(){
...
@@ -38,9 +46,9 @@ function init(){
});
});
});
});
$
(
"body"
).
append
(
$
(
"<div>"
).
css
({
padding
:
"0px 0px 10px 0px"
}).
append
(
b0
).
append
(
b1
).
append
(
b2
));
$
(
"body"
).
append
(
$
(
"<div>"
).
css
({
padding
:
"0px 0px 10px 0px"
}).
append
(
b0
).
append
(
b1
).
append
(
b2
));
//list header
var
t
=
$
(
"<table border=
\"
1
\"
>"
).
html
(
"
\
var
t
=
$
(
"<table border=
\"
1
\"
>"
).
html
(
"
\
<tr>
\
<tr>
\
<th style='display:none;' class='hidden_rows'>Show</th>
\
<th style='display:none;' class='hidden_rows'>Show</th>
\
...
@@ -50,6 +58,7 @@ function init(){
...
@@ -50,6 +58,7 @@ function init(){
$
(
"body"
).
append
(
t
);
$
(
"body"
).
append
(
t
);
//everything's initialized on response
$
.
ajax
({
$
.
ajax
({
url
:
"debugfs.php"
,
url
:
"debugfs.php"
,
success
:
function
(
data
){
success
:
function
(
data
){
...
@@ -59,42 +68,36 @@ function init(){
...
@@ -59,42 +68,36 @@ function init(){
var
l
,
content
,
controls
;
var
l
,
content
,
controls
;
for
(
var
i
=
0
;
i
<
r
.
length
;
i
++
){
//file walk
for
(
var
i
=
0
;
i
<
r
.
length
;
i
++
){
l
=
init_ui_file
(
r
[
i
],
i
);
l
=
init_ui_file
(
r
[
i
],
i
);
content
=
init_ui_content
(
r
[
i
],
i
);
content
=
init_ui_content
(
r
[
i
],
i
);
controls
=
init_ui_controls
(
r
[
i
],
i
);
controls
=
init_ui_controls
(
r
[
i
],
i
);
t
.
append
(
l
).
append
(
controls
).
append
(
content
);
t
.
append
(
l
).
append
(
controls
).
append
(
content
);
//line walk
var
r1
=
r
[
i
].
configs
[
0
].
lines
;
fill_content
(
r
[
i
].
configs
[
0
].
lines
,
i
,
content
.
find
(
"#content_td"
));
fill_content
(
r1
,
i
,
content
.
find
(
"#content_td"
));
}
}
fill_content_rebind_events
();
fill_content_rebind_events
();
$
(
".filename"
).
click
(
function
(){
$
(
".filename"
).
click
(
function
(){
var
id
=
$
(
this
).
attr
(
"id"
);
var
index
=
$
(
this
).
attr
(
"index"
);
id
=
id
.
substr
(
id
.
indexOf
(
"_"
)
+
1
);
$
(
"#content_"
+
index
).
toggle
();
console
.
log
(
id
);
$
(
"#controls_"
+
index
).
toggle
();
$
(
"#content_"
+
id
).
toggle
();
$
(
"#controls_"
+
id
).
toggle
();
});
});
$
(
".visibility_cb"
).
change
(
function
(){
$
(
".visibility_cb"
).
change
(
function
(){
var
id
=
$
(
this
).
attr
(
"id"
);
var
index
=
$
(
this
).
attr
(
"index"
);
id
=
id
.
substr
(
id
.
indexOf
(
"_"
)
+
1
);
if
(
$
(
this
).
prop
(
"checked"
)){
if
(
$
(
this
).
prop
(
"checked"
)){
$
(
"#row_"
+
i
d
).
removeClass
(
"hidden_rows"
);
$
(
"#row_"
+
i
ndex
).
removeClass
(
"hidden_rows"
);
$
(
"#content_"
+
i
d
).
removeClass
(
"hidden_content"
);
$
(
"#content_"
+
i
ndex
).
removeClass
(
"hidden_content"
);
$
(
"#controls_"
+
i
d
).
removeClass
(
"hidden_content"
);
$
(
"#controls_"
+
i
ndex
).
removeClass
(
"hidden_content"
);
debugfs_data
[
i
d
].
state
=
1
;
debugfs_data
[
i
ndex
].
state
=
1
;
}
else
{
}
else
{
$
(
"#row_"
+
i
d
).
addClass
(
"hidden_rows"
);
$
(
"#row_"
+
i
ndex
).
addClass
(
"hidden_rows"
);
$
(
"#content_"
+
i
d
).
addClass
(
"hidden_content"
);
$
(
"#content_"
+
i
ndex
).
addClass
(
"hidden_content"
);
$
(
"#controls_"
+
i
d
).
addClass
(
"hidden_content"
);
$
(
"#controls_"
+
i
ndex
).
addClass
(
"hidden_content"
);
debugfs_data
[
i
d
].
state
=
0
;
debugfs_data
[
i
ndex
].
state
=
0
;
}
}
update_debugfs_config
();
update_debugfs_config
();
});
});
...
@@ -128,7 +131,7 @@ function fill_content(record,index,target){
...
@@ -128,7 +131,7 @@ function fill_content(record,index,target){
//add all/none checkbox
//add all/none checkbox
l
=
"<tr>"
;
l
=
"<tr>"
;
l
+=
" <td style='text-align:center' title='check/uncheck all'>all</td>"
;
l
+=
" <td style='text-align:center' title='check/uncheck all'>all</td>"
;
l
+=
" <td
id='all_"
+
index
+
"' style='text-align:center'><input title='check flags' type='checkbox' class='tp allornone
' /></td>"
;
l
+=
" <td
style='text-align:center'><input id='all_"
+
index
+
"' title='check flags' type='checkbox' class='tp debugall' index='"
+
index
+
"
' /></td>"
;
l
+=
" <td></td>"
;
l
+=
" <td></td>"
;
l
+=
" <td></td>"
;
l
+=
" <td></td>"
;
l
+=
"</tr>"
;
l
+=
"</tr>"
;
...
@@ -157,7 +160,7 @@ function fill_content(record,index,target){
...
@@ -157,7 +160,7 @@ function fill_content(record,index,target){
l
=
"<tr class='"
+
oddeven
+
"'>"
;
l
=
"<tr class='"
+
oddeven
+
"'>"
;
l
+=
" <td style='text-align:center' title='"
+
ttl
+
"'>"
+
record
[
j
].
lineno
+
"</td>"
;
l
+=
" <td style='text-align:center' title='"
+
ttl
+
"'>"
+
record
[
j
].
lineno
+
"</td>"
;
l
+=
" <td style='text-align:center'><input title='p-flag' type='checkbox' class='tp debug' "
+
checked
+
" file='"
+
record
[
j
].
file
+
"' line='"
+
record
[
j
].
lineno
+
"' /></td>"
;
l
+=
" <td style='text-align:center'><input title='p-flag' type='checkbox' class='tp debug' "
+
checked
+
" file='"
+
record
[
j
].
file
+
"' line='"
+
record
[
j
].
lineno
+
"'
index='"
+
index
+
"' subindex='"
+
j
+
"'
/></td>"
;
l
+=
" <td title=
\"
function: "
+
record
[
j
].
function
+
"
\"
>"
+
record
[
j
].
function
.
substr
(
0
,
20
)
+
cut_function
+
"</td>"
;
l
+=
" <td title=
\"
function: "
+
record
[
j
].
function
+
"
\"
>"
+
record
[
j
].
function
.
substr
(
0
,
20
)
+
cut_function
+
"</td>"
;
l
+=
" <td title=
\"
format: "
+
record
[
j
].
format
+
"
\"
>"
+
record
[
j
].
format
.
substr
(
0
,
20
)
+
cut_format
+
"</td>"
;
l
+=
" <td title=
\"
format: "
+
record
[
j
].
format
+
"
\"
>"
+
record
[
j
].
format
.
substr
(
0
,
20
)
+
cut_format
+
"</td>"
;
l
+=
"</tr>"
;
l
+=
"</tr>"
;
...
@@ -169,19 +172,34 @@ function fill_content_rebind_events(){
...
@@ -169,19 +172,34 @@ function fill_content_rebind_events(){
//init actions
//init actions
$
(
".debug"
).
off
(
"change"
);
$
(
".debug"
).
off
(
"change"
);
$
(
".debug"
).
change
(
function
(){
$
(
".debug"
).
change
(
function
(){
console
.
log
(
$
(
this
).
attr
(
"file"
)
+
", "
+
$
(
this
).
attr
(
"line"
)
+
", "
+
$
(
this
).
prop
(
"checked"
));
var
index
=
$
(
this
).
attr
(
"index"
);
var
subindex
=
$
(
this
).
attr
(
"subindex"
);
if
(
$
(
this
).
prop
(
"checked"
))
flags
=
"p"
;
else
flags
=
"_"
;
debugfs_data
[
index
].
configs
[
0
].
lines
[
subindex
].
flags
=
flags
;
//console.log($(this).attr("file")+", "+$(this).attr("line")+", "+$(this).prop("checked"));
$
.
ajax
({
$
.
ajax
({
url
:
"debugfs.php?cmd=echo&file="
+
$
(
this
).
attr
(
"file"
)
+
"&line="
+
$
(
this
).
attr
(
"line"
)
+
"&pflag="
+
$
(
this
).
prop
(
"checked"
)
url
:
"debugfs.php?cmd=echo&file="
+
$
(
this
).
attr
(
"file"
)
+
"&line="
+
$
(
this
).
attr
(
"line"
)
+
"&pflag="
+
$
(
this
).
prop
(
"checked"
)
});
});
});
});
$
(
".debugall"
).
off
(
"change"
);
$
(
".debugall"
).
change
(
function
(){
var
index
=
$
(
this
).
attr
(
"index"
);
var
checked
=
$
(
this
).
prop
(
"checked"
);
$
(
"#content_"
+
index
).
find
(
".debug"
).
prop
(
"checked"
,
checked
).
change
();
});
}
}
function
init_ui_file
(
record
,
index
){
function
init_ui_file
(
record
,
index
){
var
l
=
$
(
"<tr>"
,{
id
:
"row_"
+
index
}).
html
(
"
\
var
l
=
$
(
"<tr>"
,{
id
:
"row_"
+
index
}).
html
(
"
\
<td class='hidden_rows' style='text-align:center;display:none' >
\
<td class='hidden_rows' style='text-align:center;display:none' >
\
<input id='cb_"
+
index
+
"' class='tp visibility_cb' type='checkbox'>
\
<input id='cb_"
+
index
+
"' class='tp visibility_cb' type='checkbox'
index='"
+
index
+
"'
>
\
</td>
\
</td>
\
<td class='special filename' id='header_"
+
index
+
"
'
>"
+
record
.
file
+
"</td>
\
<td class='special filename' id='header_"
+
index
+
"
' index='"
+
index
+
"'
>"
+
record
.
file
+
"</td>
\
"
);
"
);
if
(
record
.
state
==
0
){
if
(
record
.
state
==
0
){
...
@@ -233,7 +251,11 @@ function init_ui_controls(record,index){
...
@@ -233,7 +251,11 @@ function init_ui_controls(record,index){
$
(
"<td>"
,{
id
:
"controls_td"
})
$
(
"<td>"
,{
id
:
"controls_td"
})
);
);
var
bc0
=
$
(
"<button>"
,{
id
:
"bc0_"
+
index
,
file
:
record
.
file
}).
css
({
margin
:
"5px 5px 5px 5px"
,
"font-size"
:
"14px"
}).
html
(
"reread from debugfs"
);
var
bc0
=
$
(
"<button>"
,{
id
:
"bc0_"
+
index
,
title
:
"read config from debugfs - useful when changes were made and the line numbers got shifted from the ones in the stored config"
,
file
:
record
.
file
}).
css
({
margin
:
"5px 5px 5px 5px"
,
"font-size"
:
"14px"
}).
html
(
"read from debugfs"
);
bc0
.
click
(
function
(){
bc0
.
click
(
function
(){
var
id
=
$
(
this
).
attr
(
"id"
);
var
id
=
$
(
this
).
attr
(
"id"
);
...
...
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