Skip to content

Commit b8ad1ab

Browse files
committed
Lots more meta pipeline improvements
1 parent 2093ded commit b8ad1ab

6 files changed

Lines changed: 331 additions & 242 deletions

File tree

frontend/src/components/pages/rp-connect/pipeline/config-dialog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export function ConfigDialog({ open, onOpenChange, form, mode }: ConfigDialogPro
238238
{mode !== 'view' && (
239239
<DialogFooter>
240240
<Button onClick={onSaveClick} variant="primary">
241-
Save
241+
Save settings
242242
</Button>
243243
</DialogFooter>
244244
)}

frontend/src/components/pages/rp-connect/pipeline/index.test.tsx

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ vi.mock('@tanstack/react-router', async (importOriginal) => {
8282
useNavigate: () => mockNavigate,
8383
useRouter: () => ({ history: { back: mockBack, canGoBack: () => true } }),
8484
useSearch: () => mockSearch(),
85+
useBlocker: () => ({ status: 'idle', proceed: undefined, reset: undefined }),
8586
};
8687
});
8788

@@ -265,6 +266,16 @@ function createTransport(overrides?: {
265266
});
266267
}
267268

269+
// The pipeline name now lives in the settings dialog (opened via "Edit settings")
270+
// rather than an inline field in the header.
271+
const setPipelineNameViaDialog = async (user: ReturnType<typeof userEvent.setup>, name: string) => {
272+
await user.click(screen.getByRole('button', { name: /edit settings/i }));
273+
const nameInput = await screen.findByPlaceholderText('Enter pipeline name');
274+
await user.clear(nameInput);
275+
await user.type(nameInput, name);
276+
await user.click(screen.getByRole('button', { name: /save settings/i }));
277+
};
278+
268279
describe('PipelinePage', () => {
269280
beforeEach(() => {
270281
mockNavigate.mockClear();
@@ -370,12 +381,7 @@ describe('PipelinePage', () => {
370381

371382
render(<PipelinePage />, { transport: createTransport({ createPipelineMock }) });
372383

373-
// EditableText with defaultEditing starts in edit mode — use placeholder to find the input
374-
const nameInput = screen.getByPlaceholderText('Pipeline name');
375-
await user.clear(nameInput);
376-
await user.type(nameInput, 'my-pipeline');
377-
// Tab to commit the EditableText value (fires onChange -> handleNameChange -> form.setValue)
378-
await user.tab();
384+
await setPipelineNameViaDialog(user, 'my-pipeline');
379385

380386
// Set YAML via the textarea mock
381387
const yamlEditor = screen.getByTestId('yaml-editor');
@@ -406,11 +412,7 @@ describe('PipelinePage', () => {
406412

407413
render(<PipelinePage />, { transport: createTransport({ createPipelineMock }) });
408414

409-
// Fill in name (min 3 chars for validation)
410-
const nameInput = screen.getByPlaceholderText('Pipeline name');
411-
await user.clear(nameInput);
412-
await user.type(nameInput, 'my-pipeline');
413-
await user.tab();
415+
await setPipelineNameViaDialog(user, 'my-pipeline');
414416

415417
// Set YAML and click Save
416418
const yamlEditor = screen.getByTestId('yaml-editor');
@@ -441,11 +443,7 @@ describe('PipelinePage', () => {
441443

442444
render(<PipelinePage />, { transport: createTransport({ createPipelineMock, lintMock }) });
443445

444-
// Fill in name
445-
const nameInput = screen.getByPlaceholderText('Pipeline name');
446-
await user.clear(nameInput);
447-
await user.type(nameInput, 'my-pipeline');
448-
await user.tab();
446+
await setPipelineNameViaDialog(user, 'my-pipeline');
449447

450448
// Set YAML (triggers lint query which returns response warning)
451449
const yamlEditor = screen.getByTestId('yaml-editor');
@@ -483,11 +481,7 @@ describe('PipelinePage', () => {
483481

484482
render(<PipelinePage />, { transport: createTransport({ createPipelineMock, lintMock }) });
485483

486-
// Fill in name
487-
const nameInput = screen.getByPlaceholderText('Pipeline name');
488-
await user.clear(nameInput);
489-
await user.type(nameInput, 'my-pipeline');
490-
await user.tab();
484+
await setPipelineNameViaDialog(user, 'my-pipeline');
491485

492486
// Set YAML
493487
const yamlEditor = screen.getByTestId('yaml-editor');
@@ -532,15 +526,15 @@ describe('PipelinePage', () => {
532526
});
533527
});
534528

535-
it('displays the pipeline display name (not the ID) in view mode', async () => {
529+
it('displays the pipeline display name in the summary in view mode', async () => {
536530
mockUsePipelineMode.mockReturnValue({ mode: 'view', pipelineId: 'test-pipeline' });
537531

538532
render(<PipelinePage />, { transport: createTransport() });
539533

540-
// The toolbar title (level-1 heading) should show the displayName from the pipeline
541-
// response, not the pipeline ID. The ID is shown separately in the Configuration section.
542-
expect(await screen.findByRole('heading', { level: 1, name: 'Test Pipeline' })).toBeInTheDocument();
543-
expect(screen.queryByRole('heading', { level: 1, name: 'test-pipeline' })).not.toBeInTheDocument();
534+
// The page title (level-1 heading) is static; the displayName is shown
535+
// prominently as the summary card heading, with the ID as a labeled field below.
536+
expect(await screen.findByRole('heading', { level: 1, name: 'Pipeline view' })).toBeInTheDocument();
537+
expect(await screen.findByRole('heading', { level: 2, name: 'Test Pipeline' })).toBeInTheDocument();
544538
});
545539

546540
it('hydrates the flow diagram with pipeline configYaml in view mode', async () => {
@@ -667,9 +661,9 @@ describe('PipelinePage', () => {
667661

668662
render(<PipelinePage />, { transport: createTransport() });
669663

670-
// In edit mode, defaultEditing is false so EditableText renders as a button showing the name
664+
// In edit mode the name is pre-filled from the server and shown in the settings summary heading.
671665
await waitFor(() => {
672-
expect(screen.getByRole('button', { name: 'Test Pipeline' })).toBeInTheDocument();
666+
expect(screen.getByRole('heading', { level: 2, name: 'Test Pipeline' })).toBeInTheDocument();
673667
});
674668

675669
// The yaml editor textarea should be populated with the pipeline's configYaml

0 commit comments

Comments
 (0)