Allow instance rebuild via interface
This commit is contained in:
parent
5e7c5b2d23
commit
1e1d1a3cad
2 changed files with 40 additions and 6 deletions
|
|
@ -4,10 +4,11 @@
|
||||||
<title>Distillery Status Page - {{ .Info.Slug }}</title>
|
<title>Distillery Status Page - {{ .Info.Slug }}</title>
|
||||||
<h1 id="top">Distillery Status Page - {{ .Info.Slug }}</h1>
|
<h1 id="top">Distillery Status Page - {{ .Info.Slug }}</h1>
|
||||||
<p>
|
<p>
|
||||||
|
<a href=".">Reload</a>
|
||||||
<a href="/dis/index">Back to index</a>
|
<a href="/dis/index">Back to index</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<div>
|
||||||
<b>Slug:</b> <code>{{ .Info.Slug }}</code> <br />
|
<b>Slug:</b> <code>{{ .Info.Slug }}</code> <br />
|
||||||
<b>URL:</b> <a href="{{ .Info.URL }}" target="_blank" rel="noopener noreferrer">{{ .Info.URL }}</a> <br />
|
<b>URL:</b> <a href="{{ .Info.URL }}" target="_blank" rel="noopener noreferrer">{{ .Info.URL }}</a> <br />
|
||||||
<hr />
|
<hr />
|
||||||
|
|
@ -25,6 +26,11 @@
|
||||||
<hr />
|
<hr />
|
||||||
<b>Created:</b> <code class="date">{{ .Instance.Created.Format "2006-01-02T15:04:05Z07:00" }}</code> <br />
|
<b>Created:</b> <code class="date">{{ .Instance.Created.Format "2006-01-02T15:04:05Z07:00" }}</code> <br />
|
||||||
<b>Last Rebuild:</b> <code class="date">{{ .Info.LastRebuild.Format "2006-01-02T15:04:05Z07:00" }}</code> <br />
|
<b>Last Rebuild:</b> <code class="date">{{ .Info.LastRebuild.Format "2006-01-02T15:04:05Z07:00" }}</code> <br />
|
||||||
|
<hr>
|
||||||
|
<p>
|
||||||
|
<button class="remote-action" data-action="rebuild" data-param="{{ .Instance.Slug }}" data-target="#rebuild" data-buffer="20">Rebuild</button>
|
||||||
|
<pre class="remote-action-out" id="rebuild"></pre>
|
||||||
|
</p>
|
||||||
<hr />
|
<hr />
|
||||||
<b>FilesystemBase:</b> <code>{{ .Instance.FilesystemBase }}</code> <br />
|
<b>FilesystemBase:</b> <code>{{ .Instance.FilesystemBase }}</code> <br />
|
||||||
<b>AutoBlindUpdateEnabled:</b> <code>{{ .Instance.AutoBlindUpdateEnabled }}</code> <br />
|
<b>AutoBlindUpdateEnabled:</b> <code>{{ .Instance.AutoBlindUpdateEnabled }}</code> <br />
|
||||||
|
|
@ -64,12 +70,13 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<hr />
|
<hr />
|
||||||
</p>
|
<p>
|
||||||
|
<button class="remote-action" data-action="snapshot" data-param="{{ .Instance.Slug }}" data-target="#snapshot" data-buffer="20">Take a snapshot</button>
|
||||||
|
<pre class="remote-action-out" id="snapshot"></pre>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<button class="remote-action" data-action="snapshot" data-param="{{ .Instance.Slug }}" data-target="#snapshot" data-buffer="20">Take a snapshot</button>
|
|
||||||
<pre class="remote-action-out" id="snapshot"></pre>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
Generated at <code>{{ .Time }}</code>
|
Generated at <code>{{ .Time }}</code>
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,12 @@ func (info *Info) serveSocket(conn httpx.WebSocketConnection) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
info.serverSocketSnapshot(string(slug.Bytes), info.socketWriter(conn))
|
info.serverSocketSnapshot(string(slug.Bytes), info.socketWriter(conn))
|
||||||
|
case "rebuild":
|
||||||
|
slug, ok := <-conn.Read()
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
info.serverSocketRebuild(string(slug.Bytes), info.socketWriter(conn))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -61,3 +67,24 @@ func (info *Info) serverSocketSnapshot(slug string, writer *status.LineBuffer) {
|
||||||
stream.Println("Done")
|
stream.Println("Done")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (info *Info) serverSocketRebuild(slug string, writer *status.LineBuffer) {
|
||||||
|
stream := stream.NewIOStream(writer, writer, nil, 0)
|
||||||
|
|
||||||
|
// get the wisski
|
||||||
|
wissKI, err := info.Instances.WissKI(slug)
|
||||||
|
if err != nil {
|
||||||
|
stream.EPrintln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
err := wissKI.Build(stream, true)
|
||||||
|
if err != nil {
|
||||||
|
stream.EPrintln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream.Println("Done")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue