Skip to content

Commit

Permalink
Merge pull request #147 from KxSystems/KXI-31546
Browse files Browse the repository at this point in the history
KXI-31546
  • Loading branch information
Philip-Carneiro-KX authored Oct 13, 2023
2 parents 0b2ad9d + f6b636a commit 62746e7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 42 deletions.
48 changes: 12 additions & 36 deletions src/commands/dataSourceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ export async function runDataSource(dataSourceForm: any): Promise<void> {
fileContent.dataSource.api.fill !== ""
? fileContent.dataSource.api.fill
: undefined;
const temporary =
fileContent.dataSource.api.temporary !== ""
? fileContent.dataSource.api.temporary
const temporality =
fileContent.dataSource.api.temporality !== ""
? fileContent.dataSource.api.temporality
: undefined;
const filter =
fileContent.dataSource.api.filter.length > 0
Expand Down Expand Up @@ -267,47 +267,23 @@ export async function runDataSource(dataSourceForm: any): Promise<void> {
const apiBody: getDataBodyPayload = {
table: fileContent.dataSource.api.table,
};
if (startTS !== undefined) {
apiBody.startTS = startTS;
}

if (endTS !== undefined) {
apiBody.endTS = endTS;
}

if (fill !== undefined) {
apiBody.fill = fill;
}

if (temporary !== undefined) {
apiBody.temporary = temporary;
}
apiBody.startTS = startTS;
apiBody.endTS = endTS;
apiBody.fill = fill;
apiBody.temporality = temporality;
apiBody.groupBy = groupBy;
apiBody.agg = agg;
apiBody.sortCols = sortCols;
apiBody.slice = slice;
apiBody.labels = labels;

if (filter !== undefined) {
apiBody.filter = filter.map((filterEl: string) => {
return filterEl.split(";");
});
}

if (groupBy !== undefined) {
apiBody.groupBy = groupBy;
}

if (agg !== undefined) {
apiBody.agg = agg;
}

if (sortCols !== undefined) {
apiBody.sortCols = sortCols;
}

if (slice !== undefined) {
apiBody.slice = slice;
}

if (labels !== undefined) {
apiBody.labels = labels;
}
const apiCall = await getDataInsights(
ext.insightsAuthUrls.dataURL,
JSON.stringify(apiBody)
Expand Down
2 changes: 1 addition & 1 deletion src/models/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type getDataBodyPayload = {
startTS?: string;
endTS?: string;
fill?: string;
temporary?: string;
temporality?: string;
filter?: string[][];
groupBy?: string[];
agg?: string[];
Expand Down
4 changes: 2 additions & 2 deletions src/models/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface DataSourceFiles {
startTS: string;
endTS: string;
fill: string;
temporary: string;
temporality: string;
filter: string[];
groupBy: string[];
agg: string[];
Expand Down Expand Up @@ -56,7 +56,7 @@ export const defaultDataSourceFile: DataSourceFiles = {
startTS: "",
endTS: "",
fill: "",
temporary: "",
temporality: "",
filter: [],
groupBy: [],
agg: [],
Expand Down
4 changes: 2 additions & 2 deletions src/panels/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class DataSourcesPanel {
const startTS = datasourceFile.dataSource.api.startTS;
const endTS = datasourceFile.dataSource.api.endTS;
const fill = datasourceFile.dataSource.api.fill;
const temporary = datasourceFile.dataSource.api.temporary;
const temporality = datasourceFile.dataSource.api.temporality;
const qsql = datasourceFile.dataSource.qsql.query;
const qsqlTarget = datasourceFile.dataSource.qsql.selectedTarget;
const sql = datasourceFile.dataSource.sql.query;
Expand Down Expand Up @@ -344,7 +344,7 @@ export class DataSourcesPanel {
<vscode-text-field size="100" id="fill" name="fill" placeholder="fill" value="${fill}">fill</vscode-text-field>
</div>
<div class="field-row">
<vscode-text-field size="100" id="temporary" name="temporary" placeholder="temporary" value="${temporary}">temporary</vscode-text-field>
<vscode-text-field size="100" id="temporality" name="temporality" placeholder="temporality" value="${temporality}">temporality</vscode-text-field>
</div>
<div class="params-wrapper" id="filter-wrapper">
<label>filter</label>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function convertDataSourceFormToDataSourceFile(
fileContent.dataSource.api.startTS = form.startTS;
fileContent.dataSource.api.endTS = form.endTS;
fileContent.dataSource.api.fill = form.fill;
fileContent.dataSource.api.temporary = form.temporary;
fileContent.dataSource.api.temporality = form.temporality;
fileContent.dataSource.qsql.query = form.qsql;
fileContent.dataSource.qsql.selectedTarget = form.selectedTarget;
fileContent.dataSource.sql.query = form.sql;
Expand Down

0 comments on commit 62746e7

Please sign in to comment.