-
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.
* [Removed unneeded PseudoJSON and DBPersistence classes, migrated al…
…l json contained column's type to JSONB](getredash/redash#6687) * enhanced SETUP documentation * postgres docker image version from 12 to latest * [Add default limit (1000) to SQL queries](getredash/redash#5088) * new settings are implemented
- Loading branch information
Showing
101 changed files
with
2,375 additions
and
1,269 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
37 changes: 37 additions & 0 deletions
37
client/app/components/queries/QueryEditor/AutoLimitCheckbox.jsx
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,37 @@ | ||
import React, { useCallback } from "react"; | ||
import PropTypes from "prop-types"; | ||
import recordEvent from "@/services/recordEvent"; | ||
import Checkbox from "antd/lib/checkbox"; | ||
import Tooltip from "antd/lib/tooltip"; | ||
|
||
export default function AutoLimitCheckbox({ available, checked, onChange }) { | ||
const handleClick = useCallback(() => { | ||
recordEvent("checkbox_auto_limit", "screen", "query_editor", { state: !checked }); | ||
onChange(!checked); | ||
}, [checked, onChange]); | ||
|
||
let tooltipMessage = null; | ||
if (!available) { | ||
tooltipMessage = "Auto limiting is not available for this Data Source type."; | ||
} else { | ||
tooltipMessage = "Auto limit results to first 1000 rows."; | ||
} | ||
|
||
return ( | ||
<Tooltip placement="top" title={tooltipMessage}> | ||
<Checkbox | ||
className="query-editor-controls-checkbox" | ||
disabled={!available} | ||
onClick={handleClick} | ||
checked={available && checked}> | ||
LIMIT 1000 | ||
</Checkbox> | ||
</Tooltip> | ||
); | ||
} | ||
|
||
AutoLimitCheckbox.propTypes = { | ||
available: PropTypes.bool, | ||
checked: PropTypes.bool.isRequired, | ||
onChange: PropTypes.func.isRequired, | ||
}; |
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
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,24 @@ | ||
import { useCallback, useState } from "react"; | ||
import localOptions from "@/lib/localOptions"; | ||
import { get, extend } from "lodash"; | ||
|
||
function isAutoLimitAvailable(dataSource) { | ||
return get(dataSource, "supports_auto_limit", false); | ||
} | ||
|
||
export default function useAutoLimitFlags(dataSource, query, setQuery) { | ||
const isAvailable = isAutoLimitAvailable(dataSource); | ||
const [isChecked, setIsChecked] = useState(query.options.apply_auto_limit); | ||
query.options.apply_auto_limit = isChecked; | ||
|
||
const setAutoLimit = useCallback( | ||
state => { | ||
setIsChecked(state); | ||
localOptions.set("applyAutoLimit", state); | ||
setQuery(extend(query.clone(), { options: { ...query.options, apply_auto_limit: state } })); | ||
}, | ||
[query, setQuery] | ||
); | ||
|
||
return [isAvailable, isChecked, setAutoLimit]; | ||
} |
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
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
Oops, something went wrong.