Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ header.tkn--step-details-header {
.#{$prefix}--btn-set {
margin-inline: 0.5rem;
align-self: center;
align-items: baseline;

.cds--btn--icon-only {
inline-size: 2rem;
block-size: 2rem;
}
}

.tkn--run-details-name {
Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/components/Log/Log.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ export class LogContainer extends Component {
componentDidUpdate(prevProps, prevState) {
if (
this.props.enableLogAutoScroll &&
(prevState.logs?.length !== this.state.logs?.length ||
prevProps.isLogsMaximized !== this.props.isLogsMaximized)
prevState.logs?.length !== this.state.logs?.length
) {
if (this.shouldAutoScroll()) {
this.scrollToBottomLog();
Expand Down
34 changes: 2 additions & 32 deletions packages/components/src/components/Log/_Log.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2025 The Tekton Authors
Copyright 2019-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -72,37 +72,7 @@ pre.tkn--log {
.#{$prefix}--btn-set {
position: absolute;
inset-block-start: 0;
inset-inline-end: var(--tkn-log-inline-padding);
align-items: center;
}

.button-container {
position: absolute;
clip-path: inset(0); // ensure the children with position:fixed are not shown outside this element.
inset-block-start: 3.125rem; //equals the maximum between padding-block-start of pre.tkn--log and between the page header height
inset-block-end: 0;
inset-inline-end: 0;
inline-size: var(--tkn-log-inline-padding);
}

.#{$prefix}--btn--ghost,
.#{$prefix}--copy-btn {
inline-size: 2rem;
block-size: 2rem;
min-block-size: 2rem;
background-color: $background;

&:hover {
background-color: $layer-hover;
}

&:focus {
outline-color: white;
}

svg {
fill: $icon-primary;
}
inset-inline-end: 0.5rem; // var(--tkn-log-inline-padding);
}

.tkn--log-trailer {
Expand Down
110 changes: 30 additions & 80 deletions packages/components/src/components/LogsToolbar/LogsToolbar.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2020-2025 The Tekton Authors
Copyright 2020-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -12,98 +12,51 @@ limitations under the License.
*/
/* istanbul ignore file */
import { useIntl } from 'react-intl';
import { Maximize, Minimize, Settings } from '@carbon/react/icons';
import {
Download,
Launch,
Maximize,
Minimize,
Settings
} from '@carbon/react/icons';
import {
Button,
ButtonSet,
Checkbox,
CheckboxGroup,
Popover,
PopoverContent,
usePrefix
PopoverContent
} from '@carbon/react';
import { useState } from 'react';

const LogsToolbar = ({
id,
isMaximized,
name,
logLevels,
onToggleShowTimestamps,
onToggleLogLevel,
onToggleMaximized,
showTimestamps,
url
showTimestamps
}) => {
const carbonPrefix = usePrefix();
const intl = useIntl();
const [isSettingsOpen, setIsSettingsOpen] = useState(false);

return (
<div className={`${carbonPrefix}--btn-set`}>
<ButtonSet className="tkn--toolbar">
{onToggleMaximized ? (
<button
className={`${carbonPrefix}--btn ${carbonPrefix}--btn--sm ${carbonPrefix}--layout--size-sm ${carbonPrefix}--btn--icon-only ${carbonPrefix}--copy-btn`}
onClick={onToggleMaximized}
type="button"
>
{isMaximized ? (
<Minimize>
<title>
{intl.formatMessage({
<Button
autoAlign
hasIconOnly
iconDescription={
isMaximized
? intl.formatMessage({
id: 'dashboard.logs.restore',
defaultMessage: 'Return to default'
})}
</title>
</Minimize>
) : (
<Maximize>
<title>
{intl.formatMessage({
})
: intl.formatMessage({
id: 'dashboard.logs.maximize',
defaultMessage: 'Maximize'
})}
</title>
</Maximize>
)}
</button>
) : null}
{url ? (
<>
<a
className={`${carbonPrefix}--btn ${carbonPrefix}--btn--sm ${carbonPrefix}--layout--size-sm ${carbonPrefix}--btn--icon-only ${carbonPrefix}--copy-btn`}
href={url}
target="_blank"
rel="noopener noreferrer"
>
<Launch>
<title>
{intl.formatMessage({
id: 'dashboard.logs.launchButtonTooltip',
defaultMessage: 'Open logs in a new window'
})}
</title>
</Launch>
</a>
<a
className={`${carbonPrefix}--btn ${carbonPrefix}--btn--sm ${carbonPrefix}--layout--size-sm ${carbonPrefix}--btn--icon-only ${carbonPrefix}--copy-btn`}
download={name}
href={url}
>
<Download>
<title>
{intl.formatMessage({
id: 'dashboard.logs.downloadButtonTooltip',
defaultMessage: 'Download logs'
})}
</title>
</Download>
</a>
</>
})
}
kind="ghost"
onClick={onToggleMaximized}
renderIcon={isMaximized ? Minimize : Maximize}
size="sm"
/>
) : null}
<Popover
align="bottom-end"
Expand All @@ -121,21 +74,18 @@ const LogsToolbar = ({
}}
open={isSettingsOpen}
>
<button
<Button
aria-expanded={isSettingsOpen}
aria-label={intl.formatMessage({
hasIconOnly
iconDescription={intl.formatMessage({
id: 'dashboard.settings.title',
defaultMessage: 'Settings'
})}
kind="ghost"
onClick={() => setIsSettingsOpen(open => !open)}
title={intl.formatMessage({
id: 'dashboard.settings.title',
defaultMessage: 'Settings'
})}
type="button"
>
<Settings />
</button>
renderIcon={Settings}
size="sm"
/>
<PopoverContent className="tkn--log-settings-menu-content">
<Checkbox
id={`${id}-timestamps-toggle`}
Expand Down Expand Up @@ -228,7 +178,7 @@ const LogsToolbar = ({
) : null}
</PopoverContent>
</Popover>
</div>
</ButtonSet>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2019-2025 The Tekton Authors
Copyright 2019-2026 The Tekton Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down Expand Up @@ -97,27 +97,3 @@ export const WithMaximize = {
);
}
};

export const WithURL = {
args: {
...WithMaximize.args,
name: 'some_filename.txt',
url: '/some/logs/url'
},
render: args => {
const [, updateArgs] = useArgs();

return (
<LogsToolbar
{...args}
onToggleLogLevel={logLevel =>
updateArgs({ logLevels: { ...args.logLevels, ...logLevel } })
}
onToggleMaximized={() => updateArgs({ isMaximized: !args.isMaximized })}
onToggleShowTimestamps={showTimestamps =>
updateArgs({ showTimestamps })
}
/>
);
}
};
Loading