Added a visibility log button to a panel
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
---
|
||||
|
||||
Added a possibility to open logs view in a scaffolder execution panel automatically
|
||||
@@ -241,7 +241,6 @@ const routes = (
|
||||
path="/create"
|
||||
element={
|
||||
<NextScaffolderPage
|
||||
logs={{ autoOpen: true }}
|
||||
groups={[
|
||||
{
|
||||
title: 'Recommended',
|
||||
|
||||
@@ -35,9 +35,6 @@ export type NextRouterProps = {
|
||||
TemplateListPageComponent?: React_2.ComponentType<TemplateListPageProps>;
|
||||
TemplateWizardPageComponent?: React_2.ComponentType<TemplateWizardPageProps>;
|
||||
};
|
||||
logs?: {
|
||||
autoOpen?: boolean;
|
||||
};
|
||||
groups?: TemplateGroupFilter[];
|
||||
templateFilter?: (entity: TemplateEntityV1beta3) => boolean;
|
||||
FormProps?: FormProps_2;
|
||||
|
||||
@@ -46,15 +46,15 @@ const useStyles = makeStyles(theme => ({
|
||||
cancelButton: {
|
||||
marginRight: theme.spacing(1),
|
||||
},
|
||||
logsVisibilityButton: {
|
||||
marginRight: theme.spacing(1),
|
||||
},
|
||||
}));
|
||||
|
||||
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();
|
||||
@@ -72,7 +72,7 @@ export const OngoingTask = (props: {
|
||||
[taskStream],
|
||||
);
|
||||
|
||||
const [logsVisible, setLogVisibleState] = useState(props.logs?.autoOpen ?? false);
|
||||
const [logsVisible, setLogVisibleState] = useState(false);
|
||||
const [buttonBarVisible, setButtonBarVisibleState] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -191,6 +191,14 @@ export const OngoingTask = (props: {
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
className={classes.logsVisibilityButton}
|
||||
color="primary"
|
||||
variant="outlined"
|
||||
onClick={() => setLogVisibleState(!logsVisible)}
|
||||
>
|
||||
{logsVisible ? 'Hide Logs' : 'Show Logs'}
|
||||
</Button>
|
||||
<Button
|
||||
variant="contained"
|
||||
color="primary"
|
||||
|
||||
@@ -65,9 +65,6 @@ 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
|
||||
@@ -142,7 +139,6 @@ export const Router = (props: PropsWithChildren<NextRouterProps>) => {
|
||||
path={scaffolderTaskRouteRef.path}
|
||||
element={
|
||||
<TaskPageComponent
|
||||
logs={props.logs}
|
||||
TemplateOutputsComponent={TemplateOutputsComponent}
|
||||
/>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user