Skip to content

Commit

Permalink
redis查询结果json格式化显示 hhyo#1376
Browse files Browse the repository at this point in the history
redis查询结果json格式化显示 hhyo#1376
  • Loading branch information
nick2wang committed Feb 14, 2022
1 parent 360d052 commit 2d6008c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sql/templates/sqlquery.html
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ <h4 class="modal-title text-danger">收藏语句</h4>
//初始化查询结果
var isdetail = false
var optgroup = $('#instance_name :selected').parent().attr('label');
if (optgroup == 'Mongo') {
if (optgroup === 'Mongo' || optgroup === 'Redis') {
isdetail = true
}
var showExport = {{can_download}}===1
Expand Down Expand Up @@ -811,6 +811,16 @@ <h4 class="modal-title text-danger">收藏语句</h4>
$.each(row, function (key, value) {
if (key === 0) {//mongodb这里要修改
let rs = value;
if (optgroup === 'Redis') {
try {
rs = JSON.parse(rs);
if (typeof rs == 'object' && rs) {
rs = JSON.stringify(rs, null, 2)
}
} catch (e) {
console.log("非json格式")
}
}
html.push('<pre>' + highLight(rs) + '</pre>');
}
});
Expand Down

0 comments on commit 2d6008c

Please sign in to comment.