mirror of
https://github.com/Eugeny/tabby.git
synced 2025-03-31 15:50:28 +08:00
moved recentProfiles from config to localStorage
This commit is contained in:
parent
bcf09c59e3
commit
f36e2551b5
@ -35,7 +35,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
async launchProfile (profile: PartialProfile<Profile>) {
|
||||
await this.profilesService.openNewTabForProfile(profile)
|
||||
|
||||
let recentProfiles = this.config.store.recentProfiles
|
||||
let recentProfiles: PartialProfile<Profile>[] = JSON.parse(window.localStorage['recentProfiles'] ?? '[]')
|
||||
if (this.config.store.terminal.showRecentProfiles > 0) {
|
||||
recentProfiles = recentProfiles.filter(x => x.group !== profile.group || x.name !== profile.name)
|
||||
recentProfiles.unshift(profile)
|
||||
@ -43,7 +43,7 @@ export class ButtonProvider extends ToolbarButtonProvider {
|
||||
} else {
|
||||
recentProfiles = []
|
||||
}
|
||||
this.config.store.recentProfiles = recentProfiles
|
||||
window.localStorage['recentProfiles'] = JSON.stringify(recentProfiles)
|
||||
this.config.save()
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,6 @@ hotkeys:
|
||||
profiles: []
|
||||
profileDefaults:
|
||||
__nonStructural: true
|
||||
recentProfiles: []
|
||||
recoverTabs: true
|
||||
enableAnalytics: true
|
||||
enableWelcomeTab: true
|
||||
|
@ -94,7 +94,7 @@ export class ProfilesService {
|
||||
showProfileSelector (): Promise<PartialProfile<Profile>|null> {
|
||||
return new Promise<PartialProfile<Profile>|null>(async (resolve, reject) => {
|
||||
try {
|
||||
let recentProfiles: PartialProfile<Profile>[] = this.config.store.recentProfiles
|
||||
let recentProfiles: PartialProfile<Profile>[] = JSON.parse(window.localStorage['recentProfiles'] ?? '[]')
|
||||
recentProfiles = recentProfiles.slice(0, this.config.store.terminal.showRecentProfiles)
|
||||
|
||||
let options: SelectorOption<void>[] = recentProfiles.map(p => ({
|
||||
@ -113,7 +113,7 @@ export class ProfilesService {
|
||||
name: 'Clear recent connections',
|
||||
icon: 'fas fa-eraser',
|
||||
callback: async () => {
|
||||
this.config.store.recentProfiles = []
|
||||
window.localStorage.removeItem('recentProfiles')
|
||||
this.config.save()
|
||||
resolve(null)
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user