From d5277b5b54a96750b1992650be1d740dba7341e7 Mon Sep 17 00:00:00 2001 From: Bogdan Nechyporenko Date: Tue, 26 Sep 2023 12:51:30 +0200 Subject: [PATCH] Auto open log view in NextScaffolderPage Signed-off-by: Bogdan Nechyporenko --- packages/app/src/App.tsx | 1 + plugins/scaffolder/src/next/OngoingTask/OngoingTask.tsx | 5 ++++- plugins/scaffolder/src/next/Router/Router.tsx | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index a0a6419328..b7774ee1b6 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -241,6 +241,7 @@ const routes = ( path="/create" element={ ; + logs?: { + autoOpen?: boolean; + }; }) => { // todo(blam): check that task Id actually exists, and that it's valid. otherwise redirect to something more useful. const { taskId } = useParams(); @@ -69,7 +72,7 @@ export const OngoingTask = (props: { [taskStream], ); - const [logsVisible, setLogVisibleState] = useState(false); + const [logsVisible, setLogVisibleState] = useState(props.logs?.autoOpen); const [buttonBarVisible, setButtonBarVisibleState] = useState(true); useEffect(() => { diff --git a/plugins/scaffolder/src/next/Router/Router.tsx b/plugins/scaffolder/src/next/Router/Router.tsx index 2061cd1243..12193ac48b 100644 --- a/plugins/scaffolder/src/next/Router/Router.tsx +++ b/plugins/scaffolder/src/next/Router/Router.tsx @@ -65,6 +65,9 @@ export type NextRouterProps = { TemplateListPageComponent?: React.ComponentType; TemplateWizardPageComponent?: React.ComponentType; }; + logs?: { + autoOpen?: boolean; + }; groups?: TemplateGroupFilter[]; templateFilter?: (entity: TemplateEntityV1beta3) => boolean; // todo(blam): rename this to formProps @@ -139,6 +142,7 @@ export const Router = (props: PropsWithChildren) => { path={scaffolderTaskRouteRef.path} element={ }