2025-07-01 01:28:09 -07:00
// Code generated by templ - DO NOT EDIT.
2025-10-20 22:22:12 -07:00
// templ: version: v0.3.960
2025-07-01 01:28:09 -07:00
package app
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
"fmt"
"github.com/seaweedfs/seaweedfs/weed/admin/dash"
)
func ObjectStoreUsers ( data dash . ObjectStoreUsersData ) templ . Component {
return templruntime . GeneratedTemplate ( func ( templ_7745c5c3_Input templruntime . GeneratedComponentInput ) ( templ_7745c5c3_Err error ) {
templ_7745c5c3_W , ctx := templ_7745c5c3_Input . Writer , templ_7745c5c3_Input . Context
if templ_7745c5c3_CtxErr := ctx . Err ( ) ; templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer , templ_7745c5c3_IsBuffer := templruntime . GetBuffer ( templ_7745c5c3_W )
if ! templ_7745c5c3_IsBuffer {
defer func ( ) {
templ_7745c5c3_BufErr := templruntime . ReleaseBuffer ( templ_7745c5c3_Buffer )
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
} ( )
}
ctx = templ . InitializeContext ( ctx )
templ_7745c5c3_Var1 := templ . GetChildren ( ctx )
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ . NopComponent
}
ctx = templ . ClearChildren ( ctx )
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 1 , "<div class=\"container-fluid\"><!-- Page Header --><div class=\"d-sm-flex align-items-center justify-content-between mb-4\"><div><h1 class=\"h3 mb-0 text-gray-800\"><i class=\"fas fa-users me-2\"></i>Object Store Users</h1><p class=\"mb-0 text-muted\">Manage S3 API users and their access credentials</p></div><div class=\"d-flex gap-2\"><button type=\"button\" class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#createUserModal\"><i class=\"fas fa-plus me-1\"></i>Create User</button></div></div><!-- Summary Cards --><div class=\"row mb-4\"><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-primary shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-primary text-uppercase mb-1\">Total Users</div><div class=\"h5 mb-0 font-weight-bold text-gray-800\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , data . TotalUsers ) )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 38 , Col : 71 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var2 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-02 00:00:23 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 2 , "</div></div><div class=\"col-auto\"><i class=\"fas fa-users fa-2x text-gray-300\"></i></div></div></div></div></div><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-success shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-success text-uppercase mb-1\">Total Users</div><div class=\"h5 mb-0 font-weight-bold text-gray-800\">" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
2025-07-02 00:00:23 -07:00
templ_7745c5c3_Var3 , templ_7745c5c3_Err = templ . JoinStringErrs ( fmt . Sprintf ( "%d" , len ( data . Users ) ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
2025-07-02 00:00:23 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 58 , Col : 71 }
2025-07-01 01:28:09 -07:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var3 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 3 , "</div></div><div class=\"col-auto\"><i class=\"fas fa-user-check fa-2x text-gray-300\"></i></div></div></div></div></div><div class=\"col-xl-3 col-md-6 mb-4\"><div class=\"card border-left-info shadow h-100 py-2\"><div class=\"card-body\"><div class=\"row no-gutters align-items-center\"><div class=\"col mr-2\"><div class=\"text-xs font-weight-bold text-info text-uppercase mb-1\">Last Updated</div><div class=\"h6 mb-0 font-weight-bold text-gray-800\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4 , templ_7745c5c3_Err = templ . JoinStringErrs ( data . LastUpdated . Format ( "15:04" ) )
if templ_7745c5c3_Err != nil {
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 78 , Col : 69 }
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var4 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-02 00:00:23 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 4 , "</div></div><div class=\"col-auto\"><i class=\"fas fa-clock fa-2x text-gray-300\"></i></div></div></div></div></div></div><!-- Users Table --><div class=\"row\"><div class=\"col-12\"><div class=\"card shadow mb-4\"><div class=\"card-header py-3 d-flex flex-row align-items-center justify-content-between\"><h6 class=\"m-0 font-weight-bold text-primary\"><i class=\"fas fa-users me-2\"></i>Object Store Users</h6><div class=\"dropdown no-arrow\"><a class=\"dropdown-toggle\" href=\"#\" role=\"button\" data-bs-toggle=\"dropdown\"><i class=\"fas fa-ellipsis-v fa-sm fa-fw text-gray-400\"></i></a><div class=\"dropdown-menu dropdown-menu-right shadow animated--fade-in\"><div class=\"dropdown-header\">Actions:</div><a class=\"dropdown-item\" href=\"#\" onclick=\"exportUsers()\"><i class=\"fas fa-download me-2\"></i>Export List</a></div></div></div><div class=\"card-body\"><div class=\"table-responsive\"><table class=\"table table-hover\" width=\"100%\" cellspacing=\"0\" id=\"usersTable\"><thead><tr><th>Username</th><th>Email</th><th>Access Key</th><th>Actions</th></tr></thead> <tbody>" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _ , user := range data . Users {
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 5 , "<tr><td><div class=\"d-flex align-items-center\"><i class=\"fas fa-user me-2 text-muted\"></i> <strong>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . Username )
if templ_7745c5c3_Err != nil {
2025-07-02 00:00:23 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 127 , Col : 74 }
2025-07-01 01:28:09 -07:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var5 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 6 , "</strong></div></td><td>" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . Email )
if templ_7745c5c3_Err != nil {
2025-07-02 00:00:23 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 130 , Col : 59 }
2025-07-01 01:28:09 -07:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var6 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 7 , "</td><td><code class=\"text-muted\">" )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . AccessKey )
if templ_7745c5c3_Err != nil {
2025-07-02 00:00:23 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 132 , Col : 88 }
2025-07-01 01:28:09 -07:00
}
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var7 ) )
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 8 , "</code></td><td><div class=\"btn-group btn-group-sm\" role=\"group\"><button type=\"button\" class=\"btn btn-outline-info\" data-action=\"show-user-details\" data-username=\"" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . Username )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
2025-07-11 13:03:04 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 137 , Col : 121 }
2025-07-01 01:28:09 -07:00
}
2025-07-11 13:03:04 -07:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var8 ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 9 , "\"><i class=\"fas fa-info-circle\"></i></button> <button type=\"button\" class=\"btn btn-outline-primary\" data-action=\"edit-user\" data-username=\"" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . Username )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
2025-07-11 13:03:04 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 141 , Col : 113 }
2025-07-01 01:28:09 -07:00
}
2025-07-11 13:03:04 -07:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var9 ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 10 , "\"><i class=\"fas fa-edit\"></i></button> <button type=\"button\" class=\"btn btn-outline-secondary\" data-action=\"manage-access-keys\" data-username=\"" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . Username )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
2025-07-11 13:03:04 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 145 , Col : 122 }
2025-07-01 01:28:09 -07:00
}
2025-07-11 13:03:04 -07:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var10 ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 11 , "\"><i class=\"fas fa-key\"></i></button> <button type=\"button\" class=\"btn btn-outline-danger\" data-action=\"delete-user\" data-username=\"" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11 , templ_7745c5c3_Err = templ . JoinStringErrs ( user . Username )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
2025-07-11 13:03:04 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 149 , Col : 115 }
2025-07-01 01:28:09 -07:00
}
2025-07-11 13:03:04 -07:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var11 ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 12 , "\"><i class=\"fas fa-trash\"></i></button></div></td></tr>" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
if len ( data . Users ) == 0 {
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 13 , "<tr><td colspan=\"4\" class=\"text-center text-muted py-4\"><i class=\"fas fa-users fa-3x mb-3 text-muted\"></i><div><h5>No users found</h5><p>Create your first object store user to get started.</p></div></td></tr>" )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
2025-07-11 13:03:04 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 14 , "</tbody></table></div></div></div></div></div><!-- Last Updated --><div class=\"row\"><div class=\"col-12\"><small class=\"text-muted\"><i class=\"fas fa-clock me-1\"></i> Last updated: " )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-02 00:00:23 -07:00
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12 , templ_7745c5c3_Err = templ . JoinStringErrs ( data . LastUpdated . Format ( "2006-01-02 15:04:05" ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
2025-07-11 13:03:04 -07:00
return templ . Error { Err : templ_7745c5c3_Err , FileName : ` view/app/object_store_users.templ ` , Line : 180 , Col : 81 }
2025-07-01 01:28:09 -07:00
}
2025-07-02 00:00:23 -07:00
_ , templ_7745c5c3_Err = templ_7745c5c3_Buffer . WriteString ( templ . EscapeString ( templ_7745c5c3_Var12 ) )
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
2025-07-13 20:29:25 -07:00
templ_7745c5c3_Err = templruntime . WriteString ( templ_7745c5c3_Buffer , 15 , "</small></div></div></div><!-- Create User Modal --><div class=\"modal fade\" id=\"createUserModal\" tabindex=\"-1\" role=\"dialog\"><div class=\"modal-dialog\" role=\"document\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\"><i class=\"fas fa-user-plus me-2\"></i>Create New User</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\"></button></div><div class=\"modal-body\"><form id=\"createUserForm\"><div class=\"mb-3\"><label for=\"username\" class=\"form-label\">Username *</label> <input type=\"text\" class=\"form-control\" id=\"username\" name=\"username\" required></div><div class=\"mb-3\"><label for=\"email\" class=\"form-label\">Email</label> <input type=\"email\" class=\"form-control\" id=\"email\" name=\"email\"></div><div class=\"mb-3\"><label for=\"actions\" class=\"form-label\">Permissions</label> <select multiple class=\"form-control\" id=\"actions\" name=\"actions\" size=\"10\"><option value=\"Admin\">Admin (Full Access)</option> <option value=\"Read\">Read</option> <option value=\"Write\">Write</option> <option value=\"List\">List</option> <option value=\"Tagging\">Tagging</option> <optgroup label=\"Object Lock Permissions\"><option value=\"BypassGovernanceRetention\">Bypass Governance Retention</option> <option value=\"GetObjectRetention\">Get Object Retention</option> <option value=\"PutObjectRetention\">Put Object Retention</option> <option value=\"GetObjectLegalHold\">Get Object Legal Hold</option> <option value=\"PutObjectLegalHold\">Put Object Legal Hold</option> <option value=\"GetBucketObjectLockConfiguration\">Get Bucket Object Lock Configuration</option> <option value=\"PutBucketObjectLockConfiguration\">Put Bucket Object Lock Configuration</option></optgroup></select> <small class=\"form-text text-muted\">Hold Ctrl/Cmd to select multiple permissions</small></div><div class=\"mb-3 form-check\"><input type=\"checkbox\" class=\"form-check-input\" id=\"generateKey\" name=\"generateKey\" checked> <label class=\"form-check-label\" for=\"generateKey\">Generate access key automatically</label></div></form></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Cancel</button> <button type=\"button\" class=\"btn btn-primary\" onclick=\"handleCreateUser()\">Create User</button></div></div></div></div><!-- Edit User Modal --><div class=\"modal fade\" id=\"editUserModal\" tabindex=\"-1\" role=\"dialog\"><div class=\"modal-dialog\" role=\"document\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\"><i class=\"fas fa-user-edit me-2\"></i>Edit User</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\"></button></div><div class=\"modal-body\"><form id=\"editUserForm\"><input type=\"hidden\" id=\"editUsername\" name=\"username\"><div class=\"mb-3\"><label for=\"editEmail\" class=\"form-label\">Email</label> <input type=\"email\" class=\"form-control\" id=\"editEmail\" name=\"email\"></div><div class=\"mb-3\"><label for=\"editActions\" class=\"form-label\">Permissions</label> <select multiple class=\"form-control\" id=\"editActions\" name=\"actions\" size=\"10\"><option value=\"Admin\">Admin (Full Access)</option> <option value=\"Read\">Read</option> <option value=\"Write\">Write</option> <option value=\"List\">List</option> <option value=\"Tagging\">Tagging</option> <optgroup label=\"Object Lock Permissions\"><option value=\"BypassGovernanceRetention\">Bypass Governance Retention</option> <option value=\"GetObjectRetention\">Get Object Retention</option> <option value=\"PutObjectRetention\">Put Object Retention</option> <option value=\"GetObjectLegalHold\">Get Object Legal Hold</option> <option value=\"PutObjectLegalHold\">Put Object Legal Hold</option> <option value=\"GetBucketObjectLockConfiguration\">Get Bucket Object Lock Configuration</option> <option value=\"PutBucketObjectLockConfiguration\" > Put Bucket Object Lock Configuration < / option > < / optgroup > < / select > < / div > < / form >
2025-07-01 01:28:09 -07:00
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
} )
}
// Helper functions for template
var _ = templruntime . GeneratedTemplate