This repository has been archived by the owner on Aug 5, 2021. It is now read-only.
/
scheduledevents.js
executable file
·100 lines (81 loc) · 2.98 KB
/
scheduledevents.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
var ec2ui_ScheduledEventsTreeView = {
COLNAMES : [
'scheduledevents.instanceId',
'scheduledevents.instanceName',
'scheduledevents.availabilityZone',
'scheduledevents.code',
'scheduledevents.description',
'scheduledevents.startTime',
'scheduledevents.endTime'
],
treeBox : null,
selection : null,
scheduledEventList : new Array(),
registered : false,
get rowCount() { return this.scheduledEventList.length; },
setTree: function(treeBox) { this.treeBox = treeBox; },
getCellText : function(idx, column) {
if (idx >= this.rowCount) { return ""; }
var member = column.id.split(".").pop();
return this.scheduledEventList[idx][member];
},
isEditable: function(idx, column) { return true; },
isContainer: function(idx) { return false;},
isSeparator: function(idx) { return false; },
isSorted: function() { return false; },
getImageSrc: function(idx, column) { return ""; },
getProgressMode : function(idx, column) {},
getCellValue: function(idx, column) {},
cycleHeader: function(col) {
cycleHeader(
col,
document,
this.COLNAMES,
this.scheduledEventList);
this.treeBox.invalidate();
},
sort: function() {
sortView(document, this.COLNAMES, this.scheduledEventList);
},
cycleCell: function(idx, column) {},
performAction: function(action) {},
performActionOnCell: function(action, index, column) {},
getRowProperties: function(idx, column, prop) {},
getCellProperties: function(idx, column, prop) {},
getColumnProperties: function(column, element, prop) {},
getLevel: function(idx) { return 0; },
getSelectedScheduledEvent : function() {
var index = this.selection.currentIndex;
if (index == -1) { return null; }
return this.scheduledEventList[index];
},
register: function() {
if (!this.registered) {
this.registered = true;
ec2ui_model.registerInterest(this, 'scheduledEvents');
}
},
invalidate: function() {
this.displayScheduledEvent(ec2ui_session.model.instanceStatuses);
},
refresh: function() {
ec2ui_session.controller.describeInstanceStatus();
},
notifyModelChanged: function(interest) {
this.invalidate();
},
copyToClipBoard: function(fieldName) {
var scheduledEvent = this.getSelectedScheduledEvent();
if (scheduledEvent == null) { return; }
copyToClipboard(scheduledEvent[fieldName]);
},
displayScheduledEvent : function (scheduledEventList) {
if (!scheduledEventList) { scheduledEventList = []; }
this.treeBox.rowCountChanged(0, -this.scheduledEventList.length);
this.scheduledEventList = scheduledEventList;
this.treeBox.rowCountChanged(0, this.scheduledEventList.length);
this.sort();
this.selection.clearSelection();
}
};
ec2ui_ScheduledEvents.register();