mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-06 17:08:10 +00:00
fix(editor): remove misleading image line above stack actions (#1584)
Closes #1580. The Command Center header showed the first container's image directly above stack-wide Start/Stop/Update controls, which implied those buttons targeted one image. Remove the header image/digest row; per-container ImageSourceMenu on each row remains.
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import type { ComponentProps } from 'react';
|
||||
import { StackIdentityHeader } from '../editor-view-blocks';
|
||||
import type { ContainerInfo } from '../EditorView';
|
||||
|
||||
vi.mock('@/lib/clipboard', () => ({ copyToClipboard: vi.fn().mockResolvedValue(undefined) }));
|
||||
vi.mock('../../Terminal', () => ({ default: () => null }));
|
||||
vi.mock('../../StructuredLogViewer', () => ({ default: () => null }));
|
||||
vi.mock('../../ImageSourceMenu', () => ({ ImageSourceMenu: () => null }));
|
||||
|
||||
const CONTAINERS: ContainerInfo[] = [
|
||||
{
|
||||
Id: 'abc123',
|
||||
Names: ['/web'],
|
||||
State: 'running',
|
||||
Status: 'Up 2 hours',
|
||||
Image: 'nginx:alpine',
|
||||
ImageID: 'sha256:deadbeef',
|
||||
healthStatus: 'healthy',
|
||||
} as ContainerInfo,
|
||||
{
|
||||
Id: 'def456',
|
||||
Names: ['/api'],
|
||||
State: 'running',
|
||||
Status: 'Up 2 hours',
|
||||
Image: 'node:20',
|
||||
ImageID: 'sha256:cafebabe',
|
||||
healthStatus: 'healthy',
|
||||
} as ContainerInfo,
|
||||
];
|
||||
|
||||
function renderHeader(over: Partial<ComponentProps<typeof StackIdentityHeader>> = {}) {
|
||||
return render(
|
||||
<StackIdentityHeader
|
||||
stackName="plex"
|
||||
activeNode={{ id: 1, name: 'local', type: 'local' } as never}
|
||||
safeContainers={CONTAINERS}
|
||||
isRunning
|
||||
can={() => true}
|
||||
isAdmin
|
||||
trivy={{ available: false }}
|
||||
backupInfo={{ exists: false, timestamp: null }}
|
||||
loadingAction={null}
|
||||
stackMisconfigScanning={false}
|
||||
deployStack={vi.fn()}
|
||||
restartStack={vi.fn()}
|
||||
stopStack={vi.fn()}
|
||||
updateStack={vi.fn()}
|
||||
rollbackStack={vi.fn()}
|
||||
scanStackConfig={vi.fn()}
|
||||
requestDeleteStack={vi.fn()}
|
||||
{...over}
|
||||
/>,
|
||||
);
|
||||
}
|
||||
|
||||
describe('StackIdentityHeader', () => {
|
||||
it('renders stack identity and stack-wide actions without a header image line', () => {
|
||||
renderHeader();
|
||||
|
||||
expect(screen.getByText('plex')).toBeInTheDocument();
|
||||
expect(screen.getByText(/running · healthy/i)).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Restart' })).toBeInTheDocument();
|
||||
expect(screen.getByRole('button', { name: 'Update' })).toBeInTheDocument();
|
||||
|
||||
expect(screen.queryByText(/^image$/i)).not.toBeInTheDocument();
|
||||
expect(screen.queryByText('nginx:alpine')).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole('button', { name: 'Copy digest' })).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user