Skip to content

Commit

Permalink
添加规则页面易用性改进,支持显示规则详细,并且支持编辑 hhyo#76
Browse files Browse the repository at this point in the history
  • Loading branch information
hhyo authored and kkrepos committed Apr 28, 2019
1 parent 0399bbc commit 20c6d1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 43 deletions.
51 changes: 11 additions & 40 deletions themis/static/js/sql_review/rule_set.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $(document).ready(function() {
// if (flag != 0){

// }
// })
// })
$.get("/themis/sqlreview/rule/info", {}, function(result){
if(result["errcode"] === 80013){
var columns = [
Expand Down Expand Up @@ -63,32 +63,24 @@ $(document).ready(function() {
$(nTd).addClass('inputParm2').attr('id', oData[0] + "$parm2");
}
},
{
{
"title": "参数三",
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).addClass('inputParm3').attr('dbtype', oData[6]);
$(nTd).addClass('inputParm3').attr('id', oData[0] + "$parm3");
}
},
{
"title": "参数四",
{
"title": "RuleCmd",
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).addClass('inputParm4').attr('dbtype', oData[6]);
$(nTd).addClass('inputParm4').attr('id', oData[0] + "$parm4");
$(nTd).addClass('RuleCmd').attr('dbtype', oData[6]);
$(nTd).addClass('RuleCmd').attr('id', oData[0] + "$rule_cmd");
}
},
{
"title": "参数五",
"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).addClass('inputParm5').attr('dbtype', oData[6]);
$(nTd).addClass('inputParm5').attr('id', oData[0] + "$parm5");
}
},
{"title": "exclude_type"}
}
]
genTable("struct", "struct_table", result["data"], columns)
}
})
})
});

function genTable(domid, table_id, data, columns){
Expand Down Expand Up @@ -227,7 +219,7 @@ function genTable(domid, table_id, data, columns){
}
}
});
$('#' + table_id + ' tbody td.inputParm3').
$('#' + table_id + ' tbody td.inputParm3').
editable('/themis/sqlreview/rule/info', {
method: "POST",
submitdata: function(value, settings) {
Expand All @@ -248,35 +240,14 @@ function genTable(domid, table_id, data, columns){
}
}
});
$('#' + table_id + ' tbody td.inputParm4').
editable('/themis/sqlreview/rule/info', {
method: "POST",
submitdata: function(value, settings) {
return {
oldvalue: value,
dbtype: $(this).attr("dbtype"),
flag: "parm4"
};
},
callback: function(value, settings) {
var result = JSON.parse(value)
if (result["errcode"] === 80025){
$(this).text(function(){ return result["data"]})
}
else{
alert(result["message"])
$(this).text(function(){ return 0})
}
}
});
$('#' + table_id + ' tbody td.inputParm5').
$('#' + table_id + ' tbody td.RuleCmd').
editable('/themis/sqlreview/rule/info', {
method: "POST",
submitdata: function(value, settings) {
return {
oldvalue: value,
dbtype: $(this).attr("dbtype"),
flag: "parm5"
flag: "rule_cmd"
};
},
callback: function(value, settings) {
Expand Down
5 changes: 2 additions & 3 deletions themis/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,8 @@ def get(self, request):
parms[0],
parms[1],
parms[2],
parms[3],
parms[4],
value.get("exclude_obj_type", "无")
value["rule_cmd"],
value.get("exclude_obj_type", "无"),
])
return {"errcode": 80013, "message": u"查询成功", "data": data}

Expand Down

0 comments on commit 20c6d1f

Please sign in to comment.