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

View File

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

View File

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