Skip to content

Commit 0505d5a

Browse files
committed
Merge comments
1 parent 27f62bc commit 0505d5a

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

extensions/ql-vscode/src/databases/db-config.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22

33
export interface DbConfig {
44
databases: DbConfigDatabases;
5-
selected?: SelectedDb;
5+
selected?: SelectedDbItem;
66
}
77

88
export interface DbConfigDatabases {
99
remote: RemoteDbConfig;
1010
local: LocalDbConfig;
1111
}
1212

13-
export interface SelectedDb {
14-
kind: string;
15-
path: string;
13+
export interface SelectedDbItem {
14+
kind: SelectedDbKind;
15+
value: string;
16+
}
17+
18+
export enum SelectedDbKind {
19+
ConfigDefined = 'configDefined',
20+
RemoteSystemDefinedList = 'remoteSystemDefinedList',
1621
}
1722

1823
export interface RemoteDbConfig {
@@ -64,7 +69,7 @@ export function cloneDbConfig(config: DbConfig): DbConfig {
6469
},
6570
selected: config.selected ? {
6671
kind: config.selected.kind,
67-
path: config.selected.path
72+
value: config.selected.value,
6873
} : undefined
6974
};
7075
}

extensions/ql-vscode/test/pure-tests/databases/data/workspace-databases.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
}
4747
},
4848
"selected": {
49-
"kind": "foo",
50-
"path": "bar"
49+
"kind": "configDefined",
50+
"value": "path.to.database"
5151
}
5252
}

extensions/ql-vscode/test/pure-tests/databases/db-config-store.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ describe('db config store', async () => {
8080
storagePath: '/path/to/database/',
8181
});
8282
expect(config.selected).to.deep.equal({
83-
kind: 'foo',
84-
path: 'bar',
83+
kind: 'configDefined',
84+
value: 'path.to.database',
8585
});
8686
});
8787

88-
it('should load an existing config and accept no selected', async () => {
88+
it('should load an existing config without selected db', async () => {
8989
const testDataStoragePathWithout = path.join(__dirname, 'data', 'without-selected');
9090

9191
const configStore = new DbConfigStore(testDataStoragePathWithout, extensionPath);

extensions/ql-vscode/workspace-databases-schema.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,14 @@
125125
"type": "object",
126126
"properties": {
127127
"kind": {
128-
"type": "string"
128+
"type": "string",
129+
"enum": ["configDefined", "remoteSystemDefinedList"]
129130
},
130-
"path": {
131+
"value": {
131132
"type": "string"
132133
}
133134
},
134-
"required": ["kind", "path"],
135+
"required": ["kind", "value"],
135136
"additionalProperties": false
136137
}
137138
},

0 commit comments

Comments
 (0)