From dd2edbc6dfe686a3bc6e6f90eda638064b05d20f Mon Sep 17 00:00:00 2001 From: Alisson Fabiano Date: Tue, 21 Jan 2025 15:16:36 -0300 Subject: [PATCH 1/6] fix log stream component to take up remaining space Signed-off-by: Alisson Fabiano --- .../src/components/OngoingTask/OngoingTask.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx index ffcc377995..97047d00c9 100644 --- a/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx +++ b/plugins/scaffolder/src/components/OngoingTask/OngoingTask.tsx @@ -20,7 +20,6 @@ import Box from '@material-ui/core/Box'; import Button from '@material-ui/core/Button'; import Paper from '@material-ui/core/Paper'; import { makeStyles } from '@material-ui/core/styles'; -import { ResizableBox } from 'react-resizable'; import { ScaffolderTaskOutput, scaffolderApiRef, @@ -119,6 +118,7 @@ export const OngoingTask = (props: { useEffect(() => { if (taskStream.completed && !taskStream.error) { + setLogVisibleState(true); setButtonBarVisibleState(false); } }, [taskStream.error, taskStream.completed]); @@ -292,13 +292,11 @@ export const OngoingTask = (props: { ) : null} {logsVisible ? ( - - - - - - - + + + + + ) : null} From b11d5cc5da562211d7fc0329dadf1457fd49c7ce Mon Sep 17 00:00:00 2001 From: Alisson Fabiano Date: Tue, 21 Jan 2025 15:16:46 -0300 Subject: [PATCH 2/6] add feature to move scroll to the end of lines Signed-off-by: Alisson Fabiano --- .../components/LogViewer/RealLogViewer.tsx | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/packages/core-components/src/components/LogViewer/RealLogViewer.tsx b/packages/core-components/src/components/LogViewer/RealLogViewer.tsx index cbeb249815..37768ad80b 100644 --- a/packages/core-components/src/components/LogViewer/RealLogViewer.tsx +++ b/packages/core-components/src/components/LogViewer/RealLogViewer.tsx @@ -18,12 +18,12 @@ import Box from '@material-ui/core/Box'; import IconButton from '@material-ui/core/IconButton'; import CopyIcon from '@material-ui/icons/FileCopy'; import classnames from 'classnames'; -import React, { useEffect, useMemo, useRef } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { useLocation } from 'react-router-dom'; import AutoSizer from 'react-virtualized-auto-sizer'; import { FixedSizeList } from 'react-window'; -import { AnsiProcessor } from './AnsiProcessor'; +import { AnsiLine, AnsiProcessor } from './AnsiProcessor'; import { LogLine } from './LogLine'; import { LogViewerControls } from './LogViewerControls'; import { HEADER_SIZE, useStyles } from './styles'; @@ -37,7 +37,9 @@ export interface RealLogViewerProps { export function RealLogViewer(props: RealLogViewerProps) { const classes = useStyles({ classes: props.classes }); - const listRef = useRef(null); + const [fixedListInstance, setFixedListInstance] = useState | null>(null); // The processor keeps state that optimizes appending to the text const processor = useMemo(() => new AnsiProcessor(), []); @@ -48,10 +50,21 @@ export function RealLogViewer(props: RealLogViewerProps) { const location = useLocation(); useEffect(() => { - if (search.resultLine !== undefined && listRef.current) { - listRef.current.scrollToItem(search.resultLine - 1, 'center'); + if (fixedListInstance) { + fixedListInstance.scrollToItem(lines.length - 1, 'end'); } - }, [search.resultLine]); + }, [fixedListInstance, lines]); + + useEffect(() => { + if (!fixedListInstance) { + return; + } + if (search.resultLine) { + fixedListInstance.scrollToItem(search.resultLine - 1, 'center'); + } else { + fixedListInstance.scrollToItem(lines.length - 1, 'end'); + } + }, [fixedListInstance, search.resultLine, lines]); useEffect(() => { if (location.hash) { @@ -76,7 +89,9 @@ export function RealLogViewer(props: RealLogViewerProps) { ) => { + setFixedListInstance(instance); + }} className={classes.log} height={(height || 480) - HEADER_SIZE} width={width || 640} From 17088d22bc11f7a21f35dee39d2c59032f3d4e1f Mon Sep 17 00:00:00 2001 From: Alisson Fabiano Date: Tue, 21 Jan 2025 15:16:57 -0300 Subject: [PATCH 3/6] add changeset Signed-off-by: Alisson Fabiano --- .changeset/loud-baboons-relate.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/loud-baboons-relate.md diff --git a/.changeset/loud-baboons-relate.md b/.changeset/loud-baboons-relate.md new file mode 100644 index 0000000000..408188abd0 --- /dev/null +++ b/.changeset/loud-baboons-relate.md @@ -0,0 +1,7 @@ +--- +'@backstage/core-components': minor +'@backstage/plugin-scaffolder': minor +--- + +Changes the TaskLogStream to take up all remaining space +Changes the RealLogViewer to always display the last line by default From 5258c3511aa7e8985f00b4aa8e08df3e464c1a16 Mon Sep 17 00:00:00 2001 From: esw-afabiano <135993301+esw-afabiano@users.noreply.github.com> Date: Fri, 24 Jan 2025 13:29:40 -0300 Subject: [PATCH 4/6] Update .changeset/loud-baboons-relate.md Co-authored-by: Ben Lambert Signed-off-by: esw-afabiano <135993301+esw-afabiano@users.noreply.github.com> --- .changeset/loud-baboons-relate.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.changeset/loud-baboons-relate.md b/.changeset/loud-baboons-relate.md index 408188abd0..a6ea65f685 100644 --- a/.changeset/loud-baboons-relate.md +++ b/.changeset/loud-baboons-relate.md @@ -3,5 +3,4 @@ '@backstage/plugin-scaffolder': minor --- -Changes the TaskLogStream to take up all remaining space -Changes the RealLogViewer to always display the last line by default +Updating the `TaskLogStream` to take up all space in a running task, and also show the last line of the log by default From 5b78cd9c17842d99e65c0831a244b2f22f213e2f Mon Sep 17 00:00:00 2001 From: esw-afabiano <135993301+esw-afabiano@users.noreply.github.com> Date: Fri, 24 Jan 2025 13:29:47 -0300 Subject: [PATCH 5/6] Update .changeset/loud-baboons-relate.md Co-authored-by: Ben Lambert Signed-off-by: esw-afabiano <135993301+esw-afabiano@users.noreply.github.com> --- .changeset/loud-baboons-relate.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/loud-baboons-relate.md b/.changeset/loud-baboons-relate.md index a6ea65f685..8f719861e1 100644 --- a/.changeset/loud-baboons-relate.md +++ b/.changeset/loud-baboons-relate.md @@ -1,5 +1,5 @@ --- -'@backstage/core-components': minor +'@backstage/core-components': patch '@backstage/plugin-scaffolder': minor --- From 057164f795f1362a0e4465d523c09fa112625051 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Mon, 27 Jan 2025 15:59:43 +0100 Subject: [PATCH 6/6] .github/workflows: add separate build for canon Signed-off-by: Patrik Oldsberg --- .github/workflows/ci.yml | 4 ++++ .github/workflows/deploy_packages.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcf5ed94a0..794e5d2cdb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -127,6 +127,10 @@ jobs: - name: build all packages run: yarn backstage-cli repo build --all + # For now canon has a custom build script and needs to be built separately + - name: build canon + run: yarn --cwd packages/canon build + - name: verify type dependencies run: yarn lint:type-deps diff --git a/.github/workflows/deploy_packages.yml b/.github/workflows/deploy_packages.yml index d59bb189d0..fc6997a2e9 100644 --- a/.github/workflows/deploy_packages.yml +++ b/.github/workflows/deploy_packages.yml @@ -110,6 +110,10 @@ jobs: - name: build run: yarn backstage-cli repo build --all + # For now canon has a custom build script and needs to be built separately + - name: build canon + run: yarn --cwd packages/canon build + - name: verify type dependencies run: yarn lint:type-deps