web UIs: fix dismissable alerts

alerts can now be shown again after the user dismissal

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2023-10-29 08:17:24 +01:00
parent 59378104b7
commit 8c31cc47b0
17 changed files with 127 additions and 37 deletions

View File

@@ -1231,7 +1231,7 @@ func (s *httpdServer) handleClientEditFile(w http.ResponseWriter, r *http.Reques
return return
} }
s.renderEditFilePage(w, r, name, b.String(), util.Contains(user.Filters.WebClient, sdk.WebClientWriteDisabled)) s.renderEditFilePage(w, r, name, b.String(), !user.CanAddFilesFromWeb(path.Dir(name)))
} }
func (s *httpdServer) handleClientAddShareGet(w http.ResponseWriter, r *http.Request) { func (s *httpdServer) handleClientAddShareGet(w http.ResponseWriter, r *http.Request) {

View File

@@ -28,12 +28,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">View and manage auto blocklist</h6> <h6 class="m-0 font-weight-bold text-primary">View and manage auto blocklist</h6>

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">View and manage event actions</h6> <h6 class="m-0 font-weight-bold text-primary">View and manage event actions</h6>

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successTxt" class="card-body"></div> <div id="successTxt" class="card-body"></div>
</div> </div>

View File

@@ -28,12 +28,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Search logs</h6> <h6 class="m-0 font-weight-bold text-primary">Search logs</h6>

View File

@@ -27,12 +27,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successTxt" class="card-body"></div> <div id="successTxt" class="card-body"></div>

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">

View File

@@ -27,12 +27,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">View and manage IP Lists</h6> <h6 class="m-0 font-weight-bold text-primary">View and manage IP Lists</h6>

View File

@@ -31,12 +31,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<div id="successTOTPMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successTOTPMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successTOTPTxt" class="card-body"></div> <div id="successTOTPTxt" class="card-body"></div>
</div> </div>
<div id="errorTOTPMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorTOTPMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTOTPTxt"></span> <span id="errorTOTPTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorTOTPMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorTOTPMsg(){
$('#errorTOTPMsg').hide();
}
</script>
<div> <div>
<p>Status: {{if .TOTPConfig.Enabled }}"Enabled". Current configuration: "{{.TOTPConfig.ConfigName}}"{{else}}"Disabled"{{end}}</p> <p>Status: {{if .TOTPConfig.Enabled }}"Enabled". Current configuration: "{{.TOTPConfig.ConfigName}}"{{else}}"Disabled"{{end}}</p>
</div> </div>
@@ -93,12 +98,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<div id="successRecCodesMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successRecCodesMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successRecCodesTxt" class="card-body"></div> <div id="successRecCodesTxt" class="card-body"></div>
</div> </div>
<div id="errorRecCodesMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorRecCodesMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorRecCodesTxt"></span> <span id="errorRecCodesTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorRecCodesMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorRecCodesMsg(){
$('#errorRecCodesMsg').hide();
}
</script>
<div> <div>
<p>Recovery codes are a set of one time use codes that can be used in place of the TOTP to login to the web UI. You can use them if you lose access to your phone to login to your account and disable or regenerate TOTP configuration.</p> <p>Recovery codes are a set of one time use codes that can be used in place of the TOTP to login to the web UI. You can use them if you lose access to your phone to login to your account and disable or regenerate TOTP configuration.</p>
<p>To keep your account secure, don't share or distribute your recovery codes. We recommend saving them with a secure password manager.</p> <p>To keep your account secure, don't share or distribute your recovery codes. We recommend saving them with a secure password manager.</p>

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">

View File

@@ -28,12 +28,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div id="successMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successTxt" class="card-body"></div> <div id="successTxt" class="card-body"></div>

View File

@@ -42,12 +42,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header"> <div class="card-header">
<h6 class="d-flex justify-content-between align-items-center"> <h6 class="d-flex justify-content-between align-items-center">

View File

@@ -31,12 +31,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<div id="successTOTPMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successTOTPMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successTOTPTxt" class="card-body"></div> <div id="successTOTPTxt" class="card-body"></div>
</div> </div>
<div id="errorTOTPMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorTOTPMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTOTPTxt"></span> <span id="errorTOTPTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorTOTPMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorTOTPMsg(){
$('#errorTOTPMsg').hide();
}
</script>
<div> <div>
<p>Status: {{if .TOTPConfig.Enabled }}"Enabled". Current configuration: "{{.TOTPConfig.ConfigName}}"{{else}}"Disabled"{{end}}</p> <p>Status: {{if .TOTPConfig.Enabled }}"Enabled". Current configuration: "{{.TOTPConfig.ConfigName}}"{{else}}"Disabled"{{end}}</p>
</div> </div>
@@ -118,12 +123,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
<div id="successRecCodesMsg" class="card mb-4 border-left-success" style="display: none;"> <div id="successRecCodesMsg" class="card mb-4 border-left-success" style="display: none;">
<div id="successRecCodesTxt" class="card-body"></div> <div id="successRecCodesTxt" class="card-body"></div>
</div> </div>
<div id="errorRecCodesMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorRecCodesMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorRecCodesTxt"></span> <span id="errorRecCodesTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorRecCodesMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorRecCodesMsg(){
$('#errorRecCodesMsg').hide();
}
</script>
<div> <div>
<p>Recovery codes are a set of one time use codes that can be used in place of the TOTP to login to the web UI. You can use them if you lose access to your phone to login to your account and disable or regenerate TOTP configuration.</p> <p>Recovery codes are a set of one time use codes that can be used in place of the TOTP to login to the web UI. You can use them if you lose access to your phone to login to your account and disable or regenerate TOTP configuration.</p>
<p>To keep your account secure, don't share or distribute your recovery codes. We recommend saving them with a secure password manager.</p> <p>To keep your account secure, don't share or distribute your recovery codes. We recommend saving them with a secure password manager.</p>

View File

@@ -46,12 +46,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
</button> </button>
</div> </div>
{{end}} {{end}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div id="tableContainer" class="table-responsive"> <div id="tableContainer" class="table-responsive">
<table class="table table-hover nowrap" id="dataTable" width="100%" cellspacing="0"> <table class="table table-hover nowrap" id="dataTable" width="100%" cellspacing="0">
<thead> <thead>

View File

@@ -26,12 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
{{end}} {{end}}
{{define "page_body"}} {{define "page_body"}}
<div id="errorMsg" class="alert alert-warning alert-dismissible fade show" style="display: none;" role="alert"> <div id="errorMsg" class="alert alert-warning fade show" style="display: none;" role="alert">
<span id="errorTxt"></span> <span id="errorTxt"></span>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <button type="button" class="close" aria-label="Close" onclick="dismissErrorMsg();">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<script type="text/javascript">
function dismissErrorMsg(){
$('#errorMsg').hide();
}
</script>
<div class="card shadow mb-4"> <div class="card shadow mb-4">
<div class="card-header py-3"> <div class="card-header py-3">