Revision 6 hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/SysLogController.groovy

View differences:

SysLogController.groovy
10 10
	
11 11
	def browse = {
12 12
		
13
		flash['warnings'] = null
14
		
13 15
		def entries = LoggedData.list()
16
		Map devices = new HashMap()
17
		Map icons   = new HashMap()
18
		List unknownDevices = new ArrayList()
19
		DeviceInfo.list().each {
20
			devices[it.deviceId] = it.friendlyName
21
			if(it.iconPath) {
22
				icons[it.deviceId] = it.iconPath
23
			}
24
		}
25
		entries.each {
26
			if(!devices[it.deviceId]) {
27
				if(!unknownDevices.contains(it.deviceId)) {
28
					unknownDevices << it.deviceId
29
				}
30
			}
31
		}
32
		unknownDevices.each {
33
			if(!flash['warnings']) flash['warnings'] = ""
34
			flash['warnings'] += "<p>There was found at least one log entry for a device with id <b>${it}</b>, which is <b>unknown</b> to HCI. You should <b>add this device</b> by <b>" + g.link(controller: 'config', action: 'addDevice', params: ['deviceId' : it], "clicking here") + "</b>.</p>"
35
		}
14 36
		
15
		[data: entries]
37
		[data: entries, devices: devices, icons: icons]
16 38
		
17 39
	}
18 40
	
19 41
	def detail = {
20 42
		
43
		def detailsOf = LoggedData.findById(params.id)
44
		if(!detailsOf) {
45
			flash['errors'] = "<p>There is no logged data with id ${params.id}</p>"
46
			redirect(action: 'browse')
47
			return false
48
		}
49
		return detailsOf.getProperties()
21 50
	}
22 51
	
23 52
	def deleteEntry = {

Also available in: Unified diff