Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ecmel committed May 8, 2024
1 parent 181ff5a commit 9a3e40c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/commands/workspaceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ async function waitForConnection(label: string) {
} else if (count < 5) {
retry();
} else {
reject(`Can not connect to ${label}`);
reject(new Error(`Can not connect to ${label}`));
}
}, 50);
};
Expand Down
7 changes: 1 addition & 6 deletions src/services/dataSourceEditorProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,7 @@ export class DataSourceEditorProvider implements CustomTextEditorProvider {
if (text.trim().length === 0) {
return {};
}

try {
return JSON.parse(text);
} catch (error) {
throw error;
}
return JSON.parse(text);
}

private updateTextDocument(document: TextDocument, json: unknown) {
Expand Down
61 changes: 29 additions & 32 deletions src/webview/components/kdbDataSourceView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
* specific language governing permissions and limitations under the License.
*/

import { LitElement, html } from "lit";
import { LitElement, html, css } from "lit";
import { repeat } from "lit/directives/repeat.js";
import { customElement } from "lit/decorators.js";
import { css } from "lit";
import {
Agg,
DataSourceFiles,
Expand Down Expand Up @@ -93,37 +92,35 @@ export class KdbDataSourceView extends LitElement {

message = (event: MessageEvent<DataSourceMessage2>) => {
const msg = event.data;
switch (msg.command) {
case DataSourceCommand.Update:
this.servers = msg.servers;
this.selectedServer = msg.selectedServer;
this.isInsights = msg.isInsights;
this.isMetaLoaded = !!msg.insightsMeta.dap;
this.insightsMeta = msg.insightsMeta;
const ds = msg.dataSourceFile;
this.selectedType = ds.dataSource.selectedType;
this.selectedApi = ds.dataSource.api.selectedApi;
this.selectedTable = ds.dataSource.api.table;
this.startTS = ds.dataSource.api.startTS;
this.endTS = ds.dataSource.api.endTS;
this.fill = ds.dataSource.api.fill;
this.temporality = ds.dataSource.api.temporality;
this.qsqlTarget = ds.dataSource.qsql.selectedTarget;
this.qsql = ds.dataSource.qsql.query;
this.sql = ds.dataSource.sql.query;
const optional = ds.dataSource.api.optional;
if (optional) {
this.filled = optional.filled;
this.temporal = optional.temporal;
this.filters = optional.filters;
this.labels = optional.labels;
this.sorts = optional.sorts;
this.aggs = optional.aggs;
this.groups = optional.groups;
}
break;
if (msg.command === DataSourceCommand.Update) {
this.servers = msg.servers;
this.selectedServer = msg.selectedServer;
this.isInsights = msg.isInsights;
this.isMetaLoaded = !!msg.insightsMeta.dap;
this.insightsMeta = msg.insightsMeta;
const ds = msg.dataSourceFile;
this.selectedType = ds.dataSource.selectedType;
this.selectedApi = ds.dataSource.api.selectedApi;
this.selectedTable = ds.dataSource.api.table;
this.startTS = ds.dataSource.api.startTS;
this.endTS = ds.dataSource.api.endTS;
this.fill = ds.dataSource.api.fill;
this.temporality = ds.dataSource.api.temporality;
this.qsqlTarget = ds.dataSource.qsql.selectedTarget;
this.qsql = ds.dataSource.qsql.query;
this.sql = ds.dataSource.sql.query;
const optional = ds.dataSource.api.optional;
if (optional) {
this.filled = optional.filled;
this.temporal = optional.temporal;
this.filters = optional.filters;
this.labels = optional.labels;
this.sorts = optional.sorts;
this.aggs = optional.aggs;
this.groups = optional.groups;
}
this.requestUpdate();
}
this.requestUpdate();
};

get data(): DataSourceFiles {
Expand Down

0 comments on commit 9a3e40c

Please sign in to comment.