Compare commits

..

1 Commits

Author SHA1 Message Date
Evan Chen b0d76dff3e chore 2021-11-15 16:54:55 +08:00
17 changed files with 40 additions and 702 deletions

43
app.go
View File

@ -27,7 +27,6 @@ type Page struct {
BaseUrl string
Actions []Action
Integrations []*Integration
Onitachi map[string]*Oni
Version string
Build string
Files []ActiveFile
@ -80,7 +79,6 @@ func (cui *ConfigUI) App(w http.ResponseWriter, r *http.Request) {
},
Actions: cui.Actions,
Integrations: cui.Integrations,
Onitachi: cui.Onitachi,
Static: cui.NoReconfig,
HideConfig: cui.HideConfig,
ResultBellow: cui.ResultBellow,
@ -129,44 +127,3 @@ func (cui *ConfigUI) App(w http.ResponseWriter, r *http.Request) {
panic(err)
}
}
func (cui *ConfigUI) Program(w http.ResponseWriter, r *http.Request) {
Files := []ActiveFile{}
for _, i := range cui.fileIndex {
Files = append(Files, ActiveFile{
Name: cui.Files[i].Name,
Path: cui.Files[i].Path,
Order: cui.Files[i].Order,
})
}
sort.Slice(Files, func(i, j int) bool {
if Files[i].Order == Files[j].Order {
return Files[i].Name < Files[j].Name
}
return Files[i].Order < Files[j].Order
})
plat := "unix"
if runtime.GOOS == "windows" {
plat = "windows"
}
data := Page{
AppName: cui.AppName,
BaseUrl: cui.BaseUrl,
File: ActiveFile{},
Files: Files,
Editor: Editor{
Platform: plat,
},
Actions: cui.Actions,
Integrations: cui.Integrations,
Onitachi: cui.Onitachi,
Static: cui.NoReconfig,
HideConfig: cui.HideConfig,
Version: version,
}
err := cui.tmpl.ExecuteTemplate(w, "muzan", data)
if err != nil {
panic(err)
}
}

View File

@ -36,7 +36,7 @@ func init() {
flag.StringVar(&flagAction, "c", "", "cmd to apply")
flag.StringVar(&flagLogFile, "log", "", "log to file")
flag.StringVar(&flagAllow, "allow", "", "IPs to allow, blank to allow all")
flag.StringVar(&flagBind, "bind", "127.0.0.1:8000", "address to bind")
flag.StringVar(&flagBind, "bind", "0.0.0.0:8000", "address to bind")
flag.BoolVar(&flagNoReconfig, "static", false, "disable config api")
flag.BoolVar(&flagVer, "v", false, "show version")
flag.Usage = func() {

View File

@ -7,7 +7,6 @@ import (
"fmt"
"html/template"
"os"
"path/filepath"
"runtime"
"strings"
"sync"
@ -37,12 +36,12 @@ var Ext2Mode map[string]string = map[string]string{
}
type Action struct {
Name string `json:"name"`
Cmd string `json:"cmd"`
Dir string `json:"dir"`
run chan struct{} `json:"-"`
pid int
Name string `json:"name"`
Cmd string `json:"cmd"`
Dir string `json:"dir"`
Env []string `json"env,omitempty"`
run chan struct{} `json:"-"`
pid int `json:"-"`
}
type Integration struct {
@ -76,9 +75,6 @@ type ConfigUI struct {
LogPath string `json:"log_path"`
LogLevel klog.Llevel `json:"log_level"`
// Running commands
Onitachi map[string]*Oni `json:"onitachi"`
TmplFS embed.FS `json:"-"`
tmpl *engine.Engine
PublicFS embed.FS `json:"-"`
@ -100,30 +96,6 @@ func New() *ConfigUI {
"normal": func(name string) string {
return strings.ReplaceAll(name, " ", "-")
},
"state_class": func(state State) string {
switch state {
case STARTED:
return "is-success"
case ERROR:
return "is-danger"
case ENDED:
return "has-background-grey-light"
default:
return ""
}
},
"state_icon": func(state State) string {
switch state {
case STARTED:
return "play_arrow"
case ERROR:
return "error"
case ENDED:
return "stop"
default:
return "pending"
}
},
}).ParseFS(tmplFS, "templates/*.tmpl", "templates/**/*.tmpl"))
sh := ""
switch runtime.GOOS {
@ -148,7 +120,6 @@ func New() *ConfigUI {
cmdTimeout: time.Second * 10,
LogLevel: klog.Lerror | klog.Linfo,
log: klog.Sub("ConfigUI"),
Onitachi: make(map[string]*Oni),
}
}
@ -169,8 +140,6 @@ func (cui *ConfigUI) File(file_name string) (*File, error) {
}
func (cui *ConfigUI) LoadConfig(confstr string) error {
cui.configLock.Lock()
defer cui.configLock.Unlock()
tmpConf := &ConfigUI{}
err := json.Unmarshal([]byte(confstr), tmpConf)
if err != nil {
@ -193,15 +162,9 @@ func (cui *ConfigUI) LoadConfig(confstr string) error {
}
}
// del oni dry run
for k, v := range cui.Onitachi {
_, ok := tmpConf.Onitachi[k]
if !ok && v.State == STARTED {
return ErrorNoDeleteRunning.New(k)
}
}
// copy
cui.configLock.Lock()
defer cui.configLock.Unlock()
cui.fileIndex = tmpIndex
cui.Files = tmpConf.Files
cui.AllowIP = tmpConf.AllowIP
@ -211,40 +174,6 @@ func (cui *ConfigUI) LoadConfig(confstr string) error {
cui.HideConfig = tmpConf.HideConfig
cui.NoReconfig = tmpConf.NoReconfig
cui.ResultBellow = tmpConf.ResultBellow
cui.SHELL = tmpConf.SHELL
cui.log = klog.Sub(cui.AppName)
cui.LogLevel = tmpConf.LogLevel
if cui.LogLevel == 0 {
cui.LogLevel = klog.Lerror | klog.Linfo
}
klog.LEVEL = cui.LogLevel
cui.LogPath = tmpConf.LogPath
cui.setLog()
// construct oni - update existing, del
for k, v := range cui.Onitachi {
n, ok := tmpConf.Onitachi[k]
if !ok {
delete(cui.Onitachi, k)
} else {
v.Name = k
v.Cmd = n.Cmd
v.Args = n.Args
v.Envs = n.Envs
v.Dir = n.Dir
v.Policy = n.Policy
}
}
// construct oni - append new
for k, v := range tmpConf.Onitachi {
_, ok := cui.Onitachi[k]
if !ok {
v.Name = k
v.Init(cui)
cui.Onitachi[k] = v
}
}
cui.Actions = tmpConf.Actions
for i := range cui.Actions {
@ -272,6 +201,15 @@ func (cui *ConfigUI) LoadConfig(confstr string) error {
cui.cmdTimeout = ct
}
cui.log = klog.Sub(cui.AppName)
cui.LogLevel = tmpConf.LogLevel
if cui.LogLevel == 0 {
cui.LogLevel = klog.Lerror | klog.Linfo
}
klog.LEVEL = cui.LogLevel
cui.LogPath = tmpConf.LogPath
cui.setLog()
// fmt.Printf("%+v", cui)
return nil
}
@ -282,7 +220,6 @@ func (cui *ConfigUI) setLog() {
cui.f.Close()
}
if cui.LogPath != "" {
mkdir(filepath.Dir(cui.LogPath))
cui.f, err = os.OpenFile(cui.LogPath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
cui.log.Error(err)

View File

@ -11,45 +11,3 @@ var ErrorServerReloading = ksrv.Error{
ID: "ErrorServerReloading",
Message: "server is reloading",
}
var ErrorOniHasNoPID = ksrv.Error{
Code: http.StatusBadRequest,
ID: "ErrorOniHasNoPID",
Message: "oni has no pid",
}
var ErrorOniNotStarted = ksrv.Error{
Code: http.StatusConflict,
ID: "ErrorOniNotStarted",
Tmpl: "%s hasn't start",
}
var ErrorOniHasStarted = ksrv.Error{
Code: http.StatusConflict,
ID: "ErrorOniHasStarted",
Tmpl: "%s has started",
}
var ErrorOniNotFound = ksrv.Error{
Code: http.StatusNotFound,
ID: "ErrorOniNotFound",
Tmpl: "%s not found",
}
var ErrorOniNotValid = ksrv.Error{
Code: http.StatusBadRequest,
ID: "ErrorOniNotValid",
Message: "oni no name or cmd",
}
var ErrorNoDeleteRunning = ksrv.Error{
Code: http.StatusBadRequest,
ID: "ErrorNoDeleteRunning",
Tmpl: "cannot delete running: %s",
}
var ErrorOniNoLog = ksrv.Error{
Code: http.StatusNotFound,
ID: "ErrorOniNoLog",
Tmpl: "%s has no logs",
}

View File

@ -154,7 +154,6 @@ func (cui *ConfigUI) DoAction(w http.ResponseWriter, r *http.Request) {
panic(err)
}
w.Write([]byte(result))
return
}
}
@ -259,99 +258,3 @@ func (cui *ConfigUI) GetConfig(w http.ResponseWriter, r *http.Request) {
}
w.Write(data)
}
func (cui *ConfigUI) GetOni(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
if name == "" {
ksrv.JSON(w, cui.Onitachi)
return
}
oni, ok := cui.Onitachi[name]
if !ok {
panic(ErrorOniNotFound.New(name))
}
ksrv.JSON(w, oni)
}
func (cui *ConfigUI) OniStart(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
oni, ok := cui.Onitachi[name]
if !ok {
panic(ErrorOniNotFound.New(name))
}
switch oni.State {
case "":
oni.Init(cui)
case STARTED:
panic(ErrorOniHasStarted.New(name))
}
err := oni.Start()
if err != nil {
panic(err)
}
w.Write([]byte("ok"))
}
func (cui *ConfigUI) OniStop(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
oni, ok := cui.Onitachi[name]
if !ok {
panic(ErrorOniNotFound.New(name))
}
switch oni.State {
case STARTED:
err := oni.Stop()
if err != nil {
panic(err)
}
default:
panic(ErrorOniNotStarted.New(name))
}
w.Write([]byte("ok"))
}
func (cui *ConfigUI) OniLog(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
oni, ok := cui.Onitachi[name]
if !ok {
panic(ErrorOniNotFound.New(name))
}
if oni.LogFile == "" {
panic(ErrorOniNoLog.New(name))
}
stat, err := os.Stat(oni.LogFile)
if err != nil {
panic(err)
}
data, err := os.ReadFile(oni.LogFile)
if err != nil {
panic(err)
}
ksrv.JSON(w, map[string]string{
"name": name,
"data": string(data),
"delta": strconv.Itoa(int(stat.Size())),
})
}
func (cui *ConfigUI) OniKill(w http.ResponseWriter, r *http.Request) {
name := r.URL.Query().Get("name")
oni, ok := cui.Onitachi[name]
if !ok {
panic(ErrorOniNotFound.New(name))
}
switch oni.State {
case STARTED:
err := oni.Kill()
if err != nil {
panic(err)
}
default:
panic(ErrorOniNotStarted.New(name))
}
w.Write([]byte("ok"))
}
func (cui *ConfigUI) OniAttach(w http.ResponseWriter, r *http.Request) {
}

172
muzan.go
View File

@ -1,172 +0,0 @@
package configui
import (
"bufio"
"bytes"
"fmt"
"io"
"os"
"os/exec"
"path/filepath"
"syscall"
)
type State string
const (
READY State = "ready"
ERROR State = "error"
STARTED State = "started"
ENDED State = "ended"
)
type Policy string
const (
NO Policy = "no"
ONFAIL Policy = "on-failure"
ALWAYS Policy = "always"
UNLESSSTOP Policy = "unless-stopped"
)
type Oni struct {
Name string `json:"-"`
Cmd string `json:"cmd"`
Dir string `json:"dir"`
Args []string `json:"args"`
Envs []string `json:"envs"`
Policy Policy `json:"policy"`
PID int `json:"pid"`
LogFile string `json:"log_file"`
State State `json:"state"`
Error string `json:"error"`
ManStop bool `json:"manual_stop"`
parent *ConfigUI
cmd *exec.Cmd
running chan struct{}
buff bytes.Buffer
log io.Writer
listeners []io.Writer
}
func (oni *Oni) Init(cui *ConfigUI) {
oni.parent = cui
oni.running = make(chan struct{}, 1)
oni.listeners = make([]io.Writer, 0)
oni.StateChange(READY)
oni.SetLog()
}
func (oni *Oni) Start() error {
if oni.Cmd == "" {
return ErrorOniNotValid
}
select {
case oni.running <- struct{}{}:
defer func() {
err := recover()
if err != nil {
oni.end(err)
}
}()
default:
return ErrorOniHasStarted
}
var err error
cmd := exec.Command(oni.Cmd, oni.Args...)
setgpid(cmd)
cmd.Env = oni.Envs
cmd.Dir = oni.Dir
var out io.Writer
if oni.LogFile != "" {
out = io.MultiWriter(oni.log, &oni.buff)
} else {
out = &oni.buff
}
cmd.Stderr = out
cmd.Stdout = out
oni.cmd = cmd
err = oni.cmd.Start()
if err != nil {
oni.end(err)
return err
}
go oni.read()
oni.PID = cmd.Process.Pid
oni.StateChange(STARTED)
go func() {
oni.end(cmd.Wait())
}()
return nil
}
func (oni *Oni) Stop() error {
if oni.cmd == nil {
return nil
}
return oni.cmd.Process.Signal(syscall.SIGTERM)
}
func (oni *Oni) end(v interface{}) {
if v == nil {
oni.StateChange(ENDED)
} else {
oni.Error = fmt.Sprint(v)
oni.StateChange(ERROR)
}
if oni.log != nil {
file, ok := oni.log.(*os.File)
if ok {
file.Close()
}
}
if len(oni.running) == 1 {
<-oni.running
}
}
func (oni *Oni) read() {
go func() {
scanner := bufio.NewScanner(&oni.buff)
for scanner.Scan() {
if len(oni.listeners) == 0 {
continue
}
w := io.MultiWriter(oni.listeners...)
w.Write([]byte(scanner.Text()))
}
}()
}
func (oni *Oni) StateChange(state State) {
oni.State = state
// for i := range oni.parent.Actions {
// if oni.parent.Actions[i].Name == oni.Name {
// oni.parent.Actions[i].State = state
// }
// }
}
func (oni *Oni) SetLog() error {
var err error
if oni.log != nil {
file, ok := oni.log.(*os.File)
if ok {
file.Close()
}
}
if oni.parent.LogPath != "" {
logpath := filepath.Join(filepath.Dir(oni.parent.LogPath), oni.Name+".log")
oni.LogFile = logpath
oni.log, err = os.OpenFile(logpath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil {
oni.end(err)
return err
}
}
return err
}

View File

@ -1,24 +0,0 @@
//go:build !windows
// +build !windows
package configui
import (
"os/exec"
"syscall"
)
func setgpid(cmd *exec.Cmd) {
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
}
func (oni *Oni) Kill() error {
if oni.cmd == nil {
return nil
}
pgid, err := syscall.Getpgid(oni.cmd.Process.Pid)
if err == nil {
return syscall.Kill(-pgid, 15) // note the minus sign
}
return oni.cmd.Process.Kill()
}

View File

@ -1,13 +0,0 @@
package configui
import "os/exec"
func setgpid(cmd *exec.Cmd) {
}
func (oni *Oni) Kill() error {
if oni.cmd == nil {
return nil
}
return oni.cmd.Process.Kill()
}

View File

@ -31,9 +31,6 @@ func (cui *ConfigUI) middleware(next http.Handler) http.Handler {
panic("permission denied")
}
}
if MutexLocked(&cui.configLock) {
panic(ErrorServerReloading)
}
next.ServeHTTP(rw, r)
}),
)
@ -42,6 +39,13 @@ func (cui *ConfigUI) middleware(next http.Handler) http.Handler {
func (cui *ConfigUI) mux() *http.ServeMux {
cuiR := http.NewServeMux()
cuiR.HandleFunc("/api/profile", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
ksrv.JSON(w, stat.GetProfile())
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/conf", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
cui.GetConfig(w, r)
@ -102,57 +106,7 @@ func (cui *ConfigUI) mux() *http.ServeMux {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/profile", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
ksrv.JSON(w, stat.GetProfile())
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/oni", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
cui.GetOni(w, r)
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/oni/start", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
cui.OniStart(w, r)
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/oni/stop", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
cui.OniStop(w, r)
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/oni/kill", func(w http.ResponseWriter, r *http.Request) {
if r.Method == "POST" {
cui.OniKill(w, r)
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/oni/log", func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodGet {
cui.OniLog(w, r)
} else {
w.WriteHeader(404)
}
})
cuiR.HandleFunc("/api/oni/attach", func(w http.ResponseWriter, r *http.Request) {
if r.Method == http.MethodGet {
cui.OniAttach(w, r)
} else {
w.WriteHeader(404)
}
})
cuiR.Handle("/public/", http.StripPrefix("/public/", http.FileServer(http.FS(cui.PublicFS))))
cuiR.HandleFunc("/program", cui.Program)
cuiR.HandleFunc("/", cui.App)
return cuiR
}

View File

@ -3,7 +3,6 @@
$modal-content-width: 90vw;
$footer-padding: 0.5rem 1.5rem 0.5rem;
// $navbar-z: 0;
@import "../node_modules/bulma/bulma.sass";
@import "../node_modules/@creativebulma/bulma-tooltip/src/sass/index.sass";

View File

@ -6,6 +6,11 @@
</p>
</div>
</footer>
<script src="{{.BaseUrl}}public/ace/js/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="{{.BaseUrl}}public/ace/js/ext-beautify.js" type="text/javascript" charset="utf-8"></script>
<script src="{{.BaseUrl}}public/ace/js/ext-searchbox.js" type="text/javascript" charset="utf-8"></script>
{{template "base/script" .}}
<!-- <script src="/public/js/main.js"></script> -->
</body>
</html>
{{end}}

View File

@ -8,6 +8,4 @@
<link rel="stylesheet" href="{{.BaseUrl}}public/css/main.css">
</head>
<body>
{{template "base/nav" .}}
{{end}}

View File

@ -1,76 +0,0 @@
{{define "base/nav"}}
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="{{.BaseUrl}}">
<p><strong>{{.AppName}}</strong></p>
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbarBasicExample" class="navbar-menu">
{{/*
<div class="navbar-start">
{{if .Actions}}
<a class="navbar-item">
Actions
</a>
{{end}}
{{if .Integrations}}
<a class="navbar-item">
Integrations
</a>
{{end}}
</div>
<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
*/}}
</div>
</nav>
{{/* not having pages
<script>
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Check if there are any navbar burgers
if ($navbarBurgers.length > 0) {
// Add a click event on each of them
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
// Get the target from the "data-target" attribute
const target = el.dataset.target;
const $target = document.getElementById(target);
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
});
*/}}
</script>
{{end}}

View File

@ -1,8 +1,4 @@
{{define "base/script"}}
<script src="{{.BaseUrl}}public/ace/js/ace.js" type="text/javascript" charset="utf-8"></script>
<script src="{{.BaseUrl}}public/ace/js/ext-beautify.js" type="text/javascript" charset="utf-8"></script>
<script src="{{.BaseUrl}}public/ace/js/ext-searchbox.js" type="text/javascript" charset="utf-8"></script>
<script>
window.ToolIsFollow = false;
window.LastDelta = 0;

View File

@ -14,26 +14,6 @@
</li>
{{ end }}
</ul>
{{if .Onitachi}}
<p class="menu-label">
Programs
</p>
<ul class="menu-list">
{{- range $key, $value := .Onitachi -}}
<li>
<a class="has-tooltip-arrow" data-tooltip="{{$value.Cmd}}" href="{{$.BaseUrl}}program?name={{.Name}}">
<div class="level">
<span>{{$key}}</span>
<div class="tags has-addons">
<span class="tag">State</span>
<span class="tag {{$value.State|state_class}}">{{$value.State}}</span>
</div>
</div>
</a>
</li>
{{- end -}}
</ul>
{{end}}
{{if not .HideConfig}}
<p class="menu-label">
System

View File

@ -5,6 +5,16 @@
var Active = "{{.File.Name}}";
</script>
<nav class="level">
<div class="level-left">
<div class="level-item">
<a class="title is-size-4 ml-2 mt-1" href="{{.BaseUrl}}">
{{.AppName}}
</a>
</div>
</div>
</nav>
<div class="columns">
<div class="column is-one-quarter">
<div class="box">
@ -80,6 +90,5 @@ async function toolDoIntegration(name){
{{if not .ResultBellow}}
{{template "components/result" .}}
{{end}}
{{template "base/script" .}}
{{template "base/footer" .}}
{{end}}

View File

@ -1,73 +0,0 @@
{{define "muzan"}}
{{template "base/header" .}}
{{template "components/error" .}}
<script>
var Active = "{{.File.Name}}";
</script>
<div class="columns">
<div class="column is-one-quarter">
<div class="box">
{{template "components/menu" .}}
</div>
{{if .Actions}}
<div class="box">
<p class="menu-label has-text-left">Actions</p>
<div class="buttons are-small">
{{- range .Actions -}}
<button class="button has-tooltip-arrow" id="actbtn-{{.Name|normal}}"
data-tooltip="{{.Cmd}}" onclick="toolDoAction('{{.Name}}')">
<span>{{- .Name -}}</span>
</button>
{{- end -}}
</div>
</div>
{{end}}
{{if .Integrations}}
<div class="box">
<p class="menu-label has-text-left">Integrations</p>
<div class="buttons are-small">
{{- range .Integrations -}}
<button class="button has-tooltip-arrow" id="itgbtn-{{.Name|normal}}"
data-tooltip="{{.Description}}" onclick="toolDoIntegration('{{.Name}}')">
<span>{{- .Name -}}</span>
</button>
{{- end -}}
</div>
</div>
{{end}}
<div class="box has-text-centered">
<a href="{{.BaseUrl}}api/export" class="button is-small">Export Files</a>
</div>
</div>
<div class="column">
<div class="box">
Home
{{/* {{template "components/editor" .}} */}}
</div>
</div>
</div>
<script>
async function toolDoAction(name){
let el = document.getElementById('actbtn-'+name.replaceAll(" ","-"));
el.classList.add("is-loading")
el.classList.remove("has-tooltip-arrow")
await DoAction('action',name)
el.classList.remove("is-loading")
el.classList.add("has-tooltip-arrow")
{{if not .ResultBellow}}ResultViewTog(){{end}}
}
async function toolDoIntegration(name){
let el = document.getElementById('itgbtn-'+name.replaceAll(" ","-"));
el.classList.add("is-loading")
el.classList.remove("has-tooltip-arrow")
await DoAction('integration',name)
el.classList.remove("is-loading")
el.classList.add("has-tooltip-arrow")
{{if not .ResultBellow}}ResultViewTog(){{end}}
}
</script>
{{template "base/footer" .}}
{{end}}