/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import React, { ChangeEvent, EventHandler } from 'react'; import cx from 'classnames'; import { t, SupersetTheme } from '@superset-ui/core'; import InfoTooltip from 'src/components/InfoTooltip'; import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox'; import Collapse from 'src/components/Collapse'; import { StyledInputContainer, StyledJsonEditor, StyledExpandableForm, antdCollapseStyles, no_margin_bottom, } from './styles'; import { DatabaseObject, ExtraJson } from '../types'; const ExtraOptions = ({ db, onInputChange, onTextChange, onEditorChange, onExtraInputChange, onExtraEditorChange, }: { db: DatabaseObject | null; onInputChange: EventHandler>; onTextChange: EventHandler>; onEditorChange: Function; onExtraInputChange: EventHandler>; onExtraEditorChange: Function; }) => { const expandableModalIsOpen = !!db?.expose_in_sqllab; const createAsOpen = !!(db?.allow_ctas || db?.allow_cvas); const isFileUploadSupportedByEngine = db?.engine_information?.supports_file_upload; // JSON.parse will deep parse engine_params // if it's an object, and we want to keep it a string const extraJson: ExtraJson = JSON.parse(db?.extra || '{}', (key, value) => { if (key === 'engine_params' && typeof value === 'object') { // keep this as a string return JSON.stringify(value); } return value; }); return ( antdCollapseStyles(theme)} >

SQL Lab

Adjust how this database will interact with SQL Lab.

} key="1" >
{t('CTAS & CVAS SCHEMA')}
{t( 'Force all tables and views to be created in this schema when clicking CTAS or CVAS in SQL Lab.', )}

Performance

Adjust performance settings of this database.

} key="2" >
{t('Chart cache timeout')}
{t( 'Duration (in seconds) of the caching timeout for charts of this database.' + ' A timeout of 0 indicates that the cache never expires.' + ' Note this defaults to the global timeout if undefined.', )}
{t('Schema cache timeout')}
{t( 'Duration (in seconds) of the metadata caching timeout for schemas of ' + 'this database. If left unset, the cache never expires.', )}
{t('Table cache timeout')}
{t( 'Duration (in seconds) of the metadata caching timeout for tables of ' + 'this database. If left unset, the cache never expires. ', )}

Security

Add extra connection information.

} key="3" >
{t('Secure extra')}
onEditorChange({ json, name: 'masked_encrypted_extra' }) } width="100%" height="160px" />
{t( 'JSON string containing additional connection configuration. ' + 'This is used to provide connection information for systems ' + 'like Hive, Presto and BigQuery which do not conform to the ' + 'username:password syntax normally used by SQLAlchemy.', )}
{t('Root certificate')}