This is an automated email from the ASF dual-hosted git repository.
toulmean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
The following commit(s) were added to refs/heads/main by this push:
new e09aeb0 wip - UI for crawler
new d31b38b Merge pull request #240 from atoulme/add_static_html_crawler
e09aeb0 is described below
commit e09aeb0a0ef955da51264368fc9bb25a43ce5970
Author: Antoine Toulme <[email protected]>
AuthorDate: Wed May 19 23:56:24 2021 -0700
wip - UI for crawler
---
.../tuweni/eth/crawler/CrawlerRESTService.kt | 7 +++
eth-crawler/src/main/resources/webapp/index.html | 66 ++++++++++++++++++++++
eth-crawler/src/main/resources/webapp/index.js | 25 ++++++++
3 files changed, 98 insertions(+)
diff --git
a/eth-crawler/src/main/kotlin/org/apache/tuweni/eth/crawler/CrawlerRESTService.kt
b/eth-crawler/src/main/kotlin/org/apache/tuweni/eth/crawler/CrawlerRESTService.kt
index a91c504..858f977 100644
---
a/eth-crawler/src/main/kotlin/org/apache/tuweni/eth/crawler/CrawlerRESTService.kt
+++
b/eth-crawler/src/main/kotlin/org/apache/tuweni/eth/crawler/CrawlerRESTService.kt
@@ -20,7 +20,9 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import org.eclipse.jetty.server.Server
+import org.eclipse.jetty.servlet.DefaultServlet
import org.eclipse.jetty.servlet.ServletContextHandler
+import org.eclipse.jetty.util.resource.Resource
import org.glassfish.jersey.servlet.ServletContainer
import org.slf4j.LoggerFactory
import java.net.InetSocketAddress
@@ -57,6 +59,11 @@ class CrawlerRESTService(
"org.apache.tuweni.eth.crawler.rest"
)
+
ctx.setBaseResource(Resource.newResource(CrawlerRESTService::class.java.getResource("/webapp")))
+ val staticContent = ctx.addServlet(DefaultServlet::class.java, "/*")
+ ctx.setWelcomeFiles(arrayOf("index.html"))
+ staticContent.initOrder = 10
+
newServer.stopAtShutdown = true
newServer.start()
serHol.servlet.servletConfig.servletContext.setAttribute("repo",
repository)
diff --git a/eth-crawler/src/main/resources/webapp/index.html
b/eth-crawler/src/main/resources/webapp/index.html
new file mode 100644
index 0000000..0741af8
--- /dev/null
+++ b/eth-crawler/src/main/resources/webapp/index.html
@@ -0,0 +1,66 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE
+file distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file
+to You 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>
+<html lang="en">
+<head>
+ <!-- Required meta tags -->
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1,
shrink-to-fit=no">
+
+ <!-- Bootstrap CSS -->
+ <link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
+
integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk"
crossorigin="anonymous">
+
+ <title>Apache Tuweni Network Crawler</title>
+</head>
+<body>
+<nav class="navbar navbar-dark sticky-top bg-dark flex-md-nowrap p-0 shadow">
+ <a class="navbar-brand col-md-3 col-lg-2 mr-0 px-3" href="#">Tuweni</a>
+ <button class="navbar-toggler position-absolute d-md-none collapsed"
type="button" data-toggle="collapse"
+ data-target="#sidebarMenu" aria-controls="sidebarMenu"
aria-expanded="false" aria-label="Toggle navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+ <ul class="navbar-nav px-3">
+<!-- <li class="nav-item text-nowrap">-->
+<!-- <a class="nav-link" href="#">Sign out</a>-->
+<!-- </li>-->
+ </ul>
+</nav>
+<div class="container-fluid">
+ <div class="row">
+
+ <main role="main" class="col-md-12 ml-sm-auto col-lg-12 px-md-4">
+ <div class="d-flex justify-content-between flex-wrap
flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
+ <h1 class="h2">Configuration</h1>
+ </div>
+ <div id="app">
+ <pre><code>{{ config }}</code></pre>
+ </div>
+ </main>
+ </div>
+</div>
+
+<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
+
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
+ crossorigin="anonymous"></script>
+<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"
+
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
+ crossorigin="anonymous"></script>
+<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
+
integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
+ crossorigin="anonymous"></script>
+<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
+<script
src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.19.2/axios.min.js"></script>
+<script src="index.js"></script>
+</body>
+</html>
\ No newline at end of file
diff --git a/eth-crawler/src/main/resources/webapp/index.js
b/eth-crawler/src/main/resources/webapp/index.js
new file mode 100644
index 0000000..43668d6
--- /dev/null
+++ b/eth-crawler/src/main/resources/webapp/index.js
@@ -0,0 +1,25 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE
+file distributed with this work for additional information regarding copyright
ownership. The ASF licenses this file
+to You 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.
+ */
+new Vue({
+ el: '#app',
+ data () {
+ return {
+ config: null
+ }
+ },
+ mounted () {
+ axios
+ .get('/rest/config')
+ .then(response => (this.config = response.data));
+ }
+})
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]