Skip to content

Commit

Permalink
added link to default db in explore when no data for session
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltester committed Feb 25, 2024
1 parent 0a8c306 commit 8744c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public DefaultGUI(final Thingifier thingifier, DefaultGUIHTML defaultGui) {

public DefaultGUI configureRoutes(){

String tryDefault = " [<a href='/gui/instances?entity=todo&database=__default'>explore default data</a>]";

get("/gui", (request, response) -> {
response.type("text/html");
response.status(200);
Expand Down Expand Up @@ -114,7 +116,7 @@ public DefaultGUI configureRoutes(){
}

if (!thingifier.getERmodel().getDatabaseNames().contains(database)) {
htmlErrorMessage = htmlErrorMessage + "<p>Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?</p>";
htmlErrorMessage = htmlErrorMessage + "<p>Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?" + tryDefault + "</p>";
}

EntityInstanceCollection thing = null;
Expand All @@ -127,7 +129,7 @@ public DefaultGUI configureRoutes(){
}

if (thing == null) {
htmlErrorMessage = htmlErrorMessage + "<p>Entity instances not found in database, have you made any API calls?</p>";
htmlErrorMessage = htmlErrorMessage + "<p>Entity instances not found in database, have you made any API calls?" + tryDefault + "</p>";
}
}

Expand Down Expand Up @@ -186,7 +188,7 @@ public DefaultGUI configureRoutes(){
}

if(!thingifier.getERmodel().getDatabaseNames().contains(database)){
htmlErrorMessage = htmlErrorMessage + "<p>Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?</p>";
htmlErrorMessage = htmlErrorMessage + "<p>Database Named " + htmlsanitise(database) + " not found. Have you made any API Calls?" + tryDefault + "</p>";
}

html.append(templates.getPageStart(entityName + " Instance"));
Expand All @@ -202,7 +204,7 @@ public DefaultGUI configureRoutes(){
}

if(thing == null){
htmlErrorMessage = htmlErrorMessage + "<p>Entity instances not found in database, have you made any API calls?</p>";
htmlErrorMessage = htmlErrorMessage + "<p>Entity instances not found in database, have you made any API calls?" + tryDefault + "</p>";
}
}

Expand All @@ -226,7 +228,7 @@ public DefaultGUI configureRoutes(){
try {
instance = thing.findInstanceByFieldNameAndValue(keyName, keyValue);
}catch(Exception e){
htmlErrorMessage = htmlErrorMessage + "<p>Instances not found in database, have you made any API calls?</p>";
htmlErrorMessage = htmlErrorMessage + "<p>Instances not found in database, have you made any API calls?" + tryDefault + "</p>";
}

if (instance == null) {
Expand Down

0 comments on commit 8744c4a

Please sign in to comment.