mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-05 22:44:55 +00:00
deprecated matchedHotkey
This commit is contained in:
@@ -4,8 +4,9 @@ import { FormsModule } from '@angular/forms'
|
||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { ToastrModule } from 'ngx-toastr'
|
||||
import { NgxFilesizeModule } from 'ngx-filesize'
|
||||
import TabbyCoreModule, { ConfigProvider, TabRecoveryProvider, HotkeyProvider, ProfileProvider } from 'tabby-core'
|
||||
import TabbyCoreModule, { ConfigProvider, TabRecoveryProvider, HotkeyProvider, ProfileProvider, HotkeysService, AppService, SelectorService, ProfilesService, SelectorOption } from 'tabby-core'
|
||||
import TabbyTerminalModule from 'tabby-terminal'
|
||||
import { SettingsTabComponent } from 'tabby-settings'
|
||||
|
||||
import { TelnetProfileSettingsComponent } from './components/telnetProfileSettings.component'
|
||||
import { TelnetTabComponent } from './components/telnetTab.component'
|
||||
@@ -30,7 +31,7 @@ import { TelnetProfilesService } from './profiles'
|
||||
{ provide: ConfigProvider, useClass: TelnetConfigProvider, multi: true },
|
||||
{ provide: TabRecoveryProvider, useClass: RecoveryProvider, multi: true },
|
||||
{ provide: HotkeyProvider, useClass: TelnetHotkeyProvider, multi: true },
|
||||
{ provide: ProfileProvider, useClass: TelnetProfilesService, multi: true },
|
||||
{ provide: ProfileProvider, useExisting: TelnetProfilesService, multi: true },
|
||||
],
|
||||
entryComponents: [
|
||||
TelnetProfileSettingsComponent,
|
||||
@@ -41,4 +42,49 @@ import { TelnetProfilesService } from './profiles'
|
||||
TelnetTabComponent,
|
||||
],
|
||||
})
|
||||
export default class TelnetModule { } // eslint-disable-line @typescript-eslint/no-extraneous-class
|
||||
export default class TelnetModule {
|
||||
constructor (
|
||||
hotkeys: HotkeysService,
|
||||
private app: AppService,
|
||||
private selector: SelectorService,
|
||||
private profilesService: ProfilesService,
|
||||
private telnetProfiles: TelnetProfilesService,
|
||||
) {
|
||||
hotkeys.hotkey$.subscribe(hotkey => {
|
||||
if (hotkey === 'telnet-profile-selector') {
|
||||
this.showSelector()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async showSelector (): Promise<void> {
|
||||
let profiles = await this.profilesService.getProfiles()
|
||||
|
||||
profiles = profiles.filter(x => !x.isTemplate && x.type === 'telnet')
|
||||
|
||||
const options: SelectorOption<void>[] = profiles.map(p => ({
|
||||
...this.profilesService.selectorOptionForProfile(p),
|
||||
callback: () => this.profilesService.openNewTabForProfile(p),
|
||||
}))
|
||||
|
||||
options.push({
|
||||
name: 'Manage profiles',
|
||||
icon: 'fas fa-window-restore',
|
||||
callback: () => this.app.openNewTabRaw({
|
||||
type: SettingsTabComponent,
|
||||
inputs: { activeTab: 'profiles' },
|
||||
}),
|
||||
})
|
||||
|
||||
options.push({
|
||||
name: 'Quick connect',
|
||||
freeInputPattern: 'Connect to "%s"...',
|
||||
icon: 'fas fa-arrow-right',
|
||||
callback: query => this.profilesService.openNewTabForProfile(
|
||||
this.telnetProfiles.quickConnect(query)
|
||||
),
|
||||
})
|
||||
|
||||
await this.selector.show('Select an Telnet profile', options)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user