From e5cf72e79b205450e6400c21360ac86f7bd999e9 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Sun, 4 Jul 2021 14:04:40 +0200 Subject: [PATCH] context menu dep fix --- tabby-local/src/tabContextMenu.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tabby-local/src/tabContextMenu.ts b/tabby-local/src/tabContextMenu.ts index 9772cafd..fd9a1dab 100644 --- a/tabby-local/src/tabContextMenu.ts +++ b/tabby-local/src/tabContextMenu.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core' -import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, SplitTabComponent, NotificationsService, MenuItemOptions, ProfilesService } from 'tabby-core' +import { NgbModal } from '@ng-bootstrap/ng-bootstrap' +import { ConfigService, BaseTabComponent, TabContextMenuItemProvider, TabHeaderComponent, SplitTabComponent, NotificationsService, MenuItemOptions, ProfilesService, PromptModalComponent } from 'tabby-core' import { TerminalTabComponent } from './components/terminalTab.component' import { UACService } from './services/uac.service' import { TerminalService } from './services/terminal.service' @@ -10,6 +11,7 @@ import { LocalProfile } from './api' export class SaveAsProfileContextMenu extends TabContextMenuItemProvider { constructor ( private config: ConfigService, + private ngbModal: NgbModal, private notifications: NotificationsService, ) { super() @@ -23,12 +25,18 @@ export class SaveAsProfileContextMenu extends TabContextMenuItemProvider { { label: 'Save as profile', click: async () => { + const modal = this.ngbModal.open(PromptModalComponent) + modal.componentInstance.prompt = 'New profile name' + const name = (await modal.result)?.name + if (!name) { + return + } const profile = { options: { ...tab.sessionOptions, cwd: await tab.session?.getWorkingDirectory() ?? tab.sessionOptions.cwd, }, - name: tab.sessionOptions.command, + name, type: 'local', } this.config.store.profiles = [