mirror of
https://github.com/alibaba/anyproxy.git
synced 2025-06-06 09:18:21 +00:00
optimze map icon
This commit is contained in:
parent
f4c96180b5
commit
ffd59eb055
@ -15,7 +15,6 @@ function Recorder(option){
|
|||||||
|
|
||||||
option = option || {};
|
option = option || {};
|
||||||
if(option.filename && typeof option.filename == "string"){
|
if(option.filename && typeof option.filename == "string"){
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if(fs.existsSync(option.filename)){
|
if(fs.existsSync(option.filename)){
|
||||||
fs.writeFileSync(option.filename,""); //empty original file
|
fs.writeFileSync(option.filename,""); //empty original file
|
||||||
@ -39,9 +38,20 @@ function Recorder(option){
|
|||||||
db = new Datastore();
|
db = new Datastore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
self.recordBodyMap = []; // id - body
|
self.recordBodyMap = []; // id - body
|
||||||
|
|
||||||
|
self.emitUpdate = function(id,info){
|
||||||
|
if(info){
|
||||||
|
self.emit("update",info);
|
||||||
|
}else{
|
||||||
|
self.getSingleRecord(id,function(err,doc){
|
||||||
|
if(!err && !!doc && !!doc[0]){
|
||||||
|
self.emit("update",doc[0]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
self.updateRecord = function(id,info){
|
self.updateRecord = function(id,info){
|
||||||
if(id < 0 ) return;
|
if(id < 0 ) return;
|
||||||
|
|
||||||
@ -50,10 +60,18 @@ function Recorder(option){
|
|||||||
db.update({_id:id},finalInfo);
|
db.update({_id:id},finalInfo);
|
||||||
self.updateRecordBody(id,info);
|
self.updateRecordBody(id,info);
|
||||||
|
|
||||||
self.emit("update",finalInfo);
|
self.emitUpdate(id,finalInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.updateExtInfo = function(id,extInfo){
|
||||||
|
db.update({_id:id},{ $set: { ext: extInfo } },{},function(err,nums){
|
||||||
|
if(!err){
|
||||||
|
self.emitUpdate(id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
self.appendRecord = function(info){
|
self.appendRecord = function(info){
|
||||||
if(info.req.headers.anyproxy_web_req){ //request from web interface
|
if(info.req.headers.anyproxy_web_req){ //request from web interface
|
||||||
return -1;
|
return -1;
|
||||||
@ -64,10 +82,9 @@ function Recorder(option){
|
|||||||
db.insert(finalInfo);
|
db.insert(finalInfo);
|
||||||
self.updateRecordBody(id,info);
|
self.updateRecordBody(id,info);
|
||||||
|
|
||||||
self.emit("update",finalInfo);
|
self.emitUpdate(id,finalInfo);
|
||||||
return thisId;
|
return thisId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//update recordBody if exits
|
//update recordBody if exits
|
||||||
self.updateRecordBody =function(id,info){
|
self.updateRecordBody =function(id,info){
|
||||||
@ -91,9 +108,7 @@ function Recorder(option){
|
|||||||
return self.recordBodyMap[id] || "";
|
return self.recordBodyMap[id] || "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
self.getBodyUTF8 = function(id,cb){
|
self.getBodyUTF8 = function(id,cb){
|
||||||
|
|
||||||
var bodyContent = self.getBody(id),
|
var bodyContent = self.getBody(id),
|
||||||
result = "";
|
result = "";
|
||||||
|
|
||||||
@ -123,17 +138,16 @@ function Recorder(option){
|
|||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
self.getSingleRecord = function(id,cb){
|
self.getSingleRecord = function(id,cb){
|
||||||
db.find({_id:parseInt(id)},cb);
|
db.find({_id:parseInt(id)},cb);
|
||||||
}
|
};
|
||||||
|
|
||||||
self.getSummaryList = function(cb){
|
self.getSummaryList = function(cb){
|
||||||
db.find({},cb);
|
db.find({},cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
self.db = db;
|
self.db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,15 @@ function userRequestHandler(req,userRes){
|
|||||||
logUtil.printLog(color.green("\nreceived request to : " + host + path));
|
logUtil.printLog(color.green("\nreceived request to : " + host + path));
|
||||||
|
|
||||||
//get request body and route to local or remote
|
//get request body and route to local or remote
|
||||||
async.series([fetchReqData,routeReq],function(){});
|
async.series([
|
||||||
|
fetchReqData,
|
||||||
|
routeReq
|
||||||
|
],function(){
|
||||||
|
//mark some ext info
|
||||||
|
if(req.anyproxy_map_local){
|
||||||
|
GLOBAL.recorder.updateExtInfo(resourceInfoId, {map : req.anyproxy_map_local});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//get request body
|
//get request body
|
||||||
function fetchReqData(callback){
|
function fetchReqData(callback){
|
||||||
@ -408,5 +416,5 @@ module.exports.getRuleSummary = getRuleSummary;
|
|||||||
note
|
note
|
||||||
req.url is wired
|
req.url is wired
|
||||||
in http server : http://www.example.com/a/b/c
|
in http server : http://www.example.com/a/b/c
|
||||||
in https server : /work/alibaba
|
in https server : /a/b/c
|
||||||
*/
|
*/
|
||||||
|
@ -31,6 +31,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return !!req.anyproxy_map_local;
|
return !!req.anyproxy_map_local;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -140,6 +140,12 @@ var recorder;
|
|||||||
|
|
||||||
//action bar
|
//action bar
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
|
//detect whether to show the filter and map btn
|
||||||
|
$.get("/filetree?root=/",function(){
|
||||||
|
$(".J_filterSection").show();
|
||||||
|
});
|
||||||
|
|
||||||
//clear log
|
//clear log
|
||||||
function clearLogs(){
|
function clearLogs(){
|
||||||
recordSet = [];
|
recordSet = [];
|
||||||
|
@ -78,7 +78,7 @@ function init(React){
|
|||||||
React.createElement("div", {className: "overlay_mask", onClick: this.setHide}),
|
React.createElement("div", {className: "overlay_mask", onClick: this.setHide}),
|
||||||
React.createElement("div", {className: "recordDetailOverlay", ref: "mainOverlay", style: {left: this.state.left}},
|
React.createElement("div", {className: "recordDetailOverlay", ref: "mainOverlay", style: {left: this.state.left}},
|
||||||
React.createElement("div", {className: "dragbar", onMouseDown: this.dealDrag}),
|
React.createElement("div", {className: "dragbar", onMouseDown: this.dealDrag}),
|
||||||
React.createElement("span", {className: "escBtn", onClick: this.setHide}, "Close (ESC)"),
|
React.createElement("span", {className: "escBtn", onClick: this.setHide}, React.createElement("i", {className: "uk-icon-times"})),
|
||||||
React.createElement("div", null,
|
React.createElement("div", null,
|
||||||
this.state.content
|
this.state.content
|
||||||
)
|
)
|
||||||
|
@ -20,24 +20,34 @@ function init(React){
|
|||||||
},
|
},
|
||||||
render : function(){
|
render : function(){
|
||||||
var trClassesArr = [],
|
var trClassesArr = [],
|
||||||
trClasses;
|
trClasses,
|
||||||
if(this.props.data.statusCode){
|
data = this.props.data || {};
|
||||||
|
if(data.statusCode){
|
||||||
trClassesArr.push("record_status_done");
|
trClassesArr.push("record_status_done");
|
||||||
}
|
}
|
||||||
|
|
||||||
trClassesArr.push( ((Math.floor(this.props.data._id /2) - this.props.data._id /2) == 0)? "row_even" : "row_odd" );
|
trClassesArr.push( ((Math.floor(data._id /2) - data._id /2) == 0)? "row_even" : "row_odd" );
|
||||||
trClasses = trClassesArr.join(" ");
|
trClasses = trClassesArr.join(" ");
|
||||||
|
|
||||||
var dateStr = dateFormat(new Date(this.props.data.startTime),"hh:mm:ss");
|
var dateStr = dateFormat(new Date(data.startTime),"hh:mm:ss");
|
||||||
|
|
||||||
|
var rowIcon = [];
|
||||||
|
if(data.protocol == "https"){
|
||||||
|
rowIcon.push(React.createElement("span", {className: "icon_record", title: "https"}, React.createElement("i", {className: "uk-icon-lock"})));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.ext && data.ext.map){
|
||||||
|
rowIcon.push(React.createElement("span", {className: "icon_record", title: "mapped to local file"}, React.createElement("i", {className: "uk-icon-shield"})));
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
React.createElement("tr", {className: trClasses, onClick: this.props.onSelect},
|
React.createElement("tr", {className: trClasses, onClick: this.props.onSelect},
|
||||||
React.createElement("td", {className: "data_id"}, this.props.data._id),
|
React.createElement("td", {className: "data_id"}, data._id),
|
||||||
React.createElement("td", null, this.props.data.method, " ", React.createElement("span", {className: "protocol protocol_" + this.props.data.protocol, title: "https"}, React.createElement("i", {className: "uk-icon-lock"})), " "),
|
React.createElement("td", null, data.method, " ", rowIcon, " "),
|
||||||
React.createElement("td", {className: "http_status http_status_" + this.props.data.statusCode}, this.props.data.statusCode),
|
React.createElement("td", {className: "http_status http_status_" + data.statusCode}, data.statusCode),
|
||||||
React.createElement("td", {title: this.props.data.host}, this.props.data.host),
|
React.createElement("td", {title: data.host}, data.host),
|
||||||
React.createElement("td", {title: this.props.data.path}, this.props.data.path),
|
React.createElement("td", {title: data.path}, data.path),
|
||||||
React.createElement("td", null, this.props.data.mime),
|
React.createElement("td", null, data.mime),
|
||||||
React.createElement("td", null, dateStr)
|
React.createElement("td", null, dateStr)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -9,10 +9,8 @@ body, html {
|
|||||||
.topHead{
|
.topHead{
|
||||||
height: 55px;
|
height: 55px;
|
||||||
position: relative;
|
position: relative;
|
||||||
/* -webkit-box-shadow: 0px 3px 23px 0px rgba(50, 50, 50, 0.75);
|
border-bottom: 1px solid #333;
|
||||||
-moz-box-shadow: 0px 3px 23px 0px rgba(50, 50, 50, 0.75);
|
}
|
||||||
box-shadow: 0px 3px 23px 0px rgba(50, 50, 50, 0.75);
|
|
||||||
*/}
|
|
||||||
|
|
||||||
.topHead .logoWrapper{
|
.topHead .logoWrapper{
|
||||||
float: left;
|
float: left;
|
||||||
@ -64,20 +62,26 @@ body, html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.topHead .ctrlWrapper{
|
.topHead .ctrlWrapper{
|
||||||
height: 35px;
|
height: 26px;
|
||||||
line-height: 35px;
|
line-height: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topHead .ctrlWrapper .sep{
|
||||||
|
display: inline-block;
|
||||||
|
margin: 0 8px;
|
||||||
|
color: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topHead .topBtn{
|
.topHead .topBtn{
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
transition:0.1s;
|
transition:0.08s;
|
||||||
padding: 4px;
|
padding: 4px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topHead .topBtn:hover:not(.btn_disable){
|
.topHead .topBtn:hover:not(.btn_disable){
|
||||||
background: #07D;
|
background: #07D;
|
||||||
transition:0.1s;
|
transition:0.08s;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,20 +97,6 @@ body, html {
|
|||||||
color: #777;
|
color: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topHead .ruleDesc{
|
|
||||||
height: 20px;
|
|
||||||
border-bottom: 1px solid #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topHead .ruleDesc span{
|
|
||||||
padding-left: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.topHead .ctrlWrapper .sep{
|
|
||||||
display: inline-block;
|
|
||||||
margin: 0 8px;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mainTableWrapper{
|
.mainTableWrapper{
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
@ -214,7 +204,7 @@ body, html {
|
|||||||
background: #FFF;
|
background: #FFF;
|
||||||
border-left: 1px solid #CCC;
|
border-left: 1px solid #CCC;
|
||||||
top: 0;
|
top: 0;
|
||||||
padding: 10px 10px 20px 10px;
|
padding: 10px 20px 10px 10px;
|
||||||
overflow-y:scroll;
|
overflow-y:scroll;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
@ -223,11 +213,11 @@ body, html {
|
|||||||
|
|
||||||
.recordDetailOverlay .escBtn{
|
.recordDetailOverlay .escBtn{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 10px;
|
right: 8px;
|
||||||
top: 8px;
|
top: 8px;
|
||||||
color: #777;
|
color: #777;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: underline;
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.recordDetailOverlay li{
|
.recordDetailOverlay li{
|
||||||
@ -257,12 +247,7 @@ body, html {
|
|||||||
color: #910A0A;
|
color: #910A0A;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon_record{
|
||||||
.protocol{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.protocol.protocol_https{
|
|
||||||
display: inline;
|
display: inline;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #777;
|
color: #777;
|
||||||
|
@ -21,16 +21,20 @@
|
|||||||
<a href="#"><span class="topBtn J_clearBtn"><i class="uk-icon-eraser"></i>Clear(Ctrl+X)</span></a>
|
<a href="#"><span class="topBtn J_clearBtn"><i class="uk-icon-eraser"></i>Clear(Ctrl+X)</span></a>
|
||||||
|
|
||||||
<span class="sep">|</span>
|
<span class="sep">|</span>
|
||||||
<a href="/fetchCrtFile" target="_blank"><span class="topBtn"><i class="uk-icon-certificate"></i>Download rootCA.crt</span></a>
|
<a href="/fetchCrtFile" target="_blank"><span class="topBtn"><i class="uk-icon-download"></i>Download rootCA.crt</span></a>
|
||||||
<a href="/qr_root" class="J_fetchRootQR" target="_blank"><span class="topBtn"><i class="uk-icon-qrcode"></i>QRCode of rootCA.crt</span></a>
|
<a href="/qr_root" class="J_fetchRootQR" target="_blank"><span class="topBtn"><i class="uk-icon-qrcode"></i>QRCode of rootCA.crt</span></a>
|
||||||
|
|
||||||
<span class="sep">|</span>
|
<span class="sep">|</span>
|
||||||
<a href="https://github.com/alibaba/anyproxy" target="_blank"><span class="topBtn"><i class="uk-icon-github"></i>Github</span></a>
|
<a href="https://github.com/alibaba/anyproxy" target="_blank"><span class="topBtn"><i class="uk-icon-github"></i>Github</span></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ruleDesc">
|
<div class="ctrlWrapper">
|
||||||
<a href="#"><span class="topBtn J_showFilter"><i class="uk-icon-filter"></i>Filter</span></a>
|
<span class="J_filterSection" style="display:none">
|
||||||
<a href="#"><span class="topBtn J_showMapPanel"><i class="uk-icon-level-down"></i>Map Local</span></a>
|
<a href="#"><span class="topBtn J_showFilter"><i class="uk-icon-filter"></i>Filter</span></a>
|
||||||
|
<a href="#"><span class="topBtn J_showMapPanel"><i class="uk-icon-shield"></i>Map Local</span></a>
|
||||||
|
|
||||||
|
<span class="sep">|</span>
|
||||||
|
</span>
|
||||||
<span><i class="uk-icon-chain"></i>Rule : {{rule}}</span>
|
<span><i class="uk-icon-chain"></i>Rule : {{rule}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
38
web/page.js
38
web/page.js
@ -186,6 +186,12 @@
|
|||||||
|
|
||||||
//action bar
|
//action bar
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
|
//detect whether to show the filter and map btn
|
||||||
|
$.get("/filetree?root=/",function(){
|
||||||
|
$(".J_filterSection").show();
|
||||||
|
});
|
||||||
|
|
||||||
//clear log
|
//clear log
|
||||||
function clearLogs(){
|
function clearLogs(){
|
||||||
recordSet = [];
|
recordSet = [];
|
||||||
@ -20355,7 +20361,7 @@
|
|||||||
React.createElement("div", {className: "overlay_mask", onClick: this.setHide}),
|
React.createElement("div", {className: "overlay_mask", onClick: this.setHide}),
|
||||||
React.createElement("div", {className: "recordDetailOverlay", ref: "mainOverlay", style: {left: this.state.left}},
|
React.createElement("div", {className: "recordDetailOverlay", ref: "mainOverlay", style: {left: this.state.left}},
|
||||||
React.createElement("div", {className: "dragbar", onMouseDown: this.dealDrag}),
|
React.createElement("div", {className: "dragbar", onMouseDown: this.dealDrag}),
|
||||||
React.createElement("span", {className: "escBtn", onClick: this.setHide}, "Close (ESC)"),
|
React.createElement("span", {className: "escBtn", onClick: this.setHide}, React.createElement("i", {className: "uk-icon-times"})),
|
||||||
React.createElement("div", null,
|
React.createElement("div", null,
|
||||||
this.state.content
|
this.state.content
|
||||||
)
|
)
|
||||||
@ -20449,24 +20455,34 @@
|
|||||||
},
|
},
|
||||||
render : function(){
|
render : function(){
|
||||||
var trClassesArr = [],
|
var trClassesArr = [],
|
||||||
trClasses;
|
trClasses,
|
||||||
if(this.props.data.statusCode){
|
data = this.props.data || {};
|
||||||
|
if(data.statusCode){
|
||||||
trClassesArr.push("record_status_done");
|
trClassesArr.push("record_status_done");
|
||||||
}
|
}
|
||||||
|
|
||||||
trClassesArr.push( ((Math.floor(this.props.data._id /2) - this.props.data._id /2) == 0)? "row_even" : "row_odd" );
|
trClassesArr.push( ((Math.floor(data._id /2) - data._id /2) == 0)? "row_even" : "row_odd" );
|
||||||
trClasses = trClassesArr.join(" ");
|
trClasses = trClassesArr.join(" ");
|
||||||
|
|
||||||
var dateStr = dateFormat(new Date(this.props.data.startTime),"hh:mm:ss");
|
var dateStr = dateFormat(new Date(data.startTime),"hh:mm:ss");
|
||||||
|
|
||||||
|
var rowIcon = [];
|
||||||
|
if(data.protocol == "https"){
|
||||||
|
rowIcon.push(React.createElement("span", {className: "icon_record", title: "https"}, React.createElement("i", {className: "uk-icon-lock"})));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.ext && data.ext.map){
|
||||||
|
rowIcon.push(React.createElement("span", {className: "icon_record", title: "mapped to local file"}, React.createElement("i", {className: "uk-icon-shield"})));
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
React.createElement("tr", {className: trClasses, onClick: this.props.onSelect},
|
React.createElement("tr", {className: trClasses, onClick: this.props.onSelect},
|
||||||
React.createElement("td", {className: "data_id"}, this.props.data._id),
|
React.createElement("td", {className: "data_id"}, data._id),
|
||||||
React.createElement("td", null, this.props.data.method, " ", React.createElement("span", {className: "protocol protocol_" + this.props.data.protocol, title: "https"}, React.createElement("i", {className: "uk-icon-lock"})), " "),
|
React.createElement("td", null, data.method, " ", rowIcon, " "),
|
||||||
React.createElement("td", {className: "http_status http_status_" + this.props.data.statusCode}, this.props.data.statusCode),
|
React.createElement("td", {className: "http_status http_status_" + data.statusCode}, data.statusCode),
|
||||||
React.createElement("td", {title: this.props.data.host}, this.props.data.host),
|
React.createElement("td", {title: data.host}, data.host),
|
||||||
React.createElement("td", {title: this.props.data.path}, this.props.data.path),
|
React.createElement("td", {title: data.path}, data.path),
|
||||||
React.createElement("td", null, this.props.data.mime),
|
React.createElement("td", null, data.mime),
|
||||||
React.createElement("td", null, dateStr)
|
React.createElement("td", null, dateStr)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -140,6 +140,12 @@ var recorder;
|
|||||||
|
|
||||||
//action bar
|
//action bar
|
||||||
(function(){
|
(function(){
|
||||||
|
|
||||||
|
//detect whether to show the filter and map btn
|
||||||
|
$.get("/filetree?root=/",function(){
|
||||||
|
$(".J_filterSection").show();
|
||||||
|
});
|
||||||
|
|
||||||
//clear log
|
//clear log
|
||||||
function clearLogs(){
|
function clearLogs(){
|
||||||
recordSet = [];
|
recordSet = [];
|
||||||
|
@ -78,7 +78,7 @@ function init(React){
|
|||||||
<div className="overlay_mask" onClick={this.setHide}></div>
|
<div className="overlay_mask" onClick={this.setHide}></div>
|
||||||
<div className="recordDetailOverlay" ref="mainOverlay" style={{left: this.state.left}}>
|
<div className="recordDetailOverlay" ref="mainOverlay" style={{left: this.state.left}}>
|
||||||
<div className="dragbar" onMouseDown={this.dealDrag}></div>
|
<div className="dragbar" onMouseDown={this.dealDrag}></div>
|
||||||
<span className="escBtn" onClick={this.setHide}>Close (ESC)</span>
|
<span className="escBtn" onClick={this.setHide}><i className="uk-icon-times"></i></span>
|
||||||
<div>
|
<div>
|
||||||
{this.state.content}
|
{this.state.content}
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,24 +20,34 @@ function init(React){
|
|||||||
},
|
},
|
||||||
render : function(){
|
render : function(){
|
||||||
var trClassesArr = [],
|
var trClassesArr = [],
|
||||||
trClasses;
|
trClasses,
|
||||||
if(this.props.data.statusCode){
|
data = this.props.data || {};
|
||||||
|
if(data.statusCode){
|
||||||
trClassesArr.push("record_status_done");
|
trClassesArr.push("record_status_done");
|
||||||
}
|
}
|
||||||
|
|
||||||
trClassesArr.push( ((Math.floor(this.props.data._id /2) - this.props.data._id /2) == 0)? "row_even" : "row_odd" );
|
trClassesArr.push( ((Math.floor(data._id /2) - data._id /2) == 0)? "row_even" : "row_odd" );
|
||||||
trClasses = trClassesArr.join(" ");
|
trClasses = trClassesArr.join(" ");
|
||||||
|
|
||||||
var dateStr = dateFormat(new Date(this.props.data.startTime),"hh:mm:ss");
|
var dateStr = dateFormat(new Date(data.startTime),"hh:mm:ss");
|
||||||
|
|
||||||
|
var rowIcon = [];
|
||||||
|
if(data.protocol == "https"){
|
||||||
|
rowIcon.push(<span className="icon_record" title="https"><i className="uk-icon-lock"></i></span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.ext && data.ext.map){
|
||||||
|
rowIcon.push(<span className="icon_record" title="mapped to local file"><i className="uk-icon-shield"></i></span>);
|
||||||
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<tr className={trClasses} onClick={this.props.onSelect}>
|
<tr className={trClasses} onClick={this.props.onSelect}>
|
||||||
<td className="data_id">{this.props.data._id}</td>
|
<td className="data_id">{data._id}</td>
|
||||||
<td>{this.props.data.method} <span className={"protocol protocol_" + this.props.data.protocol} title="https"><i className="uk-icon-lock"></i></span> </td>
|
<td>{data.method} {rowIcon} </td>
|
||||||
<td className={"http_status http_status_" + this.props.data.statusCode}>{this.props.data.statusCode}</td>
|
<td className={"http_status http_status_" + data.statusCode}>{data.statusCode}</td>
|
||||||
<td title={this.props.data.host}>{this.props.data.host}</td>
|
<td title={data.host}>{data.host}</td>
|
||||||
<td title={this.props.data.path}>{this.props.data.path}</td>
|
<td title={data.path}>{data.path}</td>
|
||||||
<td>{this.props.data.mime}</td>
|
<td>{data.mime}</td>
|
||||||
<td>{dateStr}</td>
|
<td>{dateStr}</td>
|
||||||
</tr>
|
</tr>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user