sysStat for +op username vs old config value

This commit is contained in:
Bryan Ashby 2016-08-03 21:46:38 -06:00
parent 8d9a686629
commit b12d9aad04
3 changed files with 20 additions and 2 deletions

View File

@ -3,6 +3,7 @@
// ENiGMA½ // ENiGMA½
const Config = require('./config.js').config; const Config = require('./config.js').config;
const StatLog = require('./stat_log.js');
// deps // deps
const _ = require('lodash'); const _ = require('lodash');
@ -13,6 +14,7 @@ exports.getAssetWithShorthand = getAssetWithShorthand;
exports.getArtAsset = getArtAsset; exports.getArtAsset = getArtAsset;
exports.getModuleAsset = getModuleAsset; exports.getModuleAsset = getModuleAsset;
exports.resolveConfigAsset = resolveConfigAsset; exports.resolveConfigAsset = resolveConfigAsset;
exports.resolveSystemStatAsset = resolveSystemStatAsset;
exports.getViewPropertyAsset = getViewPropertyAsset; exports.getViewPropertyAsset = getViewPropertyAsset;
const ALL_ASSETS = [ const ALL_ASSETS = [
@ -24,6 +26,7 @@ const ALL_ASSETS = [
'systemModule', 'systemModule',
'prompt', 'prompt',
'config', 'config',
'sysStat',
]; ];
const ASSET_RE = new RegExp('\\@(' + ALL_ASSETS.join('|') + ')\\:([\\w\\d\\.]*)(?:\\/([\\w\\d\\_]+))*'); const ASSET_RE = new RegExp('\\@(' + ALL_ASSETS.join('|') + ')\\:([\\w\\d\\.]*)(?:\\/([\\w\\d\\_]+))*');
@ -101,7 +104,18 @@ function resolveConfigAsset(spec) {
return conf; return conf;
} else { } else {
return spec; return spec;
}
}
function resolveSystemStatAsset(spec) {
const asset = parseAsset(spec);
if(!asset) {
return spec;
} }
assert('sysStat' === asset.type);
return StatLog.getSystemStat(asset.asset) || spec;
} }
function getViewPropertyAsset(src) { function getViewPropertyAsset(src) {

View File

@ -180,6 +180,10 @@ function ViewController(options) {
case 'config' : case 'config' :
propValue = asset.resolveConfigAsset(conf[propName]); propValue = asset.resolveConfigAsset(conf[propName]);
break; break;
case 'sysStat' :
propValue = asset.resolveSystemStatAsset(conf[propName]);
break;
// :TODO: handle @art (e.g. text : @art ...) // :TODO: handle @art (e.g. text : @art ...)

View File

@ -405,7 +405,7 @@
ET2: { ET2: {
argName: to argName: to
focus: true focus: true
text: @config:general.sysOp.username text: @sysStat:sysop_username
// :TODO: readOnly: true // :TODO: readOnly: true
} }
ET3: { ET3: {
@ -927,7 +927,7 @@
ET2: { ET2: {
argName: to argName: to
focus: true focus: true
text: @config:general.sysOp.username text: @sysStat:sysop_username
// :TODO: readOnly: true // :TODO: readOnly: true
} }
ET3: { ET3: {