Skip to content

Commit 121e7be

Browse files
fix(dashboard): Multiple small UI fixes (vendurehq#4394)
2 parents 1633446 + 12bd2a9 commit 121e7be

File tree

23 files changed

+676
-161
lines changed

23 files changed

+676
-161
lines changed

CLAUDE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,27 @@ DB=sqlite npm run populate
9797
- **E2E tests**: In `packages/<name>/e2e/` as `*.e2e-spec.ts`, run with `npm run e2e <test-file>` from package dir
9898
- **E2E cache**: Seed data gets cached in `packages/<name>/e2e/__data__` for speed. Delete to reset after schema changes.
9999

100+
### Dashboard E2E Tests
101+
102+
Dashboard Playwright tests live in `packages/dashboard/e2e/tests/`. When adding a new test (including regression tests for bug fixes), **always check existing suites first** before creating a new file:
103+
104+
- `catalog/product-list.spec.ts` — product list behaviour (sorting, column settings, filtering)
105+
- `catalog/products.spec.ts` — product detail page
106+
- `catalog/custom-fields.spec.ts` — custom field rendering, editing, persistence
107+
- `sales/orders.spec.ts` — draft orders, order detail, order modification
108+
- `tests/regression/`**only** for tests that genuinely don't fit any existing suite
109+
110+
Add a comment referencing the issue number above the test, e.g.:
111+
```ts
112+
// #4393 — product list should default to sorting by updatedAt descending
113+
test('should apply descending updatedAt sort by default', async ({ page }) => {
114+
```
115+
116+
Run dashboard e2e tests from `packages/dashboard`:
117+
```bash
118+
CI=true VITE_TEST_PORT=5176 npx playwright test --config e2e/playwright.config.ts <test-path> --reporter=list
119+
```
120+
100121
## Code Style
101122
102123
- **Indentation**: 4 spaces

docs/docs/reference/dashboard/form-components/date-time-input.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "DateTimeInput"
33
generated: true
44
---
5-
<GenerationInfo sourceFile="packages/dashboard/src/lib/components/data-input/datetime-input.tsx" sourceLine="41" packageName="@vendure/dashboard" />
5+
<GenerationInfo sourceFile="packages/dashboard/src/lib/components/data-input/datetime-input.tsx" sourceLine="42" packageName="@vendure/dashboard" />
66

77
A component for selecting a date and time.
88

docs/docs/reference/dashboard/list-views/list-page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ Allows you to specify the default sorting applied to the table.
362362
*Example*
363363

364364
```tsx
365-
defaultSort={[{ id: 'orderPlacedAt', desc: true }]}
365+
defaultSort={[{ id: 'updatedAt', desc: true }]}
366366
```
367367
### defaultVisibility
368368

packages/dashboard/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ storybook-static
3333
# E2E tests (Playwright)
3434
e2e/.auth/
3535
e2e/__data__/
36+
e2e/fixtures/.compiled/
3637
e2e/test-results/
3738
e2e/playwright-report/
3839
test-results/
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* Registers a CUSTOM_TYPE order history entry and exposes a mutation
3+
* to create one. Used to test the fallback renderer for unrecognized
4+
* history entry types in the dashboard.
5+
*
6+
* NOTE: This file uses NestJS parameter decorators and must be
7+
* compiled with SWC (which supports emitDecoratorMetadata).
8+
* The global-setup.ts handles this automatically.
9+
*/
10+
import { Args, Mutation, Resolver } from '@nestjs/graphql';
11+
import {
12+
Ctx,
13+
HistoryService,
14+
ID,
15+
Order,
16+
PluginCommonModule,
17+
RequestContext,
18+
TransactionalConnection,
19+
VendurePlugin,
20+
} from '@vendure/core';
21+
import gql from 'graphql-tag';
22+
23+
const CUSTOM_TYPE = 'CUSTOM_TYPE';
24+
25+
@Resolver()
26+
class AddHistoryEntryResolver {
27+
constructor(
28+
private connection: TransactionalConnection,
29+
private historyService: HistoryService,
30+
) {}
31+
32+
@Mutation()
33+
async addCustomOrderHistoryEntry(
34+
@Ctx() ctx: RequestContext,
35+
@Args() args: { orderId: ID; message: string },
36+
) {
37+
const order = await this.connection.getEntityOrThrow(ctx, Order, args.orderId);
38+
await this.historyService.createHistoryEntryForOrder({
39+
orderId: order.id,
40+
ctx,
41+
type: CUSTOM_TYPE as any,
42+
data: { message: args.message },
43+
});
44+
return order;
45+
}
46+
}
47+
48+
@VendurePlugin({
49+
imports: [PluginCommonModule],
50+
adminApiExtensions: {
51+
schema: gql`
52+
extend enum HistoryEntryType {
53+
CUSTOM_TYPE
54+
}
55+
extend type Mutation {
56+
addCustomOrderHistoryEntry(orderId: ID!, message: String!): Order!
57+
}
58+
`,
59+
resolvers: [AddHistoryEntryResolver],
60+
},
61+
})
62+
export class CustomHistoryEntryPlugin {}

0 commit comments

Comments
 (0)