Revision 66
hci/trunk/eneraptor-web-app/web-app/css/style.css | ||
---|---|---|
422 | 422 |
.actions-add{background:transparent url(../img/icons/script_add.png) no-repeat left;} |
423 | 423 |
|
424 | 424 |
.config-main{background:transparent url(../img/icons/eye.png) no-repeat left;} |
425 |
.config-hci{background:transparent url(../img/icons/application.png) no-repeat left;} |
|
426 |
.config-logic{background:transparent url(../img/icons/cog.png) no-repeat left;} |
|
427 |
.config-connection{background:transparent url(../img/icons/connect.png) no-repeat left;} |
|
425 |
.config-hci{background:transparent url(../img/icons/calculator.png) no-repeat left;} |
|
426 |
.config-logic{background:transparent url(../img/icons/processor.png) no-repeat left;} |
|
427 |
.config-connection{background:transparent url(../img/icons/connect.png) no-repeat left;} |
|
428 |
.config-database{background:transparent url(../img/icons/database.png) no-repeat left;} |
hci/trunk/eneraptor-web-app/grails-app/services/com/eneraptor/hci/HciLogicCommService.groovy | ||
---|---|---|
4 | 4 |
|
5 | 5 |
static transactional = true |
6 | 6 |
|
7 |
Map getReplyToRequest(String requestContent) { |
|
7 |
Map getReplyToRequest(String requestContent,String ipAddress,int portNum) {
|
|
8 | 8 |
|
9 | 9 |
Map reply = new HashMap() |
10 | 10 |
|
11 | 11 |
Socket logicSocket = null; |
12 | 12 |
PrintWriter toLogic = null; |
13 | 13 |
BufferedReader fromLogic = null; |
14 |
|
|
15 |
def ipAddress = InternalConfig.findByConfigId("logic-ip")['configVal'] |
|
16 |
def portNum = InternalConfig.findByConfigId("logic-port")['configVal'] |
|
17 | 14 |
|
18 | 15 |
try { |
19 |
logicSocket = new Socket(ipAddress, portNum as int);
|
|
16 |
logicSocket = new Socket(ipAddress, portNum); |
|
20 | 17 |
toLogic = new PrintWriter(logicSocket.getOutputStream(), true); |
21 | 18 |
fromLogic = new BufferedReader(new InputStreamReader( |
22 | 19 |
logicSocket.getInputStream())); |
hci/trunk/eneraptor-web-app/grails-app/services/com/eneraptor/hci/MainMenuService.groovy | ||
---|---|---|
55 | 55 |
|
56 | 56 |
configSubMenu = new ArrayList() |
57 | 57 |
configSubMenu.add(new MenuItem("Overview","config","main")) |
58 |
configSubMenu.add(new MenuItem("Configure HCI","config","hci")) |
|
59 |
configSubMenu.add(new MenuItem("Configure the Logic","config","logic")) |
|
60 |
configSubMenu.add(new MenuItem("Configure HCI to Logic connection","config","connection")) |
|
58 |
configSubMenu.add(new MenuItem("Configure devices","config","hci")) |
|
59 |
configSubMenu.add(new MenuItem("Configure hardware set (card)","config","logic")) |
|
60 |
configSubMenu.add(new MenuItem("Configure connection","config","connection")) |
|
61 |
configSubMenu.add(new MenuItem("Configure database","config","database")) |
|
61 | 62 |
|
62 | 63 |
} |
63 | 64 |
|
hci/trunk/eneraptor-web-app/grails-app/conf/com/eneraptor/hci/LoginFilters.groovy | ||
---|---|---|
7 | 7 |
before = { |
8 | 8 |
|
9 | 9 |
if(!session["loggedIn"]) { |
10 |
|
|
10 | 11 |
redirect(controller: 'login'); |
12 |
return false |
|
13 |
|
|
14 |
} else if (!session["hwSet"] && params.controller != 'chooseHwSet') { |
|
15 |
|
|
16 |
redirect(controller: 'chooseHwSet', action: 'main') |
|
17 |
return false |
|
18 |
|
|
11 | 19 |
} |
20 |
|
|
12 | 21 |
return true; |
13 | 22 |
|
14 | 23 |
} |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/ConfigController.groovy | ||
---|---|---|
33 | 33 |
|
34 | 34 |
*/ |
35 | 35 |
|
36 |
def allDevices = DeviceInfo.list() |
|
36 |
def allDevices = HardwareSet.get(session.hwSet.id).devices |
|
37 |
|
|
37 | 38 |
[conf: InternalConfig, devices: allDevices, totalSpace: totalSpace, freeSpace: freeSpace, percent: percent] |
38 | 39 |
} |
39 | 40 |
|
... | ... | |
42 | 43 |
|
43 | 44 |
def addDeviceSave = { |
44 | 45 |
def newDevice = new DeviceInfo(params) |
46 |
HardwareSet.get(session.hwSet.id).addToDevices(newDevice) |
|
45 | 47 |
if(newDevice.validate() && (params.inputDevice || params.outputDevice)) { |
46 | 48 |
newDevice.save() |
47 | 49 |
flash['confirms'] = "<p>New device added successfully.</p>" |
... | ... | |
107 | 109 |
|
108 | 110 |
def logic = { |
109 | 111 |
|
110 |
[conf: InternalConfig]
|
|
112 |
def hwSet = session.hwSet
|
|
111 | 113 |
|
114 |
[hwSet:hwSet] |
|
115 |
|
|
112 | 116 |
} |
113 | 117 |
|
114 | 118 |
def connection = { |
115 | 119 |
|
116 |
[conf: InternalConfig]
|
|
120 |
def hwSet = session.hwSet
|
|
117 | 121 |
|
122 |
[hwSet: hwSet] |
|
123 |
|
|
118 | 124 |
} |
119 | 125 |
|
120 | 126 |
def saveConnection = { |
121 | 127 |
|
122 | 128 |
if(params['logic-ip'] == 'localhost') params['logic-ip'] = '127.0.0.1' |
123 | 129 |
|
124 |
if(params['logic-ip'] && params['logic-port']) { |
|
125 |
InternalConfig.findByConfigId('logic-ip').configVal = params['logic-ip'] |
|
126 |
InternalConfig.findByConfigId('logic-port').configVal = params['logic-port'] |
|
130 |
if(params['logic-ip'] && params['logic-port'] && params['logic-port'].isInteger()) { |
|
131 |
|
|
132 |
session.hwSet.IPaddress = params['logic-ip'] |
|
133 |
session.hwSet.portNumber = (params['logic-port'] as int) |
|
127 | 134 |
flash['confirms'] = "<p>Changes saved.</p>" |
128 | 135 |
redirect(action: 'connection') |
129 | 136 |
} else { |
130 |
flash['errors'] = "<p>Logic IP address and port fields cannot be blank.</p>"
|
|
137 |
flash['errors'] = "<p>Could not save changes.</p><p>Logic IP address and port fields cannot be blank. Port number must be an integer.</p>"
|
|
131 | 138 |
redirect(action: 'connection') |
132 | 139 |
} |
133 | 140 |
|
... | ... | |
171 | 178 |
def getHelp = { |
172 | 179 |
[what : params.what] |
173 | 180 |
} |
181 |
|
|
182 |
def database = { } |
|
174 | 183 |
|
175 | 184 |
} |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/LogicRequestController.groovy | ||
---|---|---|
11 | 11 |
|
12 | 12 |
def output = ""; |
13 | 13 |
output += reportService.println("Conection test using") |
14 |
output += reportService.println("Logic IP address: " + InternalConfig.findByConfigId('logic-ip').configVal)
|
|
15 |
output += reportService.println("Logic port number: " + InternalConfig.findByConfigId('logic-port').configVal)
|
|
14 |
output += reportService.println("Logic IP address: " + session.hwSet.IPaddress)
|
|
15 |
output += reportService.println("Logic port number: " + session.hwSet.portNumber)
|
|
16 | 16 |
|
17 | 17 |
output += reportService.println("Test started") |
18 | 18 |
|
19 | 19 |
String reqStr = "<?xml version=\"1.0\"?><hci-request type=\"checkConnection\"><data>12345</data></hci-request>" |
20 |
Map testReply = hciLogicCommService.getReplyToRequest(reqStr) |
|
20 |
Map testReply = hciLogicCommService.getReplyToRequest(reqStr,session.hwSet.IPaddress,session.hwSet.portNumber)
|
|
21 | 21 |
|
22 | 22 |
if(testReply['status'] == "error") { |
23 | 23 |
output += reportService.println("<span style='color:red;'>Error: " + testReply['content'] + "</span>") |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/StatisticsController.groovy | ||
---|---|---|
16 | 16 |
List savedGraphs = new ArrayList() |
17 | 17 |
List combinedGraphs = new ArrayList() |
18 | 18 |
|
19 |
savedGraphs = EneGraph.list() |
|
19 |
savedGraphs = EneGraph.findAllByHwSet(session.hwSet) |
|
20 |
|
|
20 | 21 |
combinedGraphs = CombGraph.list() |
21 | 22 |
|
22 | 23 |
[savedGraphs: savedGraphs, combinedGraphs:combinedGraphs] |
... | ... | |
31 | 32 |
List devices = new ArrayList() |
32 | 33 |
List devicesFriendly = new ArrayList() |
33 | 34 |
|
34 |
DeviceInfo.list().each {
|
|
35 |
DeviceInfo.findAllByHwSet(session.hwSet).each {
|
|
35 | 36 |
devices << it.deviceId |
36 | 37 |
devicesFriendly << it.friendlyName |
37 | 38 |
} |
... | ... | |
78 | 79 |
deviceId: params['deviceId'] |
79 | 80 |
) |
80 | 81 |
|
82 |
HardwareSet.get(session.hwSet.id).addToGraphs(newEneGraph) |
|
83 |
|
|
81 | 84 |
if(!newEneGraph.validate()) { |
82 | 85 |
errors += "<p>Graph could not be created - there were some input errors. Please check if all input values are valid.</p>" |
83 | 86 |
flash['errors'] = errors |
... | ... | |
118 | 121 |
List devices = new ArrayList() |
119 | 122 |
List devicesFriendly = new ArrayList() |
120 | 123 |
|
121 |
DeviceInfo.list().each {
|
|
124 |
DeviceInfo.findAllByHwSet(session.hwSet).each {
|
|
122 | 125 |
devices << it.deviceId |
123 | 126 |
devicesFriendly << it.friendlyName |
124 | 127 |
} |
... | ... | |
167 | 170 |
|
168 | 171 |
def newReport = { |
169 | 172 |
|
170 |
def graphsAll = EneGraph.list()
|
|
173 |
def graphsAll = EneGraph.findAllByHwSet(session.hwSet)
|
|
171 | 174 |
def graphs = new ArrayList() |
172 | 175 |
def graphsKeys = new ArrayList() |
173 | 176 |
graphsAll.each { |
... | ... | |
420 | 423 |
def graphToDelete = EneGraph.get(params['id']) |
421 | 424 |
if(graphToDelete) { |
422 | 425 |
|
423 |
if(graphToDelete.delete()) {
|
|
424 |
flash['confirms'] = "<p>Graph deleted successfully.</p>" |
|
425 |
redirect(action:'graphs')
|
|
426 |
return true
|
|
427 |
} else {
|
|
426 |
def idOfDeleted = graphToDelete.id
|
|
427 |
|
|
428 |
try {
|
|
429 |
graphToDelete.delete(flush:true)
|
|
430 |
} catch (Exception e) {
|
|
428 | 431 |
flash['errors'] = "<p>Cannot remove this graph. This graph is part of a <b>combined</b> graph.</p><p>You should remove the <b>combined</b> graph first.</p>" |
429 | 432 |
redirect(action:'graphs') |
430 | 433 |
return false |
431 | 434 |
} |
432 | 435 |
|
436 |
flash['confirms'] = "<p>Graph deleted successfully.</p>" |
|
437 |
redirect(action:'graphs') |
|
438 |
return true |
|
439 |
|
|
433 | 440 |
} else { |
434 | 441 |
flash['errors'] = "<p>No graph was deleted. Graph ID invalid!</p>" |
435 | 442 |
redirect(action:'graphs') |
... | ... | |
448 | 455 |
|
449 | 456 |
def newCombGraph = { |
450 | 457 |
|
451 |
def graphs = EneGraph.list() |
|
458 |
def graphs = EneGraph.findAllByHwSet(session.hwSet) |
|
459 |
def otherGraphs = EneGraph.findAllByHwSetNotEqual(session.hwSet) |
|
452 | 460 |
|
453 |
[graphs:graphs] |
|
461 |
[graphs:graphs, otherGraphs: otherGraphs]
|
|
454 | 462 |
|
455 | 463 |
} |
456 | 464 |
|
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/ChooseHwSetController.groovy | ||
---|---|---|
1 |
package com.eneraptor.hci |
|
2 |
|
|
3 |
class ChooseHwSetController { |
|
4 |
|
|
5 |
def index = { } |
|
6 |
|
|
7 |
def main = { |
|
8 |
|
|
9 |
def hwSets = HardwareSet.list() |
|
10 |
|
|
11 |
[hwSets: hwSets] |
|
12 |
|
|
13 |
} |
|
14 |
|
|
15 |
def mainDo = { |
|
16 |
|
|
17 |
HardwareSet chosenHwSet = HardwareSet.get(params['hwSet']) |
|
18 |
|
|
19 |
if(chosenHwSet) { |
|
20 |
|
|
21 |
session['hwSet'] = chosenHwSet |
|
22 |
redirect(controller:'sysState',action:'main') |
|
23 |
return true |
|
24 |
|
|
25 |
} |
|
26 |
|
|
27 |
redirect(action:'main') |
|
28 |
return false |
|
29 |
|
|
30 |
} |
|
31 |
|
|
32 |
def addNew = { } |
|
33 |
|
|
34 |
def addNewDo = { |
|
35 |
|
|
36 |
HardwareSet newHwSet = new HardwareSet(params) |
|
37 |
|
|
38 |
if(!newHwSet.validate()) { |
|
39 |
redirect(action:'addNew',params:(params << ['invalid':true])) |
|
40 |
return false |
|
41 |
} else { |
|
42 |
newHwSet.save() |
|
43 |
redirect(action:main) |
|
44 |
return true |
|
45 |
} |
|
46 |
|
|
47 |
} |
|
48 |
|
|
49 |
def change = { |
|
50 |
|
|
51 |
def chosenHwSet = HardwareSet.get(params.id) |
|
52 |
|
|
53 |
if(chosenHwSet) { |
|
54 |
session['hwSet'] = chosenHwSet |
|
55 |
flash.confirms = "<p>Changed current hardware set to " + chosenHwSet.name + "</p>" |
|
56 |
redirect(controller:'sysState',action:'main') |
|
57 |
return true |
|
58 |
} else { |
|
59 |
flash.errors = "<p>Could not change current hardware set (card). The ID specified is not valid!</p>" |
|
60 |
redirect(controller:'sysState',action:'main') |
|
61 |
} |
|
62 |
|
|
63 |
return false |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
def delete = { |
|
68 |
|
|
69 |
def hwSet = HardwareSet.get(params['id']) |
|
70 |
|
|
71 |
if(hwSet) { |
|
72 |
|
|
73 |
session.hwSet = null |
|
74 |
hwSet.delete() |
|
75 |
redirect(action:'main') |
|
76 |
return true |
|
77 |
|
|
78 |
} else { |
|
79 |
flash.errors = '<p>Could not delete hardware set (card). The ID specified is invalid.</p>' |
|
80 |
redirect(controller:'config',action:'logic') |
|
81 |
return false |
|
82 |
} |
|
83 |
|
|
84 |
} |
|
85 |
|
|
86 |
} |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/SysStateController.groovy | ||
---|---|---|
7 | 7 |
|
8 | 8 |
def main = { |
9 | 9 |
|
10 |
List inDevices = DeviceInfo.findAllByInputDevice(true, [sort:'friendlyName', order:'asc']) |
|
10 |
def crit1 = DeviceInfo.createCriteria() |
|
11 |
List inDevices = crit1 { |
|
12 |
and { |
|
13 |
eq("inputDevice",true) |
|
14 |
eq("hwSet",session.hwSet) |
|
15 |
} |
|
16 |
order("friendlyName","asc") |
|
17 |
} |
|
18 |
|
|
11 | 19 |
List inDevicesData = new ArrayList() |
12 | 20 |
inDevices.each { |
13 | 21 |
Map inDeviceDataEntry = new HashMap() |
... | ... | |
17 | 25 |
inDevicesData << inDeviceDataEntry |
18 | 26 |
} |
19 | 27 |
|
20 |
List outDevices = DeviceInfo.findAllByOutputDevice(true, [sort:'friendlyName', order:'asc']) |
|
28 |
def crit2 = DeviceInfo.createCriteria() |
|
29 |
List outDevices = crit2 { |
|
30 |
and { |
|
31 |
eq("outputDevice",true) |
|
32 |
eq("hwSet",session.hwSet) |
|
33 |
} |
|
34 |
order("friendlyName","asc") |
|
35 |
} |
|
36 |
|
|
21 | 37 |
List outDevicesData = new ArrayList() |
22 | 38 |
outDevices.each { |
23 | 39 |
Map outDeviceDataEntry = new HashMap() |
... | ... | |
33 | 49 |
|
34 | 50 |
def measure = { |
35 | 51 |
|
36 |
List inDevices = DeviceInfo.findAllByInputDevice(true, [sort:'friendlyName', order:'asc']) |
|
52 |
def crit1 = DeviceInfo.createCriteria() |
|
53 |
List inDevices = crit1 { |
|
54 |
and { |
|
55 |
eq("inputDevice",true) |
|
56 |
eq("hwSet",session.hwSet) |
|
57 |
} |
|
58 |
order("friendlyName","asc") |
|
59 |
} |
|
60 |
|
|
37 | 61 |
List inDevicesData = new ArrayList() |
38 | 62 |
inDevices.each { |
39 | 63 |
Map inDeviceDataEntry = new HashMap() |
... | ... | |
92 | 116 |
|
93 | 117 |
def actions = { |
94 | 118 |
|
95 |
List outDevices = DeviceInfo.findAllByOutputDevice(true, [sort:'friendlyName', order:'asc']) |
|
119 |
def crit2 = DeviceInfo.createCriteria() |
|
120 |
List outDevices = crit2 { |
|
121 |
and { |
|
122 |
eq("outputDevice",true) |
|
123 |
eq("hwSet",session.hwSet) |
|
124 |
} |
|
125 |
order("friendlyName","asc") |
|
126 |
} |
|
127 |
|
|
96 | 128 |
List outDevicesData = new ArrayList() |
97 | 129 |
outDevices.each { |
98 | 130 |
Map outDeviceDataEntry = new HashMap() |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/ActionsController.groovy | ||
---|---|---|
17 | 17 |
def getActions = { |
18 | 18 |
|
19 | 19 |
String reqStr = "<?xml version=\"1.0\"?><hci-request type=\"getScenarios\"></hci-request>" |
20 |
Map reply = hciLogicCommService.getReplyToRequest(reqStr) |
|
20 |
Map reply = hciLogicCommService.getReplyToRequest(reqStr,session.hwSet.IPaddress,session.hwSet.portNumber)
|
|
21 | 21 |
|
22 | 22 |
if(reply['status'] == 'error' || reply['content'] == null) { |
23 | 23 |
return [replyError: reply['content']] |
... | ... | |
43 | 43 |
def viewAction = { |
44 | 44 |
|
45 | 45 |
String reqStr = "<?xml version=\"1.0\"?><hci-request type=\"getScenarios\"></hci-request>" |
46 |
Map reply = hciLogicCommService.getReplyToRequest(reqStr) |
|
46 |
Map reply = hciLogicCommService.getReplyToRequest(reqStr,session.hwSet.IPaddress,session.hwSet.portNumber)
|
|
47 | 47 |
|
48 | 48 |
if(reply['status'] == 'error' || reply['content'] == null) { |
49 | 49 |
flash['errors'] = "<p>Error connecting with logic: " + reply['content'] + "</p>" |
... | ... | |
94 | 94 |
// First part: get XML from logic and modify |
95 | 95 |
|
96 | 96 |
String reqStr = "<?xml version=\"1.0\"?><hci-request type=\"getScenarios\"></hci-request>" |
97 |
Map reply = hciLogicCommService.getReplyToRequest(reqStr) |
|
97 |
Map reply = hciLogicCommService.getReplyToRequest(reqStr,session.hwSet.IPaddress,session.hwSet.portNumber)
|
|
98 | 98 |
|
99 | 99 |
if(reply['status'] == 'error' || reply['content'] == null) { |
100 | 100 |
flash['errors'] = "<p>Error connecting with logic: " + reply['content'] + "</p>" |
... | ... | |
118 | 118 |
|
119 | 119 |
// Second part: give modified XML to logic |
120 | 120 |
|
121 |
Map reply2 = hciLogicCommService.getReplyToRequest(result) |
|
121 |
Map reply2 = hciLogicCommService.getReplyToRequest(result,session.hwSet.IPaddress,session.hwSet.portNumber)
|
|
122 | 122 |
|
123 | 123 |
if(reply2['status'] == 'error' || reply2['content'] == null) { |
124 | 124 |
flash['errors'] = "<p>Error connecting with logic: " + reply2['content'] + "</p>" |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/SysLogController.groovy | ||
---|---|---|
41 | 41 |
flash['warnings'] = null |
42 | 42 |
|
43 | 43 |
List devicesForCheckBox = new ArrayList() |
44 |
DeviceInfo.findAllByInputDeviceOrOutputDevice(true,true).each { |
|
45 |
devicesForCheckBox << it |
|
44 |
|
|
45 |
def crit1 = DeviceInfo.createCriteria() |
|
46 |
devicesForCheckBox = crit1 { |
|
47 |
and { |
|
48 |
or { |
|
49 |
eq("outputDevice",true) |
|
50 |
eq("inputDevice",true) |
|
51 |
} |
|
52 |
eq("hwSet",session.hwSet) |
|
53 |
} |
|
54 |
order("friendlyName","asc") |
|
46 | 55 |
} |
47 | 56 |
|
48 | 57 |
def entries = new ArrayList() |
... | ... | |
132 | 141 |
List devices = new ArrayList() |
133 | 142 |
List data = new ArrayList() |
134 | 143 |
|
135 |
DeviceInfo.findAllByInputDevice(true).each { |
|
136 |
devices << it |
|
144 |
def crit1 = DeviceInfo.createCriteria() |
|
145 |
devices = crit1 { |
|
146 |
and { |
|
147 |
eq("inputDevice",true) |
|
148 |
eq("hwSet",session.hwSet) |
|
149 |
} |
|
150 |
order("friendlyName","asc") |
|
137 | 151 |
} |
138 | 152 |
|
139 | 153 |
if(params['dataList']) |
... | ... | |
162 | 176 |
def export = { |
163 | 177 |
|
164 | 178 |
List devicesForCheckBox = new ArrayList() |
165 |
DeviceInfo.findAllByInputDeviceOrOutputDevice(true,true).each { |
|
166 |
devicesForCheckBox << it |
|
179 |
|
|
180 |
def crit1 = DeviceInfo.createCriteria() |
|
181 |
devicesForCheckBox = crit1 { |
|
182 |
and { |
|
183 |
or { |
|
184 |
eq("outputDevice",true) |
|
185 |
eq("inputDevice",true) |
|
186 |
} |
|
187 |
eq("hwSet",session.hwSet) |
|
188 |
} |
|
189 |
order("friendlyName","asc") |
|
167 | 190 |
} |
168 | 191 |
|
169 | 192 |
[devicesForCheckBox: devicesForCheckBox] |
... | ... | |
241 | 264 |
def clear = { |
242 | 265 |
|
243 | 266 |
List devicesForCheckBox = new ArrayList() |
244 |
DeviceInfo.findAllByInputDeviceOrOutputDevice(true,true).each { |
|
245 |
devicesForCheckBox << it |
|
267 |
|
|
268 |
def crit1 = DeviceInfo.createCriteria() |
|
269 |
devicesForCheckBox = crit1 { |
|
270 |
and { |
|
271 |
or { |
|
272 |
eq("outputDevice",true) |
|
273 |
eq("inputDevice",true) |
|
274 |
} |
|
275 |
eq("hwSet",session.hwSet) |
|
276 |
} |
|
277 |
order("friendlyName","asc") |
|
246 | 278 |
} |
247 | 279 |
|
248 | 280 |
[devicesForCheckBox: devicesForCheckBox] |
hci/trunk/eneraptor-web-app/grails-app/domain/com/eneraptor/hci/EneGraph.groovy | ||
---|---|---|
15 | 15 |
int advMonthTimeFrameStart |
16 | 16 |
int advMonthTimeFrameEnd |
17 | 17 |
String deviceId |
18 |
|
|
19 |
static belongsTo = [hwSet: HardwareSet] |
|
18 | 20 |
|
19 | 21 |
static constraints = { |
20 | 22 |
|
21 |
name(blank:false, unique:true)
|
|
23 |
name(blank:false, unique:'hwSet')
|
|
22 | 24 |
type(blank:false, inList:["max","min","avg","sum"]) |
23 | 25 |
timeFrameType(blank:false, inList:["day","month","year","custom"]) |
24 | 26 |
timeFrameStart(blank:false) |
hci/trunk/eneraptor-web-app/grails-app/domain/com/eneraptor/hci/HardwareSet.groovy | ||
---|---|---|
1 |
package com.eneraptor.hci |
|
2 |
|
|
3 |
class HardwareSet { |
|
4 |
|
|
5 |
String hardId |
|
6 |
String name |
|
7 |
String IPaddress |
|
8 |
int portNumber |
|
9 |
|
|
10 |
static hasMany = [ |
|
11 |
graphs: EneGraph, |
|
12 |
devices: DeviceInfo |
|
13 |
] |
|
14 |
|
|
15 |
static constraints = { |
|
16 |
hardId(blank:false,unique:true) |
|
17 |
name(blank:false,unique:true) |
|
18 |
} |
|
19 |
} |
hci/trunk/eneraptor-web-app/grails-app/domain/com/eneraptor/hci/DeviceInfo.groovy | ||
---|---|---|
9 | 9 |
boolean inputDevice |
10 | 10 |
boolean outputDevice |
11 | 11 |
|
12 |
|
|
12 |
static belongsTo = [hwSet: HardwareSet] |
|
13 | 13 |
|
14 | 14 |
static constraints = { |
15 |
deviceId(blank: false, unique: true)
|
|
15 |
deviceId(blank: false, unique: 'hwSet')
|
|
16 | 16 |
friendlyName(blank: false, maxSize: 64) |
17 | 17 |
description(nullable: true, maxSize: 128) |
18 | 18 |
iconPath(nullable: true) |
hci/trunk/eneraptor-web-app/grails-app/views/statistics/showCombGraph.gsp | ||
---|---|---|
14 | 14 |
var options = { |
15 | 15 |
lines: { show: true }, |
16 | 16 |
points: { show: true }, |
17 |
xaxis: { mode: "time", timeformat: "%y/%m/%d %H:%M" } |
|
17 |
xaxis: { mode: "time", timeformat: "%y/%m/%d %H:%M" }, |
|
18 |
legend: { |
|
19 |
container: $('legendContainer') |
|
20 |
} |
|
18 | 21 |
}; |
19 | 22 |
</g:javascript> |
20 | 23 |
<div class="chart"> |
21 | 24 |
<flot:plot id="placeholder" style="width: 900px; height: 300px; padding:5px;" data="data" options="options" /> |
22 | 25 |
</div> |
26 |
<br /> |
|
27 |
<p>Legend:</p> |
|
28 |
<div id="legendContainer" name="legendContainer"></div> |
|
23 | 29 |
</erptr:box> |
24 | 30 |
|
25 | 31 |
</body> |
hci/trunk/eneraptor-web-app/grails-app/views/statistics/newCombGraph.gsp | ||
---|---|---|
24 | 24 |
<p>Select by clicking on the grpah's name while holding CTRL key on your keyboard.</p> |
25 | 25 |
<br /> |
26 | 26 |
<select multiple="multiple" name="graphsToCombine" id="graphsToCombine" size="10" style="width:820px;"> |
27 |
<g:each in="${graphs}" var="graph"> |
|
28 |
<option value="${graph.id}">(${graph.type}) ${graph.name}</option> |
|
29 |
</g:each> |
|
27 |
<optgroup label="Current hardware set's (card's) graphs"></optgroup> |
|
28 |
<g:each in="${graphs}" var="graph"> |
|
29 |
<option value="${graph.id}"> (${graph.type}) ${graph.name}</option> |
|
30 |
</g:each> |
|
31 |
<optgroup label="Other hardware set's (card's) graphs"></optgroup> |
|
32 |
<g:each in="${otherGraphs}" var="ograph"> |
|
33 |
<option value="${ograph.id}"> (${ograph.type}) ${ograph.name}</option> |
|
34 |
</g:each> |
|
30 | 35 |
</select> |
31 | 36 |
<br /><br /> |
32 | 37 |
</fieldset> |
hci/trunk/eneraptor-web-app/grails-app/views/chooseHwSet/addNew.gsp | ||
---|---|---|
1 |
<html> |
|
2 |
|
|
3 |
<head> |
|
4 |
<title>Eneraptor » Adding new hardware set (card)</title> |
|
5 |
<link rel="stylesheet" type="text/css" href="${g.resource(dir:'css/', file:'theme.css')}" /> |
|
6 |
<link rel="stylesheet" type="text/css" href="${g.resource(dir:'css/', file:'style.css')}" /> |
|
7 |
<!--[if IE]> |
|
8 |
<link rel="stylesheet" type="text/css" href="${g.resource(dir:'css/', file:'ie-sucks.css')}" /> |
|
9 |
<![endif]--> |
|
10 |
</head> |
|
11 |
|
|
12 |
<body> |
|
13 |
<center> |
|
14 |
<br /> |
|
15 |
<img src="${g.resource(dir:'img', file:'logo.jpg')}" /> |
|
16 |
<div style="width:518px;background:white;padding:10px;margin-top:20px;"> |
|
17 |
|
|
18 |
<g:if test="${params.invalid}"> |
|
19 |
<div style="width:100%;border:1px solid #E33939;'"> |
|
20 |
<p style="color:#E33939;"><erptr:icon w="exclamation" />Sorry, some fields were either left blank or invalid.</p> |
|
21 |
</div> |
|
22 |
<br /> |
|
23 |
</g:if> |
|
24 |
|
|
25 |
<erptr:box title="New hardware set (card)"> |
|
26 |
|
|
27 |
<p>Please enter information about the new hardware set (card). All fiealds are required.</p> |
|
28 |
|
|
29 |
<g:form action="addNewDo"> |
|
30 |
|
|
31 |
<label for="hardId">Card's unique ID:</label> |
|
32 |
<g:textField name="hardId" value="${params.hardId?:''}" /> |
|
33 |
<br /><br /> |
|
34 |
|
|
35 |
<label for="name">Card's unique name:</label> |
|
36 |
<g:textField name="name" value="${params.name?:''}" /> |
|
37 |
<br /><br /> |
|
38 |
|
|
39 |
<label for="IPaddress">Card's IP address:</label> |
|
40 |
<g:textField name="IPaddress" value="${params.IPaddress?:'127.0.0.1'}" /> |
|
41 |
<br /><br /> |
|
42 |
|
|
43 |
<label for="portNumber">Logic's port number:</label> |
|
44 |
<g:textField name="portNumber" value="${params.portNumber?:'1100'}" /> |
|
45 |
<br /><br /> |
|
46 |
|
|
47 |
<g:submitButton name="addNewSubmit" value="Sumbit" /> |
|
48 |
|
|
49 |
</g:form> |
|
50 |
|
|
51 |
</erptr:box> |
|
52 |
</div> |
|
53 |
</center> |
|
54 |
</body> |
|
55 |
|
|
56 |
</html> |
hci/trunk/eneraptor-web-app/grails-app/views/chooseHwSet/main.gsp | ||
---|---|---|
1 |
<html> |
|
2 |
|
|
3 |
<head> |
|
4 |
<title>Eneraptor » Hardware set (card) selection</title> |
|
5 |
<link rel="stylesheet" type="text/css" href="${g.resource(dir:'css/', file:'theme.css')}" /> |
|
6 |
<link rel="stylesheet" type="text/css" href="${g.resource(dir:'css/', file:'style.css')}" /> |
|
7 |
<!--[if IE]> |
|
8 |
<link rel="stylesheet" type="text/css" href="${g.resource(dir:'css/', file:'ie-sucks.css')}" /> |
|
9 |
<![endif]--> |
|
10 |
</head> |
|
11 |
|
|
12 |
<body> |
|
13 |
<center> |
|
14 |
<br /> |
|
15 |
<img src="${g.resource(dir:'img', file:'logo.jpg')}" /> |
|
16 |
<div style="width:518px;background:white;padding:10px;margin-top:20px;"> |
|
17 |
<erptr:box title="Hardware set selection"> |
|
18 |
|
|
19 |
<p>Before you continue using Eneraptor, please choose hardware set (card) to control:</p> |
|
20 |
|
|
21 |
<g:form action="mainDo"> |
|
22 |
|
|
23 |
<g:select name="hwSet" from="${hwSets}" optionKey="id" optionValue="name" style="width:350px;" /> |
|
24 |
|
|
25 |
<g:submitButton name="mainSubmit" value="Select" /> |
|
26 |
<br /><br /> |
|
27 |
<g:link action="addNew" style="float:right;"><erptr:icon w="add" /> Add new...</g:link> |
|
28 |
|
|
29 |
<br /> |
|
30 |
|
|
31 |
</g:form> |
|
32 |
|
|
33 |
</erptr:box> |
|
34 |
</div> |
|
35 |
</center> |
|
36 |
</body> |
|
37 |
|
|
38 |
</html> |
hci/trunk/eneraptor-web-app/grails-app/views/layouts/main.gsp | ||
---|---|---|
18 | 18 |
|
19 | 19 |
<!-- Energy saved --> |
20 | 20 |
<div style="position:absolute;top:10px;"> |
21 |
<div style="position:absolute;left:250px;color:white;"> |
|
22 |
<center style="width:150px;"> |
|
23 |
<p style="font-size:75%;">From start</p> |
|
24 |
<p><b>1243432.45</b> kWh</p> |
|
25 |
<p style="font-size:75%;">of energy saved</p> |
|
26 |
</center> |
|
21 |
<div style="position:relative;left:650px;top:15px;"> |
|
22 |
<select style="width:310px;" onchange="location.href=escape(this.options[this.selectedIndex].value)"> |
|
23 |
<g:each in="${com.eneraptor.hci.HardwareSet.list()}" var="hwSet"> |
|
24 |
<g:if test="${hwSet.id == session.hwSet.id}"> |
|
25 |
<option value="${createLink(controller:'chooseHwSet',action:'change',id:hwSet.id)}" selected="selected">${hwSet.name}</option> |
|
26 |
</g:if> |
|
27 |
<g:else> |
|
28 |
<option value="${createLink(controller:'chooseHwSet',action:'change',id:hwSet.id)}">${hwSet.name}</option> |
|
29 |
</g:else> |
|
30 |
</g:each> |
|
31 |
</select> |
|
27 | 32 |
</div> |
28 |
<div style="position:absolute;left:400px;color:white;"> |
|
29 |
<center style="width:150px;"> |
|
30 |
<p style="font-size:75%;">Last year</p> |
|
31 |
<p><b>87329.84</b> kWh</p> |
|
32 |
<p style="font-size:75%;">of energy saved</p> |
|
33 |
</center> |
|
34 |
</div> |
|
35 |
<div style="position:absolute;left:550px;color:white;"> |
|
36 |
<center style="width:150px;"> |
|
37 |
<p style="font-size:75%;">Last month</p> |
|
38 |
<p><b>5644.56</b> kWh</p> |
|
39 |
<p style="font-size:75%;">of energy saved</p> |
|
40 |
</center> |
|
41 |
</div> |
|
42 |
<div style="position:absolute;left:700px;color:white;"> |
|
43 |
<center style="width:150px;"> |
|
44 |
<p style="font-size:75%;">Last week</p> |
|
45 |
<p><b>453.00</b> kWh</p> |
|
46 |
<p style="font-size:75%;">of energy saved</p> |
|
47 |
</center> |
|
48 |
</div> |
|
49 |
<div style="position:absolute;left:850px;color:white;"> |
|
50 |
<center style="width:150px;"> |
|
51 |
<p style="font-size:75%;">Last day</p> |
|
52 |
<p><b>23.28</b> kWh</p> |
|
53 |
<p style="font-size:75%;">of energy saved</p> |
|
54 |
</center> |
|
55 | 33 |
</div> |
56 |
</div> |
|
57 | 34 |
<!-- / Energy saved --> |
58 | 35 |
|
59 | 36 |
<div id="header"> |
hci/trunk/eneraptor-web-app/grails-app/views/config/hci.gsp | ||
---|---|---|
7 | 7 |
|
8 | 8 |
<body> |
9 | 9 |
|
10 |
<erptr:box title="Information"> |
|
11 |
|
|
12 |
<p>HCI Version: <span style="font-family:monospace;">${conf.findByConfigId('hci-version').configVal}</span></p> |
|
13 |
|
|
14 |
<!-- DISK USAGE - ONLY IF ENERAPTOR HCI IS SUPERUSER |
|
15 |
<p style="float: left;">Disk usage: </p> |
|
16 |
<div style="float:left;"> |
|
17 |
<div style="width: 100px;border:1px solid grey;"> |
|
18 |
<div style="width:${percent}px;background:grey;"> |
|
19 |
|
|
20 |
</div> |
|
21 |
</div> |
|
22 |
</div> |
|
23 |
<span> ${percent}% (free space ${(int)freeSpace} MB) </span> |
|
24 |
<g:if test="${percent >= 95}"> |
|
25 |
<i style="color:red;"> Warning: disk is almost full. You should erase some old log entries.</i> |
|
26 |
</g:if> |
|
27 |
--> |
|
28 |
|
|
29 |
</erptr:box> |
|
30 |
|
|
31 | 10 |
<erptr:box title="Known devices"> |
32 | 11 |
|
33 | 12 |
<table width="100%"> |
... | ... | |
79 | 58 |
|
80 | 59 |
</erptr:box> |
81 | 60 |
|
82 |
<erptr:box title="Database information"> |
|
83 |
|
|
84 |
<p>Eneraptor system uses PostgreSQL database management system to store log data and HCI configuration.</p> |
|
85 |
|
|
86 |
<br /> |
|
87 |
|
|
88 |
<div id="dbConfigHolder"> |
|
89 |
<g:remoteLink action="dbInfo" update="dbConfigHolder"><erptr:icon w="eye" />View database configuration</g:remoteLink> |
|
90 |
</div> |
|
91 |
|
|
92 |
<br /> |
|
93 |
|
|
94 |
<g:link action="dbExec"><erptr:icon w="database_edit" />Execute SQL queries manually</g:link> |
|
95 |
|
|
96 |
</erptr:box> |
|
97 |
|
|
98 | 61 |
</body> |
99 | 62 |
|
100 | 63 |
</html> |
hci/trunk/eneraptor-web-app/grails-app/views/config/database.gsp | ||
---|---|---|
1 |
<html> |
|
2 |
|
|
3 |
<head> |
|
4 |
<title>Configuration » Database</title> |
|
5 |
<meta name="layout" content="main" /> |
|
6 |
</head> |
|
7 |
|
|
8 |
<body> |
|
9 |
|
|
10 |
<!-- DISK USAGE - ONLY IF ENERAPTOR HCI IS SUPERUSER |
|
11 |
<p style="float: left;">Disk usage: </p> |
|
12 |
<div style="float:left;"> |
|
13 |
<div style="width: 100px;border:1px solid grey;"> |
|
14 |
<div style="width:${percent}px;background:grey;"> |
|
15 |
|
|
16 |
</div> |
|
17 |
</div> |
|
18 |
</div> |
|
19 |
<span> ${percent}% (free space ${(int)freeSpace} MB) </span> |
|
20 |
<g:if test="${percent >= 95}"> |
|
21 |
<i style="color:red;"> Warning: disk is almost full. You should erase some old log entries.</i> |
|
22 |
</g:if> |
|
23 |
--> |
|
24 |
|
|
25 |
<erptr:box title="Database information"> |
|
26 |
|
|
27 |
<p>Eneraptor system uses PostgreSQL database management system to store log data and HCI configuration.</p> |
|
28 |
|
|
29 |
<br /> |
|
30 |
|
|
31 |
<div id="dbConfigHolder"> |
|
32 |
<g:remoteLink action="dbInfo" update="dbConfigHolder"><erptr:icon w="eye" />View database configuration</g:remoteLink> |
|
33 |
</div> |
|
34 |
|
|
35 |
<br /> |
|
36 |
|
|
37 |
<g:link action="dbExec"><erptr:icon w="database_edit" />Execute SQL queries manually</g:link> |
|
38 |
|
|
39 |
</erptr:box> |
|
40 |
|
|
41 |
</body> |
|
42 |
|
|
43 |
</html> |
hci/trunk/eneraptor-web-app/grails-app/views/config/logic.gsp | ||
---|---|---|
1 | 1 |
<html> |
2 | 2 |
|
3 | 3 |
<head> |
4 |
<title>Configuration » Logic</title>
|
|
4 |
<title>Configuration » Hardware set (card)</title>
|
|
5 | 5 |
<meta name="layout" content="main" /> |
6 | 6 |
</head> |
7 | 7 |
|
8 | 8 |
<body> |
9 | 9 |
|
10 |
<erptr:box title="Logic configuration"> |
|
11 |
<g:form name="logic-config-form" action="saveLogic"> |
|
12 |
|
|
13 |
<p>TODO: Logic configuration</p> |
|
14 |
|
|
15 |
</g:form> |
|
10 |
<erptr:box title="Hardware set (card) information"> |
|
11 |
|
|
12 |
<p>Hardware set's (card's) unique ID: <b>${hwSet.hardId}</b></p> |
|
13 |
<p>Hardware set's (card's) name: <b>${hwSet.name}</b></p> |
|
14 |
|
|
16 | 15 |
</erptr:box> |
17 | 16 |
|
17 |
<erptr:box title="Configuration"> |
|
18 |
|
|
19 |
<p>If you no longer have or need currently selected hardware set (card), you may delete it.</p> |
|
20 |
<p style="color:red;"><i>Warning: deleting current hardware set (card) <b>will also delete</b> all of it's devices, graphs, and other saved data, but <b>will not delete</b> any logged data in the database.</i></p> |
|
21 |
<br /> |
|
22 |
<p><a href="javascript:confirmDelete();"><erptr:icon w="delete" /> Delete current hardware set (card)</a></p> |
|
23 |
|
|
24 |
</erptr:box> |
|
25 |
|
|
26 |
<g:javascript> |
|
27 |
function confirmDelete() { |
|
28 |
|
|
29 |
var answer = confirm("Do you really want to proceed?\nAll of current hardware set's (card's) data will be deleted."); |
|
30 |
if(answer) { |
|
31 |
window.location = "<g:createLink controller="chooseHwSet" action="delete" id="${hwSet.id}" />"; |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
35 |
</g:javascript> |
|
36 |
|
|
18 | 37 |
</body> |
19 | 38 |
|
20 | 39 |
</html> |
hci/trunk/eneraptor-web-app/grails-app/views/config/connection.gsp | ||
---|---|---|
16 | 16 |
<legend>Basic</legend> |
17 | 17 |
|
18 | 18 |
<label for="logic-ip">Logic's IP address</label> |
19 |
<g:textField name="logic-ip" value="${conf.findByConfigId('logic-ip').configVal}" />
|
|
19 |
<g:textField name="logic-ip" value="${hwSet.IPaddress}" />
|
|
20 | 20 |
<erptr:helpLink for="logic-ip" /> |
21 | 21 |
|
22 | 22 |
<br /> |
23 | 23 |
|
24 | 24 |
<label for="logic-port">Logic's port number</label> |
25 |
<g:textField name="logic-port" value="${conf.findByConfigId('logic-port').configVal}" />
|
|
25 |
<g:textField name="logic-port" value="${hwSet.portNumber}" />
|
|
26 | 26 |
|
27 | 27 |
<br /> |
28 | 28 |
|
hci/trunk/eneraptor-web-app/test/unit/com/eneraptor/hci/HardwareSetTests.groovy | ||
---|---|---|
1 |
package com.eneraptor.hci |
|
2 |
|
|
3 |
import grails.test.* |
|
4 |
|
|
5 |
class HardwareSetTests extends GrailsUnitTestCase { |
|
6 |
protected void setUp() { |
|
7 |
super.setUp() |
|
8 |
} |
|
9 |
|
|
10 |
protected void tearDown() { |
|
11 |
super.tearDown() |
|
12 |
} |
|
13 |
|
|
14 |
void testSomething() { |
|
15 |
|
|
16 |
} |
|
17 |
} |
hci/trunk/eneraptor-web-app/test/unit/com/eneraptor/hci/ChooseHwSetControllerTests.groovy | ||
---|---|---|
1 |
package com.eneraptor.hci |
|
2 |
|
|
3 |
import grails.test.* |
|
4 |
|
|
5 |
class ChooseHwSetControllerTests extends ControllerUnitTestCase { |
|
6 |
protected void setUp() { |
|
7 |
super.setUp() |
|
8 |
} |
|
9 |
|
|
10 |
protected void tearDown() { |
|
11 |
super.tearDown() |
|
12 |
} |
|
13 |
|
|
14 |
void testSomething() { |
|
15 |
|
|
16 |
} |
|
17 |
} |
Also available in: Unified diff