Skip to content

Commit

Permalink
compose menu based on session type
Browse files Browse the repository at this point in the history
  • Loading branch information
mbektas committed Feb 28, 2024
1 parent c72e31f commit 8621eab
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/main/sessionwindow/sessionwindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -857,13 +857,12 @@ export class SessionWindow implements IDisposable {
return;
}

const template: MenuItemConstructorOptions[] = [
{
label: 'New Window',
click: () => {
this._newWindow();
}
},
const inSession =
this._contentViewType === ContentViewType.Lab &&
!this._progressViewVisible;
const inLocalSession = inSession && !this._sessionConfig?.remoteURL;

const uiModeSubmenu: MenuItemConstructorOptions[] = [
{
label: 'UI Mode',
visible:
Expand Down Expand Up @@ -912,18 +911,29 @@ export class SessionWindow implements IDisposable {
this._labView.uiMode === UIMode.Custom
}
]
},
{ type: 'separator' },
}
];

const closeSessionMenuItem: MenuItemConstructorOptions[] = [
{
label: 'Close Session',
visible:
this._contentViewType === ContentViewType.Lab &&
!this._progressViewVisible,
click: () => {
this._closeSession();
}
},
{ type: 'separator' }
];

const template: MenuItemConstructorOptions[] = [
{
label: 'New Window',
click: () => {
this._newWindow();
}
},
...(inLocalSession ? uiModeSubmenu : []),
{ type: 'separator' },
...(inSession ? closeSessionMenuItem : []),
{
label: 'Settings',
click: () => {
Expand Down

0 comments on commit 8621eab

Please sign in to comment.