@wakastellar/ui 2.3.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blocks/dashboard/index.d.ts +4 -1
- package/dist/blocks/empty-states/index.d.ts +4 -1
- package/dist/blocks/error-pages/index.d.ts +4 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/landing/index.d.ts +4 -1
- package/dist/blocks/pricing/index.d.ts +5 -1
- package/dist/blocks/sidebar/index.d.ts +5 -1
- package/dist/index.cjs.js +130 -130
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +7905 -7856
- package/dist/stories/Button.d.ts +14 -0
- package/dist/stories/Button.stories.d.ts +8 -0
- package/dist/stories/Header.d.ts +11 -0
- package/dist/stories/Header.stories.d.ts +6 -0
- package/dist/stories/Page.d.ts +2 -0
- package/dist/stories/Page.stories.d.ts +6 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/link.d.ts +23 -0
- package/package.json +11 -3
- package/src/blocks/activity-timeline/ActivityTimeline.stories.tsx +460 -0
- package/src/blocks/apm-overview/APMOverview.stories.tsx +435 -0
- package/src/blocks/auth-2fa/Auth2FA.stories.tsx +308 -0
- package/src/blocks/calendar-view/CalendarView.stories.tsx +398 -0
- package/src/blocks/chat/Chat.stories.tsx +466 -0
- package/src/blocks/chat-interface/ChatInterface.stories.tsx +412 -0
- package/src/blocks/checkout-flow/CheckoutFlow.stories.tsx +408 -0
- package/src/blocks/cicd-builder/CICDBuilder.stories.tsx +499 -0
- package/src/blocks/cloud-cost-dashboard/CloudCostDashboard.stories.tsx +356 -0
- package/src/blocks/container-orchestrator/ContainerOrchestrator.stories.tsx +461 -0
- package/src/blocks/dashboard/Dashboard.stories.tsx +559 -0
- package/src/blocks/dashboard/index.tsx +68 -27
- package/src/blocks/dashboard-kpi/DashboardKPI.stories.tsx +422 -0
- package/src/blocks/database-admin/DatabaseAdmin.stories.tsx +393 -0
- package/src/blocks/deployment-dashboard/DeploymentDashboard.stories.tsx +457 -0
- package/src/blocks/empty-states/EmptyStates.stories.tsx +467 -0
- package/src/blocks/empty-states/index.tsx +26 -8
- package/src/blocks/error-pages/ErrorPages.stories.tsx +401 -0
- package/src/blocks/error-pages/index.tsx +26 -8
- package/src/blocks/faq/FAQ.stories.tsx +416 -0
- package/src/blocks/file-manager/FileManager.stories.tsx +413 -0
- package/src/blocks/footer/Footer.stories.tsx +328 -0
- package/src/blocks/gitops-sync-status/GitOpsSyncStatus.stories.tsx +529 -0
- package/src/blocks/header/WakaHeader.stories.tsx +455 -0
- package/src/blocks/headtab/Headtab.stories.tsx +369 -0
- package/src/blocks/i18n-editor/I18nEditor.stories.tsx +451 -0
- package/src/blocks/incident-manager/IncidentManager.stories.tsx +464 -0
- package/src/blocks/index.ts +1 -1
- package/src/blocks/infrastructure-map/InfrastructureMap.stories.tsx +533 -0
- package/src/blocks/kanban-board/KanbanBoard.stories.tsx +494 -0
- package/src/blocks/landing/WakaLanding.stories.tsx +449 -0
- package/src/blocks/landing/index.tsx +125 -66
- package/src/blocks/language-selector/LanguageSelector.stories.tsx +345 -0
- package/src/blocks/layout/Layout.stories.tsx +373 -0
- package/src/blocks/login/Login.stories.tsx +443 -0
- package/src/blocks/on-call-schedule/OnCallSchedule.stories.tsx +381 -0
- package/src/blocks/player-profile/PlayerProfile.stories.tsx +316 -0
- package/src/blocks/pricing/WakaPricing.stories.tsx +530 -0
- package/src/blocks/pricing/index.tsx +38 -4
- package/src/blocks/profile/Profile.stories.tsx +371 -0
- package/src/blocks/release-notes/ReleaseNotes.stories.tsx +431 -0
- package/src/blocks/settings/Settings.stories.tsx +520 -0
- package/src/blocks/sidebar/WakaSidebar.stories.tsx +513 -0
- package/src/blocks/sidebar/index.tsx +49 -20
- package/src/blocks/theme-creator-block/ThemeCreatorBlock.stories.tsx +370 -0
- package/src/blocks/user-management/UserManagement.stories.tsx +411 -0
- package/src/blocks/wizard/Wizard.stories.tsx +683 -0
- package/src/components/accordion/Accordion.stories.tsx +93 -0
- package/src/components/alert/Alert.stories.tsx +95 -0
- package/src/components/alert-dialog/AlertDialog.stories.tsx +126 -0
- package/src/components/aspect-ratio/AspectRatio.stories.tsx +118 -0
- package/src/components/avatar/Avatar.stories.tsx +104 -0
- package/src/components/button/Button.stories.tsx +12 -1
- package/src/components/calendar/Calendar.stories.tsx +102 -0
- package/src/components/card/Card.stories.tsx +125 -0
- package/src/components/checkbox/Checkbox.stories.tsx +100 -0
- package/src/components/code/Code.stories.tsx +402 -0
- package/src/components/collapsible/Collapsible.stories.tsx +123 -0
- package/src/components/command/Command.stories.tsx +207 -0
- package/src/components/context-menu/ContextMenu.stories.tsx +220 -0
- package/src/components/dialog/Dialog.stories.tsx +157 -0
- package/src/components/dropdown-menu/DropdownMenu.stories.tsx +225 -0
- package/src/components/form/Form.stories.tsx +413 -0
- package/src/components/hover-card/HoverCard.stories.tsx +148 -0
- package/src/components/input-otp/InputOTP.stories.tsx +255 -0
- package/src/components/label/Label.stories.tsx +68 -0
- package/src/components/menubar/Menubar.stories.tsx +278 -0
- package/src/components/navigation-menu/NavigationMenu.stories.tsx +202 -0
- package/src/components/popover/Popover.stories.tsx +199 -0
- package/src/components/progress/Progress.stories.tsx +104 -0
- package/src/components/radio-group/RadioGroup.stories.tsx +138 -0
- package/src/components/scroll-area/ScrollArea.stories.tsx +153 -0
- package/src/components/select/Select.stories.tsx +146 -0
- package/src/components/separator/Separator.stories.tsx +117 -0
- package/src/components/sheet/Sheet.stories.tsx +195 -0
- package/src/components/skeleton/Skeleton.stories.tsx +114 -0
- package/src/components/slider/Slider.stories.tsx +157 -0
- package/src/components/switch/Switch.stories.tsx +114 -0
- package/src/components/table/Table.stories.tsx +153 -0
- package/src/components/tabs/Tabs.stories.tsx +155 -0
- package/src/components/textarea/Textarea.stories.tsx +116 -0
- package/src/components/toast/Toast.stories.tsx +160 -0
- package/src/components/toggle/Toggle.stories.tsx +125 -0
- package/src/components/tooltip/Tooltip.stories.tsx +133 -0
- package/src/components/typography/Typography.stories.tsx +207 -0
- package/src/components/waka-3d-pie-chart/Waka3DPieChart.stories.tsx +308 -0
- package/src/components/waka-achievement-unlock/WakaAchievementUnlock.stories.tsx +353 -0
- package/src/components/waka-artifact-list/WakaArtifactList.stories.tsx +258 -0
- package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +224 -0
- package/src/components/waka-badge-showcase/WakaBadgeShowcase.stories.tsx +269 -0
- package/src/components/waka-barcode/WakaBarcode.stories.tsx +227 -0
- package/src/components/waka-bottom-sheet/WakaBottomSheet.stories.tsx +408 -0
- package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +237 -0
- package/src/components/waka-build-matrix/WakaBuildMatrix.stories.tsx +328 -0
- package/src/components/waka-carousel/WakaCarousel.stories.tsx +296 -0
- package/src/components/waka-charts/WakaCharts.stories.tsx +519 -0
- package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +200 -0
- package/src/components/waka-combobox/WakaCombobox.stories.tsx +250 -0
- package/src/components/waka-container-list/WakaContainerList.stories.tsx +315 -0
- package/src/components/waka-contribution-graph/WakaContributionGraph.stories.tsx +354 -0
- package/src/components/waka-cost-breakdown/WakaCostBreakdown.stories.tsx +348 -0
- package/src/components/waka-daily-reward/WakaDailyReward.stories.tsx +365 -0
- package/src/components/waka-database-card/WakaDatabaseCard.stories.tsx +306 -0
- package/src/components/waka-date-range-picker/WakaDateRangePicker.stories.tsx +339 -0
- package/src/components/waka-datetime-picker/WakaDateTimePicker.stories.tsx +317 -0
- package/src/components/waka-deployment-lane/WakaDeploymentLane.stories.tsx +292 -0
- package/src/components/waka-dock/WakaDock.stories.tsx +332 -0
- package/src/components/waka-drawer/WakaDrawer.stories.tsx +437 -0
- package/src/components/waka-env-var-editor/WakaEnvVarEditor.stories.tsx +263 -0
- package/src/components/waka-error-shake/WakaErrorShake.stories.tsx +410 -0
- package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +239 -0
- package/src/components/waka-flow-diagram/WakaFlowDiagram.stories.tsx +365 -0
- package/src/components/waka-funnel-chart/WakaFunnelChart.stories.tsx +281 -0
- package/src/components/waka-glow-card/WakaGlowCard.stories.tsx +274 -0
- package/src/components/waka-haptic-button/WakaHapticButton.stories.tsx +349 -0
- package/src/components/waka-health-pulse/WakaHealthPulse.stories.tsx +293 -0
- package/src/components/waka-heatmap/WakaHeatmap.stories.tsx +376 -0
- package/src/components/waka-image/WakaImage.stories.tsx +255 -0
- package/src/components/waka-incident-timeline/WakaIncidentTimeline.stories.tsx +300 -0
- package/src/components/waka-kanban/WakaKanban.stories.tsx +399 -0
- package/src/components/waka-kubernetes-overview/WakaKubernetesOverview.stories.tsx +281 -0
- package/src/components/waka-leaderboard/WakaLeaderboard.stories.tsx +300 -0
- package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +313 -0
- package/src/components/waka-loading-orbit/WakaLoadingOrbit.stories.tsx +413 -0
- package/src/components/waka-log-viewer/WakaLogViewer.stories.tsx +312 -0
- package/src/components/waka-loot-box/WakaLootBox.stories.tsx +374 -0
- package/src/components/waka-metric-sparkline/WakaMetricSparkline.stories.tsx +312 -0
- package/src/components/waka-migration-list/WakaMigrationList.stories.tsx +289 -0
- package/src/components/waka-modal/WakaModal.stories.tsx +434 -0
- package/src/components/waka-morph-button/WakaMorphButton.stories.tsx +405 -0
- package/src/components/waka-network-topology/WakaNetworkTopology.stories.tsx +364 -0
- package/src/components/waka-notifications/WakaNotifications.stories.tsx +290 -0
- package/src/components/waka-number-input/WakaNumberInput.stories.tsx +282 -0
- package/src/components/waka-pagination/WakaPagination.stories.tsx +328 -0
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +318 -0
- package/src/components/waka-pipeline-view/WakaPipelineView.stories.tsx +386 -0
- package/src/components/waka-player-card/WakaPlayerCard.stories.tsx +333 -0
- package/src/components/waka-pod-card/WakaPodCard.stories.tsx +435 -0
- package/src/components/waka-qrcode/WakaQRCode.stories.tsx +232 -0
- package/src/components/waka-query-explain/WakaQueryExplain.stories.tsx +407 -0
- package/src/components/waka-quest-card/WakaQuestCard.stories.tsx +394 -0
- package/src/components/waka-quota-bar/WakaQuotaBar.stories.tsx +435 -0
- package/src/components/waka-radar-score/WakaRadarScore.stories.tsx +372 -0
- package/src/components/waka-resource-gauge/WakaResourceGauge.stories.tsx +366 -0
- package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +238 -0
- package/src/components/waka-sankey-diagram/WakaSankeyDiagram.stories.tsx +389 -0
- package/src/components/waka-scratch-card/WakaScratchCard.stories.tsx +388 -0
- package/src/components/waka-secret-card/WakaSecretCard.stories.tsx +314 -0
- package/src/components/waka-segmented-control/WakaSegmentedControl.stories.tsx +309 -0
- package/src/components/waka-server-rack/WakaServerRack.stories.tsx +382 -0
- package/src/components/waka-service-graph/WakaServiceGraph.stories.tsx +262 -0
- package/src/components/waka-skeleton-wave/WakaSkeletonWave.stories.tsx +321 -0
- package/src/components/waka-skill-tree/WakaSkillTree.stories.tsx +308 -0
- package/src/components/waka-spin-wheel/WakaSpinWheel.stories.tsx +368 -0
- package/src/components/waka-spinner/WakaSpinner.stories.tsx +156 -0
- package/src/components/waka-stat/WakaStat.stories.tsx +334 -0
- package/src/components/waka-status-matrix/WakaStatusMatrix.stories.tsx +331 -0
- package/src/components/waka-stepper/WakaStepper.stories.tsx +468 -0
- package/src/components/waka-streak-counter/WakaStreakCounter.stories.tsx +235 -0
- package/src/components/waka-success-explosion/WakaSuccessExplosion.stories.tsx +389 -0
- package/src/components/waka-tabs-morph/WakaTabsMorph.stories.tsx +471 -0
- package/src/components/waka-terminal-output/WakaTerminalOutput.stories.tsx +351 -0
- package/src/components/waka-test-report/WakaTestReport.stories.tsx +322 -0
- package/src/components/waka-tilt-card/WakaTiltCard.stories.tsx +300 -0
- package/src/components/waka-time-picker/WakaTimePicker.stories.tsx +227 -0
- package/src/components/waka-timeline/WakaTimeline.stories.tsx +383 -0
- package/src/components/waka-tournament-bracket/WakaTournamentBracket.stories.tsx +375 -0
- package/src/components/waka-trace-viewer/WakaTraceViewer.stories.tsx +445 -0
- package/src/components/waka-tree/WakaTree.stories.tsx +359 -0
- package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +378 -0
- package/src/components/waka-typewriter/WakaTypewriter.stories.tsx +366 -0
- package/src/components/waka-versus-card/WakaVersusCard.stories.tsx +530 -0
- package/src/components/waka-video/WakaVideo.stories.tsx +203 -0
- package/src/components/waka-virtual-list/WakaVirtualList.stories.tsx +273 -0
- package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +305 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
DatabaseAdmin,
|
|
4
|
+
defaultDatabaseInstance,
|
|
5
|
+
} from './index'
|
|
6
|
+
import type { DatabaseInstance, DatabaseStatus, DatabaseConnection, DatabaseBackup, SlowQuery } from './index'
|
|
7
|
+
import * as React from 'react'
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof DatabaseAdmin> = {
|
|
10
|
+
title: 'Blocks/DatabaseAdmin',
|
|
11
|
+
component: DatabaseAdmin,
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: 'fullscreen',
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component:
|
|
17
|
+
'A database administration dashboard for PostgreSQL, MySQL, MongoDB, and Redis with connection monitoring, query execution, backup management, and slow query analysis.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
tags: ['autodocs'],
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof DatabaseAdmin>
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
render: () => (
|
|
29
|
+
<div className="p-6">
|
|
30
|
+
<DatabaseAdmin
|
|
31
|
+
instance={defaultDatabaseInstance}
|
|
32
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
33
|
+
onCreateBackup={() => console.log('Create backup')}
|
|
34
|
+
onRestoreBackup={(backup) => console.log('Restore:', backup.name)}
|
|
35
|
+
onKillConnection={(conn) => console.log('Kill:', conn.id)}
|
|
36
|
+
onRefresh={() => console.log('Refresh')}
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
),
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const HealthyDatabase: Story = {
|
|
43
|
+
render: () => {
|
|
44
|
+
const healthyInstance: DatabaseInstance = {
|
|
45
|
+
...defaultDatabaseInstance,
|
|
46
|
+
status: 'healthy',
|
|
47
|
+
metrics: {
|
|
48
|
+
...defaultDatabaseInstance.metrics,
|
|
49
|
+
connections: { active: 25, idle: 10, max: 100 },
|
|
50
|
+
cache: { hitRatio: 99.5, bufferHit: 25000, diskRead: 50 },
|
|
51
|
+
transactions: { committed: 250000, rolledBack: 5, perSecond: 500 },
|
|
52
|
+
},
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div className="p-6">
|
|
57
|
+
<DatabaseAdmin
|
|
58
|
+
instance={healthyInstance}
|
|
59
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
60
|
+
onRefresh={() => console.log('Refresh')}
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
)
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const HighLoad: Story = {
|
|
68
|
+
render: () => {
|
|
69
|
+
const highLoadInstance: DatabaseInstance = {
|
|
70
|
+
...defaultDatabaseInstance,
|
|
71
|
+
status: 'warning',
|
|
72
|
+
metrics: {
|
|
73
|
+
connections: { active: 95, idle: 3, max: 100 },
|
|
74
|
+
transactions: { committed: 500000, rolledBack: 150, perSecond: 1200 },
|
|
75
|
+
cache: { hitRatio: 85.2, bufferHit: 8000, diskRead: 1500 },
|
|
76
|
+
storage: {
|
|
77
|
+
used: 180 * 1024 * 1024 * 1024,
|
|
78
|
+
total: 200 * 1024 * 1024 * 1024,
|
|
79
|
+
tablespace: 160 * 1024 * 1024 * 1024,
|
|
80
|
+
indexes: 20 * 1024 * 1024 * 1024,
|
|
81
|
+
},
|
|
82
|
+
replication: { lag: 250, state: 'catchup', replicas: 2 },
|
|
83
|
+
},
|
|
84
|
+
connections: [
|
|
85
|
+
{ id: '1', user: 'api_user', database: 'production', state: 'active', query: 'SELECT * FROM large_table WHERE...', duration: 45, client: '192.168.1.10' },
|
|
86
|
+
{ id: '2', user: 'api_user', database: 'production', state: 'active', duration: 32, client: '192.168.1.11' },
|
|
87
|
+
{ id: '3', user: 'analytics', database: 'production', state: 'idle_in_transaction', query: 'UPDATE analytics SET...', duration: 180, client: '192.168.1.20' },
|
|
88
|
+
{ id: '4', user: 'api_user', database: 'production', state: 'waiting', query: 'INSERT INTO orders...', duration: 15, client: '192.168.1.12' },
|
|
89
|
+
{ id: '5', user: 'batch', database: 'production', state: 'active', query: 'DELETE FROM temp_data WHERE...', duration: 120, client: '192.168.1.30' },
|
|
90
|
+
...Array.from({ length: 20 }, (_, i) => ({
|
|
91
|
+
id: `conn-${i + 6}`,
|
|
92
|
+
user: 'api_user',
|
|
93
|
+
database: 'production',
|
|
94
|
+
state: 'active' as const,
|
|
95
|
+
duration: Math.random() * 5,
|
|
96
|
+
client: `192.168.1.${50 + i}`,
|
|
97
|
+
})),
|
|
98
|
+
],
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<div className="p-6">
|
|
103
|
+
<DatabaseAdmin
|
|
104
|
+
instance={highLoadInstance}
|
|
105
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
106
|
+
onKillConnection={(conn) => console.log('Kill connection:', conn.id)}
|
|
107
|
+
onRefresh={() => console.log('Refresh')}
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const CriticalStatus: Story = {
|
|
115
|
+
render: () => {
|
|
116
|
+
const criticalInstance: DatabaseInstance = {
|
|
117
|
+
...defaultDatabaseInstance,
|
|
118
|
+
status: 'critical',
|
|
119
|
+
metrics: {
|
|
120
|
+
...defaultDatabaseInstance.metrics,
|
|
121
|
+
connections: { active: 100, idle: 0, max: 100 },
|
|
122
|
+
cache: { hitRatio: 72.5, bufferHit: 5000, diskRead: 2000 },
|
|
123
|
+
replication: { lag: 5000, state: 'disconnected', replicas: 0 },
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<div className="p-6">
|
|
129
|
+
<DatabaseAdmin
|
|
130
|
+
instance={criticalInstance}
|
|
131
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
132
|
+
onKillConnection={(conn) => console.log('Kill:', conn.id)}
|
|
133
|
+
onRefresh={() => console.log('Refresh')}
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const ReplicaDatabase: Story = {
|
|
141
|
+
render: () => {
|
|
142
|
+
const replicaInstance: DatabaseInstance = {
|
|
143
|
+
...defaultDatabaseInstance,
|
|
144
|
+
id: '2',
|
|
145
|
+
name: 'production-db-replica-1',
|
|
146
|
+
role: 'replica',
|
|
147
|
+
status: 'healthy',
|
|
148
|
+
metrics: {
|
|
149
|
+
...defaultDatabaseInstance.metrics,
|
|
150
|
+
connections: { active: 20, idle: 5, max: 50 },
|
|
151
|
+
replication: { lag: 15, state: 'streaming', replicas: 0 },
|
|
152
|
+
},
|
|
153
|
+
connections: defaultDatabaseInstance.connections.slice(0, 3),
|
|
154
|
+
backups: [],
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<div className="p-6">
|
|
159
|
+
<DatabaseAdmin
|
|
160
|
+
instance={replicaInstance}
|
|
161
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
162
|
+
onRefresh={() => console.log('Refresh')}
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
)
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const MySQLDatabase: Story = {
|
|
170
|
+
render: () => {
|
|
171
|
+
const mysqlInstance: DatabaseInstance = {
|
|
172
|
+
...defaultDatabaseInstance,
|
|
173
|
+
id: '3',
|
|
174
|
+
name: 'mysql-primary',
|
|
175
|
+
type: 'mysql',
|
|
176
|
+
version: '8.0.35',
|
|
177
|
+
port: 3306,
|
|
178
|
+
host: 'mysql.example.com',
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return (
|
|
182
|
+
<div className="p-6">
|
|
183
|
+
<DatabaseAdmin
|
|
184
|
+
instance={mysqlInstance}
|
|
185
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
186
|
+
onCreateBackup={() => console.log('Create backup')}
|
|
187
|
+
onRefresh={() => console.log('Refresh')}
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
)
|
|
191
|
+
},
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export const MongoDBDatabase: Story = {
|
|
195
|
+
render: () => {
|
|
196
|
+
const mongoInstance: DatabaseInstance = {
|
|
197
|
+
...defaultDatabaseInstance,
|
|
198
|
+
id: '4',
|
|
199
|
+
name: 'mongodb-cluster',
|
|
200
|
+
type: 'mongodb',
|
|
201
|
+
version: '7.0.4',
|
|
202
|
+
port: 27017,
|
|
203
|
+
host: 'mongodb.example.com',
|
|
204
|
+
metrics: {
|
|
205
|
+
connections: { active: 50, idle: 20, max: 200 },
|
|
206
|
+
transactions: { committed: 80000, rolledBack: 100, perSecond: 150 },
|
|
207
|
+
cache: { hitRatio: 95.0, bufferHit: 12000, diskRead: 600 },
|
|
208
|
+
storage: {
|
|
209
|
+
used: 120 * 1024 * 1024 * 1024,
|
|
210
|
+
total: 500 * 1024 * 1024 * 1024,
|
|
211
|
+
tablespace: 100 * 1024 * 1024 * 1024,
|
|
212
|
+
indexes: 20 * 1024 * 1024 * 1024,
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return (
|
|
218
|
+
<div className="p-6">
|
|
219
|
+
<DatabaseAdmin
|
|
220
|
+
instance={mongoInstance}
|
|
221
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
222
|
+
onRefresh={() => console.log('Refresh')}
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
225
|
+
)
|
|
226
|
+
},
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export const WithManySlowQueries: Story = {
|
|
230
|
+
render: () => {
|
|
231
|
+
const slowQueries: SlowQuery[] = [
|
|
232
|
+
{ id: '1', query: 'SELECT * FROM orders o JOIN order_items oi ON o.id = oi.order_id JOIN products p ON oi.product_id = p.id WHERE o.created_at > $1', calls: 5000, totalTime: 250000, meanTime: 50, maxTime: 1200, rows: 50000 },
|
|
233
|
+
{ id: '2', query: 'SELECT u.*, (SELECT COUNT(*) FROM orders WHERE user_id = u.id) as order_count FROM users u ORDER BY created_at DESC', calls: 1000, totalTime: 180000, meanTime: 180, maxTime: 2500, rows: 10000 },
|
|
234
|
+
{ id: '3', query: 'UPDATE products SET view_count = view_count + 1, updated_at = NOW() WHERE id = $1', calls: 100000, totalTime: 150000, meanTime: 1.5, maxTime: 50, rows: 1 },
|
|
235
|
+
{ id: '4', query: 'SELECT * FROM analytics_events WHERE event_type IN ($1, $2, $3) AND created_at BETWEEN $4 AND $5 GROUP BY user_id', calls: 500, totalTime: 500000, meanTime: 1000, maxTime: 8000, rows: 100000 },
|
|
236
|
+
{ id: '5', query: 'DELETE FROM sessions WHERE expires_at < NOW()', calls: 24, totalTime: 120000, meanTime: 5000, maxTime: 15000, rows: 500000 },
|
|
237
|
+
{ id: '6', query: 'SELECT pg_sleep(1)', calls: 50, totalTime: 50000, meanTime: 1000, maxTime: 1000, rows: 1 },
|
|
238
|
+
]
|
|
239
|
+
|
|
240
|
+
const instanceWithSlowQueries: DatabaseInstance = {
|
|
241
|
+
...defaultDatabaseInstance,
|
|
242
|
+
slowQueries,
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<div className="p-6">
|
|
247
|
+
<DatabaseAdmin
|
|
248
|
+
instance={instanceWithSlowQueries}
|
|
249
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
250
|
+
onRefresh={() => console.log('Refresh')}
|
|
251
|
+
/>
|
|
252
|
+
</div>
|
|
253
|
+
)
|
|
254
|
+
},
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export const BackupInProgress: Story = {
|
|
258
|
+
render: () => {
|
|
259
|
+
const backups: DatabaseBackup[] = [
|
|
260
|
+
{ id: '1', name: 'full-backup-running', type: 'full', status: 'running', startedAt: new Date(Date.now() - 15 * 60000) },
|
|
261
|
+
{ id: '2', name: 'daily-backup-20240110', type: 'full', status: 'completed', size: 45 * 1024 * 1024 * 1024, startedAt: new Date(Date.now() - 24 * 3600000), completedAt: new Date(Date.now() - 22 * 3600000), duration: 7200 },
|
|
262
|
+
{ id: '3', name: 'hourly-backup-20240110-12', type: 'incremental', status: 'completed', size: 250 * 1024 * 1024, startedAt: new Date(Date.now() - 1 * 3600000), completedAt: new Date(Date.now() - 50 * 60000), duration: 600 },
|
|
263
|
+
]
|
|
264
|
+
|
|
265
|
+
const instanceWithBackup: DatabaseInstance = {
|
|
266
|
+
...defaultDatabaseInstance,
|
|
267
|
+
backups,
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<div className="p-6">
|
|
272
|
+
<DatabaseAdmin
|
|
273
|
+
instance={instanceWithBackup}
|
|
274
|
+
onCreateBackup={() => console.log('Create backup')}
|
|
275
|
+
onRestoreBackup={(backup) => console.log('Restore:', backup.name)}
|
|
276
|
+
onRefresh={() => console.log('Refresh')}
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
)
|
|
280
|
+
},
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export const Interactive: Story = {
|
|
284
|
+
render: () => {
|
|
285
|
+
const [queryHistory, setQueryHistory] = React.useState<string[]>([])
|
|
286
|
+
|
|
287
|
+
const handleExecuteQuery = (query: string) => {
|
|
288
|
+
setQueryHistory(prev => [query, ...prev.slice(0, 9)])
|
|
289
|
+
alert(`Executing query:\n${query}`)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const handleKillConnection = (conn: DatabaseConnection) => {
|
|
293
|
+
if (confirm(`Kill connection ${conn.id} from ${conn.user}?`)) {
|
|
294
|
+
alert(`Connection ${conn.id} terminated`)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const handleCreateBackup = () => {
|
|
299
|
+
alert('Starting full backup...')
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const handleRestoreBackup = (backup: DatabaseBackup) => {
|
|
303
|
+
if (confirm(`Restore from backup "${backup.name}"? This will overwrite current data.`)) {
|
|
304
|
+
alert(`Restoring from ${backup.name}...`)
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<div className="p-6">
|
|
310
|
+
<DatabaseAdmin
|
|
311
|
+
instance={defaultDatabaseInstance}
|
|
312
|
+
onExecuteQuery={handleExecuteQuery}
|
|
313
|
+
onCreateBackup={handleCreateBackup}
|
|
314
|
+
onRestoreBackup={handleRestoreBackup}
|
|
315
|
+
onKillConnection={handleKillConnection}
|
|
316
|
+
onRefresh={() => alert('Refreshing metrics...')}
|
|
317
|
+
/>
|
|
318
|
+
</div>
|
|
319
|
+
)
|
|
320
|
+
},
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export const DatabaseAdminPanel: Story = {
|
|
324
|
+
render: () => (
|
|
325
|
+
<div className="min-h-screen bg-muted/30">
|
|
326
|
+
<header className="bg-background border-b px-6 py-4">
|
|
327
|
+
<div className="flex items-center justify-between">
|
|
328
|
+
<div>
|
|
329
|
+
<h1 className="font-bold text-xl">Database Administration</h1>
|
|
330
|
+
<p className="text-sm text-muted-foreground">PostgreSQL Cluster Management</p>
|
|
331
|
+
</div>
|
|
332
|
+
<nav className="flex gap-4 text-sm">
|
|
333
|
+
<a href="#" className="text-foreground font-medium">Overview</a>
|
|
334
|
+
<a href="#" className="text-muted-foreground hover:text-foreground">Replication</a>
|
|
335
|
+
<a href="#" className="text-muted-foreground hover:text-foreground">Users</a>
|
|
336
|
+
<a href="#" className="text-muted-foreground hover:text-foreground">Settings</a>
|
|
337
|
+
</nav>
|
|
338
|
+
</div>
|
|
339
|
+
</header>
|
|
340
|
+
<main className="p-6">
|
|
341
|
+
<DatabaseAdmin
|
|
342
|
+
instance={defaultDatabaseInstance}
|
|
343
|
+
onExecuteQuery={(query) => console.log('Execute:', query)}
|
|
344
|
+
onCreateBackup={() => console.log('Create backup')}
|
|
345
|
+
onRestoreBackup={(backup) => console.log('Restore:', backup.name)}
|
|
346
|
+
onKillConnection={(conn) => console.log('Kill:', conn.id)}
|
|
347
|
+
onRefresh={() => console.log('Refresh')}
|
|
348
|
+
/>
|
|
349
|
+
</main>
|
|
350
|
+
</div>
|
|
351
|
+
),
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export const RedisInstance: Story = {
|
|
355
|
+
render: () => {
|
|
356
|
+
const redisInstance: DatabaseInstance = {
|
|
357
|
+
id: '5',
|
|
358
|
+
name: 'redis-cache-cluster',
|
|
359
|
+
type: 'redis',
|
|
360
|
+
version: '7.2.3',
|
|
361
|
+
host: 'redis.example.com',
|
|
362
|
+
port: 6379,
|
|
363
|
+
status: 'healthy',
|
|
364
|
+
role: 'primary',
|
|
365
|
+
metrics: {
|
|
366
|
+
connections: { active: 150, idle: 50, max: 1000 },
|
|
367
|
+
transactions: { committed: 1500000, rolledBack: 0, perSecond: 5000 },
|
|
368
|
+
cache: { hitRatio: 99.8, bufferHit: 50000, diskRead: 100 },
|
|
369
|
+
storage: {
|
|
370
|
+
used: 8 * 1024 * 1024 * 1024,
|
|
371
|
+
total: 32 * 1024 * 1024 * 1024,
|
|
372
|
+
tablespace: 8 * 1024 * 1024 * 1024,
|
|
373
|
+
indexes: 0,
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
connections: [
|
|
377
|
+
{ id: '1', user: 'default', database: '0', state: 'active', duration: 0.1, client: '192.168.1.10' },
|
|
378
|
+
{ id: '2', user: 'default', database: '0', state: 'active', duration: 0.05, client: '192.168.1.11' },
|
|
379
|
+
],
|
|
380
|
+
backups: [],
|
|
381
|
+
slowQueries: [],
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return (
|
|
385
|
+
<div className="p-6">
|
|
386
|
+
<DatabaseAdmin
|
|
387
|
+
instance={redisInstance}
|
|
388
|
+
onRefresh={() => console.log('Refresh')}
|
|
389
|
+
/>
|
|
390
|
+
</div>
|
|
391
|
+
)
|
|
392
|
+
},
|
|
393
|
+
}
|