style: AutoRefresh -> Record

This commit is contained in:
avwo
2018-12-03 17:43:52 +08:00
parent 3c0d093668
commit 9028afd6a6
8 changed files with 51 additions and 21 deletions
+6 -2
View File
@@ -15,6 +15,8 @@ module.exports = function(req, res) {
data.ids = null;
}
var clientIp = util.getClientIp(req);
var stopRecordConsole = data.startLogTime == -3;
var stopRecordSvrLog = data.startSvrLogTime == -3;
res.json({
ec: 0,
version: config.version,
@@ -24,8 +26,10 @@ module.exports = function(req, res) {
mvaluesClientId: config.mvaluesClientId,
mvaluesTime: config.mvaluesTime,
server: util.getServerInfo(req),
log: proxy.getLogs(data.startLogTime, data.count, data.logId),
svrLog: logger.getLogs(data.startSvrLogTime, data.count),
lastLogId: stopRecordConsole ? proxy.getLatestId() : undefined,
lastSvrLogId: stopRecordSvrLog ? logger.getLatestId() : undefined,
log: stopRecordConsole ? [] : proxy.getLogs(data.startLogTime, data.count, data.logId),
svrLog: stopRecordSvrLog ? [] : logger.getLogs(data.startSvrLogTime, data.count),
plugins: pluginMgr.getPlugins(),
disabledPlugins: properties.get('disabledPlugins') || {},
disabledPluginsRules: properties.get('disabledPluginsRules') || {},
File diff suppressed because one or more lines are too long
+7 -5
View File
@@ -215,11 +215,13 @@ var Console = React.createClass({
if (type === 'bottom') {
return this.autoRefresh();
}
if (type === 'refresh') {
var modal = this.state.network;
if (modal && modal.hasKeyword()) {
message.warn('The filter input at the bottom must be empty first.');
}
var refresh = type === 'refresh';
dataCenter.stopConsoleRecord(!refresh);
if (refresh) {
// var modal = this.state.network;
// if (modal && modal.hasKeyword()) {
// message.warn('The filter input at the bottom must be empty first.');
// }
return this.autoRefresh();
}
},
+17 -3
View File
@@ -472,8 +472,8 @@ function startLoadData() {
}
var count = inited ? 20 : networkModal.getDisplayCount();
var options = {
startLogTime: startLogTime,
startSvrLogTime: startSvrLogTime,
startLogTime: exports.stopConsoleRefresh ? -3 : startLogTime,
startSvrLogTime: exports.stopServerLogRefresh ? -3 : startSvrLogTime,
ids: pendingIds.join(),
startTime: startTime,
dumpCount: dumpCount,
@@ -523,6 +523,12 @@ function startLoadData() {
cb(logList, svrLogList);
});
}
if (data.lastLogId) {
lastPageLogTime = data.lastLogId;
}
if (data.lastSvrLogId) {
lastSvrLogTime = data.lastSvrLogId;
}
data = data.data;
var hasChhanged;
@@ -794,7 +800,15 @@ exports.on = function (type, callback) {
}
};
exports.stopRecord = function(stop) {
exports.stopNetworkRecord = function(stop) {
networkModal.clearNetwork = !stop;
exports.stopRefresh = stop;
};
exports.stopConsoleRecord = function(stop) {
exports.stopConsoleRefresh = stop;
};
exports.stopServerLogRecord = function(stop) {
exports.stopServerLogRefresh = stop;
};
+1 -1
View File
@@ -1210,7 +1210,7 @@ var Index = React.createClass({
return this.autoRefresh();
}
var refresh = type === 'refresh';
dataCenter.stopRecord(!refresh);
dataCenter.stopNetworkRecord(!refresh);
if (refresh) {
var modal = this.state.network;
if (modal && modal.hasKeyword()) {
+7 -5
View File
@@ -182,11 +182,13 @@ var ServerLog = React.createClass({
if (type === 'bottom') {
return this.autoRefresh();
}
if (type === 'refresh') {
var modal = this.state.network;
if (modal && modal.hasKeyword()) {
message.warn('The filter input at the bottom must be empty first.');
}
var refresh = type === 'refresh';
dataCenter.stopServerLogRecord(!refresh);
if (refresh) {
// var modal = this.state.network;
// if (modal && modal.hasKeyword()) {
// message.warn('The filter input at the bottom must be empty first.');
// }
return this.autoRefresh();
}
},
+4 -1
View File
@@ -71,6 +71,9 @@ module.exports = function init(proxy) {
logs = logs.slice(len - MIN_LENGTH, len);
}
};
proxy.getLogs = getLogs;
proxy.getLatestId = function() {
var last = logs[logs.length - 1];
return last && last.id;
};
};
+5
View File
@@ -55,6 +55,11 @@ LEVELS.forEach(function(level) {
};
});
exports.getLatestId = function() {
var last = logs[logs.length - 1];
return last && last.id;
};
exports.log = exports.info;