webui: add responsive extension

This commit is contained in:
Nicola Murino
2021-03-28 11:02:11 +02:00
parent 2a89a8f664
commit 183bedd6ed
21 changed files with 414 additions and 207 deletions

View File

@@ -874,6 +874,10 @@ func (u *User) GetQuotaSummary() string {
result += "/" + utils.ByteCountIEC(u.QuotaSize)
}
}
if u.LastQuotaUpdate > 0 {
t := utils.GetTimeFromMsecSinceEpoch(u.LastQuotaUpdate)
result += fmt.Sprintf(". Last update: %v ", t.Format("2006-01-02 15:04")) // YYYY-MM-DD HH:MM
}
return result
}
@@ -901,13 +905,13 @@ func (u *User) GetPermissionsAsString() string {
// GetBandwidthAsString returns bandwidth limits if defines
func (u *User) GetBandwidthAsString() string {
result := "Download: "
result := "DL: "
if u.DownloadBandwidth > 0 {
result += utils.ByteCountIEC(u.DownloadBandwidth*1000) + "/s."
} else {
result += "unlimited."
}
result += " Upload: "
result += " UL: "
if u.UploadBandwidth > 0 {
result += utils.ByteCountIEC(u.UploadBandwidth*1000) + "/s."
} else {
@@ -923,7 +927,7 @@ func (u *User) GetInfoString() string {
var result string
if u.LastLogin > 0 {
t := utils.GetTimeFromMsecSinceEpoch(u.LastLogin)
result += fmt.Sprintf("Last login: %v ", t.Format("2006-01-02 15:04:05")) // YYYY-MM-DD HH:MM:SS
result += fmt.Sprintf("Last login: %v ", t.Format("2006-01-02 15:04")) // YYYY-MM-DD HH:MM
}
switch u.FsConfig.Provider {
case vfs.S3FilesystemProvider:
@@ -958,6 +962,17 @@ func (u *User) GetInfoString() string {
return result
}
// GetStatusAsString returns the user status as a string
func (u *User) GetStatusAsString() string {
if u.ExpirationDate > 0 && u.ExpirationDate < utils.GetTimeAsMsSinceEpoch(time.Now()) {
return "Expired"
}
if u.Status == 1 {
return "Active"
}
return "Inactive"
}
// GetExpirationDateAsString returns expiration date formatted as YYYY-MM-DD
func (u *User) GetExpirationDateAsString() string {
if u.ExpirationDate > 0 {