-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.js
73 lines (62 loc) · 1.65 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { Scheduler } from "@bryntum/scheduler";
import "./style.css";
const scheduler = new Scheduler({
appendTo: "app",
viewPreset: "dayAndMonth",
// To center the view on a certain date
visibleDate: new Date(2024, 1, 6),
// Enables endless timeline scrolling
infiniteScroll: true,
// The infiniteScroll gets a better UX if a larger bufferCoef is used. When using lazyLoading, this only means that
// the timeline "shifts" more seldom. Only events inside or close to the visible date range is requested from the
// backend
bufferCoef: 20,
// Affects when the timespan shifts upon horizontal scroll
bufferThreshold: 0.01,
tickSize: 30,
selectionMode: { rowNumber: true },
features: {
filter: false,
resourceTimeRanges: true,
},
columns: [
{
text: "Name",
field: "name",
width: 200,
sortable: false,
editor: {
type: "textfield",
required: true,
},
},
],
resourceStore: {
readUrl: "http://localhost:3000/read-resources",
autoLoad: true,
},
eventStore: {
autoLoad: true,
readUrl: "http://localhost:3000/read-events",
fields: [{ name: "duration", persist: false }],
},
resourceTimeRangeStore: {
autoLoad: true,
readUrl: "http://localhost:3000/read-resourcetimeranges",
},
tbar: [
{
type: "container",
style: "align-content:center",
items: {
label: "Network status:",
networkValue: "Idle",
},
},
],
});
const updateNetworkValue = (text = "Idle", color = "green") => {
const { networkValue } = scheduler.widgetMap;
networkValue.html = text;
networkValue.element.style.color = color;
};