|
|
@@ -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, QuickConnectProfileProvider, SelectorOption, Profile, SelectorService, CommandProvider } from './api'
|
|
|
+import { Theme, CLIHandler, TabContextMenuItemProvider, TabRecoveryProvider, HotkeyProvider, ConfigProvider, PlatformService, FileProvider, ProfilesService, ProfileProvider, QuickConnectProfileProvider, SelectorOption, Profile, SelectorService, CommandProvider, PartialProfileGroup, ProfileGroup } from './api'
|
|
|
|
|
|
import { AppService } from './services/app.service'
|
|
|
import { ConfigService } from './services/config.service'
|
|
|
@@ -181,20 +181,24 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
|
|
|
if (profile) {
|
|
|
profilesService.openNewTabForProfile(profile)
|
|
|
}
|
|
|
- }
|
|
|
- if (hotkey.startsWith('profile-selectors.')) {
|
|
|
+ } else if (hotkey.startsWith('profile-selectors.')) {
|
|
|
const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
|
|
const provider = profilesService.getProviders().find(x => x.id === id)
|
|
|
if (!provider) {
|
|
|
return
|
|
|
}
|
|
|
this.showSelector(provider).catch(() => null)
|
|
|
- }
|
|
|
- if (hotkey === 'command-selector') {
|
|
|
+ } else if (hotkey.startsWith('group-selectors.')) {
|
|
|
+ const id = hotkey.substring(hotkey.indexOf('.') + 1)
|
|
|
+ const groups = await this.profilesService.getProfileGroups({ includeProfiles: true })
|
|
|
+ const group = groups.find(x => x.id === id)
|
|
|
+ if (!group) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.showGroupSelector(group).catch(() => null)
|
|
|
+ } else if (hotkey === 'command-selector') {
|
|
|
commands.showSelector().catch(() => null)
|
|
|
- }
|
|
|
-
|
|
|
- if (hotkey === 'profile-selector') {
|
|
|
+ } else if (hotkey === 'profile-selector') {
|
|
|
commands.run('core:profile-selector', {})
|
|
|
}
|
|
|
})
|
|
|
@@ -232,6 +236,21 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
|
|
|
await this.selector.show(this.translate.instant('Select profile'), options)
|
|
|
}
|
|
|
|
|
|
+ async showGroupSelector (group: PartialProfileGroup<ProfileGroup>): Promise<void> {
|
|
|
+ if (this.selector.active) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ const profiles = group.profiles ?? []
|
|
|
+
|
|
|
+ const options: SelectorOption<void>[] = profiles.map(p => ({
|
|
|
+ ...this.profilesService.selectorOptionForProfile(p),
|
|
|
+ callback: () => this.profilesService.openNewTabForProfile(p),
|
|
|
+ }))
|
|
|
+
|
|
|
+ await this.selector.show(this.translate.instant('Select profile'), options)
|
|
|
+ }
|
|
|
+
|
|
|
static forRoot (): ModuleWithProviders<AppModule> {
|
|
|
return {
|
|
|
ngModule: AppModule,
|