diff --git a/tabby-core/src/api/index.ts b/tabby-core/src/api/index.ts index 5ca9b636..cc467f96 100644 --- a/tabby-core/src/api/index.ts +++ b/tabby-core/src/api/index.ts @@ -16,7 +16,7 @@ export { BootstrapData, PluginInfo, BOOTSTRAP_DATA } from './mainProcess' export { HostWindowService } from './hostWindow' export { HostAppService, Platform } from './hostApp' export { FileProvider } from './fileProvider' -export { ProfileProvider, ConnectableProfileProvider, Profile, ConnectableProfile, PartialProfile, ProfileSettingsComponent, ProfileGroup, PartialProfileGroup } from './profileProvider' +export { ProfileProvider, ConnectableProfileProvider, QuickConnectProfileProvider, Profile, ConnectableProfile, PartialProfile, ProfileSettingsComponent, ProfileGroup, PartialProfileGroup } from './profileProvider' export { PromptModalComponent } from '../components/promptModal.component' export * from './commands' diff --git a/tabby-core/src/api/profileProvider.ts b/tabby-core/src/api/profileProvider.ts index 01c7b759..ba13b0ff 100644 --- a/tabby-core/src/api/profileProvider.ts +++ b/tabby-core/src/api/profileProvider.ts @@ -74,14 +74,12 @@ export abstract class ProfileProvider

{ deleteProfile (profile: P): void { } } -export abstract class ConnectableProfileProvider

extends ProfileProvider

{ +export abstract class ConnectableProfileProvider

extends ProfileProvider

{} - quickConnect (query: string): PartialProfile

|null { - return null - } +export abstract class QuickConnectProfileProvider

extends ConnectableProfileProvider

{ - intoQuickConnectString (profile: P): string|null { - return null - } + abstract quickConnect (query: string): PartialProfile

|null + + abstract intoQuickConnectString (profile: P): string|null } diff --git a/tabby-core/src/index.ts b/tabby-core/src/index.ts index d0d06789..e376edec 100644 --- a/tabby-core/src/index.ts +++ b/tabby-core/src/index.ts @@ -37,7 +37,7 @@ import { FastHtmlBindDirective } from './directives/fastHtmlBind.directive' import { DropZoneDirective } from './directives/dropZone.directive' import { CdkAutoDropGroup } from './directives/cdkAutoDropGroup.directive' -import { Theme, CLIHandler, TabContextMenuItemProvider, TabRecoveryProvider, HotkeyProvider, ConfigProvider, PlatformService, FileProvider, ProfilesService, ProfileProvider, ConnectableProfileProvider, SelectorOption, Profile, SelectorService, CommandProvider } from './api' +import { Theme, CLIHandler, TabContextMenuItemProvider, TabRecoveryProvider, HotkeyProvider, ConfigProvider, PlatformService, FileProvider, ProfilesService, ProfileProvider, QuickConnectProfileProvider, SelectorOption, Profile, SelectorService, CommandProvider } from './api' import { AppService } from './services/app.service' import { ConfigService } from './services/config.service' @@ -214,7 +214,7 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex callback: () => this.profilesService.openNewTabForProfile(p), })) - if (provider instanceof ConnectableProfileProvider) { + if (provider instanceof QuickConnectProfileProvider) { options.push({ name: this.translate.instant('Quick connect'), freeInputPattern: this.translate.instant('Connect to "%s"...'), diff --git a/tabby-core/src/services/profiles.service.ts b/tabby-core/src/services/profiles.service.ts index 2501bca0..ad6c991e 100644 --- a/tabby-core/src/services/profiles.service.ts +++ b/tabby-core/src/services/profiles.service.ts @@ -2,7 +2,7 @@ import { Injectable, Inject } from '@angular/core' import { TranslateService } from '@ngx-translate/core' import { NewTabParameters } from './tabs.service' import { BaseTabComponent } from '../components/baseTab.component' -import { ConnectableProfileProvider, PartialProfile, PartialProfileGroup, Profile, ProfileGroup, ProfileProvider } from '../api/profileProvider' +import { QuickConnectProfileProvider, PartialProfile, PartialProfileGroup, Profile, ProfileGroup, ProfileProvider } from '../api/profileProvider' import { SelectorOption } from '../api/selector' import { AppService } from './app.service' import { configMerge, ConfigProxy, ConfigService } from './config.service' @@ -230,7 +230,7 @@ export class ProfilesService { selectorOptionForProfile

(profile: PartialProfile

): SelectorOption { const fullProfile = this.getConfigProxyForProfile(profile) const provider = this.providerForProfile(fullProfile) - const freeInputEquivalent = provider instanceof ConnectableProfileProvider ? provider.intoQuickConnectString(fullProfile) ?? undefined : undefined + const freeInputEquivalent = provider instanceof QuickConnectProfileProvider ? provider.intoQuickConnectString(fullProfile) ?? undefined : undefined return { ...profile, group: this.resolveProfileGroupName(profile.group ?? ''), @@ -308,7 +308,7 @@ export class ProfilesService { } catch { } this.getProviders().forEach(provider => { - if (provider instanceof ConnectableProfileProvider) { + if (provider instanceof QuickConnectProfileProvider) { options.push({ name: this.translate.instant('Quick connect'), freeInputPattern: this.translate.instant('Connect to "%s"...'), @@ -338,7 +338,7 @@ export class ProfilesService { async quickConnect (query: string): Promise|null> { for (const provider of this.getProviders()) { - if (provider instanceof ConnectableProfileProvider) { + if (provider instanceof QuickConnectProfileProvider) { const profile = provider.quickConnect(query) if (profile) { return profile diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index 9a3589dc..d9cb446b 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -2,7 +2,7 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker' import deepClone from 'clone-deep' import { Component, Inject } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform, ProfileGroup, PartialProfileGroup, ConnectableProfileProvider } from 'tabby-core' +import { ConfigService, HostAppService, Profile, SelectorService, ProfilesService, PromptModalComponent, PlatformService, BaseComponent, PartialProfile, ProfileProvider, TranslateService, Platform, ProfileGroup, PartialProfileGroup, QuickConnectProfileProvider } from 'tabby-core' import { EditProfileModalComponent } from './editProfileModal.component' import { EditProfileGroupModalComponent, EditProfileGroupModalComponentResult } from './editProfileGroupModal.component' @@ -345,7 +345,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent { } getQuickConnectProviders (): ProfileProvider[] { - return this.profileProviders.filter(x => x instanceof ConnectableProfileProvider) + return this.profileProviders.filter(x => x instanceof QuickConnectProfileProvider) } /** diff --git a/tabby-ssh/src/profiles.ts b/tabby-ssh/src/profiles.ts index 64610e03..36de9ce2 100644 --- a/tabby-ssh/src/profiles.ts +++ b/tabby-ssh/src/profiles.ts @@ -1,5 +1,5 @@ import { Injectable, InjectFlags, Injector } from '@angular/core' -import { NewTabParameters, PartialProfile, TranslateService, ConnectableProfileProvider } from 'tabby-core' +import { NewTabParameters, PartialProfile, TranslateService, QuickConnectProfileProvider } from 'tabby-core' import * as ALGORITHMS from 'ssh2/lib/protocol/constants' import { SSHProfileSettingsComponent } from './components/sshProfileSettings.component' import { SSHTabComponent } from './components/sshTab.component' @@ -8,7 +8,7 @@ import { ALGORITHM_BLACKLIST, SSHAlgorithmType, SSHProfile } from './api' import { SSHProfileImporter } from './api/importer' @Injectable({ providedIn: 'root' }) -export class SSHProfilesService extends ConnectableProfileProvider { +export class SSHProfilesService extends QuickConnectProfileProvider { id = 'ssh' name = 'SSH' settingsComponent = SSHProfileSettingsComponent diff --git a/tabby-telnet/src/profiles.ts b/tabby-telnet/src/profiles.ts index 0c247e8a..212858e9 100644 --- a/tabby-telnet/src/profiles.ts +++ b/tabby-telnet/src/profiles.ts @@ -1,11 +1,11 @@ import { Injectable } from '@angular/core' -import { NewTabParameters, PartialProfile, TranslateService, ConnectableProfileProvider } from 'tabby-core' +import { NewTabParameters, PartialProfile, TranslateService, QuickConnectProfileProvider } from 'tabby-core' import { TelnetProfileSettingsComponent } from './components/telnetProfileSettings.component' import { TelnetTabComponent } from './components/telnetTab.component' import { TelnetProfile } from './session' @Injectable({ providedIn: 'root' }) -export class TelnetProfilesService extends ConnectableProfileProvider { +export class TelnetProfilesService extends QuickConnectProfileProvider { id = 'telnet' name = 'Telnet' supportsQuickConnect = true @@ -96,4 +96,12 @@ export class TelnetProfilesService extends ConnectableProfileProvider