aceberg/WatchYourPorts

View on GitHub
internal/web/templates/config.html

Summary

Maintainability
Test Coverage
{{ define "config.html" }}

<body>
    <div class="container-lg">
    <div class="row">
        <div class="col-md mt-4">
        <div class="card border-primary">
            <div class="card-header">Config</div>
        <div class="card-body table-responsive">
        <table class="table table-borderless">
            <form action="/config/" method="post">
                <tr>
                    <td>Host</td>
                    <td><input name="host" type="text" class="form-control" value="{{ .Config.Host }}"></td>
                </tr>
                <tr>
                    <td>Port</td>
                    <td><input name="port" type="text" class="form-control" value="{{ .Config.Port }}"></td>
                </tr>
                <tr>
                    <td>Theme</td>
                    <td><select name="theme" class="form-select">
                        <option selected>{{ .Config.Theme }}</option>
                        {{ range .Themes }}
                            <option value="{{ . }}">{{ . }}</option>
                        {{ end }}
                    </select></td>
                </tr>
                <tr>
                    <td>Color mode</td>
                    <td><select name="color" class="form-select">
                        <option selected>{{ .Config.Color }}</option>
                        <option value="light">light</option>
                        <option value="dark">dark</option>
                    </select></td>
                </tr>
                <tr>
                    <td>Timeout (minutes)</td>
                    <td><input name="timeout" type="number" class="form-control" value="{{ .Config.Timeout }}"></td>
                </tr>
                <tr>
                    <td>Trim History</td>
                    <td><input name="trim" type="number" class="form-control" value="{{ .Config.HistTrim }}"></td>
                </tr>
                <tr>
                    <td><button type="submit" class="btn btn-primary">Save</button></td>
                    <td></td>
                </tr>
            </form>
        </table>
        </div>
        </div>
        <div class="card border-primary mt-4">
            <div class="card-header">Version</div>
            <div class="card-body">
                <a href="https://github.com/aceberg/WatchYourPorts/releases/tag/{{ .Version }}" target="_blank">{{ .Version }}</a>
            </div>
        </div>
        </div>
        <div class="col-md mt-4">
            <div class="card border-primary">
                <div class="card-header">InfluxDB2 config</div>
            <div class="card-body table-responsive">
            <table class="table table-borderless">
                <form action="/config_influx/" method="post">
                    <tr>
                        <td>Enable</td>
                        <td>
                            <div class="form-check form-switch">
                                {{ if .Config.InfluxEnable }}
                                <input class="form-check-input" type="checkbox" name="enable" checked>
                                {{ else }}
                                <input class="form-check-input" type="checkbox" name="enable">
                                {{ end }}
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td>Address</td>
                        <td><input name="addr" type="text" class="form-control" value="{{ .Config.InfluxAddr }}"></td>
                    </tr>
                    <tr>
                        <td>Token</td>
                        <td><input name="token" type="text" class="form-control" value="{{ .Config.InfluxToken }}"></td>
                    </tr>
                    <tr>
                        <td>Org</td>
                        <td><input name="org" type="text" class="form-control" value="{{ .Config.InfluxOrg }}"></td>
                    </tr>
                    <tr>
                        <td>Bucket</td>
                        <td><input name="bucket" type="text" class="form-control" value="{{ .Config.InfluxBucket }}"></td>
                    </tr>
                    <tr>
                        <td>Skip TLS verify</td>
                        <td>
                            <div class="form-check form-switch">
                                {{ if .Config.InfluxSkipTLS }}
                                <input class="form-check-input" type="checkbox" name="skip" checked>
                                {{ else }}
                                <input class="form-check-input" type="checkbox" name="skip">
                                {{ end }}
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td><button type="submit" class="btn btn-primary">Save</button></td>
                        <td></td>
                    </tr>
                </form>
            </table>
            </div>
        </div>
            <div class="card border-primary mt-4 mb-4">
                <div class="card-header">About</div>
            <div class="card-body">
                <p>● After changing <b>Host</b> or <b>Port</b> the app must be restarted</p>
                <p>● <b>Timeout (minutes)</b> - how often watched ports are scanned</p>
                <p>● <b>Trim History</b> - how many port states are saved in memory and displayed on the <a href="/history/">History</a> page</p>
                <p>● If you find this app useful, please, <a href="https://github.com/aceberg#donate" target="_blank">donate</a></p>
                <p>● Commission your own app (Golang, HTML/JS). Contact and prices <a href="https://github.com/aceberg" target="_blank">here</a></p>
            </div>
        </div>
    </div>
    </div>
        

{{ template "footer.html" }}
{{ end }}