mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
add stats
This commit is contained in:
parent
b0653a81e5
commit
d5830c34cd
14
index.css
14
index.css
@ -16,6 +16,7 @@ body {
|
||||
--input-radius:5px; --input-width:120px;
|
||||
--button-radius:5px; --button-margin:10px;
|
||||
--output-bg-color: var(--input-bg-color);
|
||||
--status-font-size:12px;
|
||||
--status-border:var(--box-border);
|
||||
--panel-bg-color:var(--panel-output-bg-color);
|
||||
--panel-fg-color:var(--panel-output-fg-color);
|
||||
@ -180,12 +181,6 @@ body>div.input.login>div.display div.sso div.item:hover { background-color:var(-
|
||||
body>div.input.login>div.display div.sso div.item>img { height:32px; width:32px; }
|
||||
body>div.input.login>div.display div.sso div.item>span { line-height:32px; padding:5px; }
|
||||
body>div.input.simple td:first-child { display:none; }
|
||||
div.output.stats { display:flex;
|
||||
/* justify-content:space-between; */
|
||||
flex-wrap:wrap; }
|
||||
div.output.stats>div.item { text-align:center; padding:10px; margin:10px; float:left; display:flex; flex-direction:column; justify-content:center; }
|
||||
div.output.stats>div.item>div.value { font-size:32px; }
|
||||
div.output.stats>div.item>div.name { font-style:italic; color:var(--disable-fg-color); }
|
||||
body>div.upload div.action input[type=file] { width:320px; }
|
||||
body>div.upload div.output { border:var(--box-notice); }
|
||||
body>div.upload div.output div.progress { background-color:var(--progress-bg-color); height:10px; width:0; }
|
||||
@ -204,7 +199,7 @@ fieldset>div.action>div.cmds { font-style:italic; padding:5px 10px; box-shadow:v
|
||||
fieldset>div.output>div.code { font-size:14px; }
|
||||
fieldset>div.status { font-style:italic; line-height:20px; max-height:32px; }
|
||||
fieldset>div.status>div.item { padding:5px; height:31px; }
|
||||
fieldset>div.status>div.item>label { font-size:0.6rem; }
|
||||
fieldset>div.status>div.item>label { font-size:var(--status-font-size); }
|
||||
fieldset>div.status>legend { font-style:italic; height:31px; }
|
||||
legend, select, input[type=button], th, h1, h2, h3, div.menu, div.item, div.tabs { cursor:pointer; }
|
||||
div.story[data-type=spark] { cursor:copy; }
|
||||
@ -494,6 +489,11 @@ body.print select, body.print input[type=text], body.print textarea { box-shadow
|
||||
body.print fieldset.draw div.output { background-color:lightgray; }
|
||||
body.print fieldset.draw div.output div.content svg { background-color:lightgray; }
|
||||
/* misc */
|
||||
div.output.stats { display:flex; justify-content:center; flex-wrap:wrap; }
|
||||
body.mobile div.output.stats { justify-content:space-around; }
|
||||
div.output.stats>div.item { text-align:center; padding:10px; margin:10px; float:left; display:flex; flex-direction:column; justify-content:center; flex-grow:1; }
|
||||
div.output.stats>div.item>div.name { font-size:var(--status-font-size); font-style:italic; color:var(--disable-fg-color); }
|
||||
div.output.stats>div.item>div.value { font-size:32px; }
|
||||
fieldset.input.icon div.output td { font-size:28px; padding:5px; }
|
||||
fieldset.Search div.story[data-type=spark] { margin:0; }
|
||||
fieldset.Search>div.output>div.profile { border-left:none; width:unset; }
|
||||
|
@ -1,17 +1,18 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.onappend.style(can, "stats", can._output)
|
||||
// can.onimport.layout = function() { can.onlayout.expand(can, can._output, 150, 100) }
|
||||
var units = {}
|
||||
var stats = {}; msg.Table(function(value) {
|
||||
var units = {}, stats = {}; msg.Table(function(value) { units[value.name] = value.units
|
||||
stats[value.name] = parseFloat(stats[value.name]||"0") + parseFloat(value.value)
|
||||
units[value.name] = value.units
|
||||
})
|
||||
can.core.Item(stats, function(name, value) {
|
||||
can.page.Append(can, can._output, [{view: [[html.ITEM, name]], list: [
|
||||
{view: [mdb.VALUE, "", can.base.trimSuffix(parseFloat(value).toFixed(2)+"", ".00")+" "+units[name]]},
|
||||
function fmts(value) { var ls = []
|
||||
while (value > 0) { ls.push(value%1000)
|
||||
if (ls.length == 1) { ls[0] = ls[0].toFixed(2) }
|
||||
value = parseInt(value/1000)
|
||||
}
|
||||
return ls.reverse().join(", ")
|
||||
}
|
||||
can.core.Item(stats, function(name, value) { can.page.Append(can, can._output, [{view: [[html.ITEM, name]], list: [
|
||||
{view: [mdb.VALUE, "", can.base.trimSuffix(fmts(parseFloat(value).toFixed(2))+"", ".00")+" "+units[name]]},
|
||||
{view: [mdb.NAME, "", can.user.trans(can, name, null, html.INPUT)]},
|
||||
]}])
|
||||
})
|
||||
can.isCmdMode() && can.onappend.table(can, msg)
|
||||
]}]) }), can.isCmdMode() && can.onappend.table(can, msg)
|
||||
},
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user