From 8744c4a53d25de4db421f685eef419564238ee55 Mon Sep 17 00:00:00 2001 From: Alan Richardson Date: Sun, 25 Feb 2024 14:40:25 +0000 Subject: [PATCH] added link to default db in explore when no data for session --- .../uk/co/compendiumdev/sparkstart/Environment.java | 2 +- .../compendiumdev/thingifier/htmlgui/DefaultGUI.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/challengerAuto/src/test/java/uk/co/compendiumdev/sparkstart/Environment.java b/challengerAuto/src/test/java/uk/co/compendiumdev/sparkstart/Environment.java index 59f70237..f94a2f90 100644 --- a/challengerAuto/src/test/java/uk/co/compendiumdev/sparkstart/Environment.java +++ b/challengerAuto/src/test/java/uk/co/compendiumdev/sparkstart/Environment.java @@ -20,7 +20,7 @@ public static String getBaseUri() { // return environment if want to run externally // if(true) -// return "https://apichallenges.herokuapp.com"; +// return "https://apichallenges.eviltester.com"; // if(true) // return "http://localhost:4567"; diff --git a/thingifier/src/main/java/uk/co/compendiumdev/thingifier/htmlgui/DefaultGUI.java b/thingifier/src/main/java/uk/co/compendiumdev/thingifier/htmlgui/DefaultGUI.java index 91370cd9..bc2c3c1a 100644 --- a/thingifier/src/main/java/uk/co/compendiumdev/thingifier/htmlgui/DefaultGUI.java +++ b/thingifier/src/main/java/uk/co/compendiumdev/thingifier/htmlgui/DefaultGUI.java @@ -42,6 +42,8 @@ public DefaultGUI(final Thingifier thingifier, DefaultGUIHTML defaultGui) { public DefaultGUI configureRoutes(){ + String tryDefault = " [explore default data]"; + get("/gui", (request, response) -> { response.type("text/html"); response.status(200); @@ -114,7 +116,7 @@ public DefaultGUI configureRoutes(){ } if (!thingifier.getERmodel().getDatabaseNames().contains(database)) { - htmlErrorMessage = htmlErrorMessage + "

Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?

"; + htmlErrorMessage = htmlErrorMessage + "

Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?" + tryDefault + "

"; } EntityInstanceCollection thing = null; @@ -127,7 +129,7 @@ public DefaultGUI configureRoutes(){ } if (thing == null) { - htmlErrorMessage = htmlErrorMessage + "

Entity instances not found in database, have you made any API calls?

"; + htmlErrorMessage = htmlErrorMessage + "

Entity instances not found in database, have you made any API calls?" + tryDefault + "

"; } } @@ -186,7 +188,7 @@ public DefaultGUI configureRoutes(){ } if(!thingifier.getERmodel().getDatabaseNames().contains(database)){ - htmlErrorMessage = htmlErrorMessage + "

Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?

"; + htmlErrorMessage = htmlErrorMessage + "

Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?" + tryDefault + "

"; } html.append(templates.getPageStart(entityName + " Instance")); @@ -202,7 +204,7 @@ public DefaultGUI configureRoutes(){ } if(thing == null){ - htmlErrorMessage = htmlErrorMessage + "

Entity instances not found in database, have you made any API calls?

"; + htmlErrorMessage = htmlErrorMessage + "

Entity instances not found in database, have you made any API calls?" + tryDefault + "

"; } } @@ -226,7 +228,7 @@ public DefaultGUI configureRoutes(){ try { instance = thing.findInstanceByFieldNameAndValue(keyName, keyValue); }catch(Exception e){ - htmlErrorMessage = htmlErrorMessage + "

Instances not found in database, have you made any API calls?

"; + htmlErrorMessage = htmlErrorMessage + "

Instances not found in database, have you made any API calls?" + tryDefault + "

"; } if (instance == null) {