ui-nyla/src/core/PageManager/data/pages/dashboard.ts

101 lines
No EOL
3.1 KiB
TypeScript

import { GenericPageData } from '../../pageInterface';
import { LuTicket } from 'react-icons/lu';
import { IoMdSend } from 'react-icons/io';
import { MdStop } from 'react-icons/md';
import { HiOutlineCollection } from 'react-icons/hi';
import { privilegeCheckers } from '../../../../utils/privilegeCheckers';
import { createDashboardHook } from '../../../../hooks/usePlayground';
export const dashboardPageData: GenericPageData = {
id: 'start-dashboard',
path: 'start/dashboard',
name: 'Dashboard',
description: 'Main dashboard with overview and quick actions',
// Parent page
parentPath: 'start',
showInSidebar: true,
// Visual
icon: LuTicket,
title: 'Dashboard',
subtitle: 'Welcome to your workspace',
// Header buttons
headerButtons: [
{
id: 'workflow-selector',
label: 'dashboard.workflow.selector',
variant: 'primary',
size: 'md',
icon: HiOutlineCollection,
dropdownConfig: {
type: 'dropdown',
items: [], // Will be populated from hookData
placeholder: 'dashboard.workflow.select',
emptyMessage: 'dashboard.workflow.empty',
headerText: 'dashboard.workflow.header',
dataSource: {
itemsProperty: 'workflowItems',
selectedIdProperty: 'selectedWorkflowId',
onSelectMethod: 'onWorkflowSelect'
}
}
}
],
// Content sections
content: [
{
id: 'workflow-messages',
type: 'messages',
messagesConfig: {
showDocuments: true,
showMetadata: false,
showProgress: false,
emptyMessage: 'No messages yet. Start a workflow to see messages here.'
}
},
{
id: 'workflow-log',
type: 'log',
logConfig: {
emptyMessage: 'No log information available'
}
},
{
id: 'workflow-input',
type: 'inputForm',
inputFormConfig: {
hookFactory: createDashboardHook,
placeholder: 'dashboard.input.placeholder',
buttonLabel: 'dashboard.button.send',
stopButtonLabel: 'dashboard.button.stop',
buttonIcon: IoMdSend,
stopButtonIcon: MdStop,
buttonVariant: 'primary',
stopButtonVariant: 'danger',
buttonSize: 'md',
textFieldSize: 'md'
}
}
],
// Privilege system
privilegeChecker: privilegeCheckers.viewerRole,
// Page behavior
persistent: true,
preserveState: true,
preload: true,
moduleEnabled: true,
// Lifecycle hooks
onActivate: async () => {
if (import.meta.env.DEV) console.log('Dashboard activated - state preserved');
},
onDeactivate: async () => {
if (import.meta.env.DEV) console.log('Dashboard deactivated - keeping state');
}
};