mirror of
https://github.com/Eugeny/tabby.git
synced 2024-11-27 00:50:49 +03:00
fixed #7588 - prevent selector from opening when one is already open
This commit is contained in:
parent
7b2bc5e48b
commit
fa1649de83
@ -204,6 +204,10 @@ export default class AppModule { // eslint-disable-line @typescript-eslint/no-ex
|
||||
}
|
||||
|
||||
async showSelector (provider: ProfileProvider<Profile>): Promise<void> {
|
||||
if (this.selector.active) {
|
||||
return
|
||||
}
|
||||
|
||||
let profiles = await this.profilesService.getProfiles()
|
||||
|
||||
profiles = profiles.filter(x => !x.isTemplate && x.type === provider.id)
|
||||
|
@ -67,6 +67,10 @@ export class CommandService {
|
||||
}
|
||||
|
||||
async showSelector (): Promise<void> {
|
||||
if (this.selector.active) {
|
||||
return
|
||||
}
|
||||
|
||||
const context: CommandContext = {}
|
||||
const tab = this.app.activeTab
|
||||
if (tab instanceof SplitTabComponent) {
|
||||
|
@ -106,6 +106,10 @@ export class ProfilesService {
|
||||
}
|
||||
|
||||
showProfileSelector (): Promise<PartialProfile<Profile>|null> {
|
||||
if (this.selector.active) {
|
||||
return Promise.resolve(null)
|
||||
}
|
||||
|
||||
return new Promise<PartialProfile<Profile>|null>(async (resolve, reject) => {
|
||||
try {
|
||||
const recentProfiles = this.getRecentProfiles()
|
||||
|
@ -1,12 +1,18 @@
|
||||
|
||||
import { Injectable } from '@angular/core'
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
|
||||
|
||||
import { SelectorModalComponent } from '../components/selectorModal.component'
|
||||
import { SelectorOption } from '../api/selector'
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class SelectorService {
|
||||
private current: NgbModalRef|null = null
|
||||
|
||||
get active (): boolean {
|
||||
return !!this.current
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
private constructor (
|
||||
private ngbModal: NgbModal,
|
||||
@ -14,6 +20,10 @@ export class SelectorService {
|
||||
|
||||
show <T> (name: string, options: SelectorOption<T>[]): Promise<T> {
|
||||
const modal = this.ngbModal.open(SelectorModalComponent)
|
||||
this.current = modal
|
||||
modal.result.then(() => {
|
||||
this.current = null
|
||||
})
|
||||
const instance: SelectorModalComponent<T> = modal.componentInstance
|
||||
instance.name = name
|
||||
instance.options = options
|
||||
|
Loading…
Reference in New Issue
Block a user