8_User_Interface_Components - Anisan/osysHome-Users GitHub Wiki
Relevant source files
The following files were used as context for generating this wiki page:
This document provides a detailed overview of the user interface components in the osysHome-Users system. It focuses on the template structure, layout patterns, and interactive elements that constitute the user management interface. For information about the data structures and forms that populate these templates, see User Data Models and Forms.
The osysHome-Users plugin utilizes a layered template architecture with a consistent layout inheritance pattern. All UI components extend a common administrative layout to maintain visual consistency throughout the user management interface.
graph TD
A["layouts/module_admin.html"] --> B["templates/users.html"]
A --> C["templates/user.html"]
A --> D["templates/password.html"]
subgraph "User Management Views"
B["users.html<br>(User List)"]
C["user.html<br>(User Profile)"]
D["password.html<br>(Password Management)"]
end
E["CSS/JavaScript Assets"] --> B
E --> C
E --> D
F["Form Data"] --> B
F --> C
F --> D
Sources: templates/user.html:1-6, templates/users.html:1-4, templates/password.html:1-5
Each template in the user management system shares several common elements that create a unified user experience:
- Breadcrumb Navigation: Provides hierarchical context and navigation
- Form Error Handling: Consistent display of validation errors
- Action Buttons: Standardized button styling and positioning
- Responsive Layout: Bootstrap-based grid system for device adaptability
classDiagram
class "Base Template" {
+breadcrumb navigation
+content area
+error handling
+responsive grid
}
class "User List Template" {
+user table
+action buttons
+avatar thumbnails
}
class "User Profile Template" {
+profile form
+avatar upload
+API key generator
}
class "Password Template" {
+password form
+validation rules
}
"Base Template" <|-- "User List Template"
"Base Template" <|-- "User Profile Template"
"Base Template" <|-- "Password Template"
Sources: templates/user.html:7-15, templates/users.html:5, templates/password.html:7-15
The user list interface provides a tabular view of all users in the system with options to add, edit, delete users, and manage their passwords.
Component | Description | Source Location |
---|---|---|
Add User Button | Creates a new user | templates/users.html:6 |
User Table | Displays user information in columns | templates/users.html:7-35 |
Action Buttons | Edit, Password, Delete operations | templates/users.html:28-30 |
Avatar Thumbnails | Small user profile images | templates/users.html:21-22 |
The interface displays the following user information:
- Username with avatar
- Role
- Home page
- Last login timestamp
- Action buttons for each user
graph TD
A["User List View<br>(users.html)"] --> B["Add User Button"]
A --> C["User Table"]
C --> D["User Entry"]
D --> D1["Avatar Thumbnail"]
D --> D2["Username"]
D --> D3["Role"]
D --> D4["Home Page"]
D --> D5["Last Login"]
D --> D6["Action Buttons"]
D6 --> E["Edit User<br>(?op=edit)"]
D6 --> F["Set Password<br>(?op=setPassword)"]
D6 --> G["Delete User<br>(?op=delete)"]
B --> H["Create User Form<br>(?op=add)"]
Sources: templates/users.html
The user profile interface is a comprehensive form for creating or editing user information. It features a two-column layout with an avatar display on the left and profile details on the right.
graph TD
A["User Profile View<br>(user.html)"] --> B["Profile Card"]
A --> C["Form Card"]
B --> B1["Avatar Display"]
B --> B2["Upload Button"]
B --> B3["Username Display"]
B --> B4["Role Display"]
B --> B5["Last Login Display"]
C --> C1["Username Field"]
C --> C2["Role Selector"]
C --> C3["Home Page Field"]
C --> C4["Timezone Field"]
C --> C5["API Key Field"]
C --> C6["Generate Key Button"]
C --> C7["Submit/Cancel Buttons"]
B2 --> D["Upload Modal Dialog"]
D --> D1["File Selector"]
D --> D2["Upload Button"]
style A fill:white
style B fill:white
style C fill:white
style D fill:white
Sources: templates/user.html:30-92
The user profile interface includes an avatar upload functionality implemented through a modal dialog box. When the user clicks the upload button, a modal appears with a file selection field and upload button.
Key components of the avatar upload system:
- Circular avatar display with upload button overlay
- Modal dialog for file selection
- AJAX-based file upload with immediate preview update
- Fallback to default avatar when image is unavailable
sequenceDiagram
participant User
participant UI as "User Interface"
participant Modal as "Upload Modal"
participant Ajax as "AJAX Request"
participant Server as "Users Plugin"
User->>UI: Click upload button
UI->>Modal: Show upload dialog
User->>Modal: Select image file
User->>Modal: Click "Upload"
Modal->>Ajax: Submit form data
Ajax->>Server: POST to "Users?op=upload_image"
Server-->>Ajax: Return image URL
Ajax-->>UI: Update avatar src attribute
UI-->>User: Display new avatar
Sources: templates/user.html:16-29, templates/user.html:94-140
The user profile includes a feature to generate secure API keys. This functionality is implemented through client-side JavaScript that creates cryptographically random keys when the user clicks the "Generate key" button.
Key aspects of the API key generation:
- Input field with accompanying button
- Client-side secure random generation using Web Crypto API
- Formatted output with hyphens every 4 characters
Sources: templates/user.html:73-83, templates/user.html:141-157
The password management interface provides a simple form for changing user passwords. It includes two password fields (password and confirmation) with validation to ensure they match.
graph TD
A["Password Management View<br>(password.html)"] --> B["Form Error Display"]
A --> C["Password Form"]
C --> C1["Password Field"]
C --> C2["Repeat Password Field"]
C --> C3["Submit Button"]
C --> C4["Cancel Button"]
style A fill:white
style B fill:white
style C fill:white
Sources: templates/password.html:16-33
The password form includes validation to ensure password requirements are met. Error messages are displayed at the top of the form when validation fails.
sequenceDiagram
participant User
participant Form as "Password Form"
participant Server as "Users Plugin"
participant Validator as "Form Validator"
User->>Form: Enter password
User->>Form: Enter confirmation
User->>Form: Submit form
Form->>Server: POST form data
Server->>Validator: Validate passwords
alt Validation fails
Validator-->>Server: Return errors
Server-->>Form: Render with errors
Form-->>User: Display error messages
else Validation succeeds
Validator-->>Server: Confirm valid
Server-->>User: Redirect to Users list
end
Sources: templates/password.html:7-15
All templates receive data from the plugin controller, which gathers user information from the application's data layer. The forms are populated with this data, and user changes are submitted back to the controller for processing.
graph TD
A["Plugin Controller<br>(__init__.py)"] --> B["Template Rendering"]
C["User Data"] --> A
D["Form Data"] --> A
B --> E["users.html"]
B --> F["user.html"]
B --> G["password.html"]
E --> H["User Actions"]
F --> H
G --> H
H --> A
subgraph "Input Processing"
D
H
end
subgraph "Data Access"
C
end
subgraph "View Rendering"
B
E
F
G
end
Sources: templates/user.html, templates/users.html, templates/password.html
The UI components are tightly integrated with form objects defined in the forms directory. Each template displays a specific form:
Template | Associated Form | Purpose |
---|---|---|
user.html | UserForm | Edit user profile information |
password.html | PasswordForm | Change user password |
users.html | N/A (display only) | List all users |
For detailed information about the form implementations, see User Profile Form and Password Management Form.
Sources: templates/user.html:53-88, templates/password.html:17-33