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
05a16a80
Commit
05a16a80
authored
Aug 23, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple configs
parent
ae5148ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
34 deletions
+99
-34
debugfs.js
src/debugfs-webgui/debugfs.js
+96
-32
debugfs.php
src/debugfs-webgui/debugfs.php
+3
-2
No files found.
src/debugfs-webgui/debugfs.js
View file @
05a16a80
...
...
@@ -244,10 +244,12 @@ function fill_content_rebind_events(){
if
(
$
(
this
).
prop
(
"checked"
))
flags
=
"p"
+
flags
;
else
flags
=
"_"
;
debugfs_data
[
index
].
configs
[
0
].
lines
[
subindex
].
flags
=
flags
;
var
j
=
dropdown_active_config
(
debugfs_data
[
index
]);
debugfs_data
[
index
].
configs
[
j
].
lines
[
subindex
].
flags
=
flags
;
//console.log($(this).attr("file")+", "+$(this).attr("line")+", "+$(this).prop("checked"));
$
.
ajax
({
url
:
"debugfs.php?cmd=echo&file="
+
$
(
this
).
attr
(
"file"
)
+
"&line="
+
$
(
this
).
attr
(
"line"
)
+
"&flags="
+
flags
,
url
:
"debugfs.php?cmd=echo&
conf="
+
j
+
"&
file="
+
$
(
this
).
attr
(
"file"
)
+
"&line="
+
$
(
this
).
attr
(
"line"
)
+
"&flags="
+
flags
,
queue
:
true
});
});
...
...
@@ -338,7 +340,7 @@ function init_ui_controls(record,index){
//apply existing checkboxes to rec
oldrec
=
debugfs_data
[
id
];
j
=
init_ui_dropdown
(
rec
,
id
);
j
=
dropdown_active_config
(
rec
,
id
);
lnew
=
rec
.
configs
[
j
].
lines
.
length
;
lold
=
debugfs_data
[
id
].
configs
[
j
].
lines
.
length
;
...
...
@@ -379,12 +381,55 @@ function init_ui_controls(record,index){
var
dc0_li_in
=
$
(
"<input>"
,{
type
:
"text"
,
placeholder
:
"create new"
placeholder
:
"create new"
,
myindex
:
index
}).
css
({
width
:
"100px"
});
dc0_li_in
.
change
(
function
(){
//name?
var
value
=
$
(
this
).
val
();
var
index
=
$
(
this
).
attr
(
"myindex"
);
var
configs
=
debugfs_data
[
index
].
configs
;
var
exists
=
false
;
var
active
=
0
;
var
existing
=
0
;
for
(
var
i
=
0
;
i
<
configs
.
length
;
i
++
){
if
(
value
==
configs
[
i
].
name
)
{
exists
=
true
;
existing
=
i
;
}
if
(
configs
[
i
].
state
==
1
){
active
=
i
;
}
}
if
(
!
exists
){
//add to debugfs_data - copy current checkboxes - then select
//add to list, add to front
//apply to debugfs
var
arr
=
debugfs_data
[
index
].
configs
[
active
];
debugfs_data
[
index
].
configs
[
i
]
=
JSON
.
parse
(
JSON
.
stringify
(
arr
));
debugfs_data
[
index
].
configs
[
i
].
name
=
value
;
dropdown_add_list_item
(
record
,
index
,
i
);
//sync for now should be enough
//dropdown_clone_new_config(value,active);
update_debugfs_config
();
existing
=
i
;
}
else
{
//select and restore checkboxes
console
.
log
(
"This config already exists, selecting"
);
}
//select anyway
debugfs_data
[
index
].
configs
[
active
].
state
=
0
;
debugfs_data
[
index
].
configs
[
existing
].
state
=
1
;
$
(
"#dropdown_"
+
index
).
html
(
record
.
configs
[
existing
].
name
+
caret
);
$
(
this
).
parent
().
click
();
//check ze name if dose note exist add to list and to config then apply config
});
...
...
@@ -401,36 +446,10 @@ function init_ui_controls(record,index){
}
function
init_ui_dropdown
(
record
,
index
){
var
res
=
0
;
for
(
var
j
=
0
;
j
<
record
.
configs
.
length
;
j
++
){
var
res
=
0
;
var
lentry
=
$
(
"<li>"
,{
myindex
:
index
,
confindex
:
j
}).
html
(
record
.
configs
[
j
].
name
);
lentry
.
css
({
padding
:
"5px"
,
cursor
:
"pointer"
})
.
hover
(
function
(){
$
(
this
).
addClass
(
"even"
).
removeClass
(
"odd"
);
},
function
(){
$
(
this
).
addClass
(
"odd"
).
removeClass
(
"even"
);
});
lentry
.
click
(
function
(){
var
index
=
$
(
this
).
attr
(
"myindex"
);
var
confindex
=
$
(
this
).
attr
(
"confindex"
);
var
name
=
$
(
this
).
html
();
var
sname
=
$
(
"#dropdown_"
+
index
).
html
();
sname
=
sname
.
substr
(
0
,
sname
.
length
-
caret
.
length
);
if
(
name
==
sname
){
console
.
log
(
"Already selected, doing nothing"
);
}
else
{
//select config action here: rename, and restore checkboxes' states
}
});
$
(
"#controls_"
+
index
).
find
(
"ul"
).
append
(
lentry
);
dropdown_add_list_item
(
record
,
index
,
j
);
if
(
record
.
configs
[
j
].
state
==
1
){
$
(
"#dropdown_"
+
index
).
html
(
record
.
configs
[
j
].
name
+
caret
);
...
...
@@ -440,6 +459,51 @@ function init_ui_dropdown(record,index){
return
res
;
}
function
dropdown_active_config
(
record
){
for
(
var
j
=
0
;
j
<
record
.
configs
.
length
;
j
++
){
if
(
record
.
configs
[
j
].
state
==
1
){
return
j
;
}
}
return
0
;
}
function
dropdown_add_list_item
(
record
,
index
,
j
){
var
lentry
=
$
(
"<li>"
,{
myindex
:
index
,
confindex
:
j
}).
html
(
record
.
configs
[
j
].
name
);
lentry
.
css
({
padding
:
"5px"
,
cursor
:
"pointer"
})
.
hover
(
function
(){
$
(
this
).
addClass
(
"even"
).
removeClass
(
"odd"
);
},
function
(){
$
(
this
).
addClass
(
"odd"
).
removeClass
(
"even"
);
});
lentry
.
click
(
function
(){
var
index
=
$
(
this
).
attr
(
"myindex"
);
var
confindex
=
$
(
this
).
attr
(
"confindex"
);
var
name
=
$
(
this
).
html
();
var
sname
=
$
(
"#dropdown_"
+
index
).
html
();
sname
=
sname
.
substr
(
0
,
sname
.
length
-
caret
.
length
);
if
(
name
==
sname
){
console
.
log
(
"Already selected, doing nothing"
);
}
else
{
//select config action here: rename, and restore checkboxes' states
$
(
"#dropdown_"
+
index
).
html
(
record
.
configs
[
confindex
].
name
+
caret
);
var
ac
=
dropdown_active_config
(
record
);
record
.
configs
[
ac
].
state
=
0
;
record
.
configs
[
confindex
].
state
=
1
;
update_debugfs_config
();
}
});
$
(
"#controls_"
+
index
).
find
(
"ul"
).
append
(
lentry
);
}
function
update_debugfs_config
(){
console
.
log
(
"syncing debugfs config"
);
//console.log(debugfs_data);
...
...
src/debugfs-webgui/debugfs.php
View file @
05a16a80
...
...
@@ -148,7 +148,7 @@ function apply_flag($flag){
}
function
sync_from_debugfs_to_config
(
$file
,
$line
,
$flags
,
$sign
){
function
sync_from_debugfs_to_config
(
$
config_index
,
$
file
,
$line
,
$flags
,
$sign
){
global
$tmp_config
;
//$arr_debugfs = get_control("/sys/kernel/debug/dynamic_debug/control");
...
...
@@ -239,6 +239,7 @@ if ($cmd=="echo") {
$file
=
$_GET
[
'file'
];
$line
=
$_GET
[
'line'
];
$flags
=
$_GET
[
'flags'
];
$config_index
=
intval
(
$_GET
[
'conf'
]);
//$config name
if
(
strpos
(
$flags
,
"p"
)
===
FALSE
){
...
...
@@ -247,7 +248,7 @@ if ($cmd=="echo") {
$sign
=
"+"
;
}
exec
(
"echo -n 'file
$file
line
$line
${sign}${flags}' >
$DEBUGFSFILE
"
);
sync_from_debugfs_to_config
(
$file
,
$line
,
$flags
,
$sign
);
sync_from_debugfs_to_config
(
$
config_index
,
$
file
,
$line
,
$flags
,
$sign
);
}
$debugfs_configs
=
"debugfs_configs"
;
...
...
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