mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Add: configuration for query refresh intervals.
This commit is contained in:
parent
bf86d17d56
commit
4f27de3252
@ -1,5 +1,6 @@
|
|||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { map, range, partial } from 'underscore';
|
import { map, range, partial } from 'underscore';
|
||||||
|
import { durationHumanize } from '@/filters';
|
||||||
|
|
||||||
import template from './schedule-dialog.html';
|
import template from './schedule-dialog.html';
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ function queryTimePicker() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function queryRefreshSelect() {
|
function queryRefreshSelect(clientConfig) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
@ -73,43 +74,8 @@ function queryRefreshSelect() {
|
|||||||
<option value="">No Refresh</option>
|
<option value="">No Refresh</option>
|
||||||
</select>`,
|
</select>`,
|
||||||
link($scope) {
|
link($scope) {
|
||||||
$scope.refreshOptions = [
|
$scope.refreshOptions =
|
||||||
{
|
clientConfig.queryRefreshIntervals.map(interval => ({ value: String(interval), name: `Every ${durationHumanize(interval)}` }));
|
||||||
value: '60',
|
|
||||||
name: 'Every minute',
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
[5, 10, 15, 30].forEach((i) => {
|
|
||||||
$scope.refreshOptions.push({
|
|
||||||
value: String(i * 60),
|
|
||||||
name: `Every ${i} minutes`,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
range(1, 13).forEach((i) => {
|
|
||||||
$scope.refreshOptions.push({
|
|
||||||
value: String(i * 3600),
|
|
||||||
name: `Every ${i}h`,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.refreshOptions.push({
|
|
||||||
value: String(24 * 3600),
|
|
||||||
name: 'Every 24h',
|
|
||||||
});
|
|
||||||
$scope.refreshOptions.push({
|
|
||||||
value: String(7 * 24 * 3600),
|
|
||||||
name: 'Every 7 days',
|
|
||||||
});
|
|
||||||
$scope.refreshOptions.push({
|
|
||||||
value: String(14 * 24 * 3600),
|
|
||||||
name: 'Every 14 days',
|
|
||||||
});
|
|
||||||
$scope.refreshOptions.push({
|
|
||||||
value: String(30 * 24 * 3600),
|
|
||||||
name: 'Every 30 days',
|
|
||||||
});
|
|
||||||
|
|
||||||
$scope.$watch('refreshType', () => {
|
$scope.$watch('refreshType', () => {
|
||||||
if ($scope.refreshType === 'periodic') {
|
if ($scope.refreshType === 'periodic') {
|
||||||
|
@ -174,7 +174,8 @@ def client_config():
|
|||||||
'dateTimeFormat': "{0} HH:mm".format(date_format),
|
'dateTimeFormat': "{0} HH:mm".format(date_format),
|
||||||
'mailSettingsMissing': settings.MAIL_DEFAULT_SENDER is None,
|
'mailSettingsMissing': settings.MAIL_DEFAULT_SENDER is None,
|
||||||
'dashboardRefreshIntervals': settings.DASHBOARD_REFRESH_INTERVALS,
|
'dashboardRefreshIntervals': settings.DASHBOARD_REFRESH_INTERVALS,
|
||||||
'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED
|
'queryRefreshIntervals': settings.QUERY_REFRESH_INTERVALS,
|
||||||
|
'googleLoginEnabled': settings.GOOGLE_OAUTH_ENABLED,
|
||||||
}
|
}
|
||||||
|
|
||||||
client_config.update(defaults)
|
client_config.update(defaults)
|
||||||
|
@ -201,6 +201,7 @@ SENTRY_DSN = os.environ.get("REDASH_SENTRY_DSN", "")
|
|||||||
ALLOW_SCRIPTS_IN_USER_INPUT = parse_boolean(os.environ.get("REDASH_ALLOW_SCRIPTS_IN_USER_INPUT", "false"))
|
ALLOW_SCRIPTS_IN_USER_INPUT = parse_boolean(os.environ.get("REDASH_ALLOW_SCRIPTS_IN_USER_INPUT", "false"))
|
||||||
DATE_FORMAT = os.environ.get("REDASH_DATE_FORMAT", "DD/MM/YY")
|
DATE_FORMAT = os.environ.get("REDASH_DATE_FORMAT", "DD/MM/YY")
|
||||||
DASHBOARD_REFRESH_INTERVALS = map(int, array_from_string(os.environ.get("REDASH_DASHBOARD_REFRESH_INTERVALS", "60,300,600,1800,3600,43200,86400")))
|
DASHBOARD_REFRESH_INTERVALS = map(int, array_from_string(os.environ.get("REDASH_DASHBOARD_REFRESH_INTERVALS", "60,300,600,1800,3600,43200,86400")))
|
||||||
|
QUERY_REFRESH_INTERVALS = map(int, array_from_string(os.environ.get("REDASH_QUERY_REFRESH_INTERVALS", "60, 300, 600, 900, 1800, 3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 32400, 36000, 39600, 43200, 86400, 604800, 1209600, 2592000")))
|
||||||
|
|
||||||
# Features:
|
# Features:
|
||||||
VERSION_CHECK = parse_boolean(os.environ.get("REDASH_VERSION_CHECK", "true"))
|
VERSION_CHECK = parse_boolean(os.environ.get("REDASH_VERSION_CHECK", "true"))
|
||||||
|
Loading…
Reference in New Issue
Block a user