diff --git a/NEWS.md b/NEWS.md index 56a7ff4..9a6cca9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +## 3.0.3 2024-02-07 + * SI-45 Dashboards not displaying after upgrade to Poppy + * New endpoint: `/servint/admin/ensureDisplayData` to add (empty) display data for all dashboards which are missing it. + ## 3.0.2 2023-11-23 * ERM-3112 org.json:json:20201115 DoS/OOM diff --git a/service/gradle.properties b/service/gradle.properties index 6c0b56f..6d7a125 100644 --- a/service/gradle.properties +++ b/service/gradle.properties @@ -5,7 +5,7 @@ gorm.version=7.3.3 # Application appName=mod-service-interaction -appVersion=3.0.2 +appVersion=3.0.3 dockerTagSuffix= dockerRepo=folioci diff --git a/service/grails-app/controllers/org/olf/ActionController.groovy b/service/grails-app/controllers/org/olf/ActionController.groovy index 162333f..ff26a9f 100644 --- a/service/grails-app/controllers/org/olf/ActionController.groovy +++ b/service/grails-app/controllers/org/olf/ActionController.groovy @@ -29,5 +29,14 @@ class AdminController { result.status = 'OK' render result as JSON } + + public ensureDisplayData() { + def result = [:] + log.debug("AdminController::ensureDisplayData"); + utilityService.ensureDisplayData() + + result.status = 'OK' + render result as JSON + } } diff --git a/service/grails-app/services/org/olf/UtilityService.groovy b/service/grails-app/services/org/olf/UtilityService.groovy index 04a8f6e..dd5d3f8 100644 --- a/service/grails-app/services/org/olf/UtilityService.groovy +++ b/service/grails-app/services/org/olf/UtilityService.groovy @@ -128,4 +128,18 @@ class UtilityService { } } + public void ensureDisplayData() { + log.info("UtilityService::EnsureDisplayData") + Dashboard.executeQuery(""" + SELECT d.id FROM Dashboard AS d + LEFT JOIN DashboardDisplayData AS ddd + ON d.id = ddd.dashId + WHERE ddd.id IS NULL + """.toString()).each{ dashId -> + log.debug("Found dashboard without display data (${dashId}), creating.") + DashboardDisplayData ddd = new DashboardDisplayData([ + dashId: dashId + ]).save(flush: true, failOnError: true); + } + } }