Commit 8af5b504 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

speedup global flags

parent 05a16a80
...@@ -78,7 +78,7 @@ function init(){ ...@@ -78,7 +78,7 @@ function init(){
}else{ }else{
$(this).html("Switch off debug"); $(this).html("Switch off debug");
$.ajax({ $.ajax({
url: "debugfs.php?cmd=setflag&flag=%2Bp", url: "debugfs.php?cmd=restore",
queue: true queue: true
}); });
} }
...@@ -408,27 +408,20 @@ function init_ui_controls(record,index){ ...@@ -408,27 +408,20 @@ function init_ui_controls(record,index){
} }
} }
if (!exists){ 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]; var arr = debugfs_data[index].configs[active];
debugfs_data[index].configs[i] = JSON.parse(JSON.stringify(arr)); debugfs_data[index].configs[i] = JSON.parse(JSON.stringify(arr));
debugfs_data[index].configs[i].name = value; debugfs_data[index].configs[i].name = value;
dropdown_add_list_item(record,index,i); dropdown_add_list_item(record,index,i);
//sync for now should be enough
//dropdown_clone_new_config(value,active);
update_debugfs_config();
existing = i; existing = i;
}else{ }else{
//select and restore checkboxes //select and restore checkboxes
console.log("This config already exists, selecting"); console.log("This config already exists, selecting");
} }
//select anyway //select anyway
debugfs_data[index].configs[active].state = 0; dropdown_select_config(index,existing);
debugfs_data[index].configs[existing].state = 1;
$("#dropdown_"+index).html(record.configs[existing].name+caret);
$(this).parent().click(); $(this).parent().click();
//check ze name if dose note exist add to list and to config then apply config //check ze name if dose note exist add to list and to config then apply config
...@@ -484,26 +477,30 @@ function dropdown_add_list_item(record,index,j){ ...@@ -484,26 +477,30 @@ function dropdown_add_list_item(record,index,j){
lentry.click(function(){ lentry.click(function(){
var index = $(this).attr("myindex"); var index = $(this).attr("myindex");
var confindex = $(this).attr("confindex"); var confindex = $(this).attr("confindex");
var name = $(this).html(); dropdown_select_config(index,confindex);
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); $("#controls_"+index).find("ul").append(lentry);
} }
function dropdown_select_config(index,config_index){
var record = debugfs_data[index];
var ac = dropdown_active_config(record);
var name_new = record.configs[config_index].name;
var name_old = record.configs[ac].name;
if (name_new==name_old){
console.log("Already selected, doing nothing");
}else{
$("#dropdown_"+index).html(record.configs[config_index].name+caret);
record.configs[ac].state = 0;
record.configs[config_index].state = 1;
//restore checkboxes!
update_debugfs_config();
}
}
function update_debugfs_config(){ function update_debugfs_config(){
console.log("syncing debugfs config"); console.log("syncing debugfs config");
//console.log(debugfs_data); //console.log(debugfs_data);
......
...@@ -125,13 +125,16 @@ function apply_config_to_control(){ ...@@ -125,13 +125,16 @@ function apply_config_to_control(){
function apply_flag($flag){ function apply_flag($flag){
global $tmp_config, $DEBUGFSFILE; global $tmp_config, $DEBUGFSFILE;
//echo "<pre>\n"; //add short command for all here
$arr_config = json_decode(file_get_contents($tmp_config),true); $arr_config = json_decode(file_get_contents($tmp_config),true);
foreach($arr_config as $k0 => $v0){ foreach($arr_config as $k0 => $v0){
if ($v0['state']==1){ if ($v0['state']==1){
foreach($v0['configs'] as $k1 => $v1){ foreach($v0['configs'] as $k1 => $v1){
if ($v1['state']==1){ if ($v1['state']==1){
$cmd = "echo -n 'file ".$v0['file']." $flag' > $DEBUGFSFILE";
exec($cmd);
/*
foreach($v1['lines'] as $k2 => $v2){ foreach($v1['lines'] as $k2 => $v2){
$file = $v2['file']; $file = $v2['file'];
$lineno = $v2['lineno']; $lineno = $v2['lineno'];
...@@ -140,10 +143,12 @@ function apply_flag($flag){ ...@@ -140,10 +143,12 @@ function apply_flag($flag){
exec($cmd); exec($cmd);
//echo "echo -n 'file $file line $lineno ${sign}p'\n"; //echo "echo -n 'file $file line $lineno ${sign}p'\n";
} }
*/
} }
} }
} }
} }
echo "Done"; echo "Done";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment