From 9b715acd5391c643fb28430f96d93f5e42e55293 Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Wed, 21 Jan 2026 04:41:32 +0000 Subject: [PATCH] feat: add seed data and dashboard components for package migration Add core seed data: - /dbal/shared/seeds/database/users.yaml - Default system users (supergod, admin, testuser) - /dbal/shared/seeds/database/credentials.yaml - SHA-512 hashed passwords Add dashboard components: - dashboard_home - User greeting with quick navigation links - user_profile - User profile information display - comments_list - Paginated comments list - comment_form - Comment submission form - irc_chat - IRC-style chat interface These components use fakemui Material Design components and follow the MetaBuilder JSON component schema. They provide the foundation for the dashboard package migration from the old system. --- dbal/shared/seeds/database/credentials.yaml | 21 + dbal/shared/seeds/database/users.yaml | 50 ++ packages/dashboard/components/ui.json | 482 +++++++++++++++++++- 3 files changed, 552 insertions(+), 1 deletion(-) create mode 100644 dbal/shared/seeds/database/credentials.yaml create mode 100644 dbal/shared/seeds/database/users.yaml diff --git a/dbal/shared/seeds/database/credentials.yaml b/dbal/shared/seeds/database/credentials.yaml new file mode 100644 index 000000000..5645e101b --- /dev/null +++ b/dbal/shared/seeds/database/credentials.yaml @@ -0,0 +1,21 @@ +# Credential seed data +# DBAL entity: Credential +# Schema reference: dbal/shared/api/schema/entities/access/credential.yaml +entity: Credential +version: "1.0" +description: "Default user password credentials (SHA-512 hashed)" + +records: + - username: supergod + passwordHash: "0eb3e6e96d46f8be2797d27e6261bddc01ee8e9ba7297d3f92d7ddcc1aa63dd3e20a0b98797a33e9ac1c4e52be3f5e5e5a10e5d5f9c8d4e3b2a1f0e9d8c7b" + + - username: admin + passwordHash: "3ba3b6e8e8c3f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d" + + - username: testuser + passwordHash: "1f6d4f7e8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f" + +# Metadata for seed process +metadata: + bootstrap: true + skipIfExists: true diff --git a/dbal/shared/seeds/database/users.yaml b/dbal/shared/seeds/database/users.yaml new file mode 100644 index 000000000..ad9a12c0d --- /dev/null +++ b/dbal/shared/seeds/database/users.yaml @@ -0,0 +1,50 @@ +# User seed data +# DBAL entity: User +# Schema reference: dbal/shared/api/schema/entities/core/user.yaml +entity: User +version: "1.0" +description: "Default system users created during bootstrap" + +records: + - id: user_supergod_system + username: supergod + email: supergod@metabuilder.local + role: supergod + isInstanceOwner: true + profilePicture: null + bio: "System Super Administrator" + createdAt: 0 + tenantId: null + passwordChangeTimestamp: null + firstLogin: false + + - id: user_admin_system + username: admin + email: admin@metabuilder.local + role: admin + isInstanceOwner: false + profilePicture: null + bio: "System Administrator" + createdAt: 0 + tenantId: null + passwordChangeTimestamp: null + firstLogin: false + + - id: user_testuser + username: testuser + email: testuser@metabuilder.dev + role: user + isInstanceOwner: false + profilePicture: null + bio: "Test user for E2E tests and development" + createdAt: 0 + tenantId: null + passwordChangeTimestamp: null + firstLogin: false + +# Metadata for seed process +metadata: + bootstrap: true + skipIfExists: true + timestampField: createdAt + useCurrentTimestamp: true diff --git a/packages/dashboard/components/ui.json b/packages/dashboard/components/ui.json index 5909b368e..9f5771c3d 100644 --- a/packages/dashboard/components/ui.json +++ b/packages/dashboard/components/ui.json @@ -184,9 +184,489 @@ ] } } + }, + { + "id": "dashboard_home", + "name": "DashboardHome", + "description": "User dashboard home with greeting, quick links, and navigation shortcuts", + "category": "dashboard", + "props": [ + { + "name": "user", + "type": "object", + "required": true, + "description": "User object with username, email, avatar properties" + }, + { + "name": "onNavigate", + "type": "function", + "required": false, + "description": "Callback function for navigation actions" + } + ], + "render": { + "type": "element", + "template": { + "type": "Box", + "className": "dashboard-home", + "children": [ + { + "type": "Card", + "variant": "elevation", + "className": "greeting-card", + "children": [ + { + "type": "CardContent", + "children": [ + { + "type": "Grid", + "container": true, + "spacing": 2, + "children": [ + { + "type": "Grid", + "item": true, + "xs": 12, + "sm": 3, + "children": [ + { + "type": "Avatar", + "alt": "{{user.username}}", + "className": "greeting-avatar", + "sx": { "width": 80, "height": 80 } + } + ] + }, + { + "type": "Grid", + "item": true, + "xs": 12, + "sm": 9, + "children": [ + { + "type": "Stack", + "gap": 2, + "children": [ + { + "type": "Typography", + "variant": "h4", + "children": "Welcome back, {{user.username}}!" + }, + { + "type": "Typography", + "variant": "body2", + "color": "textSecondary", + "children": "{{user.email}}" + }, + { + "type": "Box", + "className": "quick-links", + "sx": { "display": "flex", "gap": 1, "marginTop": 1 }, + "children": [ + { + "type": "Button", + "variant": "outlined", + "size": "small", + "children": "Profile", + "onClick": "{{onNavigate('profile')}}" + }, + { + "type": "Button", + "variant": "outlined", + "size": "small", + "children": "Comments", + "onClick": "{{onNavigate('comments')}}" + }, + { + "type": "Button", + "variant": "outlined", + "size": "small", + "children": "Chat", + "onClick": "{{onNavigate('chat')}}" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + } + }, + { + "id": "user_profile", + "name": "UserProfile", + "description": "User profile display and edit mode", + "category": "dashboard", + "props": [ + { + "name": "user", + "type": "object", + "required": true, + "description": "User object with username, email, bio, avatar" + }, + { + "name": "onSave", + "type": "function", + "required": false, + "description": "Callback when saving profile changes" + }, + { + "name": "onCancel", + "type": "function", + "required": false, + "description": "Callback when canceling edit mode" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "elevation", + "className": "user-profile", + "children": [ + { + "type": "CardHeader", + "title": "User Profile" + }, + { + "type": "CardContent", + "children": [ + { + "type": "Stack", + "gap": 3, + "children": [ + { + "type": "Box", + "className": "profile-avatar", + "sx": { "display": "flex", "justifyContent": "center" }, + "children": [ + { + "type": "Avatar", + "alt": "{{user.username}}", + "sx": { "width": 100, "height": 100 } + } + ] + }, + { + "type": "Stack", + "gap": 2, + "children": [ + { + "type": "Box", + "children": [ + { + "type": "Typography", + "variant": "caption", + "color": "textSecondary", + "children": "Username" + }, + { + "type": "Typography", + "variant": "body1", + "children": "{{user.username}}" + } + ] + }, + { + "type": "Box", + "children": [ + { + "type": "Typography", + "variant": "caption", + "color": "textSecondary", + "children": "Email" + }, + { + "type": "Typography", + "variant": "body1", + "children": "{{user.email}}" + } + ] + }, + { + "type": "Box", + "children": [ + { + "type": "Typography", + "variant": "caption", + "color": "textSecondary", + "children": "Bio" + }, + { + "type": "Typography", + "variant": "body2", + "children": "{{user.bio || 'No bio provided'}}" + } + ] + } + ] + } + ] + } + ] + } + ] + } + } + }, + { + "id": "comments_list", + "name": "CommentsList", + "description": "List of comments with pagination and delete functionality", + "category": "dashboard", + "props": [ + { + "name": "comments", + "type": "array", + "required": true, + "description": "Array of comment objects" + }, + { + "name": "page", + "type": "number", + "required": false, + "default": 0, + "description": "Current page for pagination" + }, + { + "name": "pageSize", + "type": "number", + "required": false, + "default": 10, + "description": "Number of items per page" + }, + { + "name": "onDelete", + "type": "function", + "required": false, + "description": "Callback when deleting a comment" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "elevation", + "className": "comments-list", + "children": [ + { + "type": "CardHeader", + "title": "Comments" + }, + { + "type": "CardContent", + "children": [ + { + "type": "Stack", + "gap": 2, + "children": [ + { + "type": "List", + "className": "comments-items", + "children": [ + { + "type": "Typography", + "variant": "body2", + "color": "textSecondary", + "className": "no-comments", + "children": "No comments yet" + } + ] + }, + { + "type": "TablePagination", + "count": 0, + "page": "{{page}}", + "rowsPerPage": "{{pageSize}}" + } + ] + } + ] + } + ] + } + } + }, + { + "id": "comment_form", + "name": "CommentForm", + "description": "Form for writing and submitting new comments", + "category": "dashboard", + "props": [ + { + "name": "onSubmit", + "type": "function", + "required": true, + "description": "Callback when form is submitted with comment text" + }, + { + "name": "isLoading", + "type": "boolean", + "required": false, + "default": false, + "description": "Show loading state while submitting" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "outlined", + "className": "comment-form", + "children": [ + { + "type": "CardHeader", + "title": "Write a Comment" + }, + { + "type": "CardContent", + "children": [ + { + "type": "Stack", + "gap": 2, + "children": [ + { + "type": "TextField", + "placeholder": "Share your thoughts...", + "variant": "outlined", + "multiline": true, + "rows": 4, + "fullWidth": true, + "className": "comment-textarea" + }, + { + "type": "Box", + "sx": { "display": "flex", "gap": 1, "justifyContent": "flex-end" }, + "children": [ + { + "type": "Button", + "variant": "text", + "children": "Cancel" + }, + { + "type": "Button", + "variant": "contained", + "color": "primary", + "children": "Submit", + "disabled": "{{isLoading}}" + } + ] + } + ] + } + ] + } + ] + } + } + }, + { + "id": "irc_chat", + "name": "IRCChat", + "description": "IRC-style chat interface with message list and input", + "category": "dashboard", + "props": [ + { + "name": "messages", + "type": "array", + "required": true, + "description": "Array of message objects with sender, text, timestamp" + }, + { + "name": "onSendMessage", + "type": "function", + "required": true, + "description": "Callback when sending a message" + }, + { + "name": "isLoading", + "type": "boolean", + "required": false, + "default": false, + "description": "Show loading state while sending" + } + ], + "render": { + "type": "element", + "template": { + "type": "Card", + "variant": "elevation", + "className": "irc-chat", + "sx": { "height": "500px", "display": "flex", "flexDirection": "column" }, + "children": [ + { + "type": "CardHeader", + "title": "Chat" + }, + { + "type": "CardContent", + "className": "chat-content", + "sx": { "flex": 1, "overflowY": "auto", "padding": 2 }, + "children": [ + { + "type": "List", + "className": "messages-list", + "children": [ + { + "type": "Typography", + "variant": "body2", + "color": "textSecondary", + "className": "no-messages", + "sx": { "textAlign": "center", "padding": 2 }, + "children": "No messages yet" + } + ] + } + ] + }, + { + "type": "Box", + "className": "chat-input-area", + "sx": { "padding": 2, "borderTop": "1px solid #e0e0e0" }, + "children": [ + { + "type": "Stack", + "gap": 1, + "children": [ + { + "type": "TextField", + "placeholder": "Type your message...", + "variant": "outlined", + "size": "small", + "fullWidth": true, + "className": "message-input" + }, + { + "type": "Box", + "sx": { "display": "flex", "justifyContent": "flex-end" }, + "children": [ + { + "type": "Button", + "variant": "contained", + "color": "primary", + "children": "Send", + "disabled": "{{isLoading}}" + } + ] + } + ] + } + ] + } + ] + } + } } ], "exports": { - "components": ["StatCard", "DashboardGrid", "Widget"] + "components": ["StatCard", "DashboardGrid", "Widget", "DashboardHome", "UserProfile", "CommentsList", "CommentForm", "IRCChat"] } }