1
// Copyright 2016 - 2020 The aurora Authors. All rights reserved. Use of this
2
// source code is governed by a MIT license that can be found in the LICENSE
3
// file.
4
//
5
// The aurora is a web-based beanstalkd queue server console written in Go
6
// and works on macOS, Linux and Windows machines. Main idea behind using Go
7
// for backend development is to utilize ability of the compiler to produce
8
// zero-dependency binaries for multiple platforms. aurora was created as an
9
// attempt to build very simple and portable application to work with local or
10
// remote beanstalkd server.
11

12
package main
13

14
import "strings"
15

16
// tplTube render job stats page in tube by given server.
17
func tplTube(content string, server string, tube string) string {
18 10
	var isDisabledJobDataHighlight string
19 10
	if selfConf.IsDisabledJobDataHighlight != 1 {
20 10
		isDisabledJobDataHighlight = `<script src="./highlight/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script>`
21
	}
22 10
	buf := strings.Builder{}
23 10
	buf.WriteString(TplHeaderBegin)
24 10
	buf.WriteString(tube)
25 10
	buf.WriteString(` - `)
26 10
	buf.WriteString(server)
27 10
	buf.WriteString(` -`)
28 10
	buf.WriteString(TplHeaderEnd)
29 10
	buf.WriteString(TplNoScript)
30 10
	buf.WriteString(`<div class="navbar navbar-fixed-top navbar-default" role="navigation"><div class="container"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button><a class="navbar-brand" href="./">Beanstalkd console</a></div><div class="collapse navbar-collapse"><ul class="nav navbar-nav">`)
31 10
	buf.WriteString(dropDownServer(server))
32 10
	buf.WriteString(dropDownTube(server, tube))
33 10
	buf.WriteString(`</ul><ul class="nav navbar-nav navbar-right"><li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">Toolbox <span class="caret"></span></a><ul class="dropdown-menu"><li><a href="#filter" role="button" data-toggle="modal">Filter columns</a></li><li><a href="./sample?action=manageSamples" role="button">Manage samples</a></li><li><a href="./statistics?action=preference" role="button">Statistics preference</a></li><li class="divider"></li><li><a href="#settings" role="button" data-toggle="modal">Edit settings</a></li></ul></li>`)
34 10
	buf.WriteString(TplLinks)
35 10
	buf.WriteString(`</ul>`)
36 10
	buf.WriteString(tplSearchTube(server, tube, ""))
37 10
	buf.WriteString(`</div></div></div><div class="container">`)
38 10
	buf.WriteString(content)
39 10
	buf.WriteString(modalAddJob(tube))
40 10
	buf.WriteString(modalAddSample(server, tube))
41 10
	buf.WriteString(`<div id="idAllTubesCopy" style="display:none"></div>`)
42 10
	buf.WriteString(tplTubeFilter())
43 10
	buf.WriteString(dropEditSettings())
44 10
	buf.WriteString(`</div><script>function getParameterByName(name,url){if(!url){url=window.location.href}name=name.replace(/[\[\]]/g,"\\$&");var regex=new RegExp("[?&]"+name+"(=([^&#]*)|&|#|$)"),results=regex.exec(url);if(!results){return null}if(!results[2]){return""}return decodeURIComponent(results[2].replace(/\+/g," "))}var url="./tube?server="+getParameterByName("server");var contentType="";</script><script src='./assets/vendor/jquery/jquery.js'></script><script src="./js/jquery.color.js"></script><script src="./js/jquery.cookie.js"></script><script src="./js/jquery.regexp.js"></script><script src="./assets/vendor/bootstrap/js/bootstrap.min.js"></script>`)
45 10
	buf.WriteString(isDisabledJobDataHighlight)
46 10
	buf.WriteString(`<script src="./js/customer.js"></script></body></html>`)
47 10
	return buf.String()
48
}

Read our documentation on viewing source code .

Loading