Commit b675422
committed
Resolves #5111 ([FR-1948](https://lablup.atlassian.net/browse/FR-1948))
## Summary
Fixed three broken Storybook components on ui.backend.ai:
### 1. BAIFetchKeyButton - dayjs relativeTime error
- **Issue**: `me(...).fromNow is not a function` error
- **Root cause**: dayjs relativeTime plugin not loaded in Storybook
- **Fix**: Added all dayjs plugins (relativeTime, duration, utc, timezone, weekday, localeData, localizedFormat) and 21 locale imports to `.storybook/decorators.tsx` to match `BAIConfigProvider` configuration
### 2. BAIAdminResourceGroupSelect - items displayed as one
- **Issue**: All dropdown items displayed as a single item instead of separate options
- **Root cause**: Incorrect mock resolver type `ScalingGroupV2Connection` instead of `ResourceGroupConnection`
- **Fix**: Updated mock resolvers to use `ResourceGroupConnection` type across all story variants (Default, Empty, WithCustomPlaceholder, Disabled)
### 3. BAILink - Font not applied with WebUI theme
- **Issue**: react-router-dom `Link` component doesn't inherit Ant Design theme styles
- **Root cause**: react-router-dom Link doesn't automatically apply Ant Design theme tokens
- **Fix**: Added `theme.useToken()` to access fontFamily token and applied it via inline style to ensure consistent font rendering in Storybook WebUI theme
## Changes
- `packages/backend.ai-ui/.storybook/decorators.tsx`: Added dayjs plugins and locale support
- `packages/backend.ai-ui/src/components/BAILink.tsx`: Applied Ant Design theme fontFamily to Link component
- `packages/backend.ai-ui/src/components/fragments/BAIAdminResourceGroupSelect.stories.tsx`: Fixed mock resolver type
**Checklist:**
- [x] All three Storybook components now render correctly on ui.backend.ai
- [x] dayjs `fromNow()` function works in BAIFetchKeyButton
- [x] BAIAdminResourceGroupSelect displays items as separate options
- [x] BAILink applies correct font with WebUI theme
[FR-1948]: https://lablup.atlassian.net/browse/FR-1948?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent df6385f commit b675422
3 files changed
Lines changed: 49 additions & 6 deletions
File tree
- packages/backend.ai-ui
- .storybook
- src/components
- fragments
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
3 | 39 | | |
4 | 40 | | |
5 | 41 | | |
| |||
90 | 126 | | |
91 | 127 | | |
92 | 128 | | |
| 129 | + | |
93 | 130 | | |
94 | 131 | | |
95 | 132 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
| |||
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
0 commit comments