luci-app-statistics: rework graph label handling
Remove leftover unused translation code and properly escape colons in line labels. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
59d2f60a42
commit
96b031bbad
1 changed files with 7 additions and 23 deletions
|
@ -26,15 +26,6 @@ function Instance._subst( self, str, val )
|
||||||
return str
|
return str
|
||||||
end
|
end
|
||||||
|
|
||||||
function Instance._translate( self, key, alt )
|
|
||||||
local val = self.i18n.string(key)
|
|
||||||
if val ~= key then
|
|
||||||
return val
|
|
||||||
else
|
|
||||||
return alt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Instance.title( self, plugin, pinst, dtype, dinst, user_title )
|
function Instance.title( self, plugin, pinst, dtype, dinst, user_title )
|
||||||
|
|
||||||
local title = user_title or
|
local title = user_title or
|
||||||
|
@ -73,24 +64,17 @@ end
|
||||||
|
|
||||||
function Instance.ds( self, source )
|
function Instance.ds( self, source )
|
||||||
|
|
||||||
local label = source.title or self:_translate(
|
local label = source.title or
|
||||||
string.format( "stat_ds_%s_%s_%s", source.type, source.instance, source.ds ),
|
"dt=%s/di=%s/ds=%s" % {
|
||||||
self:_translate(
|
(source.type and #source.type > 0) and source.type or "(nil)",
|
||||||
string.format( "stat_ds_%s_%s", source.type, source.instance ),
|
(source.instance and #source.instance > 0) and source.instance or "(nil)",
|
||||||
self:_translate(
|
(source.ds and #source.ds > 0) and source.ds or "(nil)"
|
||||||
string.format( "stat_ds_label_%s__%s", source.type, source.ds ),
|
}
|
||||||
self:_translate(
|
|
||||||
string.format( "stat_ds_%s", source.type ),
|
|
||||||
source.type .. "_" .. source.instance:gsub("[^%w]","_") .. "_" .. source.ds
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
return self:_subst( label, {
|
return self:_subst( label, {
|
||||||
dtype = source.type,
|
dtype = source.type,
|
||||||
dinst = source.instance,
|
dinst = source.instance,
|
||||||
dsrc = source.ds
|
dsrc = source.ds
|
||||||
} )
|
} ):gsub(":", "\\:")
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue