Style pages

This commit is contained in:
René Pfeuffer
2019-06-05 11:52:36 +02:00
parent a5c65b4e2c
commit c7875e7f78
4 changed files with 88 additions and 35 deletions

View File

@@ -3,6 +3,8 @@ package sonia.scm.update;
import com.google.inject.servlet.ServletModule; import com.google.inject.servlet.ServletModule;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import sonia.scm.PushStateDispatcher;
import sonia.scm.WebResourceServlet;
class MigrationWizardModule extends ServletModule { class MigrationWizardModule extends ServletModule {
@@ -15,6 +17,8 @@ class MigrationWizardModule extends ServletModule {
LOG.info("= STARTING MIGRATION SERVLET ="); LOG.info("= STARTING MIGRATION SERVLET =");
LOG.info("= ="); LOG.info("= =");
LOG.info("=========================================================="); LOG.info("==========================================================");
bind(PushStateDispatcher.class).toInstance((request, response, uri) -> {});
serve("/images/*", "/styles/*").with(WebResourceServlet.class);
serve("/*").with(MigrationWizardServlet.class); serve("/*").with(MigrationWizardServlet.class);
} }
} }

View File

@@ -15,6 +15,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@@ -45,6 +46,7 @@ class MigrationWizardServlet extends HttpServlet {
HashMap<String, Object> model = new HashMap<>(); HashMap<String, Object> model = new HashMap<>();
model.put("contextPath", req.getContextPath());
model.put("submitUrl", req.getRequestURI()); model.put("submitUrl", req.getRequestURI());
model.put("repositories", missingMigrationStrategies); model.put("repositories", missingMigrationStrategies);
model.put("strategies", getMigrationStrategies()); model.put("strategies", getMigrationStrategies());
@@ -68,7 +70,7 @@ class MigrationWizardServlet extends HttpServlet {
MustacheFactory mf = new DefaultMustacheFactory(); MustacheFactory mf = new DefaultMustacheFactory();
Mustache mustache = mf.compile("templates/repository-migration-restart.mustache"); Mustache mustache = mf.compile("templates/repository-migration-restart.mustache");
mustache.execute(resp.getWriter(), new Object()).flush(); mustache.execute(resp.getWriter(), Collections.singletonMap("contextPath", req.getContextPath())).flush();
ScmEventBus.getInstance().post(new RestartEvent(MigrationWizardServlet.class, "wrote migration data")); ScmEventBus.getInstance().post(new RestartEvent(MigrationWizardServlet.class, "wrote migration data"));
} }

View File

@@ -2,9 +2,31 @@
<html> <html>
<head> <head>
<title>SCM-Manager Restart</title> <title>SCM-Manager Restart</title>
<link rel="stylesheet" type="text/css" href="{{ contextPath }}/styles/scm.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head> </head>
<body> <body>
SCM-Manager will restart to migrate the data. <div id="root">
<div>
<div class="App">
<section class="hero is-dark is-small">
<div class="hero-body">
<div class="container">
<div class="columns is-vcentered">
<div class="column"><img src="{{ contextPath }}/images/logo.png" alt="SCM-Manager"></div>
</div>
</div>
</div>
</section>
<div class="main">
<section class="section">
<div class="container">
<h1 class="title">SCM-Manager will restart to migrate the data.</h1>
</div>
</section>
</div>
</div>
</div>
</div>
</body> </body>
</html> </html>

View File

@@ -2,41 +2,66 @@
<html> <html>
<head> <head>
<title>SCM-Manager Migration</title> <title>SCM-Manager Migration</title>
<link rel="stylesheet" type="text/css" href="{{ contextPath }}/styles/scm.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head> </head>
<body> <body>
<h1>SCM-Manager Migration</h1> <div id="root">
You have migrated from SCM-Manager v1 to SCM-Manager v2. <div>
<form action="{{submitUrl}}" method="post"> <div class="App">
<table> <section class="hero is-dark is-small">
<tr> <div class="hero-body">
<th>original name</th> <div class="container">
<th>type</th> <div class="columns is-vcentered">
<th>new namespace/name</th> <div class="column"><img src="{{ contextPath }}/images/logo.png" alt="SCM-Manager"></div>
<th>Strategy</th> </div>
</tr> </div>
{{#repositories}} </div>
<tr> </section>
<td> <div class="main">
{{name}} <section class="section">
</td> <div class="container">
<td> <h1 class="title">SCM-Manager Migration</h1>
{{type}} <h2 class="subtitle">You have migrated from SCM-Manager v1 to SCM-Manager v2.</h2>
</td> <form action="{{submitUrl}}" method="post">
<td> <table class="card-table table is-hoverable is-fullwidth">
{{newNamespace}}/{{newName}} <tr>
</td> <th>Original name</th>
<td> <th>Type</th>
<select name="{{id}}"> <th>New namespace and name</th>
{{#strategies}} <th>Strategy</th>
<option>{{.}}</option> </tr>
{{/strategies}} {{#repositories}}
</select> <tr>
</td> <td>
</tr> {{name}}
{{/repositories}} </td>
</table> <td>
<button type="submit">Submit</button> {{type}}
</form> </td>
<td>
{{newNamespace}}/{{newName}}
</td>
<td>
<div class="field">
<div class="control select">
<select name="{{id}}">
{{#strategies}}
<option>{{.}}</option>
{{/strategies}}
</select>
</div>
</div>
</td>
</tr>
{{/repositories}}
</table>
<button class="button is-primary" type="submit">Submit</button>
</form>
</div>
</section>
</div>
</div>
</div>
</body> </body>
</html> </html>