mirror of
https://github.com/apache/superset.git
synced 2026-04-25 19:14:27 +00:00
fix: feature flags typing (#15254)
* fix: feature flags typing * fix tests * add note in UPDATING.md * fix frontend * also move SCHEDULED_QUERIES to top level * fix test Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
This commit is contained in:
committed by
GitHub
parent
02a9b84b14
commit
69f9ee8f5e
@@ -26,6 +26,12 @@ import { Form, FormItem } from 'src/components/Form';
|
||||
import './ScheduleQueryButton.less';
|
||||
import Button from 'src/components/Button';
|
||||
|
||||
const appContainer = document.getElementById('app');
|
||||
const bootstrapData = JSON.parse(
|
||||
appContainer?.getAttribute('data-bootstrap') || '{}',
|
||||
);
|
||||
const scheduledQueriesConf = bootstrapData?.common?.conf?.SCHEDULED_QUERIES;
|
||||
|
||||
const validators = {
|
||||
greater: (a: number, b: number) => a > b,
|
||||
greater_equal: (a: number, b: number) => a >= b,
|
||||
@@ -34,7 +40,7 @@ const validators = {
|
||||
};
|
||||
|
||||
const getJSONSchema = () => {
|
||||
const jsonSchema = window.featureFlags.SCHEDULED_QUERIES?.JSONSCHEMA;
|
||||
const jsonSchema = scheduledQueriesConf?.JSONSCHEMA;
|
||||
// parse date-time into usable value (eg, 'today' => `new Date()`)
|
||||
if (jsonSchema) {
|
||||
Object.entries(jsonSchema.properties).forEach(
|
||||
@@ -52,10 +58,9 @@ const getJSONSchema = () => {
|
||||
return {};
|
||||
};
|
||||
|
||||
const getUISchema = () => window.featureFlags.SCHEDULED_QUERIES?.UISCHEMA;
|
||||
const getUISchema = () => scheduledQueriesConf?.UISCHEMA;
|
||||
|
||||
const getValidationRules = () =>
|
||||
window.featureFlags.SCHEDULED_QUERIES?.VALIDATION || [];
|
||||
const getValidationRules = () => scheduledQueriesConf?.VALIDATION || [];
|
||||
|
||||
const getValidator = () => {
|
||||
const rules: any = getValidationRules();
|
||||
|
||||
@@ -82,6 +82,14 @@ const SET_QUERY_EDITOR_SQL_DEBOUNCE_MS = 2000;
|
||||
const VALIDATION_DEBOUNCE_MS = 600;
|
||||
const WINDOW_RESIZE_THROTTLE_MS = 100;
|
||||
|
||||
const appContainer = document.getElementById('app');
|
||||
const bootstrapData = JSON.parse(
|
||||
appContainer.getAttribute('data-bootstrap') || '{}',
|
||||
);
|
||||
const validatorMap =
|
||||
bootstrapData?.common?.conf?.SQL_VALIDATORS_BY_ENGINE || {};
|
||||
const scheduledQueriesConf = bootstrapData?.common?.conf?.SCHEDULED_QUERIES;
|
||||
|
||||
const LimitSelectStyled = styled.span`
|
||||
.ant-dropdown-trigger {
|
||||
align-items: center;
|
||||
@@ -391,8 +399,7 @@ class SqlEditor extends React.PureComponent {
|
||||
canValidateQuery() {
|
||||
// Check whether or not we can validate the current query based on whether
|
||||
// or not the backend has a validator configured for it.
|
||||
const validatorMap = window.featureFlags.SQL_VALIDATORS_BY_ENGINE;
|
||||
if (this.props.database && validatorMap != null) {
|
||||
if (this.props.database) {
|
||||
return validatorMap.hasOwnProperty(this.props.database.backend);
|
||||
}
|
||||
return false;
|
||||
@@ -531,7 +538,7 @@ class SqlEditor extends React.PureComponent {
|
||||
/>
|
||||
</Menu.Item>
|
||||
)}
|
||||
{isFeatureEnabled(FeatureFlag.SCHEDULED_QUERIES) && (
|
||||
{scheduledQueriesConf && (
|
||||
<Menu.Item>
|
||||
<ScheduleQueryButton
|
||||
defaultLabel={qe.title}
|
||||
|
||||
Reference in New Issue
Block a user