File tree Expand file tree Collapse file tree 3 files changed +10
-11
lines changed
src/api/configuration/storage Expand file tree Collapse file tree 3 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 1
1
export abstract class BaseStorage {
2
2
protected readonly globalState : any ;
3
3
4
+ private uniqueKeyPrefix : string | undefined ;
4
5
constructor ( globalState : any ) {
5
- this . globalState = globalState ;
6
+ this . globalState = globalState ;
6
7
}
7
8
8
9
9
10
keys ( ) : readonly string [ ] {
10
11
return Array . from ( this . globalState . keys ( ) ) ;
11
12
}
12
13
14
+ setUniqueKeyPrefix ( prefix : string ) {
15
+ this . uniqueKeyPrefix = prefix ;
16
+ }
17
+
13
18
get < T > ( key : string ) : T | undefined {
14
19
return this . globalState . get ( this . getStorageKey ( key ) ) as T | undefined ;
15
20
}
@@ -19,7 +24,7 @@ export abstract class BaseStorage {
19
24
}
20
25
21
26
getStorageKey ( key : string ) : string {
22
- return key ;
27
+ return ` ${ this . uniqueKeyPrefix ? this . uniqueKeyPrefix + '.' : '' } ${ key } ` ;
23
28
}
24
29
}
25
30
Original file line number Diff line number Diff line change @@ -34,10 +34,6 @@ export type CachedServerSettings = {
34
34
export class CodeForIStorage {
35
35
constructor ( private internalStorage : BaseStorage ) { }
36
36
37
- protected getStorageKey ( key : string ) : string {
38
- return key ;
39
- }
40
-
41
37
getLastConnections ( ) {
42
38
return this . internalStorage . get < LastConnection [ ] > ( "lastConnections" ) ;
43
39
}
Original file line number Diff line number Diff line change @@ -20,7 +20,8 @@ type AuthorisedExtension = {
20
20
21
21
export class ConnectionStorage {
22
22
private connectionName : string = "" ;
23
- constructor ( private internalStorage : BaseStorage ) { }
23
+ constructor ( private internalStorage : BaseStorage ) {
24
+ }
24
25
25
26
get ready ( ) : boolean {
26
27
if ( this . connectionName ) {
@@ -33,10 +34,7 @@ export class ConnectionStorage {
33
34
34
35
setConnectionName ( connectionName : string ) {
35
36
this . connectionName = connectionName ;
36
- }
37
-
38
- protected getStorageKey ( key : string ) : string {
39
- return `${ this . connectionName } .${ key } ` ;
37
+ this . internalStorage . setUniqueKeyPrefix ( `settings-${ connectionName } ` ) ;
40
38
}
41
39
42
40
getSourceList ( ) {
You can’t perform that action at this time.
0 commit comments