-
Notifications
You must be signed in to change notification settings - Fork 13.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: cleanup as unknown conversion #19587
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -285,7 +285,8 @@ describe('buildQueryObject', () => { | |
datasource: '5__table', | ||
granularity_sqla: 'ds', | ||
viz_type: 'table', | ||
url_params: null as unknown as undefined, | ||
// @ts-ignore | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ignore is used for the test case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe |
||
url_params: null, | ||
}).url_params, | ||
).toBeUndefined(); | ||
}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -226,7 +226,7 @@ function QuerySearch({ actions, displayLimit }: QuerySearchProps) { | |
value: xt, | ||
label: xt, | ||
}))} | ||
value={from as unknown as undefined} | ||
value={{ value: from, label: from }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bycatch: use object fill in Select value |
||
autosize={false} | ||
onChange={(selected: any) => setFrom(selected?.value)} | ||
/> | ||
|
@@ -235,7 +235,7 @@ function QuerySearch({ actions, displayLimit }: QuerySearchProps) { | |
name="select-to" | ||
placeholder={t('[To]-')} | ||
options={TIME_OPTIONS.map(xt => ({ value: xt, label: xt }))} | ||
value={to as unknown as undefined} | ||
value={{ value: to, label: to }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same before |
||
autosize={false} | ||
onChange={(selected: any) => setTo(selected?.value)} | ||
/> | ||
|
@@ -247,7 +247,7 @@ function QuerySearch({ actions, displayLimit }: QuerySearchProps) { | |
value: s, | ||
label: s, | ||
}))} | ||
value={status as unknown as undefined} | ||
value={{ value: status, label: status }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same before |
||
isLoading={false} | ||
autosize={false} | ||
onChange={(selected: any) => setStatus(selected?.value)} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,13 +16,9 @@ | |
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import { Filter } from '@superset-ui/core'; | ||
import getFormDataWithExtraFilters, { | ||
GetFormDataWithExtraFiltersArguments, | ||
} from 'src/dashboard/util/charts/getFormDataWithExtraFilters'; | ||
import { DASHBOARD_ROOT_ID } from 'src/dashboard/util/constants'; | ||
import { LayoutItem } from 'src/dashboard/types'; | ||
import { dashboardLayout } from 'spec/fixtures/mockDashboardLayout'; | ||
import { sliceId as chartId } from 'spec/fixtures/mockChartQueries'; | ||
|
||
describe('getFormDataWithExtraFilters', () => { | ||
|
@@ -63,16 +59,8 @@ describe('getFormDataWithExtraFilters', () => { | |
}, | ||
sliceId: chartId, | ||
nativeFilters: { | ||
filters: {}, | ||
filterSets: {}, | ||
filters: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. useless fields |
||
[filterId]: { | ||
id: filterId, | ||
scope: { | ||
rootPath: [DASHBOARD_ROOT_ID], | ||
excluded: [], | ||
}, | ||
} as unknown as Filter, | ||
}, | ||
}, | ||
dataMask: { | ||
[filterId]: { | ||
|
@@ -82,9 +70,7 @@ describe('getFormDataWithExtraFilters', () => { | |
ownState: {}, | ||
}, | ||
}, | ||
layout: dashboardLayout.present as unknown as { | ||
[key: string]: LayoutItem; | ||
}, | ||
layout: {}, | ||
}; | ||
|
||
it('should include filters from the passed filters', () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -371,11 +371,11 @@ function dbReducer( | |
action.payload.configuration_method === | ||
CONFIGURATION_METHOD.DYNAMIC_FORM | ||
) { | ||
const engineParamsCatalog = Object.keys( | ||
const engineParamsCatalog = Object.entries( | ||
extra_json?.engine_params?.catalog || {}, | ||
).map(e => ({ | ||
name: e, | ||
value: extra_json?.engine_params?.catalog[e], | ||
).map(([key, value]) => ({ | ||
name: key, | ||
value, | ||
Comment on lines
-374
to
+378
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same logical substitution |
||
})); | ||
return { | ||
...action.payload, | ||
|
@@ -418,9 +418,7 @@ const serializeExtra = (extraJson: DatabaseObject['extra_json']) => | |
JSON.stringify({ | ||
...extraJson, | ||
metadata_params: JSON.parse((extraJson?.metadata_params as string) || '{}'), | ||
engine_params: JSON.parse( | ||
(extraJson?.engine_params as unknown as string) || '{}', | ||
), | ||
engine_params: JSON.parse((extraJson?.engine_params as string) || '{}'), | ||
schemas_allowed_for_file_upload: ( | ||
extraJson?.schemas_allowed_for_file_upload || [] | ||
).filter(schema => schema !== ''), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,7 +79,7 @@ export type DatabaseObject = { | |
// Extra | ||
extra_json?: { | ||
engine_params?: { | ||
catalog: Record<any, any> | string; | ||
catalog?: Record<any, any> | string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
}; | ||
metadata_params?: {} | string; | ||
metadata_cache_timeout?: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bycatch: fix codes coverage.