diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/HomeController.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/HomeController.java index 7d76fb8d..d16f0c0d 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/HomeController.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/controller/HomeController.java @@ -19,6 +19,8 @@ import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import eu.dnetlib.common.controller.AbstractDnetController; +import eu.dnetlib.organizations.importer.ImportExecutor; +import eu.dnetlib.organizations.importer.ImportStatus; import eu.dnetlib.organizations.model.SystemConfiguration; import eu.dnetlib.organizations.repository.SystemConfigurationRepository; @@ -28,6 +30,9 @@ public class HomeController extends AbstractDnetController { @Autowired private Environment env; + @Autowired + private ImportExecutor importExecutor; + @Autowired private SystemConfigurationRepository systemConfigurationRepository; @@ -94,18 +99,23 @@ public class HomeController extends AbstractDnetController { return systemConfigurationRepository.findById(SystemConfiguration.DEFAULT_ID).get(); } + @ModelAttribute("isImportRunning") + public boolean isImportRunning(final Authentication authentication) { + return importExecutor.getLastImportExecution().getStatus() == ImportStatus.RUNNING; + } + @ModelAttribute("supportPages") public Map supportPages(final Authentication authentication) throws JsonMappingException, JsonProcessingException { if (supportPages == null) { final ObjectMapper mapper = new ObjectMapper(); final TypeReference> typeRef = new TypeReference>() {}; - this.supportPages = mapper.readValue(supportPagesJson, typeRef); + supportPages = mapper.readValue(supportPagesJson, typeRef); } return supportPages; } @GetMapping({ - "apidoc", "api-doc", "/doc", "/swagger" + "apidoc", "api-doc", "/doc", "/swagger" }) public String apiDoc() { return "redirect:swagger-ui/index.html"; diff --git a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/SystemConfiguration.java b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/SystemConfiguration.java index e778bc27..fad60df1 100644 --- a/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/SystemConfiguration.java +++ b/apps/dnet-orgs-database-application/src/main/java/eu/dnetlib/organizations/model/SystemConfiguration.java @@ -28,6 +28,9 @@ public class SystemConfiguration implements Serializable { @Column(name = "homepage_msg") private String homepageMessage; + @Column(name = "homepage_msg_import") + private String homepageMessageImport; + @Column(name = "readonly") private Boolean readonly; @@ -85,6 +88,14 @@ public class SystemConfiguration implements Serializable { this.homepageMessage = homepageMessage; } + public String getHomepageMessageImport() { + return homepageMessageImport; + } + + public void setHomepageMessageImport(final String homepageMessageImport) { + this.homepageMessageImport = homepageMessageImport; + } + public Boolean getReadonly() { return readonly; } diff --git a/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql b/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql index 7da2de1a..ec24091b 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql +++ b/apps/dnet-orgs-database-application/src/main/resources/sql/schema.sql @@ -32,13 +32,14 @@ DROP TABLE IF EXISTS languages; DROP SEQUENCE IF EXISTS organizations_id_seq; CREATE TABLE sysconf ( - id text PRIMARY KEY DEFAULT 'default', - title text NOT NULL, - homepage_msg text NOT NULL DEFAULT '', - readonly boolean NOT NULL DEFAULT false, - smtp_enabled boolean NOT NULL DEFAULT false, - smtp_host text NOT NULL DEFAULT 'localhost', - smtp_port int NOT NULL DEFAULT 587, + id text PRIMARY KEY DEFAULT 'default', + title text NOT NULL, + homepage_msg text NOT NULL DEFAULT '', + homepage_msg_import text NOT NULL DEFAULT '

The portal is temporarily in read-only mode because we are updating the suggestions.

We apologize for the inconvenience.

', + readonly boolean NOT NULL DEFAULT false, + smtp_enabled boolean NOT NULL DEFAULT false, + smtp_host text NOT NULL DEFAULT 'localhost', + smtp_port int NOT NULL DEFAULT 587, smtp_user text NOT NULL DEFAULT '', smtp_password text NOT NULL DEFAULT '', smtp_from_mail text NOT NULL DEFAULT 'no-reply@openaire.eu', diff --git a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/sysConf.html b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/sysConf.html index dee414ba..42dbe9cf 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/sysConf.html +++ b/apps/dnet-orgs-database-application/src/main/resources/static/resources/html/pages/admin/sysConf.html @@ -20,6 +20,12 @@ +
+ +
+ +
+
diff --git a/apps/dnet-orgs-database-application/src/main/resources/templates/home.html b/apps/dnet-orgs-database-application/src/main/resources/templates/home.html index 86dabe8f..ecd6777a 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/templates/home.html +++ b/apps/dnet-orgs-database-application/src/main/resources/templates/home.html @@ -52,10 +52,9 @@
diff --git a/apps/dnet-orgs-database-application/src/main/resources/templates/login.html b/apps/dnet-orgs-database-application/src/main/resources/templates/login.html index d2543a11..8d4308d7 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/templates/login.html +++ b/apps/dnet-orgs-database-application/src/main/resources/templates/login.html @@ -51,9 +51,8 @@
-
- -
+
+
diff --git a/apps/dnet-orgs-database-application/src/main/resources/templates/main.html b/apps/dnet-orgs-database-application/src/main/resources/templates/main.html index 5c3e863a..c97eadf6 100644 --- a/apps/dnet-orgs-database-application/src/main/resources/templates/main.html +++ b/apps/dnet-orgs-database-application/src/main/resources/templates/main.html @@ -150,9 +150,8 @@ fieldset > legend { font-size : 1.2rem !important; } -
The portal is running in READ-ONLY mode.
- - +
The portal is running in READ-ONLY mode.
+
- -