mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 22:44:55 +00:00
resolve Eugeny/tabby#7723 reconnect command palette
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable, Optional, Inject } from '@angular/core'
|
||||
import { BaseTabComponent, TabContextMenuItemProvider, NotificationsService, MenuItemOptions, TranslateService, SplitTabComponent } from 'tabby-core'
|
||||
import { BaseTerminalTabComponent } from './api/baseTerminalTab.component'
|
||||
import { tabIsReconnectable } from './api/interfaces'
|
||||
import { TerminalContextMenuItemProvider } from './api/contextMenuProvider'
|
||||
import { MultifocusService } from './services/multifocus.service'
|
||||
|
||||
@@ -85,6 +86,35 @@ export class MiscContextMenu extends TabContextMenuItemProvider {
|
||||
}
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
export class ReconnectContextMenu extends TabContextMenuItemProvider {
|
||||
weight = 1
|
||||
|
||||
constructor (
|
||||
private translate: TranslateService,
|
||||
private notifications: NotificationsService,
|
||||
) { super() }
|
||||
|
||||
async getItems (tab: BaseTabComponent): Promise<MenuItemOptions[]> {
|
||||
if (tabIsReconnectable(tab)) {
|
||||
return [
|
||||
{
|
||||
label: this.translate.instant('Reconnect'),
|
||||
click: (): void => {
|
||||
setTimeout(() => {
|
||||
tab.reconnect()
|
||||
this.notifications.notice(this.translate.instant('Reconnect'))
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
export class LegacyContextMenu extends TabContextMenuItemProvider {
|
||||
@@ -109,4 +139,5 @@ export class LegacyContextMenu extends TabContextMenuItemProvider {
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user