Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

918 - Long lists of resources don't scroll #925

Merged
merged 1 commit into from
Apr 24, 2024
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 @@ -130,6 +130,7 @@ function TabPanel(props) {
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
className="verticalFit"
{...other}
>
{value === index && (
Expand Down Expand Up @@ -201,7 +202,7 @@ export default (props: WorkspaceProps | any) => {
return (
<>
{props.open ? (
<SidebarBox>
<SidebarBox className="verticalFill">
{!hideTabs && (
<Box sx={{ borderBottom: 1, borderColor: "divider" }}>
<Tabs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const SidebarIconButton = styled(IconButton)(({ theme }) => ({
padding: 0,
"& .MuiSvgIcon-root": {
color: paragraph,
width: '1rem',
width: '1rem',
height: '1rem'
},
"&:hover": {
Expand Down Expand Up @@ -132,22 +132,22 @@ const OSBResourceItem = (props: {
};

const handleOpenResource =
(e: any | Event) => {
e.preventDefault();
const isApplicationChanged = currentResource && currentResource.type.application.code !== resource.type.application.code;
if(isApplicationChanged && window.confirm("Unsaved changes will be lost: are you sure you want to change application?")){
navigate(
{pathname: `/workspaces/open/${workspaceId}/${resource.type.application.code}`,
search: `?resource=${encodeURIComponent(resource.name)}`},
)
}
if(!isApplicationChanged){
navigate(
{pathname: `/workspaces/open/${workspaceId}/${resource.type.application.code}`,
search: `?resource=${encodeURIComponent(resource.name)}`},
)
}
};
(e: any | Event) => {
e.preventDefault();
const isApplicationChanged = currentResource && currentResource.type.application.code !== resource.type.application.code;
if(isApplicationChanged && window.confirm("Unsaved changes will be lost: are you sure you want to change application?")){
navigate(
{pathname: `/workspaces/open/${workspaceId}/${resource.type.application.code}`,
search: `?resource=${encodeURIComponent(resource.name)}`},
)
}
if(!isApplicationChanged){
navigate(
{pathname: `/workspaces/open/${workspaceId}/${resource.type.application.code}`,
search: `?resource=${encodeURIComponent(resource.name)}`},
)
}
};

return (
<ResourceItem
Expand All @@ -163,8 +163,8 @@ const OSBResourceItem = (props: {
>
{!active && <Tooltip title="Delete resource" placement="right">
<DeleteOutlinedIcon fontSize="small" onClick={handleDeleteResource} />
</Tooltip>
}
</Tooltip>
}
</SidebarIconButton>
}
>
Expand All @@ -181,8 +181,8 @@ const OSBResourceItem = (props: {
title={`${workspaceResourceService.getResourcePath(resource)}.
${
active
? "This is the resource currently opened on"
: "Click on this resource to open with"
? "This is the resource currently opened on"
: "Click on this resource to open with"
} ${resource.type.application.name}.`}
>
<ListItemText primary={resource.name} />
Expand Down Expand Up @@ -213,7 +213,7 @@ const WorkspaceResourceBrowser = (props: WorkspaceProps) => {
if (!workspace.resources || workspace.resources.length === 0) {
return null;
}

const resources = workspace.resources.filter(
(resource) => resource.id !== undefined && resource.id !== -1
);
Expand Down Expand Up @@ -267,7 +267,7 @@ const WorkspaceResourceBrowser = (props: WorkspaceProps) => {
/>
<Typography>{resources.length}</Typography>
</ListItemButton>
<Box className="scrollbar" sx={{ paddingRight: '0 !important' }}>
<Box sx={{ paddingRight: '0 !important' }}>
{open &&
resources.map((resource) => (
<OSBResourceItem
Expand All @@ -288,67 +288,65 @@ const WorkspaceResourceBrowser = (props: WorkspaceProps) => {
};

return (
<Box className="verticalFill">
<Box width="100%" className="verticalFill">
<List className="verticalFill" sx={{ pt: 0, pb: 0 }}>
{experimentalResources.length > 0 && (
<ResourceTreeGroup
resources={experimentalResources}
open={resourceOpenState.experimental}
label={"Experiment Data"}
Icon={<AreaChartIcon fontSize="small" />}
onToggle={() => toggleResourceGroup('experimental')}
currentResource={currentResource}
/>
)}
{modelResources.length > 0 && (
<ResourceTreeGroup
resources={modelResources}
open={resourceOpenState.model}
label={"Models"}
Icon={<ViewInArIcon fontSize="small" />}
onToggle={() => toggleResourceGroup('model')}
currentResource={currentResource}
/>
)}
{notebookResources.length > 0 && (
<ResourceTreeGroup
resources={notebookResources}
open={resourceOpenState.notebook}
label={"Notebooks"}
Icon={<StickyNote2OutlinedIcon fontSize="small" />}
onToggle={() => toggleResourceGroup('notebook')}
currentResource={currentResource}
/>
)}
</List>
{pendingResource && (
<ListItem
component="div"
className="workspace-tab-header"
disablePadding
sx={{
pointerEvents: "none",
"&:hover": {
background: "none",
},
}}
>
<ListItemButton>
<ListItemText
primary={pendingResource.name + "..."}
primaryTypographyProps={{
variant: "body2",
color: bgInputs,
}}
/>
<SidebarIconButton>
<DownloadingIcon fontSize="small" sx={{ fill: bgInputs }} />
</SidebarIconButton>
</ListItemButton>
</ListItem>
<Box width="100%" className="scrollbar" sx={{ paddingRight: '0 !important' }}>
<List sx={{ pt: 0, pb: 0 }}>
{experimentalResources.length > 0 && (
<ResourceTreeGroup
resources={experimentalResources}
open={resourceOpenState.experimental}
label={"Experiment Data"}
Icon={<AreaChartIcon fontSize="small" />}
onToggle={() => toggleResourceGroup('experimental')}
currentResource={currentResource}
/>
)}
{modelResources.length > 0 && (
<ResourceTreeGroup
resources={modelResources}
open={resourceOpenState.model}
label={"Models"}
Icon={<ViewInArIcon fontSize="small" />}
onToggle={() => toggleResourceGroup('model')}
currentResource={currentResource}
/>
)}
{notebookResources.length > 0 && (
<ResourceTreeGroup
resources={notebookResources}
open={resourceOpenState.notebook}
label={"Notebooks"}
Icon={<StickyNote2OutlinedIcon fontSize="small" />}
onToggle={() => toggleResourceGroup('notebook')}
currentResource={currentResource}
/>
)}
</Box>
</List>
{pendingResource && (
<ListItem
component="div"
className="workspace-tab-header"
disablePadding
sx={{
pointerEvents: "none",
"&:hover": {
background: "none",
},
}}
>
<ListItemButton>
<ListItemText
primary={pendingResource.name + "..."}
primaryTypographyProps={{
variant: "body2",
color: bgInputs,
}}
/>
<SidebarIconButton>
<DownloadingIcon fontSize="small" sx={{ fill: bgInputs }} />
</SidebarIconButton>
</ListItemButton>
</ListItem>
)}
</Box>
);
};
Expand Down
Loading