Skip to content

Commit

Permalink
Merge pull request #889 from hawkular/HWKMETRICS-737
Browse files Browse the repository at this point in the history
HWKMETRICS-737 Revert "Merge pull request #857 from jotak/angular-ui"
  • Loading branch information
mwringe committed Sep 21, 2017
2 parents 43be7fd + c91e27c commit b621194
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 101 deletions.
36 changes: 2 additions & 34 deletions api/metrics-api-jaxrs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@

<properties>
<version.org.jboss.resteasy.jaxrs-api>3.0.12.Final</version.org.jboss.resteasy.jaxrs-api>
<hawkular-ui.git.repo>scm:git:https://github.com/hawkular/hawkular-ui</hawkular-ui.git.repo>
<hawkular-ui.git.tag>0.0.2</hawkular-ui.git.tag>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -111,11 +109,6 @@
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-servlet</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down Expand Up @@ -164,29 +157,6 @@
<build>
<finalName>hawkular-metric-rest</finalName>
<plugins>
<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.5</version>
<executions>
<execution>
<id>Pull hawkular-ui webapp</id>
<goals>
<goal>checkout</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<connectionUrl>${hawkular-ui.git.repo}</connectionUrl>
<scmVersion>${hawkular-ui.git.tag}</scmVersion>
<scmVersionType>tag</scmVersionType>
<checkoutDirectory>${project.build.directory}/hawkular-ui</checkoutDirectory>
<includes>
metrics/dist/**
</includes>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
Expand All @@ -200,22 +170,20 @@
<!-- Exclude Swagger output customization classes from the WAR file -->
<packagingExcludes>WEB-INF/classes/org/hawkular/metrics/api/jaxrs/swagger/**/*</packagingExcludes>
<webResources>
<resource>
<filtering>false</filtering>
<directory>${project.build.directory}/hawkular-ui/metrics/dist</directory>
</resource>
<resource>
<filtering>false</filtering>
<directory>${basedir}/src/main/webapp</directory>
<excludes>
<exclude>WEB-INF/web.xml</exclude>
<exclude>static/index.html</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/webapp</directory>
<includes>
<include>WEB-INF/web.xml</include>
<include>static/index.html</include>
</includes>
</resource>
</webResources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import javax.ws.rs.ext.Provider;

import org.hawkular.metrics.api.jaxrs.handler.BaseHandler;
import org.hawkular.metrics.api.jaxrs.handler.ClientRouterDispatchingServlet;
import org.hawkular.metrics.api.jaxrs.handler.StatusHandler;
import org.hawkular.metrics.model.ApiError;

Expand All @@ -56,10 +55,7 @@ public void filter(ContainerRequestContext requestContext) throws IOException {
UriInfo uriInfo = requestContext.getUriInfo();
String path = uriInfo.getPath();

if (path.startsWith("/tenants")
|| path.startsWith(StatusHandler.PATH)
|| path.startsWith(ClientRouterDispatchingServlet.PATH)
|| path.equals(BaseHandler.PATH)) {
if (path.startsWith("/tenants") || path.startsWith(StatusHandler.PATH) || path.equals(BaseHandler.PATH)) {
// Some handlers do not check the tenant header
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ public Response baseJSON() {
@GET
@Produces({APPLICATION_XHTML_XML, TEXT_HTML})
public void baseHTML(@Context ServletContext context) throws Exception {
HttpServletRequest request = ResteasyProviderFactory.getContextData(HttpServletRequest.class);
HttpServletResponse response = ResteasyProviderFactory.getContextData(HttpServletResponse.class);
addHeaders(response);
response.sendRedirect("/hawkular/metrics" + ClientRouterDispatchingServlet.PATH_INDEX_HTML);
request.getRequestDispatcher("/static/index.html").forward(request, response);
}

private void addHeaders(HttpServletResponse response) {
Expand Down

This file was deleted.

22 changes: 8 additions & 14 deletions api/metrics-api-jaxrs/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,16 @@
</resource-env-ref>

<servlet>
<servlet-name>uiServlet</servlet-name>
<servlet-class>org.hawkular.metrics.api.jaxrs.handler.ClientRouterDispatchingServlet</servlet-class>
<!--<init-param>-->
<!--<param-name>resolve-against-context-root</param-name>-->
<!--<param-value>true</param-value>-->
<!--</init-param>-->
<servlet-name>staticContent</servlet-name>
<servlet-class>io.undertow.servlet.handlers.DefaultServlet</servlet-class>
<init-param>
<param-name>resolve-against-context-root</param-name>
<param-value>true</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>uiServlet</servlet-name>
<url-pattern>/ui</url-pattern>
<servlet-name>staticContent</servlet-name>
<url-pattern>/static/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>uiServlet</servlet-name>
<url-pattern>/ui/*</url-pattern>
</servlet-mapping>

</web-app>
Binary file not shown.
23 changes: 23 additions & 0 deletions api/metrics-api-jaxrs/src/main/webapp/static/fonts.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@font-face {
font-family: 'Exo 2';
font-style: normal;
font-weight: 400;
src: local('Exo 2'), local('Exo2-Regular'), url(/hawkular/metrics/static/fonts/exo-2/cyrillic.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
font-family: 'Exo 2';
font-style: normal;
font-weight: 400;
src: local('Exo 2'), local('Exo2-Regular'), url(/hawkular/metrics/static/fonts/exo-2/latin-ext.woff2) format('woff2');
unicode-range: U+0100-024F, U+1E00-1EFF, U+20A0-20AB, U+20AD-20CF, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
font-family: 'Exo 2';
font-style: normal;
font-weight: 400;
src: local('Exo 2'), local('Exo2-Regular'), url(/hawkular/metrics/static/fonts/exo-2/latin.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions api/metrics-api-jaxrs/src/main/webapp/static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
~ Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
~ and other contributors as indicated by the @author tags.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Hawkular Metrics</title>
<link rel="shortcut icon" href="/hawkular/metrics/static/favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="/hawkular/metrics/static/welcome.css" type="text/css">
<link rel="stylesheet" href="/hawkular/metrics/static/fonts.css" type="text/css">
<script src="/hawkular/metrics/static/status.js" type="text/javascript"></script>
</head>

<body>
<div class="content">
<div class="logo">
<img src="/hawkular/metrics/static/hawkular_logo.png" alt="Hawkular Logo"/>
</div>
<h1>Hawkular Metrics</h1>
<h3>A time series metrics engine based on Cassandra</h3>

<p id="implementation-version"></p>
<p id="built-from-git-sha1" style="font-size:12px;"></p>

<p id="status">Status: <i>Checking...</i></p>
</div>
</body>
</html>
46 changes: 46 additions & 0 deletions api/metrics-api-jaxrs/src/main/webapp/static/status.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2014-2017 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var httpRequest;

if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
}

httpRequest.onreadystatechange = updateStatus;
httpRequest.open("GET", "/hawkular/metrics/status");
httpRequest.send();

function updateStatus() {
if (httpRequest.readyState === 4) {
if (httpRequest.status === 200) {
statusJson = JSON.parse(httpRequest.responseText);
document.getElementById("status").innerHTML = "Metrics Service :" + statusJson.MetricsService;
document.getElementById("implementation-version").innerHTML = statusJson["Implementation-Version"];
document.getElementById("built-from-git-sha1").innerHTML = "(Git SHA1 - " + statusJson["Built-From-Git-SHA1"] + ")";
} else if (httpRequest.status === 404 || httpRequest.status === 503) {
document.getElementById("status").innerHTML = "The server is not available";
} else {
document.getElementById("status").innerHTML = "An error occured while accessing the server :" + httpRequest.responseText;
}
}
}
49 changes: 49 additions & 0 deletions api/metrics-api-jaxrs/src/main/webapp/static/welcome.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2014-2017 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
html {
width: 100%;
}

body {
font-family: 'Exo 2', sans-serif;
}

.content {
margin-left: auto;
margin-right: auto;
max-width: 100%;
width: 50em;
padding: 1em;
text-align: center;
}

.logo {
margin-left: auto;
margin-right: auto;
text-align: center;
}

.logo img {
max-width: 100%;
margin-left: auto;
margin-right: auto;
}

h1, h3 {
text-align: center;
word-wrap:break-word;
}
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@
<exclude>docker/hosts</exclude>
<!-- Exclude ANTLR token files -->
<exclude>**/.*.tokens</exclude>
<!-- Exclude fonts because it comes from google fonts and has an Open Font License -->
<exclude>src/main/webapp/static/fonts/**/*.woff2</exclude>
<!-- Exclude fonts css it comes from google fonts -->
<exclude>src/main/webapp/static/fonts.css</exclude>
</excludes>
</configuration>
</plugin>
Expand Down

0 comments on commit b621194

Please sign in to comment.