Revision 66 hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/StatisticsController.groovy
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 |
|
Also available in: Unified diff