1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 16:58:06 +08:00

add stats

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-11-16 13:11:09 +08:00
parent df18a7ef70
commit b0653a81e5
5 changed files with 32 additions and 4 deletions

View File

@ -240,6 +240,7 @@ var chat = {
}
var team = {
TASK: "task", PLAN: "plan",
ASSET: "asset",
BEGIN_TIME: "begin_time", END_TIME: "end_time",
LONG: "long", YEAR: "year", MONTH: "month", WEEK: "week", DAY: "day", HOUR: "hour",
TASK_POD: "task.pod", TASK_ZONE: "task.zone", TASK_ID: "task.id",

View File

@ -352,6 +352,7 @@ Volcanos(chat.ONAPPEND, {_init: function(can, meta, list, cb, target, field) {
function run(event, cmd, arg) { can.misc.Event(event, can, function(msg) { can.run(can.request(event, data, can.Option()), [ctx.ACTION, cmd].concat(arg)) }) }
if (key == web.SPACE && value) { value = can.page.Format(html.A, can.misc.MergePodCmd(can, {pod: value}), value) }
if (key == mdb.ICONS && value) { value = can.page.Format(html.IMG, can.misc.Resource(can, data[key]), msg.IsDetail()? 128: 48, msg.IsDetail()? null: 48) }
if (key == mdb.NAME) { value = can.user.trans(can, value, null, html.INPUT) }
return {text: [msg.IsDetail() && key == mdb.KEY? can.user.trans(can, value, null, html.INPUT): can.user.trans(can, value, null, html.VALUE), html.TD], onclick: function(event) { var target = event.target
if (key == cli.QRCODE && can.page.tagis(event.target, html.IMG)) { can.user.opens(event.target.title) }
if (can.page.tagis(target, html.INPUT) && target.type == html.BUTTON) { can.requestAction(event, target.name)
@ -553,9 +554,12 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro
}), can.onengine.signal(can, chat.ONSIZE, can.request({}, {height: height, width: width}))
can.user.isMobile && can.user.isLandscape() || can.page.style(can, document.body, kit.Dict(html.OVERFLOW, html.HIDDEN))
},
expand: function(can, target, width) { var n = parseInt(target.offsetWidth/(width+20)); width = target.offsetWidth/n - 20
expand: function(can, target, width, height) { var n = parseInt(target.offsetWidth/(width+20)); width = target.offsetWidth/n - 20
if (width+20 >= target.offsetWidth) { n = 1, width = target.offsetWidth - 20 }
can.page.SelectChild(can, target, html.DIV_ITEM, function(target) { can.page.styleWidth(can, target, width) })
can.page.SelectChild(can, target, html.DIV_ITEM, function(target) {
can.page.styleWidth(can, target, width)
height = can.page.styleHeight(can, target, height)
})
},
background: function(can, url, target) { can.page.style(can, target||can._root._target, "background-image", url == "" || url == "void"? "": 'url("'+url+'")') },
figure: function(event, can, target, right, min) { if (!event || !event.target) { return {} } target = target||can._fields||can._target

View File

@ -180,6 +180,12 @@ 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; }

View File

@ -10,10 +10,10 @@ fieldset.Footer>div.output div.cmd>input[name=cmd] { padding-left:30px; width:12
fieldset.Footer>div.output div.cmd>input[name=cmd]:focus { width:320px; transition:all 0.5s; }
fieldset.Footer>div.output div.cmd>span.delete { padding:6px; }
fieldset.Footer>div.output div.menu>div.River { display:flex; justify-content:space-around; }
fieldset.Footer>div.output div.menu>div.River>div.item { display:flex; flex-direction:column; text-align:center; flex-grow:1; }
fieldset.Footer>div.output div.menu>div.River>div.item { height:60px; display:flex; flex-direction:column; text-align:center; flex-grow:1; }
fieldset.Footer>div.output div.menu>div.River>div.item>i { font-size:24px; margin-right:0; }
fieldset.Footer>div.output div.menu>div.River>div.item>span { font-size:12px; }
body.mobile fieldset.Footer>div.output { font-style:italic; height:80px; overflow:hidden; }
body.mobile fieldset.Footer>div.output { font-style:italic; height:60px; overflow:hidden; }
body.mobile fieldset.Footer>div.output div.cmd { display:none; }
body.mobile fieldset.Footer>div.output div.toast { display:none; }

17
plugin/story/stats.js Normal file
View File

@ -0,0 +1,17 @@
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) {
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]]},
{view: [mdb.NAME, "", can.user.trans(can, name, null, html.INPUT)]},
]}])
})
can.isCmdMode() && can.onappend.table(can, msg)
},
})