diff --git a/base/src/main/java/com/thoughtworks/go/util/SystemEnvironment.java b/base/src/main/java/com/thoughtworks/go/util/SystemEnvironment.java index a599832d692..e7c59822ffe 100644 --- a/base/src/main/java/com/thoughtworks/go/util/SystemEnvironment.java +++ b/base/src/main/java/com/thoughtworks/go/util/SystemEnvironment.java @@ -186,7 +186,6 @@ public class SystemEnvironment implements Serializable, ConfigDirProvider { private static final GoSystemProperty ENABLE_ANALYTICS_ONLY_FOR_ADMINS = new GoBooleanSystemProperty("go.enable.analytics.only.for.admins", false); public static final GoSystemProperty FAIL_STARTUP_ON_DATA_ERROR = new GoBooleanSystemProperty("gocd.fail.startup.on.data.error", false); - public static final GoSystemProperty LOADING_PAGE = new GoStringSystemProperty("loading.page.resource.path", "/loading_pages/new.loading.page.html"); public static final GoSystemProperty NOTIFICATION_PLUGIN_MESSAGES_TTL_IN_MILLIS = new GoLongSystemProperty("plugins.notification.message.ttl.millis", MINUTES.toMillis(2)); public static final GoSystemProperty ALLOW_EVERYONE_TO_VIEW_OPERATE_GROUPS_WITH_NO_GROUP_AUTHORIZATION_SETUP = new GoBooleanSystemProperty("allow.everyone.to.view.operate.groups.with.no.authorization.setup", false); diff --git a/buildSrc/src/main/resources/license-for-javascript-not-in-yarn.json b/buildSrc/src/main/resources/license-for-javascript-not-in-yarn.json index c2156edb717..a931071e7a0 100644 --- a/buildSrc/src/main/resources/license-for-javascript-not-in-yarn.json +++ b/buildSrc/src/main/resources/license-for-javascript-not-in-yarn.json @@ -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" + } + ] } } diff --git a/jetty/src/main/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandler.java b/jetty/src/main/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandler.java index 857e7c2642b..54ccf4bac09 100644 --- a/jetty/src/main/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandler.java +++ b/jetty/src/main/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandler.java @@ -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; @@ -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). @@ -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 "

GoCD is starting up. Please wait ....

"; + static String loadingPage() throws IOException { + try (InputStream in = Objects.requireNonNull(GoServerLoadingIndicationHandler.class.getResourceAsStream("/loading.page.html"))) { + return new String(in.readAllBytes(), StandardCharsets.UTF_8); } } } diff --git a/jetty/src/main/resources/loading.page.html b/jetty/src/main/resources/loading.page.html new file mode 100644 index 00000000000..47980d1c283 --- /dev/null +++ b/jetty/src/main/resources/loading.page.html @@ -0,0 +1,392 @@ + + + + + + GoCD server - Loading ... + + + + + + + + + + +
+ GoCD server is starting. Please wait +
+ + + + +
Check out these GoCD concepts in the meantime:
+ +
+
+ + +
+ +
+ + + + + + + + +
+ +
+
    +
  • +
    + +
    +
    +

    The source of your pipeline is called a Material

    +
    +
  • +
  • +
    + +
    +
    +

    A material is a trigger for your Pipeline to start

    +
    +
  • +
  • +
    + +
    +
    +

    In GoCD, a pipeline is a representation of a workflow and consists of Stages

    +
    +
  • +
  • +
    + +
    +
    +

    Stages are made up of Jobs, which can run in parallel.

    +
    +
  • +
  • +
    + +
    +
    +

    A Job is a sequential collection of Tasks

    +
    +
  • +
  • +
    + 6_pac_user +
    +
    +

    User commits configurations to SCM Repository

    +
    +
  • +
  • +
    + 7_pac_SCM +
    +
    +

    Once connected to the SCM Repository, the GoCD server watches for changes

    +
    +
  • +
  • +
    + 8_pac_pipeline +
    +
    +

    GoCD creates/updates pipelines from changes in configuration files

    +
    +
  • +
+
+
+ + + + + + + diff --git a/jetty/src/main/resources/loading_pages/default.loading.page.html b/jetty/src/main/resources/loading_pages/default.loading.page.html deleted file mode 100644 index 358d4d58120..00000000000 --- a/jetty/src/main/resources/loading_pages/default.loading.page.html +++ /dev/null @@ -1,213 +0,0 @@ - - - - - - GoCD server - Loading ... - - - - - - - - -
- GoCD server is starting. Please wait ... -
- - - - - -
- - - - - - diff --git a/jetty/src/main/resources/loading_pages/new.loading.page.html b/jetty/src/main/resources/loading_pages/new.loading.page.html deleted file mode 100644 index ac9ae377404..00000000000 --- a/jetty/src/main/resources/loading_pages/new.loading.page.html +++ /dev/null @@ -1,484 +0,0 @@ - - - - - - GoCD server - Loading ... - - - - - - - - - - -
- GoCD server is starting. Please wait -
- - - - -
Check out these GoCD concepts in the meantime:
- -
-
- - -
- -
- - - - - - - - -
- -
-
    -
  • -
    - -
    -
    -

    The source of your pipeline is called a Material

    -
    -
  • -
  • -
    - -
    -
    -

    A material is a trigger for your Pipeline to start

    -
    -
  • -
  • -
    - -
    -
    -

    In GoCD, a pipeline is a representation of a workflow and consists of Stages

    -
    -
  • -
  • -
    - -
    -
    -

    Stages are made up of Jobs, which can run in parallel.

    -
    -
  • -
  • -
    - -
    -
    -

    A Job is a sequential collection of Tasks

    -
    -
  • -
  • -
    - 6_pac_user -
    -
    -

    User commits configurations to SCM Repository

    -
    -
  • -
  • -
    - 7_pac_SCM -
    -
    -

    Once connected to the SCM Repository, the GoCD server watches for changes

    -
    -
  • -
  • -
    - 8_pac_pipeline -
    -
    -

    GoCD creates/updates pipelines from changes in configuration files

    -
    -
  • -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jetty/src/test/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandlerTest.java b/jetty/src/test/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandlerTest.java index af0fac0de3f..efde8f46839 100644 --- a/jetty/src/test/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandlerTest.java +++ b/jetty/src/test/java/com/thoughtworks/go/server/GoServerLoadingIndicationHandlerTest.java @@ -105,11 +105,10 @@ void shouldRespondWithMessageInJSONWhenRequestAcceptHeaderIsJSON(String target) @ValueSource(strings = {"/", "/go/pipelines", "/this/doesnt/exist"}) void shouldRespondWithMessageInHTMLWhenRequestAcceptHeaderIsHTML(String target) throws Exception { webAppIsStarting(); - loadingPageIsSetTo("/test.loading.page.html"); MockResponse response = request(target, "text/html"); - assertLoadingResponseInHTML(response, "
GoCD server is starting. This comes from test.loading.page.html
"); + assertLoadingResponseInHTML(response); } @ParameterizedTest @@ -129,11 +128,10 @@ void shouldRespondWithMessageInJSONWhenAcceptHeaderContainsJSON(String acceptHea @ValueSource(strings = {"text/html", "something/html", "application/json;q=0.5,text/html;q=0.8", "something-with-html-in-it", ""}) void shouldRespondWithMessageInHTMLWhenAcceptHeaderContainsHTML(String acceptHeaderValue) throws Exception { webAppIsStarting(); - loadingPageIsSetTo("/test.loading.page.html"); MockResponse response = request("/go/pipelines", acceptHeaderValue); - assertLoadingResponseInHTML(response, "
GoCD server is starting. This comes from test.loading.page.html
"); + assertLoadingResponseInHTML(response); } @ParameterizedTest @@ -150,21 +148,10 @@ void shouldRespondWithMessageInPlainTextWhenAcceptHeaderIsNotHTMLOrJSON(String a @Test void shouldRespondWithMessageInHTMLWhenAcceptHeaderIsMissing() throws Exception { webAppIsStarting(); - loadingPageIsSetTo("/test.loading.page.html"); MockResponse response = request("/go/pipelines", null); - assertLoadingResponseInHTML(response, "
GoCD server is starting. This comes from test.loading.page.html
"); - } - - @Test - void shouldRespondWithSimpleMessageIfLoadingHTMLFileCannotBeLoaded() throws Exception { - webAppIsStarting(); - loadingPageIsSetTo("/some-non-existent-file"); - - MockResponse response = request("/go/pipelines", "text/html"); - - assertLoadingResponseInHTML(response, "

GoCD is starting up. Please wait ....

"); + assertLoadingResponseInHTML(response); } } @@ -186,11 +173,11 @@ private void assertLoadingResponseInJSON(MockResponse response) { done()); } - private void assertLoadingResponseInHTML(MockResponse response, String expectedBody) { + private void assertLoadingResponseInHTML(MockResponse response) throws IOException { assertTrue(response. hasStatus(503). withContentType("text/html"). - withBody(expectedBody). + withBody(GoServerLoadingIndicationHandler.loadingPage()). withNoCaching(). done()); } @@ -222,13 +209,9 @@ private void landingPageIsSetTo(String landingPage) { when(systemEnvironment.landingPage()).thenReturn(landingPage); } - private void loadingPageIsSetTo(String loadingPageResourcePath) { - when(systemEnvironment.get(SystemEnvironment.LOADING_PAGE)).thenReturn(loadingPageResourcePath); - } - private static class MockResponse { - private HttpServletResponse response; - private PrintWriter printWriter; + private final HttpServletResponse response; + private final PrintWriter printWriter; MockResponse(HttpServletResponse response, PrintWriter printWriter) { this.response = response; diff --git a/jetty/src/test/resources/test.loading.page.html b/jetty/src/test/resources/test.loading.page.html deleted file mode 100644 index 2e7c7e5e4f9..00000000000 --- a/jetty/src/test/resources/test.loading.page.html +++ /dev/null @@ -1 +0,0 @@ -
GoCD server is starting. This comes from test.loading.page.html
\ No newline at end of file