From 3857beb46bdd1769f7535ef8c99df3521faa762a Mon Sep 17 00:00:00 2001 From: Clem Fern Date: Sat, 15 Jul 2023 21:10:16 +0200 Subject: [PATCH 1/5] feat(core): Eugeny/tabby#8680 push all quick-connect provider into profile selector --- tabby-core/src/index.ts | 1 + tabby-core/src/services/profiles.service.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tabby-core/src/index.ts b/tabby-core/src/index.ts index 56229857..6cf14a24 100644 --- a/tabby-core/src/index.ts +++ b/tabby-core/src/index.ts @@ -219,6 +219,7 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex name: this.translate.instant('Quick connect'), freeInputPattern: this.translate.instant('Connect to "%s"...'), icon: 'fas fa-arrow-right', + description: `(${provider.name.toUpperCase()})`, callback: query => { const p = provider.quickConnect(query) if (p) { diff --git a/tabby-core/src/services/profiles.service.ts b/tabby-core/src/services/profiles.service.ts index 295909e7..e1892d2f 100644 --- a/tabby-core/src/services/profiles.service.ts +++ b/tabby-core/src/services/profiles.service.ts @@ -177,17 +177,19 @@ export class ProfilesService { }) } catch { } - if (this.getProviders().some(x => x.supportsQuickConnect)) { + this.getProviders().filter(x => x.supportsQuickConnect).forEach(provider => { options.push({ name: this.translate.instant('Quick connect'), freeInputPattern: this.translate.instant('Connect to "%s"...'), + description: `(${provider.name.toUpperCase()})`, icon: 'fas fa-arrow-right', callback: query => { - const profile = this.quickConnect(query) + const profile = provider.quickConnect(query) resolve(profile) }, }) - } + }) + await this.selector.show(this.translate.instant('Select profile or enter an address'), options) } catch (err) { reject(err) From 555c7f7b20d8b590aa9743a3e2c134868d3ccddf Mon Sep 17 00:00:00 2001 From: Clem Fern Date: Sat, 15 Jul 2023 21:32:47 +0200 Subject: [PATCH 2/5] feat(telnet): enable quick connect --- tabby-telnet/src/profiles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tabby-telnet/src/profiles.ts b/tabby-telnet/src/profiles.ts index 6530771e..fad4f8ce 100644 --- a/tabby-telnet/src/profiles.ts +++ b/tabby-telnet/src/profiles.ts @@ -8,7 +8,7 @@ import { TelnetProfile } from './session' export class TelnetProfilesService extends ProfileProvider { id = 'telnet' name = 'Telnet' - supportsQuickConnect = false + supportsQuickConnect = true settingsComponent = TelnetProfileSettingsComponent configDefaults = { options: { From 9ac5286017a573d9cb0c59baeea3d2c3e2b515f7 Mon Sep 17 00:00:00 2001 From: Clem Fern Date: Sat, 15 Jul 2023 21:35:01 +0200 Subject: [PATCH 3/5] fix(core): push all freeInputPattern into filteredOptions selectorModal --- tabby-core/src/components/selectorModal.component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tabby-core/src/components/selectorModal.component.ts b/tabby-core/src/components/selectorModal.component.ts index 23bcdc4b..a39cea20 100644 --- a/tabby-core/src/components/selectorModal.component.ts +++ b/tabby-core/src/components/selectorModal.component.ts @@ -76,10 +76,11 @@ export class SelectorModalComponent { { sort: true }, ).search(f) - const freeOption = this.options.find(x => x.freeInputPattern) - if (freeOption && !this.filteredOptions.includes(freeOption)) { - this.filteredOptions.push(freeOption) - } + this.options.filter(x => x.freeInputPattern).forEach(freeOption => { + if (freeOption && !this.filteredOptions.includes(freeOption)) { + this.filteredOptions.push(freeOption) + } + }) } this.selectedIndex = Math.max(0, this.selectedIndex) this.selectedIndex = Math.min(this.filteredOptions.length - 1, this.selectedIndex) From aba773b546aa69fccf808e495c21f81ea863f41e Mon Sep 17 00:00:00 2001 From: Clem Fern Date: Sat, 15 Jul 2023 21:37:23 +0200 Subject: [PATCH 4/5] lint --- tabby-core/src/components/selectorModal.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tabby-core/src/components/selectorModal.component.ts b/tabby-core/src/components/selectorModal.component.ts index a39cea20..76092314 100644 --- a/tabby-core/src/components/selectorModal.component.ts +++ b/tabby-core/src/components/selectorModal.component.ts @@ -77,7 +77,7 @@ export class SelectorModalComponent { ).search(f) this.options.filter(x => x.freeInputPattern).forEach(freeOption => { - if (freeOption && !this.filteredOptions.includes(freeOption)) { + if (!this.filteredOptions.includes(freeOption)) { this.filteredOptions.push(freeOption) } }) From d36b2b21c99b79c1e9bbe123b04b95929646bdc1 Mon Sep 17 00:00:00 2001 From: Clem Date: Tue, 18 Jul 2023 14:10:31 +0200 Subject: [PATCH 5/5] feat(settings): Eugeny/tabby#8680 configurable priotity on quick connect profile selector option --- tabby-core/src/configDefaults.yaml | 1 + tabby-core/src/services/profiles.service.ts | 1 + .../components/profilesSettingsTab.component.pug | 14 ++++++++++++++ .../components/profilesSettingsTab.component.ts | 4 ++++ 4 files changed, 20 insertions(+) diff --git a/tabby-core/src/configDefaults.yaml b/tabby-core/src/configDefaults.yaml index d8624391..7a7ee99c 100644 --- a/tabby-core/src/configDefaults.yaml +++ b/tabby-core/src/configDefaults.yaml @@ -54,3 +54,4 @@ hacks: disableVibrancyWhileDragging: false enableFluentBackground: false language: null +defaultQuickConnectProvider: "ssh" diff --git a/tabby-core/src/services/profiles.service.ts b/tabby-core/src/services/profiles.service.ts index e1892d2f..943d11c2 100644 --- a/tabby-core/src/services/profiles.service.ts +++ b/tabby-core/src/services/profiles.service.ts @@ -183,6 +183,7 @@ export class ProfilesService { freeInputPattern: this.translate.instant('Connect to "%s"...'), description: `(${provider.name.toUpperCase()})`, icon: 'fas fa-arrow-right', + weight: provider.id !== this.config.store.defaultQuickConnectProvider ? 1 : 0, callback: query => { const profile = provider.quickConnect(query) resolve(profile) diff --git a/tabby-settings/src/components/profilesSettingsTab.component.pug b/tabby-settings/src/components/profilesSettingsTab.component.pug index 0513f26b..9ce3f981 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.pug +++ b/tabby-settings/src/components/profilesSettingsTab.component.pug @@ -149,6 +149,20 @@ ul.nav-tabs(ngbNav, #nav='ngbNav') option(ngValue='wt', translation) Windows Terminal option(ngValue='cygwin', translation) Cygwin + .form-line + .header + .title(translate) Default "Connect to" type + .description(translate) Default connection type used by quick connect feature (ex. SSH, Telnet) + + select.form-control( + [(ngModel)]='config.store.defaultQuickConnectProvider', + (ngModelChange)='config.save()', + ) + option( + *ngFor='let provider of getQuickConnectProviders()', + [ngValue]='provider.id' + ) {{provider.name}} + .form-line.content-box .header .title(translate) Default profile settings diff --git a/tabby-settings/src/components/profilesSettingsTab.component.ts b/tabby-settings/src/components/profilesSettingsTab.component.ts index 9b6e1c8b..38898ae6 100644 --- a/tabby-settings/src/components/profilesSettingsTab.component.ts +++ b/tabby-settings/src/components/profilesSettingsTab.component.ts @@ -312,4 +312,8 @@ export class ProfilesSettingsTabComponent extends BaseComponent { isProfileBlacklisted (profile: PartialProfile): boolean { return profile.id && this.config.store.profileBlacklist.includes(profile.id) } + + getQuickConnectProviders (): ProfileProvider[] { + return this.profileProviders.filter(x => x.supportsQuickConnect) + } }