|
@@ -38,7 +38,10 @@ import { RouteComponentWithParams } from 'utils/types'
|
|
import { hideNavigator } from '../App/actions'
|
|
import { hideNavigator } from '../App/actions'
|
|
import { ViewActions, ViewActionType } from './actions'
|
|
import { ViewActions, ViewActionType } from './actions'
|
|
import { SourceActions, SourceActionType } from 'containers/Source/actions'
|
|
import { SourceActions, SourceActionType } from 'containers/Source/actions'
|
|
-import { OrganizationActions, OrganizationActionType } from 'containers/Organizations/actions'
|
|
|
|
|
|
+import {
|
|
|
|
+ OrganizationActions,
|
|
|
|
+ OrganizationActionType
|
|
|
|
+} from 'containers/Organizations/actions'
|
|
|
|
|
|
import {
|
|
import {
|
|
makeSelectEditingView,
|
|
makeSelectEditingView,
|
|
@@ -49,7 +52,6 @@ import {
|
|
makeSelectSqlLimit,
|
|
makeSelectSqlLimit,
|
|
makeSelectSqlValidation,
|
|
makeSelectSqlValidation,
|
|
makeSelectLoading,
|
|
makeSelectLoading,
|
|
-
|
|
|
|
makeSelectChannels,
|
|
makeSelectChannels,
|
|
makeSelectTenants,
|
|
makeSelectTenants,
|
|
makeSelectBizs,
|
|
makeSelectBizs,
|
|
@@ -59,9 +61,19 @@ import {
|
|
import { makeSelectProjectRoles } from 'containers/Projects/selectors'
|
|
import { makeSelectProjectRoles } from 'containers/Projects/selectors'
|
|
|
|
|
|
import {
|
|
import {
|
|
- IView, IViewModel, IViewRoleRaw, IViewRole, IViewVariable, IViewInfo,
|
|
|
|
- IExecuteSqlParams, IExecuteSqlResponse, IViewLoading, ISqlValidation,
|
|
|
|
- IDacChannel, IDacTenant, IDacBiz
|
|
|
|
|
|
+ IView,
|
|
|
|
+ IViewModel,
|
|
|
|
+ IViewRoleRaw,
|
|
|
|
+ IViewRole,
|
|
|
|
+ IViewVariable,
|
|
|
|
+ IViewInfo,
|
|
|
|
+ IExecuteSqlParams,
|
|
|
|
+ IExecuteSqlResponse,
|
|
|
|
+ IViewLoading,
|
|
|
|
+ ISqlValidation,
|
|
|
|
+ IDacChannel,
|
|
|
|
+ IDacTenant,
|
|
|
|
+ IDacBiz
|
|
} from './types'
|
|
} from './types'
|
|
import { ISource, ISchema } from '../Source/types'
|
|
import { ISource, ISchema } from '../Source/types'
|
|
import { ViewVariableTypes } from './constants'
|
|
import { ViewVariableTypes } from './constants'
|
|
@@ -78,6 +90,7 @@ import ViewVariableList from './components/ViewVariableList'
|
|
import VariableModal from './components/VariableModal'
|
|
import VariableModal from './components/VariableModal'
|
|
|
|
|
|
import Styles from './View.less'
|
|
import Styles from './View.less'
|
|
|
|
+import { querystring } from '../../../share/util'
|
|
|
|
|
|
interface IViewEditorStateProps {
|
|
interface IViewEditorStateProps {
|
|
editingView: IView
|
|
editingView: IView
|
|
@@ -92,7 +105,7 @@ interface IViewEditorStateProps {
|
|
|
|
|
|
channels: IDacChannel[]
|
|
channels: IDacChannel[]
|
|
tenants: IDacTenant[]
|
|
tenants: IDacTenant[]
|
|
- bizs: IDacBiz[],
|
|
|
|
|
|
+ bizs: IDacBiz[]
|
|
|
|
|
|
isLastExecuteWholeSql: boolean
|
|
isLastExecuteWholeSql: boolean
|
|
}
|
|
}
|
|
@@ -108,7 +121,11 @@ interface IViewEditorDispatchProps {
|
|
onLoadSources: (projectId: number) => void
|
|
onLoadSources: (projectId: number) => void
|
|
onLoadSourceDatabases: (sourceId: number) => void
|
|
onLoadSourceDatabases: (sourceId: number) => void
|
|
onLoadDatabaseTables: (sourceId: number, databaseName: string) => void
|
|
onLoadDatabaseTables: (sourceId: number, databaseName: string) => void
|
|
- onLoadTableColumns: (sourceId: number, databaseName: string, tableName: string) => void
|
|
|
|
|
|
+ onLoadTableColumns: (
|
|
|
|
+ sourceId: number,
|
|
|
|
+ databaseName: string,
|
|
|
|
+ tableName: string
|
|
|
|
+ ) => void
|
|
onExecuteSql: (params: IExecuteSqlParams, exeType: EExecuteType) => void
|
|
onExecuteSql: (params: IExecuteSqlParams, exeType: EExecuteType) => void
|
|
onAddView: (view: IView, resolve: () => void) => void
|
|
onAddView: (view: IView, resolve: () => void) => void
|
|
onEditView: (view: IView, resolve: () => void) => void
|
|
onEditView: (view: IView, resolve: () => void) => void
|
|
@@ -116,16 +133,18 @@ interface IViewEditorDispatchProps {
|
|
onUpdateEditingViewInfo: (viewInfo: IViewInfo) => void
|
|
onUpdateEditingViewInfo: (viewInfo: IViewInfo) => void
|
|
onSetSqlLimit: (limit: number) => void
|
|
onSetSqlLimit: (limit: number) => void
|
|
|
|
|
|
- onLoadDacChannels: () => void,
|
|
|
|
- onLoadDacTenants: (channelName: string) => void,
|
|
|
|
- onLoadDacBizs: (channelName: string, tenantId: number) => void,
|
|
|
|
|
|
+ onLoadDacChannels: () => void
|
|
|
|
+ onLoadDacTenants: (channelName: string) => void
|
|
|
|
+ onLoadDacBizs: (channelName: string, tenantId: number) => void
|
|
|
|
|
|
onResetState: () => void
|
|
onResetState: () => void
|
|
onLoadProjectRoles: (projectId: number) => void
|
|
onLoadProjectRoles: (projectId: number) => void
|
|
onSetIsLastExecuteWholeSql: (isLastExecuteWholeSql: boolean) => void
|
|
onSetIsLastExecuteWholeSql: (isLastExecuteWholeSql: boolean) => void
|
|
}
|
|
}
|
|
|
|
|
|
-type IViewEditorProps = IViewEditorStateProps & IViewEditorDispatchProps & RouteComponentWithParams
|
|
|
|
|
|
+type IViewEditorProps = IViewEditorStateProps &
|
|
|
|
+ IViewEditorDispatchProps &
|
|
|
|
+ RouteComponentWithParams
|
|
|
|
|
|
interface IViewEditorStates {
|
|
interface IViewEditorStates {
|
|
containerHeight: number
|
|
containerHeight: number
|
|
@@ -136,9 +155,10 @@ interface IViewEditorStates {
|
|
sqlFragment: string
|
|
sqlFragment: string
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorStates> {
|
|
|
|
-
|
|
|
|
|
|
+export class ViewEditor extends React.Component<
|
|
|
|
+ IViewEditorProps,
|
|
|
|
+ IViewEditorStates
|
|
|
|
+> {
|
|
public state: Readonly<IViewEditorStates> = {
|
|
public state: Readonly<IViewEditorStates> = {
|
|
containerHeight: 0,
|
|
containerHeight: 0,
|
|
currentStep: 0,
|
|
currentStep: 0,
|
|
@@ -170,9 +190,10 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
onLoadDacChannels()
|
|
onLoadDacChannels()
|
|
}
|
|
}
|
|
|
|
|
|
- public static getDerivedStateFromProps:
|
|
|
|
- React.GetDerivedStateFromProps<IViewEditorProps, IViewEditorStates>
|
|
|
|
- = (props, state) => {
|
|
|
|
|
|
+ public static getDerivedStateFromProps: React.GetDerivedStateFromProps<
|
|
|
|
+ IViewEditorProps,
|
|
|
|
+ IViewEditorStates
|
|
|
|
+ > = (props, state) => {
|
|
const { match, editingView, sqlValidation } = props
|
|
const { match, editingView, sqlValidation } = props
|
|
const { viewId } = match.params
|
|
const { viewId } = match.params
|
|
const { init, sqlValidationCode } = state
|
|
const { init, sqlValidationCode } = state
|
|
@@ -181,23 +202,23 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
notification.destroy()
|
|
notification.destroy()
|
|
sqlValidation.code === 200
|
|
sqlValidation.code === 200
|
|
? notification.success({
|
|
? notification.success({
|
|
- message: '执行成功',
|
|
|
|
- duration: 3
|
|
|
|
- })
|
|
|
|
|
|
+ message: '执行成功',
|
|
|
|
+ duration: 3
|
|
|
|
+ })
|
|
: notification.error({
|
|
: notification.error({
|
|
- message: '执行失败',
|
|
|
|
- description: (
|
|
|
|
- <Tooltip
|
|
|
|
- placement='bottom'
|
|
|
|
- trigger='click'
|
|
|
|
- title={sqlValidation.message}
|
|
|
|
- overlayClassName={Styles.errorMessage}
|
|
|
|
- >
|
|
|
|
- <a>点击查看错误信息</a>
|
|
|
|
- </Tooltip>
|
|
|
|
- ),
|
|
|
|
- duration: null
|
|
|
|
- })
|
|
|
|
|
|
+ message: '执行失败',
|
|
|
|
+ description: (
|
|
|
|
+ <Tooltip
|
|
|
|
+ placement="bottom"
|
|
|
|
+ trigger="click"
|
|
|
|
+ title={sqlValidation.message}
|
|
|
|
+ overlayClassName={Styles.errorMessage}
|
|
|
|
+ >
|
|
|
|
+ <a>点击查看错误信息</a>
|
|
|
|
+ </Tooltip>
|
|
|
|
+ ),
|
|
|
|
+ duration: null
|
|
|
|
+ })
|
|
if (sqlValidation.code === 200) {
|
|
if (sqlValidation.code === 200) {
|
|
lastSuccessExecutedSql = editingView.sql
|
|
lastSuccessExecutedSql = editingView.sql
|
|
}
|
|
}
|
|
@@ -230,7 +251,10 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
ViewEditor.ExecuteSql(this.props, this.state.sqlFragment)
|
|
ViewEditor.ExecuteSql(this.props, this.state.sqlFragment)
|
|
}
|
|
}
|
|
|
|
|
|
- private static ExecuteSql = (props: IViewEditorProps, sqlFragment?: string) => {
|
|
|
|
|
|
+ private static ExecuteSql = (
|
|
|
|
+ props: IViewEditorProps,
|
|
|
|
+ sqlFragment?: string
|
|
|
|
+ ) => {
|
|
const { onExecuteSql, editingView, editingViewInfo, sqlLimit } = props
|
|
const { onExecuteSql, editingView, editingViewInfo, sqlLimit } = props
|
|
const { sourceId, sql } = editingView
|
|
const { sourceId, sql } = editingView
|
|
const { variable } = editingViewInfo
|
|
const { variable } = editingViewInfo
|
|
@@ -240,7 +264,8 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
limit: sqlLimit,
|
|
limit: sqlLimit,
|
|
variables: variable
|
|
variables: variable
|
|
}
|
|
}
|
|
- const exeType = sqlFragment == null ? EExecuteType.whole : EExecuteType.single
|
|
|
|
|
|
+ const exeType =
|
|
|
|
+ sqlFragment == null ? EExecuteType.whole : EExecuteType.single
|
|
onExecuteSql(updatedParams, exeType)
|
|
onExecuteSql(updatedParams, exeType)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -271,14 +296,29 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
}
|
|
}
|
|
|
|
|
|
private saveView = () => {
|
|
private saveView = () => {
|
|
- const { onAddView, onEditView, editingView, editingViewInfo, projectRoles, match } = this.props
|
|
|
|
|
|
+ const searchParams = querystring(
|
|
|
|
+ this.props.location?.search?.replace('?', '')
|
|
|
|
+ )
|
|
|
|
+ const {
|
|
|
|
+ onAddView,
|
|
|
|
+ onEditView,
|
|
|
|
+ editingView,
|
|
|
|
+ editingViewInfo,
|
|
|
|
+ projectRoles,
|
|
|
|
+ match
|
|
|
|
+ } = this.props
|
|
const { projectId } = match.params
|
|
const { projectId } = match.params
|
|
const { model, variable, roles } = editingViewInfo
|
|
const { model, variable, roles } = editingViewInfo
|
|
const { id: viewId } = editingView
|
|
const { id: viewId } = editingView
|
|
- const validRoles = roles.filter(({ roleId }) => projectRoles && projectRoles.findIndex(({ id }) => id === roleId) >= 0)
|
|
|
|
|
|
+ const validRoles = roles.filter(
|
|
|
|
+ ({ roleId }) =>
|
|
|
|
+ projectRoles && projectRoles.findIndex(({ id }) => id === roleId) >= 0
|
|
|
|
+ )
|
|
const updatedView: IView = {
|
|
const updatedView: IView = {
|
|
...editingView,
|
|
...editingView,
|
|
projectId: +projectId,
|
|
projectId: +projectId,
|
|
|
|
+ // @ts-ignore
|
|
|
|
+ parentId: searchParams?.parentId * 1 || null,
|
|
model: JSON.stringify(model),
|
|
model: JSON.stringify(model),
|
|
variable: JSON.stringify(variable),
|
|
variable: JSON.stringify(variable),
|
|
roles: validRoles.map<IViewRoleRaw>(({ roleId, columnAuth, rowAuth }) => {
|
|
roles: validRoles.map<IViewRoleRaw>(({ roleId, columnAuth, rowAuth }) => {
|
|
@@ -288,7 +328,7 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
if (!v) {
|
|
if (!v) {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
- return (v.type === ViewVariableTypes.Authorization && !v.fromService)
|
|
|
|
|
|
+ return v.type === ViewVariableTypes.Authorization && !v.fromService
|
|
})
|
|
})
|
|
return {
|
|
return {
|
|
roleId,
|
|
roleId,
|
|
@@ -297,7 +337,9 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
- viewId ? onEditView(updatedView, this.goToViewList) : onAddView(updatedView, this.goToViewList)
|
|
|
|
|
|
+ viewId
|
|
|
|
+ ? onEditView(updatedView, this.goToViewList)
|
|
|
|
+ : onAddView(updatedView, this.goToViewList)
|
|
}
|
|
}
|
|
|
|
|
|
private goToViewList = () => {
|
|
private goToViewList = () => {
|
|
@@ -305,7 +347,8 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
const { projectId } = match.params
|
|
const { projectId } = match.params
|
|
const prefix = window.localStorage.getItem('inDataService') ?? ''
|
|
const prefix = window.localStorage.getItem('inDataService') ?? ''
|
|
const prefixPath = prefix ? '/' + prefix : prefix
|
|
const prefixPath = prefix ? '/' + prefix : prefix
|
|
- history.push(`/project/${projectId}${prefixPath}/views`)
|
|
|
|
|
|
+ history.replace(`/project/${projectId}${prefixPath}/views`)
|
|
|
|
+ window.location.reload()
|
|
}
|
|
}
|
|
|
|
|
|
private viewChange = (propName: keyof IView, value: string | number) => {
|
|
private viewChange = (propName: keyof IView, value: string | number) => {
|
|
@@ -368,68 +411,85 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
onUpdateEditingViewInfo(updatedViewInfo)
|
|
onUpdateEditingViewInfo(updatedViewInfo)
|
|
}
|
|
}
|
|
|
|
|
|
- private getSqlHints = memoizeOne((sourceId: number, schema: ISchema, variables: IViewVariable[]) => {
|
|
|
|
- if (!sourceId) {
|
|
|
|
- return {}
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- const variableHints = variables.reduce((acc, v) => {
|
|
|
|
- acc[`$${v.name}$`] = []
|
|
|
|
- return acc
|
|
|
|
- }, {})
|
|
|
|
- const { mapDatabases, mapTables, mapColumns } = schema
|
|
|
|
- if (!mapDatabases[sourceId]) {
|
|
|
|
- return {}
|
|
|
|
- }
|
|
|
|
|
|
+ private getSqlHints = memoizeOne(
|
|
|
|
+ (sourceId: number, schema: ISchema, variables: IViewVariable[]) => {
|
|
|
|
+ if (!sourceId) {
|
|
|
|
+ return {}
|
|
|
|
+ }
|
|
|
|
|
|
- const tableHints: { [tableName: string]: string[] } = Object.values(mapTables).reduce((acc, tablesInfo) => {
|
|
|
|
- if (tablesInfo.sourceId !== sourceId) {
|
|
|
|
|
|
+ const variableHints = variables.reduce((acc, v) => {
|
|
|
|
+ acc[`$${v.name}$`] = []
|
|
return acc
|
|
return acc
|
|
|
|
+ }, {})
|
|
|
|
+ const { mapDatabases, mapTables, mapColumns } = schema
|
|
|
|
+ if (!mapDatabases[sourceId]) {
|
|
|
|
+ return {}
|
|
}
|
|
}
|
|
|
|
|
|
- tablesInfo.tables.forEach(({ name: tableName }) => {
|
|
|
|
- acc[tableName] = []
|
|
|
|
|
|
+ const tableHints: { [tableName: string]: string[] } = Object.values(
|
|
|
|
+ mapTables
|
|
|
|
+ ).reduce((acc, tablesInfo) => {
|
|
|
|
+ if (tablesInfo.sourceId !== sourceId) {
|
|
|
|
+ return acc
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tablesInfo.tables.forEach(({ name: tableName }) => {
|
|
|
|
+ acc[tableName] = []
|
|
|
|
+ })
|
|
|
|
+ return acc
|
|
|
|
+ }, {})
|
|
|
|
+
|
|
|
|
+ Object.values(mapColumns).forEach((columnsInfo) => {
|
|
|
|
+ if (columnsInfo.sourceId !== sourceId) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ const { tableName, columns } = columnsInfo
|
|
|
|
+ if (tableHints[tableName]) {
|
|
|
|
+ tableHints[tableName] = tableHints[tableName].concat(
|
|
|
|
+ columns.map((col) => col.name)
|
|
|
|
+ )
|
|
|
|
+ }
|
|
})
|
|
})
|
|
- return acc
|
|
|
|
- }, {})
|
|
|
|
|
|
|
|
- Object.values(mapColumns).forEach((columnsInfo) => {
|
|
|
|
- if (columnsInfo.sourceId !== sourceId) {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- const { tableName, columns } = columnsInfo
|
|
|
|
- if (tableHints[tableName]) {
|
|
|
|
- tableHints[tableName] = tableHints[tableName].concat(columns.map((col) => col.name))
|
|
|
|
|
|
+ const hints = {
|
|
|
|
+ ...variableHints,
|
|
|
|
+ ...tableHints
|
|
}
|
|
}
|
|
- })
|
|
|
|
-
|
|
|
|
- const hints = {
|
|
|
|
- ...variableHints,
|
|
|
|
- ...tableHints
|
|
|
|
|
|
+ return hints
|
|
}
|
|
}
|
|
- return hints
|
|
|
|
- })
|
|
|
|
|
|
+ )
|
|
|
|
|
|
public render() {
|
|
public render() {
|
|
const {
|
|
const {
|
|
- sources, schema,
|
|
|
|
- sqlDataSource, sqlLimit, loading, projectRoles,
|
|
|
|
- channels, tenants, bizs,
|
|
|
|
- editingView, editingViewInfo,
|
|
|
|
|
|
+ sources,
|
|
|
|
+ schema,
|
|
|
|
+ sqlDataSource,
|
|
|
|
+ sqlLimit,
|
|
|
|
+ loading,
|
|
|
|
+ projectRoles,
|
|
|
|
+ channels,
|
|
|
|
+ tenants,
|
|
|
|
+ bizs,
|
|
|
|
+ editingView,
|
|
|
|
+ editingViewInfo,
|
|
isLastExecuteWholeSql,
|
|
isLastExecuteWholeSql,
|
|
- onLoadSourceDatabases, onLoadDatabaseTables, onLoadTableColumns, onSetSqlLimit,
|
|
|
|
- onLoadDacTenants, onLoadDacBizs
|
|
|
|
|
|
+ onLoadSourceDatabases,
|
|
|
|
+ onLoadDatabaseTables,
|
|
|
|
+ onLoadTableColumns,
|
|
|
|
+ onSetSqlLimit,
|
|
|
|
+ onLoadDacTenants,
|
|
|
|
+ onLoadDacBizs
|
|
} = this.props
|
|
} = this.props
|
|
const { currentStep, lastSuccessExecutedSql, sqlFragment } = this.state
|
|
const { currentStep, lastSuccessExecutedSql, sqlFragment } = this.state
|
|
const { model, variable, roles: viewRoles } = editingViewInfo
|
|
const { model, variable, roles: viewRoles } = editingViewInfo
|
|
const sqlHints = this.getSqlHints(editingView.sourceId, schema, variable)
|
|
const sqlHints = this.getSqlHints(editingView.sourceId, schema, variable)
|
|
const containerVisible = !currentStep
|
|
const containerVisible = !currentStep
|
|
const modelAuthVisible = !!currentStep
|
|
const modelAuthVisible = !!currentStep
|
|
- const nextDisabled = (editingView.sql !== lastSuccessExecutedSql)
|
|
|
|
|
|
+ const nextDisabled = editingView.sql !== lastSuccessExecutedSql
|
|
|
|
|
|
return (
|
|
return (
|
|
<>
|
|
<>
|
|
- <Helmet title='数据资产' />
|
|
|
|
|
|
+ <Helmet title="数据资产" />
|
|
<div className={Styles.viewEditor}>
|
|
<div className={Styles.viewEditor}>
|
|
<div className={Styles.header}>
|
|
<div className={Styles.header}>
|
|
<div className={Styles.steps}>
|
|
<div className={Styles.steps}>
|
|
@@ -442,7 +502,7 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
onVariableChange={this.variableChange}
|
|
onVariableChange={this.variableChange}
|
|
>
|
|
>
|
|
<SourceTable
|
|
<SourceTable
|
|
- key='SourceTable'
|
|
|
|
|
|
+ key="SourceTable"
|
|
view={editingView}
|
|
view={editingView}
|
|
sources={sources}
|
|
sources={sources}
|
|
schema={schema}
|
|
schema={schema}
|
|
@@ -451,11 +511,22 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
onDatabaseSelect={onLoadDatabaseTables}
|
|
onDatabaseSelect={onLoadDatabaseTables}
|
|
onTableSelect={onLoadTableColumns}
|
|
onTableSelect={onLoadTableColumns}
|
|
/>
|
|
/>
|
|
- <SqlEditor key='SqlEditor' value={editingView.sql} hints={sqlHints} onSqlChange={this.sqlChange}
|
|
|
|
- onSelect={this.sqlSelect} onCmdEnter={this.executeSql} />
|
|
|
|
- <SqlPreview key='SqlPreview' size='small' loading={loading.execute} response={sqlDataSource} />
|
|
|
|
|
|
+ <SqlEditor
|
|
|
|
+ key="SqlEditor"
|
|
|
|
+ value={editingView.sql}
|
|
|
|
+ hints={sqlHints}
|
|
|
|
+ onSqlChange={this.sqlChange}
|
|
|
|
+ onSelect={this.sqlSelect}
|
|
|
|
+ onCmdEnter={this.executeSql}
|
|
|
|
+ />
|
|
|
|
+ <SqlPreview
|
|
|
|
+ key="SqlPreview"
|
|
|
|
+ size="small"
|
|
|
|
+ loading={loading.execute}
|
|
|
|
+ response={sqlDataSource}
|
|
|
|
+ />
|
|
<EditorBottom
|
|
<EditorBottom
|
|
- key='EditorBottom'
|
|
|
|
|
|
+ key="EditorBottom"
|
|
sqlLimit={sqlLimit}
|
|
sqlLimit={sqlLimit}
|
|
loading={loading.execute}
|
|
loading={loading.execute}
|
|
nextDisabled={nextDisabled}
|
|
nextDisabled={nextDisabled}
|
|
@@ -465,9 +536,9 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
onExecuteSql={this.executeSql}
|
|
onExecuteSql={this.executeSql}
|
|
onStepChange={this.stepChange}
|
|
onStepChange={this.stepChange}
|
|
/>
|
|
/>
|
|
- <ViewVariableList key='ViewVariableList' variables={variable} />
|
|
|
|
|
|
+ <ViewVariableList key="ViewVariableList" variables={variable} />
|
|
<VariableModal
|
|
<VariableModal
|
|
- key='VariableModal'
|
|
|
|
|
|
+ key="VariableModal"
|
|
channels={channels}
|
|
channels={channels}
|
|
tenants={tenants}
|
|
tenants={tenants}
|
|
bizs={bizs}
|
|
bizs={bizs}
|
|
@@ -494,25 +565,35 @@ export class ViewEditor extends React.Component<IViewEditorProps, IViewEditorSta
|
|
|
|
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
const mapDispatchToProps = (dispatch) => ({
|
|
onHideNavigator: () => dispatch(hideNavigator()),
|
|
onHideNavigator: () => dispatch(hideNavigator()),
|
|
- onLoadViewDetail: (viewId: number) => dispatch(ViewActions.loadViewsDetail([viewId], null, true)),
|
|
|
|
|
|
+ onLoadViewDetail: (viewId: number) =>
|
|
|
|
+ dispatch(ViewActions.loadViewsDetail([viewId], null, true)),
|
|
onLoadSources: (projectId) => dispatch(SourceActions.loadSources(projectId)),
|
|
onLoadSources: (projectId) => dispatch(SourceActions.loadSources(projectId)),
|
|
- onLoadSourceDatabases: (sourceId) => dispatch(SourceActions.loadSourceDatabases(sourceId)),
|
|
|
|
- onLoadDatabaseTables: (sourceId, databaseName) => dispatch(SourceActions.loadDatabaseTables(sourceId, databaseName)),
|
|
|
|
- onLoadTableColumns: (sourceId, databaseName, tableName) => dispatch(SourceActions.loadTableColumns(sourceId, databaseName, tableName)),
|
|
|
|
- onExecuteSql: (params, exeType?) => dispatch(ViewActions.executeSql(params, exeType)),
|
|
|
|
- onSetIsLastExecuteWholeSql: (isLastExecuteWholeSql: boolean) => dispatch(ViewActions.setIsLastExecuteWholeSql(isLastExecuteWholeSql)),
|
|
|
|
|
|
+ onLoadSourceDatabases: (sourceId) =>
|
|
|
|
+ dispatch(SourceActions.loadSourceDatabases(sourceId)),
|
|
|
|
+ onLoadDatabaseTables: (sourceId, databaseName) =>
|
|
|
|
+ dispatch(SourceActions.loadDatabaseTables(sourceId, databaseName)),
|
|
|
|
+ onLoadTableColumns: (sourceId, databaseName, tableName) =>
|
|
|
|
+ dispatch(SourceActions.loadTableColumns(sourceId, databaseName, tableName)),
|
|
|
|
+ onExecuteSql: (params, exeType?) =>
|
|
|
|
+ dispatch(ViewActions.executeSql(params, exeType)),
|
|
|
|
+ onSetIsLastExecuteWholeSql: (isLastExecuteWholeSql: boolean) =>
|
|
|
|
+ dispatch(ViewActions.setIsLastExecuteWholeSql(isLastExecuteWholeSql)),
|
|
onAddView: (view, resolve) => dispatch(ViewActions.addView(view, resolve)),
|
|
onAddView: (view, resolve) => dispatch(ViewActions.addView(view, resolve)),
|
|
onEditView: (view, resolve) => dispatch(ViewActions.editView(view, resolve)),
|
|
onEditView: (view, resolve) => dispatch(ViewActions.editView(view, resolve)),
|
|
onUpdateEditingView: (view) => dispatch(ViewActions.updateEditingView(view)),
|
|
onUpdateEditingView: (view) => dispatch(ViewActions.updateEditingView(view)),
|
|
- onUpdateEditingViewInfo: (viewInfo: IViewInfo) => dispatch(ViewActions.updateEditingViewInfo(viewInfo)),
|
|
|
|
|
|
+ onUpdateEditingViewInfo: (viewInfo: IViewInfo) =>
|
|
|
|
+ dispatch(ViewActions.updateEditingViewInfo(viewInfo)),
|
|
onSetSqlLimit: (limit: number) => dispatch(ViewActions.setSqlLimit(limit)),
|
|
onSetSqlLimit: (limit: number) => dispatch(ViewActions.setSqlLimit(limit)),
|
|
|
|
|
|
onLoadDacChannels: () => dispatch(ViewActions.loadDacChannels()),
|
|
onLoadDacChannels: () => dispatch(ViewActions.loadDacChannels()),
|
|
- onLoadDacTenants: (channelName) => dispatch(ViewActions.loadDacTenants(channelName)),
|
|
|
|
- onLoadDacBizs: (channelName, tenantId) => dispatch(ViewActions.loadDacBizs(channelName, tenantId)),
|
|
|
|
|
|
+ onLoadDacTenants: (channelName) =>
|
|
|
|
+ dispatch(ViewActions.loadDacTenants(channelName)),
|
|
|
|
+ onLoadDacBizs: (channelName, tenantId) =>
|
|
|
|
+ dispatch(ViewActions.loadDacBizs(channelName, tenantId)),
|
|
|
|
|
|
onResetState: () => dispatch(ViewActions.resetViewState()),
|
|
onResetState: () => dispatch(ViewActions.resetViewState()),
|
|
- onLoadProjectRoles: (projectId) => dispatch(OrganizationActions.loadProjectRoles(projectId))
|
|
|
|
|
|
+ onLoadProjectRoles: (projectId) =>
|
|
|
|
+ dispatch(OrganizationActions.loadProjectRoles(projectId))
|
|
})
|
|
})
|
|
|
|
|
|
const mapStateToProps = createStructuredSelector({
|
|
const mapStateToProps = createStructuredSelector({
|
|
@@ -536,9 +617,15 @@ const mapStateToProps = createStructuredSelector({
|
|
const withConnect = connect(mapStateToProps, mapDispatchToProps)
|
|
const withConnect = connect(mapStateToProps, mapDispatchToProps)
|
|
const withReducer = injectReducer({ key: 'view', reducer })
|
|
const withReducer = injectReducer({ key: 'view', reducer })
|
|
const withSaga = injectSaga({ key: 'view', saga: sagas })
|
|
const withSaga = injectSaga({ key: 'view', saga: sagas })
|
|
-const withReducerSource = injectReducer({ key: 'source', reducer: reducerSource })
|
|
|
|
|
|
+const withReducerSource = injectReducer({
|
|
|
|
+ key: 'source',
|
|
|
|
+ reducer: reducerSource
|
|
|
|
+})
|
|
const withSagaSource = injectSaga({ key: 'source', saga: sagasSource })
|
|
const withSagaSource = injectSaga({ key: 'source', saga: sagasSource })
|
|
-const withReducerProject = injectReducer({ key: 'project', reducer: reducerProject })
|
|
|
|
|
|
+const withReducerProject = injectReducer({
|
|
|
|
+ key: 'project',
|
|
|
|
+ reducer: reducerProject
|
|
|
|
+})
|
|
const withSagaProject = injectSaga({ key: 'project', saga: sagasProject })
|
|
const withSagaProject = injectSaga({ key: 'project', saga: sagasProject })
|
|
|
|
|
|
export default compose(
|
|
export default compose(
|