Skip to content

Commit

Permalink
Merge pull request gocd#12618 from chadlwilson/clean-up-loading-page
Browse files Browse the repository at this point in the history
Clean up server loading page logic
  • Loading branch information
chadlwilson authored Mar 17, 2024
2 parents 0199f22 + 388d889 commit 02fd3a2
Show file tree
Hide file tree
Showing 8 changed files with 417 additions and 730 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ public class SystemEnvironment implements Serializable, ConfigDirProvider {

private static final GoSystemProperty<Boolean> ENABLE_ANALYTICS_ONLY_FOR_ADMINS = new GoBooleanSystemProperty("go.enable.analytics.only.for.admins", false);
public static final GoSystemProperty<Boolean> FAIL_STARTUP_ON_DATA_ERROR = new GoBooleanSystemProperty("gocd.fail.startup.on.data.error", false);
public static final GoSystemProperty<String> LOADING_PAGE = new GoStringSystemProperty("loading.page.resource.path", "/loading_pages/new.loading.page.html");
public static final GoSystemProperty<Long> NOTIFICATION_PLUGIN_MESSAGES_TTL_IN_MILLIS = new GoLongSystemProperty("plugins.notification.message.ttl.millis", MINUTES.toMillis(2));
public static final GoSystemProperty<Boolean> ALLOW_EVERYONE_TO_VIEW_OPERATE_GROUPS_WITH_NO_GROUP_AUTHORIZATION_SETUP = new GoBooleanSystemProperty("allow.everyone.to.view.operate.groups.with.no.authorization.setup", false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,5 +188,19 @@
"moduleLicenseUrl": "https://spdx.org/licenses/MIT.html"
}
]
},
"glide.js": {
"moduleName": "glide.js",
"moduleVersion": "3.6.1",
"moduleUrls": [
"https://github.com/glidejs/glide",
"https://glidejs.com/"
],
"moduleLicenses": [
{
"moduleLicense": "MIT",
"moduleLicenseUrl": "https://spdx.org/licenses/MIT.html"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import com.thoughtworks.go.util.GoConstants;
import com.thoughtworks.go.util.SystemEnvironment;
import org.apache.commons.io.IOUtils;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.HttpStatus;
import org.eclipse.jetty.http.MimeTypes;
Expand All @@ -29,11 +28,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Objects;

import static com.thoughtworks.go.util.SystemEnvironment.LOADING_PAGE;
import static org.eclipse.jetty.http.MimeTypes.Type.*;

/** When GoCD is starting. This is the only handler that will be active (till the web application context handler is up).
Expand Down Expand Up @@ -106,11 +105,9 @@ private void addHeaders(HttpServletResponse response) {

}

private String loadingPage() {
try {
return IOUtils.toString(Objects.requireNonNull(getClass().getResource(systemEnvironment.get(LOADING_PAGE))), StandardCharsets.UTF_8);
} catch (Exception e) {
return "<h2>GoCD is starting up. Please wait ....</h2>";
static String loadingPage() throws IOException {
try (InputStream in = Objects.requireNonNull(GoServerLoadingIndicationHandler.class.getResourceAsStream("/loading.page.html"))) {
return new String(in.readAllBytes(), StandardCharsets.UTF_8);
}
}
}
392 changes: 392 additions & 0 deletions jetty/src/main/resources/loading.page.html

Large diffs are not rendered by default.

213 changes: 0 additions & 213 deletions jetty/src/main/resources/loading_pages/default.loading.page.html

This file was deleted.

Loading

0 comments on commit 02fd3a2

Please sign in to comment.