Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pehrs committed Jan 9, 2024
1 parent 68f7533 commit 3218dd9
Show file tree
Hide file tree
Showing 15 changed files with 309 additions and 87 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
*.vsix
client/server
.vscode-test
.metals
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@
// "mochaExplorer.require": "ts-node/register",
"mochaExplorer.require": "source-map-support/register",
"mochaExplorer.files": "client/out/**/*.test.js",
"files.watcherExclude": {
"**/target": true
},
}
2 changes: 2 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ vsc-extension-quickstart.md
**/*.map
**/*.ts
**/.vscode-test.*
**/*.test.ts
**/*.test.js
**/.history/
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@

All notable changes to the "vscode-vespa" extension will be documented in this file.

## [1.0.2]

- Add button to save result json as file.
## [1.1.0]

- Add button to save YQL result json as file.
- Support for multiple vespa clusters via custom config
- Move configuration to $HOME/.config/vscode-vespa/vespa-config.json
- Vespa explorer to view details about the configured vespa clusters.
- Vespa Cluster Info panel with document-info and iframe for Controller Status page.
- "Vespa YQL Results" tab added to YQL results containing details about the query request.
- editor/title menus for
- Connecting to cluster
- Edit Cluster Config
- Show Vespa Cluster Info


## [1.0.1]
Expand Down
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ The [VS Code Vespa extension](https://github.com/pehrs/vscode-vespa) provides ri
<br/>
</p>

### Keybindings

`vscode-vespa` has the following keybindings by default (You can change them in the keybinding editor if you need to):

| Keybinding | Description |
|------------|-------------|
| ctrl+enter | Run the YQL request on the currently connected Vespa Cluster |
| ctrl+home | Open the Vespa Cluster Info panel |
| ctrl+end | Select Vespa cluster to connect to |


## Requirements

[Vespa cluster running](https://docs.vespa.ai/en/getting-started.html) with the config and query endpoints available.
Expand All @@ -36,16 +47,26 @@ docker rm -f zipkin

## Extension Settings

Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.

For example:

This extension contributes the following settings:
The `vscode-vespa` extension is configured via a config file in `$HOME/.config/vscode-vespa/vespa-config.json`.
If the config file is not present then `vscode-vespa` will create a default config:

```json
{
"defaultCluster": "localhost",
"clusters": [
{
"name": "localhost",
"queryEndpoint": "http://localhost:8080/search",
"configEndpoint": "http://localhost:19071",
"zipkinEndpoint": "http://localhost:9411",
}
],
"httpTimeout": "2s",
}
```

* `vespaYql.configEndpoint`: Endpoint for Vespa Config Server. (default: http://127.0.0.1:19071)
* `vespaYql.queryEndpoint`: Endpoint for Vespa YQL Queries. (default: http://127.0.0.1:8080/search)
* `vespaYql.zipkinEndpoint`: (Optional) Endpoint for Zipkin traces. (default: http://127.0.0.1:9411)
* `vespaYql.queryTimeout`: Timeout for Vespa YQL Queries. (default: 10s)
You can edit the config file directly in vscode by selecting the
"Edit Vespa Cluster Configuration" command in the YQL editor menu.

## Known Issues

Expand Down
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "VSCode part of a language server",
"author": "Matti Pehrs",
"license": "MIT",
"version": "1.0.2",
"version": "1.1.0",
"publisher": "pehrs.com",
"engines": {
"vscode": "^1.75.0"
Expand All @@ -12,7 +12,7 @@
"vscode-languageclient": "^9.0.1"
},
"devDependencies": {
"@types/vscode": "^1.75.1",
"@types/vscode": "^1.85.0",
"@vscode/test-electron": "^2.3.8"
}
}
13 changes: 6 additions & 7 deletions client/src/VespaClusterInfo.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import exp = require('constants');
import { vespaConfig } from './VespaConfig';
import { outputChannel, showError } from './extension';
import { Schema, SchemaConfig } from './model/VespaSchemaConfig';
import { VespaSchema, VespaSchemaConfig } from './model/VespaSchemaConfig';
import { StorageClusterConfig, VespaClusterList } from './model/VespaClusterList';
import { VespaAppId } from './model/VespaAppId';
import { fetchWithTimeout } from './vespaUtils';
Expand All @@ -12,13 +12,13 @@ export class VespaClusterInfo {
clusterName: string = undefined;
appId: VespaAppId = undefined;
clusterList: VespaClusterList = undefined;
clusterSchemas: Map<string, Schema[]> = new Map();
clusterSchemas: Map<string, VespaSchema[]> = new Map();

defaultConfigId() {
return this.clusterList.storage[0].configid;
}

defaultClusterSchemas(): Schema[] {
defaultClusterSchemas(): VespaSchema[] {
return this.clusterSchemas.get(this.defaultConfigId());
}

Expand All @@ -31,11 +31,10 @@ export class VespaClusterInfo {
return fetchWithTimeout(clusterListUrl, timeout)
.then(response => response.json()
.then(v => v as VespaClusterList));

}


fetchSchemas(storageConfig: StorageClusterConfig): Promise<Schema[]> {
fetchSchemas(storageConfig: StorageClusterConfig): Promise<VespaSchema[]> {
const configEndpoint: string = vespaConfig.configEndpoint();
const configid = storageConfig.configid;
const schemaListUrl = `${configEndpoint}/config/v2/tenant/${this.appId.tenant}/application/${this.appId.application}/search.config.schema-info/${configid}/search/cluster.${configid}`;
Expand All @@ -44,7 +43,7 @@ export class VespaClusterInfo {
outputChannel.appendLine(`Getting Schemas for ${configid} from ${configEndpoint}`);
return fetchWithTimeout(schemaListUrl, timeout)
.then(response => response.json()
.then(v => v as SchemaConfig))
.then(v => v as VespaSchemaConfig))
.then(schemaConfig => {
return schemaConfig.schema;
});
Expand All @@ -61,7 +60,7 @@ export class VespaClusterInfo {
.then(clusterList => {
clusterList.storage.map(storageConfig => {
return this.fetchSchemas(storageConfig)
.then((schemas: Schema[]) => {
.then((schemas: VespaSchema[]) => {
this.clusterSchemas.set(storageConfig.configid, schemas);
})
.catch(error => showError(error.reason));
Expand Down
Loading

0 comments on commit 3218dd9

Please sign in to comment.