From 2b9ba1d5205ec4b1afbd25bcb49d995ac082895d Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Sat, 23 Jan 2021 09:28:45 +0100 Subject: [PATCH] web admin: try to uniform UI --- sftpd/sftpd_test.go | 4 +- templates/connections.html | 12 +-- templates/maintenance.html | 4 - templates/message.html | 30 ++++--- templates/status.html | 173 +++++++++++++++++++------------------ 5 files changed, 119 insertions(+), 104 deletions(-) diff --git a/sftpd/sftpd_test.go b/sftpd/sftpd_test.go index 9c656f5a..82ef6f3b 100644 --- a/sftpd/sftpd_test.go +++ b/sftpd/sftpd_test.go @@ -2944,7 +2944,9 @@ func TestBandwidthAndConnections(t *testing.T) { } err = <-c assert.Error(t, err, "connection closed while uploading: the upload must fail") - assert.Eventually(t, func() bool { return len(common.Connections.GetStats()) == 0 }, 1*time.Second, 50*time.Millisecond) + assert.Eventually(t, func() bool { + return len(common.Connections.GetStats()) == 0 + }, 10*time.Second, 200*time.Millisecond) err = os.Remove(testFilePath) assert.NoError(t, err) err = os.Remove(localDownloadPath) diff --git a/templates/connections.html b/templates/connections.html index 2d970ab1..4bc235f9 100644 --- a/templates/connections.html +++ b/templates/connections.html @@ -13,12 +13,12 @@
-{{if .Connections}}
View and manage connections
+ {{if .Connections}}
@@ -43,13 +43,13 @@
+ {{else}} +
+
No user connected
+
+ {{end}}
-{{else}} -
-
No user connected
-
-{{end}} {{end}} {{define "dialog"}} diff --git a/templates/maintenance.html b/templates/maintenance.html index d4b6fab8..0767c7e8 100644 --- a/templates/maintenance.html +++ b/templates/maintenance.html @@ -58,7 +58,3 @@ {{end}} - -{{define "extra_js"}} - -{{end}} \ No newline at end of file diff --git a/templates/message.html b/templates/message.html index c017c7c8..ff23c6e5 100644 --- a/templates/message.html +++ b/templates/message.html @@ -3,19 +3,26 @@ {{define "title"}}{{.Title}}{{end}} {{define "page_body"}} -{{if .LoggedAdmin.Username}} -

{{.Title}}

-{{if .Error}} -
-
{{.Error}}
-
-{{end}} -{{if .Success}} -
-
{{.Success}}
+{{if .LoggedAdmin.Username}} +
+
+
{{.Title}}
+
+
+ {{if .Error}} +
+
{{.Error}}
+
+ {{end}} + + {{if .Success}} +
+
{{.Success}}
+
+ {{end}} +
-{{end}} {{else}}
@@ -48,4 +55,5 @@
{{end}} + {{end}} \ No newline at end of file diff --git a/templates/status.html b/templates/status.html index a7af9580..1999fc81 100644 --- a/templates/status.html +++ b/templates/status.html @@ -4,93 +4,102 @@ {{define "page_body"}} -
-
-
SFTP/SSH server
-

- Status: {{ if .Status.SSH.IsActive}}"Started"{{else}}"Stopped"{{end}} - {{if .Status.SSH.IsActive}} -
- {{range .Status.SSH.Bindings}} -
- Address: "{{.GetAddress}}" {{if .HasProxy}}Proxy: ON{{end}} -
- {{end}} - Accepted commands: "{{.Status.SSH.GetSSHCommandsAsString}}" -
- {{range .Status.SSH.HostKeys}} -
- Host Key: "{{.Path}}" -
- Fingerprint: "{{.Fingerprint}}" -
- {{end}} - {{end}} -

+
+
+
Services
-
- -
-
FTP server
-

- Status: {{ if .Status.FTP.IsActive}}"Started"{{else}}"Stopped"{{end}} - {{if .Status.FTP.IsActive}} -
- {{range .Status.FTP.Bindings}} -
- Address: "{{.GetAddress}}" {{if .HasProxy}}Proxy: ON{{end}} -
- TLS: "{{.GetTLSDescription}}" - {{if .ForcePassiveIP}} -
- PassiveIP: {{.ForcePassiveIP}} - {{end}} -
- {{end}} -
- Passive port range: "{{.Status.FTP.PassivePortRange.Start}}-{{.Status.FTP.PassivePortRange.End}}" - {{end}} -

-
-
+
+
+
SFTP/SSH server
+

+ Status: {{ if .Status.SSH.IsActive}}"Started"{{else}}"Stopped"{{end}} + {{if .Status.SSH.IsActive}} +
+ {{range .Status.SSH.Bindings}} +
+ Address: "{{.GetAddress}}" {{if .HasProxy}}Proxy: ON{{end}} +
+ {{end}} + Accepted commands: "{{.Status.SSH.GetSSHCommandsAsString}}" +
+ {{range .Status.SSH.HostKeys}} +
+ Host Key: "{{.Path}}" +
+ Fingerprint: "{{.Fingerprint}}" +
+ {{end}} + {{end}} +

+
+
-
-
-
WebDAV server
-

- Status: {{ if .Status.WebDAV.IsActive}}"Started"{{else}}"Stopped"{{end}} - {{if .Status.WebDAV.IsActive}} -
- {{range .Status.WebDAV.Bindings}} -
- Address: "{{.GetAddress}}" -
- Protocol: {{if .EnableHTTPS}} HTTPS {{else}} HTTP {{end}} -
- {{end}} - {{end}} -

-
-
+
+
+
FTP server
+

+ Status: {{ if .Status.FTP.IsActive}}"Started"{{else}}"Stopped"{{end}} + {{if .Status.FTP.IsActive}} +
+ {{range .Status.FTP.Bindings}} +
+ Address: "{{.GetAddress}}" {{if .HasProxy}}Proxy: ON{{end}} +
+ TLS: "{{.GetTLSDescription}}" + {{if .ForcePassiveIP}} +
+ PassiveIP: {{.ForcePassiveIP}} + {{end}} +
+ {{end}} +
+ Passive port range: "{{.Status.FTP.PassivePortRange.Start}}-{{.Status.FTP.PassivePortRange.End}}" + {{end}} +

+
+
-
-
-
Defender
-

- Status: {{ if .Status.Defender.IsActive}}"Enabled"{{else}}"Disabled"{{end}} -

-
-
+
+
+
WebDAV server
+

+ Status: {{ if .Status.WebDAV.IsActive}}"Started"{{else}}"Stopped"{{end}} + {{if .Status.WebDAV.IsActive}} +
+ {{range .Status.WebDAV.Bindings}} +
+ Address: "{{.GetAddress}}" +
+ Protocol: {{if .EnableHTTPS}} HTTPS {{else}} HTTP {{end}} +
+ {{end}} + {{end}} +

+
+
+ +
+
+
Defender
+

+ Status: {{ if .Status.Defender.IsActive}}"Enabled"{{else}}"Disabled"{{end}} +

+
+
+ +
+
+
Data provider
+

+ Status: {{ if .Status.DataProvider.IsActive}}"OK"{{else}}"{{.Status.DataProvider.Error}}"{{end}} +
+ Driver: "{{.Status.DataProvider.Driver}}" +

+
+
-
-
-
Data provider
-

- Status: {{ if .Status.DataProvider.IsActive}}"OK"{{else}}"{{.Status.DataProvider.Error}}"{{end}} -
- Driver: "{{.Status.DataProvider.Driver}}" -