mirror of
https://github.com/cuigh/swirl
synced 2025-01-01 00:32:09 +00:00
Allow changing time span in home page
This commit is contained in:
parent
8fecfb5ba2
commit
8c380fa23a
@ -1553,6 +1553,9 @@ var Swirl;
|
|||||||
return this.opts;
|
return this.opts;
|
||||||
}
|
}
|
||||||
loadData() {
|
loadData() {
|
||||||
|
if (this.charts.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let args = {
|
let args = {
|
||||||
charts: this.charts.map(c => c.getOptions().name).join(","),
|
charts: this.charts.map(c => c.getOptions().name).join(","),
|
||||||
period: this.opts.period,
|
period: this.opts.period,
|
||||||
@ -1636,6 +1639,9 @@ var Swirl;
|
|||||||
class IndexPage {
|
class IndexPage {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.dashboard = new ChartDashboard("#div-charts", window.charts, { name: "home" });
|
this.dashboard = new ChartDashboard("#div-charts", window.charts, { name: "home" });
|
||||||
|
$("#cb-time").change(e => {
|
||||||
|
this.dashboard.setPeriod($(e.target).val());
|
||||||
|
});
|
||||||
dragula([$('#div-charts').get(0)], {
|
dragula([$('#div-charts').get(0)], {
|
||||||
moves: function (el, container, handle) {
|
moves: function (el, container, handle) {
|
||||||
return $(handle).closest('a.drag').length > 0;
|
return $(handle).closest('a.drag').length > 0;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -498,6 +498,10 @@ namespace Swirl.Core {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private loadData() {
|
private loadData() {
|
||||||
|
if (this.charts.length == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
let args: any = {
|
let args: any = {
|
||||||
charts: this.charts.map(c => c.getOptions().name).join(","),
|
charts: this.charts.map(c => c.getOptions().name).join(","),
|
||||||
period: this.opts.period,
|
period: this.opts.period,
|
||||||
|
@ -8,6 +8,9 @@ namespace Swirl {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.dashboard = new ChartDashboard("#div-charts", window.charts, {name: "home"});
|
this.dashboard = new ChartDashboard("#div-charts", window.charts, {name: "home"});
|
||||||
|
$("#cb-time").change(e => {
|
||||||
|
this.dashboard.setPeriod($(e.target).val());
|
||||||
|
});
|
||||||
dragula([$('#div-charts').get(0)], {
|
dragula([$('#div-charts').get(0)], {
|
||||||
moves: function (el, container, handle): boolean {
|
moves: function (el, container, handle): boolean {
|
||||||
return $(handle).closest('a.drag').length > 0;
|
return $(handle).closest('a.drag').length > 0;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{{ extends "_layouts/default" }}
|
{{ extends "_layouts/default" }}
|
||||||
|
{{ import "_modules/form" }}
|
||||||
|
|
||||||
{{ block style() }}
|
{{ block style() }}
|
||||||
<link rel="stylesheet" href="/assets/dragula/dragula.min.css?v=2.7.2">
|
<link rel="stylesheet" href="/assets/dragula/dragula.min.css?v=2.7.2">
|
||||||
@ -80,6 +81,25 @@
|
|||||||
<strong>{{ i18n("home.monitor") }}</strong>
|
<strong>{{ i18n("home.monitor") }}</strong>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="level-item">
|
||||||
|
<div class="field has-addons">
|
||||||
|
<p class="control">
|
||||||
|
<a class="button is-static">Time</a>
|
||||||
|
</p>
|
||||||
|
<p class="control">
|
||||||
|
<div class="select">
|
||||||
|
<select id="cb-time">
|
||||||
|
<option value="30" selected>Last 30 minutes</option>
|
||||||
|
<option value="60">Last 1 hour</option>
|
||||||
|
<option value="180">Last 3 hours</option>
|
||||||
|
<option value="360">Last 6 hours</option>
|
||||||
|
<option value="720">Last 12 hours</option>
|
||||||
|
<option value="1440">Last 24 hours</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="level-right">
|
<div class="level-right">
|
||||||
<div class="level-item">
|
<div class="level-item">
|
||||||
|
Loading…
Reference in New Issue
Block a user