Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cacheMgr: CacheMgr | null,
visibleColumnKeys: IColumnKeys,
showFullSQL: boolean,
options?: IStatementQueryOptions,
needSave: boolean = true
): IStatementTableController {
const { orderOptions, changeOrder } = useOrderState(
'statement',
needSave,
DEF_ORDER_OPTIONS
)
const [memoryQueryOptions, setMemoryQueryOptions] = useState(
options || DEF_STMT_QUERY_OPTIONS
)
const [sessionQueryOptions, setSessionQueryOptions] = useSessionStorageState(
QUERY_OPTIONS,
options || DEF_STMT_QUERY_OPTIONS
)
const queryOptions = useMemo(
() => (needSave ? sessionQueryOptions : memoryQueryOptions),
[needSave, memoryQueryOptions, sessionQueryOptions]
)
const [enable, setEnable] = useState(true)
const [allTimeRanges, setAllTimeRanges] = useState([])
const [allSchemas, setAllSchemas] = useState([])
const [allStmtTypes, setAllStmtTypes] = useState([])
const validTimeRange = useMemo(
() => calcValidStatementTimeRange(queryOptions.timeRange, allTimeRanges),
[queryOptions, allTimeRanges]
cacheMgr: CacheMgr | null,
visibleColumnKeys: IColumnKeys,
showFullSQL: boolean,
options?: ISlowQueryOptions,
needSave: boolean = true
): ISlowQueryTableController {
const { orderOptions, changeOrder } = useOrderState(
'slow_query',
needSave,
DEF_ORDER_OPTIONS
)
const [memoryQueryOptions, setMemoryQueryOptions] = useState(
options || DEF_SLOW_QUERY_OPTIONS
)
const [sessionQueryOptions, setSessionQueryOptions] = useSessionStorageState(
QUERY_OPTIONS,
options || DEF_SLOW_QUERY_OPTIONS
)
const queryOptions = useMemo(
() => (needSave ? sessionQueryOptions : memoryQueryOptions),
[needSave, memoryQueryOptions, sessionQueryOptions]
)
const queryTimeRange = useMemo(() => {
const [beginTime, endTime] = calcTimeRange(queryOptions.timeRange)
return { beginTime, endTime }
}, [queryOptions])
const [allSchemas, setAllSchemas] = useState([])
const [loadingSlowQueries, setLoadingSlowQueries] = useState(false)
const [slowQueries, setSlowQueries] = useState([])
const [refreshTimes, setRefreshTimes] = useState(0)