Skip to content

Commit

Permalink
Fixes TypeScript errors [sc-48362]
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-briscoe committed Jun 22, 2022
1 parent 81376fb commit 6aa313e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export type Query = {
executedSql: string;
output: string | Record<string, any>;
actions: Record<string, any>;
type: DatasourceType.Query;
type: DatasourceType;
columns: QueryColumn[];
};

Expand Down Expand Up @@ -355,7 +355,7 @@ export const testQuery: Query = {
isDataPreview: false,
progress: 0,
resultsKey: null,
state: 'success',
state: QueryState.SUCCESS,
tempSchema: null,
trackingUrl: null,
templateParams: null,
Expand Down
14 changes: 10 additions & 4 deletions superset-frontend/src/SqlLab/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sinon from 'sinon';
import * as actions from 'src/SqlLab/actions/sqlLab';
import { ColumnKeyTypeType } from 'src/SqlLab/components/ColumnElement';
import { Query, QueryState } from '@superset-ui/core';
import { DatasourceType, QueryResponse, QueryState } from '@superset-ui/core';

export const mockedActions = sinon.stub({ ...actions });

Expand Down Expand Up @@ -190,6 +190,7 @@ export const defaultQueryEditor = {
},
],
};

export const queries = [
{
dbId: 1,
Expand Down Expand Up @@ -345,6 +346,7 @@ export const queryWithNoQueryLimit = {
},
},
};

export const queryWithBadColumns = {
...queries[0],
results: {
Expand Down Expand Up @@ -408,6 +410,7 @@ export const queryWithBadColumns = {
],
},
};

export const databases = {
result: [
{
Expand All @@ -430,6 +433,7 @@ export const databases = {
},
],
};

export const tables = {
options: [
{
Expand Down Expand Up @@ -513,7 +517,7 @@ export const failedQueryWithErrors = {
tempTable: '',
};

const baseQuery: Query = {
const baseQuery: QueryResponse = {
queryId: 567,
dbId: 1,
sql: 'SELECT * FROM superset.slices',
Expand Down Expand Up @@ -550,6 +554,8 @@ const baseQuery: Query = {
extra: {
progress: null,
},
columns: [],
type: DatasourceType.Query,
results: {
displayLimitReached: false,
query: { limit: 6 },
Expand Down Expand Up @@ -591,7 +597,7 @@ const baseQuery: Query = {
},
};

export const runningQuery: Query = {
export const runningQuery: QueryResponse = {
...baseQuery,
dbId: 1,
cached: false,
Expand All @@ -602,7 +608,7 @@ export const runningQuery: Query = {
startDttm: Date.now() - 500,
};

export const successfulQuery: Query = {
export const successfulQuery: QueryResponse = {
...baseQuery,
dbId: 1,
cached: false,
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/SqlLab/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type ExploreDatasource = Dataset | QueryResponse;

// Object as Dictionary (associative array) with Query id as the key and type Query as the value
export type QueryDictionary = {
[id: string]: Query;
[id: string]: QueryResponse;
};

export interface QueryEditor {
Expand Down

0 comments on commit 6aa313e

Please sign in to comment.