Skip to content

Commit

Permalink
Fix resources issue
Browse files Browse the repository at this point in the history
  • Loading branch information
filippomc committed Mar 5, 2024
1 parent ca2b907 commit ad90802
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ interface WorkspaceProps {
refreshWorkspacePage?: () => void;
currentResource: WorkspaceResource;
hideTabs: Boolean;
staticPage: Boolean;
}

const SidebarBox = styled(Box)(({ theme }) => ({
Expand Down Expand Up @@ -292,6 +293,7 @@ export default (props: WorkspaceProps | any) => {
currentResource={props.currentResource}
refreshWorkspace={handleWorkspaceRefresh}
user={props.user}
staticPage={props.staticPage}
/>
</TabPanel>
<TabPanel value={tabValue} index={1}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const OSBResourceItem = (props: {
const handleOpenResource =
(e: any | Event) => {
e.preventDefault();
const isApplicationChanged = currentResource.type.application.code !== resource.type.application.code;
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}`,
Expand Down Expand Up @@ -197,6 +197,7 @@ interface WorkspaceProps {
refreshWorkspace: () => void;
currentResource: WorkspaceResource;
user: UserInfo;
staticPage: Boolean;
}

const WorkspaceResourceBrowser = (props: WorkspaceProps) => {
Expand Down Expand Up @@ -277,7 +278,8 @@ const WorkspaceResourceBrowser = (props: WorkspaceProps) => {
currentResourceId={currentResourceId}
Icon={Icon}
workspaceId={workspace.id}
currentResource={currentResource}
currentResource={props.staticPage ? null: currentResource}

/>
))}
</Box>
Expand Down
1 change: 1 addition & 0 deletions applications/osb-portal/src/pages/WorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ export const WorkspacePage = (props: any) => {
user={user}
open={true}
hideTabs={true}
staticPage={true}
refreshWorkspace={props.refreshWorkspace}
currentResource={
workspace.lastOpen || workspace.resources[0]
Expand Down

0 comments on commit ad90802

Please sign in to comment.