mirror of
https://github.com/getredash/redash.git
synced 2026-03-21 16:00:09 -04:00
* Set corejs version in .babelrc so Jest doesn't complain. * Rewrite services/routes in TypeScript. * Add TypeScript definitions for DialogComponent. * Make image paths more portable * Add current route context and hook. * Make EmptyState more flexible by being able to pass in getSteps function. * Rewrite ItemsList in TypeScript. * Introduce the possibility to add custom sorters for a column. * Rearrange props to be friendly to TypeScript. * Type definitions for NotificationApi. * Use Databricks query editor components for databricks_internal type of query runner. * URL Escape password in Alembic configuration. * Compare types in migrations.
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
export interface ItemsSourceOptions<I = any> extends Partial<ItemsSourceState> {
|
|
getRequest?: (params: any, context: any) => any; // TODO: Add stricter types
|
|
doRequest?: () => any; // TODO: Add stricter type
|
|
processResults?: () => any; // TODO: Add stricter type
|
|
isPlainList?: boolean;
|
|
sortByIteratees?: { [fieldName: string]: (a: I) => number };
|
|
}
|
|
|
|
export interface GetResourceContext extends ItemsSourceState {
|
|
params: {
|
|
currentPage: number;
|
|
// TODO: Add more context parameters
|
|
};
|
|
}
|
|
|
|
export type GetResourceRequest = any; // TODO: Add stricter type
|
|
|
|
export interface ItemsPage<INPUT = any> {
|
|
count: number;
|
|
page: number;
|
|
page_size: number;
|
|
results: INPUT[];
|
|
}
|
|
|
|
export interface ResourceItemsSourceOptions<INPUT = any, ITEM = any> extends ItemsSourceOptions {
|
|
getResource: (context: GetResourceContext) => (request: GetResourceRequest) => Promise<INPUT[]>;
|
|
getItemProcessor?: () => (input: INPUT) => ITEM;
|
|
}
|
|
|
|
export type ItemsSourceState<ITEM = any> = {
|
|
page: number;
|
|
itemsPerPage: number;
|
|
orderByField: string;
|
|
orderByReverse: boolean;
|
|
searchTerm: string;
|
|
selectedTags: string[];
|
|
totalCount: number;
|
|
pageItems: ITEM[];
|
|
allItems: ITEM[] | undefined;
|
|
params: {
|
|
pageTitle?: string;
|
|
} & { [key: string]: string | number };
|
|
};
|
|
|
|
declare class ItemsSource {
|
|
constructor(options: ItemsSourceOptions);
|
|
}
|
|
|
|
declare class ResourceItemsSource<I> {
|
|
constructor(options: ResourceItemsSourceOptions<I>);
|
|
}
|