Skip to content
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
11 changes: 11 additions & 0 deletions packages/backend.ai-ui/src/icons/BAIFileBrowserIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { default as logo } from './Filebrowser.svg?react';
import Icon from '@ant-design/icons';
import { CustomIconComponentProps } from '@ant-design/icons/lib/components/Icon';

interface BAIFileBrowserIconProps
extends Omit<CustomIconComponentProps, 'width' | 'height' | 'fill'> {}
const BAIFileBrowserIcon: React.FC<BAIFileBrowserIconProps> = (props) => {
return <Icon component={logo} {...props} />;
};

export default BAIFileBrowserIcon;
42 changes: 42 additions & 0 deletions packages/backend.ai-ui/src/icons/Filebrowser.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/backend.ai-ui/src/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ export { default as BAIUserUnionIcon } from './BAIUserUnionIcon';
export { default as BAIHuggingFaceIcon } from './BAIHuggingFaceIcon';
export { default as BAISftpIcon } from './BAISftpIcon';
export { default as BAIJupyterIcon } from './BAIJupyterIcon';
export { default as BAIFileBrowserIcon } from './BAIFileBrowserIcon';
120 changes: 82 additions & 38 deletions react/src/components/ComputeSessionNodeItems/SessionActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Tooltip, Button, theme, Space, ButtonProps } from 'antd';
import {
BAIAppIcon,
BAIContainerCommitIcon,
BAIFileBrowserIcon,
BAIJupyterIcon,
BAISessionLogIcon,
BAISftpIcon,
Expand All @@ -36,7 +37,7 @@ type SessionActionButtonKey =
| 'terminate';

export type PrimaryAppOption = {
appName: 'jupyter';
appName: 'jupyter' | 'filebrowser';
urlPostfix?: string;
};

Expand Down Expand Up @@ -146,44 +147,87 @@ const SessionActionButtons: React.FC<SessionActionButtonsProps> = ({
return session ? (
<>
<Wrapper compact={compact}>
{primaryAppOption && primaryAppOption.appName === 'jupyter' && (
<Tooltip
title={
isButtonTitleMode
? undefined
: t('session.ExecuteSpecificApp', {
appName: 'Jupyter Notebook',
})
}
>
<Button
size={size}
type={'primary'}
disabled={
!isAppSupported(session) || !isActive(session) || !isOwner
}
icon={<BAIJupyterIcon />}
onClick={() => {
const appOption = {
'app-name': primaryAppOption.appName,
'session-uuid': session?.row_id,
'url-postfix': primaryAppOption.urlPostfix,
};
{primaryAppOption && (
<>
{primaryAppOption.appName === 'jupyter' && (
<Tooltip
title={
isButtonTitleMode
? undefined
: t('session.ExecuteSpecificApp', {
appName: 'Jupyter Notebook',
})
}
>
<Button
size={size}
type={'primary'}
disabled={
!isAppSupported(session) || !isActive(session) || !isOwner
}
icon={<BAIJupyterIcon />}
onClick={() => {
const appOption = {
'app-name': primaryAppOption.appName,
'session-uuid': session?.row_id,
'url-postfix': primaryAppOption.urlPostfix,
};

// @ts-ignore
globalThis.appLauncher._runApp(
omitNullAndUndefinedFields(appOption),
);
}}
title={
isButtonTitleMode
? t('session.ExecuteSpecificApp', {
appName: 'Jupyter Notebook',
})
: undefined
}
/>
</Tooltip>
// @ts-ignore
globalThis.appLauncher._runApp(
omitNullAndUndefinedFields(appOption),
);
}}
title={
isButtonTitleMode
? t('session.ExecuteSpecificApp', {
appName: 'Jupyter Notebook',
})
: undefined
}
/>
</Tooltip>
)}
{primaryAppOption.appName === 'filebrowser' && (
<Tooltip
title={
isButtonTitleMode
? undefined
: t('session.ExecuteSpecificApp', {
appName: 'Jupyter Notebook',
})
}
>
<Button
size={size}
type={'primary'}
disabled={
!isAppSupported(session) || !isActive(session) || !isOwner
}
icon={<BAIFileBrowserIcon />}
onClick={() => {
const appOption = {
'app-name': primaryAppOption.appName,
'session-uuid': session?.row_id,
'url-postfix': primaryAppOption.urlPostfix,
};

// @ts-ignore
globalThis.appLauncher._runApp(
omitNullAndUndefinedFields(appOption),
);
}}
title={
isButtonTitleMode
? t('session.ExecuteSpecificApp', {
appName: 'File browser',
})
: undefined
}
/>
</Tooltip>
)}
</>
)}
{isVisible('appLauncher') && (
<>
Expand Down
9 changes: 8 additions & 1 deletion react/src/components/FolderExplorerHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { FolderExplorerHeaderFragment$key } from '../__generated__/FolderExplorerHeaderFragment.graphql';
import { PrimaryAppOption } from './ComputeSessionNodeItems/SessionActionButtons';
import EditableVFolderName from './EditableVFolderName';
import VFolderNodeIdenticon from './VFolderNodeIdenticon';
import { Button, Tooltip, Image, Grid, theme, Typography, App } from 'antd';
Expand Down Expand Up @@ -218,7 +219,13 @@ const FolderExplorerHeader: React.FC<FolderExplorerHeaderProps> = ({
results?.fulfilled &&
results.fulfilled.length > 0
) {
upsertSessionNotification(results.fulfilled);
upsertSessionNotification(results.fulfilled, [
{
extraData: {
appName: 'filebrowser',
} as PrimaryAppOption,
},
]);
}
if (
results?.rejected &&
Expand Down
Loading