Skip to content

Commit

Permalink
feat: open folder explorer from session detail panel using vfolder_nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ironAiken2 committed Feb 20, 2025
1 parent d54d1c4 commit 62893ab
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 22 deletions.
18 changes: 17 additions & 1 deletion react/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ type Queries {

"""Added in 24.09.0."""
compute_session_nodes(
"""Added in 24.12.0."""
"""
Added in 25.2.0. Default value `system` queries across the entire system.
"""
scope_id: ScopeField

"""Added in 24.09.0."""
Expand Down Expand Up @@ -612,6 +614,14 @@ type KernelNode implements Node {
cluster_hostname: String
session_id: UUID
image: ImageNode

"""Added in 25.2.0."""
image_reference: String

"""
Added in 24.12.0. The architecture that the image of this kernel requires
"""
architecture: String
status: String
status_changed: DateTime
status_info: String
Expand Down Expand Up @@ -1227,6 +1237,12 @@ type ComputeSessionNode implements Node {
vfolder_mounts: [String]
occupied_slots: JSONString
requested_slots: JSONString

"""Added in 25.2.0."""
image_references: [String]

"""Added in 25.2.0."""
vfolder_nodes(filter: String, order: String, offset: Int, before: String, after: String, first: Int, last: Int): VirtualFolderConnection
num_queries: BigInt
inference_metrics: JSONString
kernel_nodes(filter: String, order: String, offset: Int, before: String, after: String, first: Int, last: Int): KernelConnection
Expand Down
71 changes: 50 additions & 21 deletions react/src/components/SessionDetailContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ const SessionDetailContent: React.FC<{
resource_opts
status
vfolder_mounts
vfolder_nodes @since(version: "25.2.0") {
edges {
node {
id
row_id
name
}
}
count
}
created_at @required(action: NONE)
terminated_at
scaling_group
Expand Down Expand Up @@ -220,27 +230,46 @@ const SessionDetailContent: React.FC<{
)}
</Descriptions.Item>
<Descriptions.Item label={t('session.launcher.MountedFolders')}>
{baiClient.supports('vfolder-mounts')
? _.map(
_.zip(legacy_session?.mounts, session?.vfolder_mounts),
(mountInfo) => {
const [name, id] = mountInfo;
return (
<Button
key={id}
type="link"
size="small"
icon={<FolderOutlined />}
onClick={() => {
open(id ?? '');
}}
>
{name}
</Button>
);
},
)
: legacy_session?.mounts?.join(', ')}
{session.vfolder_nodes
? _.map(session?.vfolder_nodes?.edges, (vfolder) => {
return (
<Button
key={vfolder?.node?.id}
type="link"
size="small"
icon={<FolderOutlined />}
onClick={() => {
open(vfolder?.node?.row_id ?? '');
}}
>
{vfolder?.node?.name}
</Button>
);
})
: baiClient.supports('vfolder-mounts')
? _.map(
// compute_session_node query's vfolder_mounts is not include name.
// To provide vfolder name in compute_session_node, schema must be changed.
// legacy_session.mounts (name) and session.vfolder_mounts (id) give vfolder information in same order.
_.zip(legacy_session?.mounts, session?.vfolder_mounts),
(mountInfo) => {
const [name, id] = mountInfo;
return (
<Button
key={id}
type="link"
size="small"
icon={<FolderOutlined />}
onClick={() => {
open(id ?? '');
}}
>
{name}
</Button>
);
},
)
: legacy_session?.mounts?.join(', ')}
</Descriptions.Item>
<Descriptions.Item label={t('session.launcher.ResourceAllocation')}>
<Flex gap={'sm'} wrap="wrap">
Expand Down

0 comments on commit 62893ab

Please sign in to comment.