Auto open log view in NextScaffolderPage

Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2023-09-26 12:51:30 +02:00
parent b6b04d84f8
commit d5277b5b54
3 changed files with 9 additions and 1 deletions
+1
View File
@@ -241,6 +241,7 @@ const routes = (
path="/create"
element={
<NextScaffolderPage
logs={{ autoOpen: true }}
groups={[
{
title: 'Recommended',
@@ -52,6 +52,9 @@ export const OngoingTask = (props: {
TemplateOutputsComponent?: React.ComponentType<{
output?: ScaffolderTaskOutput;
}>;
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(() => {
@@ -65,6 +65,9 @@ export type NextRouterProps = {
TemplateListPageComponent?: React.ComponentType<TemplateListPageProps>;
TemplateWizardPageComponent?: React.ComponentType<TemplateWizardPageProps>;
};
logs?: {
autoOpen?: boolean;
};
groups?: TemplateGroupFilter[];
templateFilter?: (entity: TemplateEntityV1beta3) => boolean;
// todo(blam): rename this to formProps
@@ -139,6 +142,7 @@ export const Router = (props: PropsWithChildren<NextRouterProps>) => {
path={scaffolderTaskRouteRef.path}
element={
<TaskPageComponent
logs={props.logs}
TemplateOutputsComponent={TemplateOutputsComponent}
/>
}