mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-08 07:10:56 +03:00
WIP new WebAdmin: maintenance page
Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
@@ -45,7 +45,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
|
||||
{{- if eq .Entry.Type 2}}
|
||||
<div class="form-group row mt-10">
|
||||
<label for="idMode" data-i18n="ip_list.mode" class="col-md-3 col-form-label">Mode</label>
|
||||
<label for="idMode" data-i18n="general.mode" class="col-md-3 col-form-label">Mode</label>
|
||||
<div class="col-md-9">
|
||||
<select id="idMode" name="mode" class="form-select" data-control="i18n-select2" data-hide-search="true">
|
||||
<option value="2" data-i18n="ip_list.deny" {{if eq .Entry.Mode 2 }}selected{{end}}>Deny</option>
|
||||
|
||||
@@ -62,7 +62,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
<tr class="text-start text-muted fw-bold fs-6 gs-0">
|
||||
<th data-i18n="ip_list.ip_net">IP/Network</th>
|
||||
<th data-i18n="ip_list.protocols">Protocols</th>
|
||||
<th data-i18n="ip_list.mode">Mode</th>
|
||||
<th data-i18n="general.mode">Mode</th>
|
||||
<th data-i18n="general.description">Description</th>
|
||||
<th class="min-w-100px"></th>
|
||||
</tr>
|
||||
|
||||
@@ -1,79 +1,98 @@
|
||||
<!--
|
||||
Copyright (C) 2019 Nicola Murino
|
||||
Copyright (C) 2024 Nicola Murino
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, version 3.
|
||||
This WebUI uses the KeenThemes Mega Bundle, a proprietary theme:
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
https://keenthemes.com/products/templates-mega-bundle
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
KeenThemes HTML/CSS/JS components are allowed for use only within the
|
||||
SFTPGo product and restricted to be used in a resealable HTML template
|
||||
that can compete with KeenThemes products anyhow.
|
||||
|
||||
This WebUI is allowed for use only within the SFTPGo product and
|
||||
therefore cannot be used in derivative works/products without an
|
||||
explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
-->
|
||||
{{template "base" .}}
|
||||
|
||||
{{define "title"}}{{.Title}}{{end}}
|
||||
|
||||
{{define "page_body"}}
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">Import</h6>
|
||||
{{- define "page_body"}}
|
||||
<div class="card shadow-sm">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="maintenance.restore" class="card-title section-title">Restore</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{if .Error}}
|
||||
<div class="alert alert-warning alert-dismissible fade show" role="alert">
|
||||
{{.Error}}
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
{{end}}
|
||||
{{- template "errmsg" .Error}}
|
||||
<form id="restore_form" enctype="multipart/form-data" action="{{.RestorePath}}" method="POST">
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="idBackupFile" class="col-sm-2 col-form-label">Backup file</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="file" class="form-control-file" id="idBackupFile" name="backup_file"
|
||||
aria-describedby="BackupFileHelpBlock">
|
||||
<small id="BackupFileHelpBlock" class="form-text text-muted">
|
||||
Import data from a JSON backup file
|
||||
</small>
|
||||
<label for="idBackupFile" data-i18n="maintenance.backup_file" class="col-md-3 col-form-label">Backup file</label>
|
||||
<div class="col-md-9">
|
||||
<input id="idBackupFile" type="file" accept="application/json" required class="form-control" name="backup_file" aria-describedby="idBackupFileHelp" />
|
||||
<div id="idBackupFileHelp" class="form-text" data-i18n="maintenance.backup_file_help"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="idMode" class="col-sm-2 col-form-label">Mode</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" id="idMode" name="mode">
|
||||
<option value="1">add only</option>
|
||||
<option value="0">add and update</option>
|
||||
<option value="2">add, update and disconnect</option>
|
||||
|
||||
<div class="form-group row mt-10">
|
||||
<label for="idMode" data-i18n="general.mode" class="col-md-3 col-form-label">Mode</label>
|
||||
<div class="col-md-9">
|
||||
<select id="idMode" name="mode" class="form-select" data-control="i18n-select2" data-hide-search="true">
|
||||
<option data-i18n="maintenance.restore_mode1" value="1">add only</option>
|
||||
<option data-i18n="maintenance.restore_mode0" value="0">add and update</option>
|
||||
<option data-i18n="maintenance.restore_mode2" value="2">add, update and disconnect</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="idQuota" class="col-sm-2 col-form-label">After restore</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" id="idQuota" name="quota">
|
||||
<option value="0">no quota update</option>
|
||||
<option value="1">update quota</option>
|
||||
<option value="2">update quota if the user has quota restrictions</option>
|
||||
|
||||
<div class="form-group row mt-10">
|
||||
<label for="idQuota" data-i18n="maintenance.after_restore" class="col-md-3 col-form-label">After restore</label>
|
||||
<div class="col-md-9">
|
||||
<select id="idQuota" name="quota" class="form-select" data-control="i18n-select2" data-hide-search="true">
|
||||
<option data-i18n="maintenance.quota_mode0" value="0">no quota update</option>
|
||||
<option data-i18n="maintenance.quota_mode1" value="1">update quota</option>
|
||||
<option data-i18n="maintenance.quota_mode2" value="2">update quota if the user has quota restrictions</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="_form_token" value="{{.CSRFToken}}">
|
||||
<button type="submit" class="btn btn-primary float-right mt-3 px-5">Import</button>
|
||||
|
||||
<div class="d-flex justify-content-end mt-12">
|
||||
<input type="hidden" name="_form_token" value="{{.CSRFToken}}">
|
||||
<button type="submit" id="form_submit" class="btn btn-primary px-10" name="form_action" value="submit">
|
||||
<span data-i18n="maintenance.restore" class="indicator-label">
|
||||
Restore
|
||||
</span>
|
||||
<span data-i18n="general.wait" class="indicator-progress">
|
||||
Please wait...
|
||||
<span class="spinner-border spinner-border-sm align-middle ms-2"></span>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card shadow mb-4">
|
||||
<div class="card-header py-3">
|
||||
<h6 class="m-0 font-weight-bold text-primary">Backup</h6>
|
||||
<div class="card shadow-sm mt-10">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="maintenance.backup" class="card-title section-title">Backup</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<a class="btn btn-primary" href="{{.BackupPath}}?output-data=1" target="_blank">Backup your data</a>
|
||||
<div>
|
||||
<a href="{{.BackupPath}}?output-data=1" target="_blank" class="btn btn-primary btn-block">
|
||||
<span data-i18n="maintenance.backup_do">Backup your data</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{- end}}
|
||||
|
||||
{{- define "extra_js"}}
|
||||
<script type="text/javascript" {{- if .CSPNonce}} nonce="{{.CSPNonce}}"{{- end}}>
|
||||
$(document).on("i18nshow", function(){
|
||||
$('#restore_form').submit(function (event) {
|
||||
let submitButton = document.querySelector('#form_submit');
|
||||
submitButton.setAttribute('data-kt-indicator', 'on');
|
||||
submitButton.disabled = true;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{{- end}}
|
||||
@@ -142,22 +142,39 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
|
||||
<div class="card mt-10">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="iplist.allow_list" class="card-title section-title-inner">Allow list</h3>
|
||||
<h3 data-i18n="general.data_provider" class="card-title section-title-inner">Database</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="fs-3 fw-semibold mb-4" {{if .Status.AllowList.IsActive}}data-i18n="status.active"{{else}}data-i18n="status.disabled"{{end}}></p>
|
||||
<p class="fs-3 fw-semibold mb-4">
|
||||
<span {{if .Status.DataProvider.IsActive}}data-i18n="status.active"{{else}}data-i18n="status.error" class="text-warning"{{end}}></span>
|
||||
{{if .Status.DataProvider.Error}} <span class="text-warning">"{{.Status.DataProvider.Error}}"</span>{{end}}
|
||||
</p>
|
||||
<div class="d-flex flex-column">
|
||||
<p class="fs-5 fw-semibold">
|
||||
<span class="text-success" data-i18n="general.driver"></span> "{{.Status.DataProvider.Driver}}"
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-10">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="iplist.defender_list" class="card-title section-title-inner">Defender</h3>
|
||||
<h3 data-i18n="ip_list.defender_list" class="card-title section-title-inner">Defender</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="fs-3 fw-semibold mb-4" {{if .Status.Defender.IsActive}}data-i18n="status.active"{{else}}data-i18n="status.disabled"{{end}}></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-10">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="ip_list.allow_list" class="card-title section-title-inner">Allow list</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="fs-3 fw-semibold mb-4" {{if .Status.AllowList.IsActive}}data-i18n="status.active"{{else}}data-i18n="status.disabled"{{end}}></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-10">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="status.rate_limiters" class="card-title section-title-inner">Rate limiters</h3>
|
||||
@@ -167,7 +184,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
{{- if .Status.RateLimiters.IsActive}}
|
||||
<div class="d-flex flex-column">
|
||||
<p class="fs-5 fw-semibold">
|
||||
<span class="text-success" data-i18n="iplist.protocols"></span> "{{.Status.RateLimiters.GetProtocolsAsString}}"
|
||||
<span class="text-success" data-i18n="ip_list.protocols"></span> "{{.Status.RateLimiters.GetProtocolsAsString}}"
|
||||
</p>
|
||||
</div>
|
||||
{{- end}}
|
||||
@@ -198,20 +215,6 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card mt-10">
|
||||
<div class="card-header bg-light">
|
||||
<h3 data-i18n="general.data_provider" class="card-title section-title-inner">Database</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p class="fs-3 fw-semibold mb-4" {{if .Status.DataProvider.IsActive}}data-i18n="status.active"{{else}}{{.Status.DataProvider.Error}}{{end}}></p>
|
||||
<div class="d-flex flex-column">
|
||||
<p class="fs-5 fw-semibold">
|
||||
<span class="text-success" data-i18n="general.driver"></span> "{{.Status.DataProvider.Driver}}"
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{- end}}
|
||||
Reference in New Issue
Block a user