Skip to content

Commit 0a73f35

Browse files
author
jenkins@seu
committed
Merge github-master
2 parents 667ff31 + 61750d1 commit 0a73f35

File tree

13 files changed

+1786
-1176
lines changed

13 files changed

+1786
-1176
lines changed

application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Sun Nov 08 15:05:51 CET 2015
1+
#Thu Nov 12 11:08:30 CET 2015
22
plugins.spring-security-core=1.2.7.3
3-
app.version=3.2.0
3+
app.version=3.2.2
44
app.stats.Domain_Classes.files=2
55
app.version.build.date=Dezember 18, 2013
66
app.version.build.env=development

grails-app/controllers/de/iteratec/osm/csi/CsiDashboardController.groovy

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package de.iteratec.osm.csi
1919

2020
import de.iteratec.osm.csi.weighting.WeightFactor
2121
import de.iteratec.osm.d3Data.BarChartData
22-
import de.iteratec.osm.d3Data.TreemapData
2322
import de.iteratec.osm.d3Data.ChartEntry
23+
import de.iteratec.osm.d3Data.TreemapData
2424
import de.iteratec.osm.measurement.environment.Browser
2525
import de.iteratec.osm.measurement.environment.Location
2626
import de.iteratec.osm.measurement.environment.dao.BrowserDaoService
@@ -30,8 +30,7 @@ import de.iteratec.osm.measurement.schedule.JobGroup
3030
import de.iteratec.osm.measurement.schedule.dao.JobGroupDaoService
3131
import de.iteratec.osm.measurement.schedule.dao.PageDaoService
3232
import de.iteratec.osm.p13n.CookieBasedSettingsService
33-
import de.iteratec.osm.report.UserspecificDashboard
34-
import de.iteratec.osm.report.UserspecificDashboardDiagramType
33+
import de.iteratec.osm.report.UserspecificCsiDashboard
3534
import de.iteratec.osm.report.chart.*
3635
import de.iteratec.osm.report.chart.dao.AggregatorTypeDaoService
3736
import de.iteratec.osm.result.EventResultService
@@ -201,15 +200,15 @@ class CsiDashboardController {
201200
*/
202201
Map<String, Object> delete() {
203202

204-
def userspecificDashboardInstance = UserspecificDashboard.get(params.id)
205-
if (!userspecificDashboardInstance) {
203+
def userspecificCSIDashboardInstance = UserspecificCsiDashboard.get(params.id)
204+
if (!userspecificCSIDashboardInstance) {
206205
flash.message = message(code: 'default.not.found.message', args: [message(code: 'custom.dashboard.label', default: 'Custom dashboard'), params.id])
207206
redirect(action: "list")
208207
return
209208
}
210209

211210
try {
212-
userspecificDashboardInstance.delete(flush: true)
211+
userspecificCSIDashboardInstance.delete(flush: true)
213212
flash.message = message(code: 'default.deleted.message', args: [message(code: 'custom.dashboard.label', default: 'Custom dashboard'), params.id])
214213
redirect(action: "list")
215214
} catch (DataIntegrityViolationException e) {
@@ -718,27 +717,6 @@ class CsiDashboardController {
718717
return null
719718
}
720719

721-
/**
722-
* <p>
723-
* Ajax service to confirm that dashboard name entered for saving custom dashboard was unique.
724-
* </p>
725-
*
726-
* @param proposedDashboardName
727-
* The proposed Dashboard Name;
728-
* not <code>null</code>.
729-
* @return nothing, immediately sends HTTP response codes to client.
730-
*/
731-
def validateDashboardName(String proposedDashboardName) {
732-
UserspecificDashboard newCustomDashboard = new UserspecificDashboard(dashboardName: proposedDashboardName)
733-
if (!newCustomDashboard.validate()) {
734-
response.sendError(302, 'dashboard by that name exists already')
735-
return null
736-
} else {
737-
response.sendError(200, 'OK')
738-
return null
739-
}
740-
}
741-
742720
/**
743721
* <p>
744722
* Ajax service to validate and store custom dashboard settings.
@@ -756,6 +734,14 @@ class CsiDashboardController {
756734
* @return nothing, immediately sends HTTP response codes to client.
757735
*/
758736
def validateAndSaveDashboardValues(String values, String dashboardName, String publiclyVisible, String wideScreenDiagramMontage) {
737+
738+
// Check if dashboardName is unique
739+
def dashboards = UserspecificCsiDashboard.findAllByDashboardName(dashboardName)
740+
if (dashboards) {
741+
response.sendError(302, 'dashboard by that name exists already')
742+
return null
743+
}
744+
759745
JSONObject dashboardValues = JSON.parse(values)
760746
Date fromDate = SIMPLE_DATE_FORMAT.parse(dashboardValues.from)
761747
Date toDate = SIMPLE_DATE_FORMAT.parse(dashboardValues.to)
@@ -769,6 +755,7 @@ class CsiDashboardController {
769755
String selectedMeasuredEventIdsString = ""
770756
String selectedBrowsersString = ""
771757
String selectedLocationsString = ""
758+
772759
dashboardValues.each { id, data ->
773760
def dataToAssign
774761
if (data instanceof org.codehaus.groovy.grails.web.json.JSONArray) {
@@ -810,11 +797,14 @@ class CsiDashboardController {
810797
break
811798
}
812799
}
800+
801+
int timeFrameInterval = Integer.parseInt(dashboardValues.selectedTimeFrameInterval)
802+
813803
def cmd = new CsiDashboardShowAllCommand(from: fromDate, to: toDate, fromHour: dashboardValues.fromHour, fromMinute: dashboardValues.fromMinute,
814804
toHour: dashboardValues.toHour, toMinute: dashboardValues.toMinute, aggrGroup: dashboardValues.aggrGroup, selectedFolder: selectedFolder,
815805
selectedPages: selectedPages, selectedMeasuredEventIds: selectedMeasuredEventIds, selectedAllMeasuredEvents: dashboardValues.selectedAllMeasuredEvents,
816806
selectedBrowsers: selectedBrowsers, selectedAllBrowsers: dashboardValues.selectedAllBrowsers, selectedLocations: selectedLocations,
817-
selectedAllLocations: dashboardValues.selectedAllLocations, debug: dashboardValues.debug, selectedTimeFrameInterval: dashboardValues.selectedTimeFrameInterval,
807+
selectedAllLocations: dashboardValues.selectedAllLocations, debug: dashboardValues.debug, selectedTimeFrameInterval: timeFrameInterval,
818808
includeInterval: dashboardValues.includeInterval, setFromHour: dashboardValues.setFromHour, setToHour: dashboardValues.setToHour)
819809

820810
if (!cmd.validate()) {
@@ -824,12 +814,7 @@ class CsiDashboardController {
824814
return null
825815
} else {
826816
def username = springSecurityService.authentication.principal.getUsername()
827-
UserspecificDashboard newCustomDashboard = new UserspecificDashboard(diagramType: UserspecificDashboardDiagramType.CSI, fromDate: fromDate, toDate: toDate, fromHour: cmd.fromHour,
828-
fromMinute: cmd.fromMinute, toHour: cmd.toHour, toMinute: cmd.toMinute, aggrGroup: cmd.aggrGroup, selectedFolder: selectedFolderString, selectedPages: selectedPagesString,
829-
selectedMeasuredEventIds: selectedMeasuredEventIdsString, selectedAllMeasuredEvents: cmd.selectedAllMeasuredEvents, selectedBrowsers: selectedBrowsersString,
830-
selectedAllBrowsers: cmd.selectedAllBrowsers, selectedLocations: selectedLocationsString, selectedAllLocations: cmd.selectedAllLocations, debug: cmd.debug,
831-
selectedTimeFrameInterval: cmd.selectedTimeFrameInterval, includeInterval: cmd.includeInterval, publiclyVisible: publiclyVisible, wideScreenDiagramMontage: wideScreenDiagramMontage, dashboardName: dashboardName, username: username,
832-
setFromHour: cmd.setFromHour, setToHour: cmd.setToHour)
817+
UserspecificCsiDashboard newCustomDashboard = new UserspecificCsiDashboard(cmd, selectedFolderString, selectedPagesString, selectedMeasuredEventIdsString, selectedBrowsersString, selectedLocationsString, publiclyVisible, wideScreenDiagramMontage, dashboardName, username)
833818
if (!newCustomDashboard.save(failOnError: true, flush: true)) {
834819
response.sendError(500, 'save error')
835820
return null

0 commit comments

Comments
 (0)