-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
profileProvider.ts
65 lines (52 loc) · 1.66 KB
/
profileProvider.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* eslint-disable @typescript-eslint/no-type-alias */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-empty-function */
import { BaseTabComponent } from '../components/baseTab.component'
import { NewTabParameters } from '../services/tabs.service'
export interface Profile {
id: string
type: string
name: string
group?: string
options: any
icon?: string
color?: string
disableDynamicTitle: boolean
behaviorOnSessionEnd: 'auto'|'keep'|'reconnect'|'close'
weight: number
isBuiltin: boolean
isTemplate: boolean
}
export type PartialProfile<T extends Profile> = Omit<Omit<Omit<{
[K in keyof T]?: T[K]
}, 'options'>, 'type'>, 'name'> & {
type: string
name: string
options?: {
[K in keyof T['options']]?: T['options'][K]
}
}
export interface ProfileSettingsComponent<P extends Profile> {
profile: P
save?: () => void
}
export abstract class ProfileProvider<P extends Profile> {
id: string
name: string
supportsQuickConnect = false
settingsComponent?: new (...args: any[]) => ProfileSettingsComponent<P>
configDefaults = {}
abstract getBuiltinProfiles (): Promise<PartialProfile<P>[]>
abstract getNewTabParameters (profile: P): Promise<NewTabParameters<BaseTabComponent>>
getSuggestedName (profile: PartialProfile<P>): string|null {
return null
}
abstract getDescription (profile: PartialProfile<P>): string
quickConnect (query: string): PartialProfile<P>|null {
return null
}
intoQuickConnectString (profile: P): string|null {
return null
}
deleteProfile (profile: P): void { }
}