forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Misc changes to codebase back ported from internal fork (getredash#5129)
* 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.
- Loading branch information
Showing
19 changed files
with
426 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
{ | ||
"presets": [ | ||
["@babel/preset-env", { | ||
"exclude": [ | ||
"@babel/plugin-transform-async-to-generator", | ||
"@babel/plugin-transform-arrow-functions" | ||
], | ||
"useBuiltIns": "usage" | ||
}], | ||
[ | ||
"@babel/preset-env", | ||
{ | ||
"exclude": ["@babel/plugin-transform-async-to-generator", "@babel/plugin-transform-arrow-functions"], | ||
"corejs": "2", | ||
"useBuiltIns": "usage" | ||
} | ||
], | ||
"@babel/preset-react", | ||
"@babel/preset-typescript" | ||
], | ||
"plugins": [ | ||
"@babel/plugin-proposal-class-properties", | ||
"@babel/plugin-transform-object-assign", | ||
["babel-plugin-transform-builtin-extend", { | ||
"globals": ["Error"] | ||
}] | ||
[ | ||
"babel-plugin-transform-builtin-extend", | ||
{ | ||
"globals": ["Error"] | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { ModalProps } from "antd/lib/modal/Modal"; | ||
|
||
export interface DialogProps<ROk, RCancel> { | ||
props: ModalProps; | ||
close: (result: ROk) => void; | ||
dismiss: (result: RCancel) => void; | ||
} | ||
|
||
export type DialogWrapperChildProps<ROk, RCancel> = { | ||
dialog: DialogProps<ROk, RCancel>; | ||
}; | ||
|
||
export type DialogComponentType<ROk = void, P = {}, RCancel = void> = React.ComponentType< | ||
DialogWrapperChildProps<ROk, RCancel> & P | ||
>; | ||
|
||
export function wrap<ROk = void, P = {}, RCancel = void>( | ||
DialogComponent: DialogComponentType<ROk, P, RCancel> | ||
): { | ||
Component: DialogComponentType<ROk, P, RCancel>; | ||
showModal: ( | ||
props?: P | ||
) => { | ||
update: (props: P) => void; | ||
onClose: (handler: (result: ROk) => Promise<void>) => void; | ||
onDismiss: (handler: (result: RCancel) => Promise<void>) => void; | ||
close: (result: ROk) => void; | ||
dismiss: (result: RCancel) => void; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,41 @@ | ||
import React from "react"; | ||
|
||
export interface EmptyStateProps { | ||
type DefaultStepKey = "dataSources" | "queries" | "alerts" | "dashboards" | "users"; | ||
export type StepKey<K> = DefaultStepKey | K; | ||
|
||
export interface StepItem<K> { | ||
key: StepKey<K>; | ||
node: React.ReactNode; | ||
} | ||
|
||
export interface EmptyStateProps<K = unknown> { | ||
header?: string; | ||
icon?: string; | ||
description: string; | ||
illustration: string; | ||
illustrationPath?: string; | ||
helpLink: string; | ||
|
||
onboardingMode?: boolean; | ||
showAlertStep?: boolean; | ||
showDashboardStep?: boolean; | ||
showDataSourceStep?: boolean; | ||
showInviteStep?: boolean; | ||
|
||
getStepsItems?: (items: Array<StepItem<K>>) => Array<StepItem<K>>; | ||
} | ||
|
||
declare const EmptyState: React.FunctionComponent<EmptyStateProps>; | ||
declare class EmptyState<R> extends React.Component<EmptyStateProps<R>> {} | ||
|
||
export default EmptyState; | ||
|
||
export interface StepProps { | ||
show: boolean; | ||
completed: boolean; | ||
url?: string; | ||
urlText?: string; | ||
text: string; | ||
onClick?: () => void; | ||
} | ||
|
||
export declare const Step: React.FunctionComponent<StepProps>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.