Revision 69
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/ChooseHwSetController.groovy | ||
---|---|---|
53 | 53 |
if(chosenHwSet) { |
54 | 54 |
session['hwSet'] = chosenHwSet |
55 | 55 |
flash.confirms = "<p>Changed current hardware set to " + chosenHwSet.name + "</p>" |
56 |
redirect(controller:'sysState',action:'main')
|
|
56 |
redirect(controller:params.ctrl,action:params.act)
|
|
57 | 57 |
return true |
58 | 58 |
} else { |
59 | 59 |
flash.errors = "<p>Could not change current hardware set (card). The ID specified is not valid!</p>" |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/ConfigController.groovy | ||
---|---|---|
109 | 109 |
|
110 | 110 |
session.hwSet.IPaddress = params['logic-ip'] |
111 | 111 |
session.hwSet.portNumber = (params['logic-port'] as int) |
112 |
HardwareSet toChange = HardwareSet.get(session.hwSet.id) |
|
113 |
toChange.IPaddress = params['logic-ip'] |
|
114 |
toChange.portNumber = (params['logic-port'] as int) |
|
115 |
toChange.save() |
|
112 | 116 |
flash['confirms'] = "<p>Changes saved.</p>" |
113 | 117 |
redirect(action: 'connection') |
114 | 118 |
} else { |
hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/StatisticsController.groovy | ||
---|---|---|
101 | 101 |
|
102 | 102 |
def showGraph = { |
103 | 103 |
|
104 |
if(!params.outputDevice) params.outputDevice = 'none' |
|
105 |
|
|
104 | 106 |
def graphToShow = EneGraph.get(params['id']) |
105 | 107 |
String query |
106 | 108 |
|
107 | 109 |
List data = new ArrayList() |
108 | 110 |
data = graphDataService.getGraphData(graphToShow) |
109 | 111 |
|
110 |
[data: "{label: '" + graphToShow.name + "', data: " + data.toString() + " }"]
|
|
112 |
List outputDevices = new ArrayList()
|
|
111 | 113 |
|
114 |
def crit1 = DeviceInfo.createCriteria() |
|
115 |
outputDevices = crit1 { |
|
116 |
and { |
|
117 |
eq("outputDevice",true) |
|
118 |
eq("hwSet",session.hwSet) |
|
119 |
} |
|
120 |
order("friendlyName","asc") |
|
121 |
} |
|
122 |
|
|
123 |
// Fetch action logged data if needed |
|
124 |
List actionLog = new ArrayList() |
|
125 |
if(params.outputDevice != 'none') { |
|
126 |
def crit2 = LoggedData.createCriteria() |
|
127 |
actionLog = crit2 { |
|
128 |
and { |
|
129 |
eq("deviceId",params.outputDevice) |
|
130 |
between("dateRecieved",new java.util.Date(data[0][0]),new java.util.Date(data[-1][0])) |
|
131 |
} |
|
132 |
order("dateRecieved","asc") |
|
133 |
} |
|
134 |
} |
|
135 |
|
|
136 |
[data: "{label: '" + graphToShow.name + "', data: " + data.toString() + " }",outputDevices:outputDevices,actionLog:actionLog] |
|
137 |
|
|
112 | 138 |
} |
113 | 139 |
|
114 | 140 |
def editGraph = { |
hci/trunk/eneraptor-web-app/grails-app/views/statistics/showGraph.gsp | ||
---|---|---|
15 | 15 |
lines: { show: true }, |
16 | 16 |
points: { show: true }, |
17 | 17 |
xaxis: { mode: "time", timeformat: "%y/%m/%d %H:%M" }, |
18 |
legend: { container: '#legendHolder' } |
|
18 |
legend: { container: '#legendHolder' }, |
|
19 |
grid: { |
|
20 |
markings: [ |
|
21 |
<g:each in="${actionLog}" var="al"> |
|
22 |
<g:if test="${al == actionLog[-1]}"> |
|
23 |
{ color: 'red', lineWidth: 1, xaxis: { from: ${al.dateRecieved.time}, to: ${al.dateRecieved.time} } } |
|
24 |
</g:if> |
|
25 |
<g:else> |
|
26 |
{ color: 'red', lineWidth: 1, xaxis: { from: ${al.dateRecieved.time}, to: ${al.dateRecieved.time} } }, |
|
27 |
</g:else> |
|
28 |
</g:each> |
|
29 |
] |
|
30 |
} |
|
19 | 31 |
}; |
20 | 32 |
</g:javascript> |
21 | 33 |
<div class="chart"> |
... | ... | |
24 | 36 |
<br /> |
25 | 37 |
<p>Legend:</p> |
26 | 38 |
<div id="legendHolder" name="legendHolder"></div> |
39 |
<br /> |
|
40 |
<p>Display actions:</p> |
|
41 |
<g:form action="showGraph" method="GET"> |
|
42 |
<g:hiddenField name="id" value="${params.id}" /> |
|
43 |
<g:select name="outputDevice" from="${outputDevices}" optionKey="deviceId" optionValue="friendlyName" noSelection="['none':'- None -']" style="width:350px;" value="${params.outputDevice}" /> |
|
44 |
|
|
45 |
<g:submitButton name="outputDeviceSubmit" value="Update" /> |
|
46 |
</g:form> |
|
47 |
<br /> |
|
27 | 48 |
|
28 | 49 |
</erptr:box> |
29 | 50 |
|
hci/trunk/eneraptor-web-app/grails-app/views/layouts/main.gsp | ||
---|---|---|
19 | 19 |
<!-- Energy saved --> |
20 | 20 |
<div style="position:absolute;top:10px;"> |
21 | 21 |
<div style="position:relative;left:650px;top:15px;"> |
22 |
<select style="width:310px;" onchange="location.href=escape(this.options[this.selectedIndex].value)">
|
|
22 |
<select style="width:310px;" onchange="location.href=(this.options[this.selectedIndex].value)"> |
|
23 | 23 |
<g:each in="${com.eneraptor.hci.HardwareSet.list()}" var="hwSet"> |
24 | 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> |
|
25 |
<option value="${createLink(controller:'chooseHwSet',action:'change',id:hwSet.id,params:[act:params.action,ctrl:params.controller])}" selected="selected">${hwSet.name}</option>
|
|
26 | 26 |
</g:if> |
27 | 27 |
<g:else> |
28 |
<option value="${createLink(controller:'chooseHwSet',action:'change',id:hwSet.id)}">${hwSet.name}</option> |
|
28 |
<option value="${createLink(controller:'chooseHwSet',action:'change',id:hwSet.id,params:[act:params.action,ctrl:params.controller])}">${hwSet.name}</option>
|
|
29 | 29 |
</g:else> |
30 | 30 |
</g:each> |
31 | 31 |
</select> |
Also available in: Unified diff