mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 03:16:22 -05:00
ui: the Open button rejoins the service's other actions (#657)
On the Control tab, each service's actions -- start/stop, restart, logs -- sit in a `.wrolpi-button-row`, a wrapping flex row. Open sat outside it, after the logs modal, so it was a block-level sibling of the row rather than a member of it: it landed on its own line under the others, on both the mobile and the desktop row. Move it inside the row, after logs. Nothing else changes -- same icon, same link, same order left to right -- and the row already wraps, so a narrow Actions column breaks it where it needs to instead of hard-coding a break at Open. The two row components are now exported so the test can mount them: `Media` renders neither branch under jsdom, where no media query matches, so `ServicesSection` yields no rows there at all and the buttons were untestable through the page. The test asserts that Open shares a `.wrolpi-button-row` with stop, restart and logs, and it fails on the old layout. 68 suites / 1202 tests pass; `npm run build` is clean.
This commit is contained in:
parent
e3fa68a53c
commit
69aaf64165
2 changed files with 69 additions and 25 deletions
|
|
@ -270,7 +270,9 @@ function ServiceLogsModal({
|
|||
}
|
||||
|
||||
// Mobile service row - simplified layout
|
||||
function MobileServiceRow({service, onAction}) {
|
||||
// Exported so tests can mount a row directly: `Media` renders neither branch in jsdom,
|
||||
// where no media query matches, so `ServicesSection` produces no rows at all there.
|
||||
export function MobileServiceRow({service, onAction}) {
|
||||
const {
|
||||
loading, logsOpen, setLogsOpen, logs, logsLoading, linesCount, countdown, logsRef,
|
||||
handleAction, fetchLogs, handleViewLogs, handleLinesChange, handleDownloadLogs,
|
||||
|
|
@ -320,6 +322,17 @@ function MobileServiceRow({service, onAction}) {
|
|||
role='primary'
|
||||
onClick={handleViewLogs}
|
||||
/>
|
||||
{viewUrl && (
|
||||
<IconButton
|
||||
icon='external'
|
||||
label={`Open ${service.name}`}
|
||||
color='violet'
|
||||
component='a'
|
||||
href={viewUrl}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<ServiceLogsModal
|
||||
service={service}
|
||||
|
|
@ -334,24 +347,13 @@ function MobileServiceRow({service, onAction}) {
|
|||
handleDownloadLogs={handleDownloadLogs}
|
||||
fetchLogs={fetchLogs}
|
||||
/>
|
||||
{viewUrl && (
|
||||
<IconButton
|
||||
icon='external'
|
||||
label={`Open ${service.name}`}
|
||||
color='violet'
|
||||
component='a'
|
||||
href={viewUrl}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
/>
|
||||
)}
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
);
|
||||
}
|
||||
|
||||
// Desktop service row - full layout with all columns
|
||||
function DesktopServiceRow({service, onAction, dockerized}) {
|
||||
export function DesktopServiceRow({service, onAction, dockerized}) {
|
||||
const {
|
||||
loading, logsOpen, setLogsOpen, logs, logsLoading, linesCount, countdown, logsRef,
|
||||
handleAction, fetchLogs, handleViewLogs, handleLinesChange, handleDownloadLogs,
|
||||
|
|
@ -402,6 +404,17 @@ function DesktopServiceRow({service, onAction, dockerized}) {
|
|||
role='primary'
|
||||
onClick={handleViewLogs}
|
||||
/>
|
||||
{viewUrl && (
|
||||
<IconButton
|
||||
icon='external'
|
||||
label={`Open ${service.name}`}
|
||||
color='violet'
|
||||
component='a'
|
||||
href={viewUrl}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<ServiceLogsModal
|
||||
service={service}
|
||||
|
|
@ -416,17 +429,6 @@ function DesktopServiceRow({service, onAction, dockerized}) {
|
|||
handleDownloadLogs={handleDownloadLogs}
|
||||
fetchLogs={fetchLogs}
|
||||
/>
|
||||
{viewUrl && (
|
||||
<IconButton
|
||||
icon='external'
|
||||
label={`Open ${service.name}`}
|
||||
color='violet'
|
||||
component='a'
|
||||
href={viewUrl}
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
/>
|
||||
)}
|
||||
</Table.Cell>
|
||||
{!dockerized && (
|
||||
<Table.Cell>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue