-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathConnectionSettings.tsx
More file actions
53 lines (47 loc) · 1.85 KB
/
ConnectionSettings.tsx
File metadata and controls
53 lines (47 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react';
import {I18n} from 'i18n';
import {useSelector} from 'react-redux';
import {selectSelectorDialog, selectSelectorsGroup} from 'ui/store/selectors/controlDialog';
import {ParameterNameInput} from '../ParameterNameInput/ParameterNameInput';
import {TabsScopeSelect} from '../TabsScopeSelect/TabsScopeSelect';
import {ConnectionSelector} from './components/ConnectionSelector/ConnectionSelector';
import {QueryTypeControl} from './components/QueryTypeControl/QueryTypeControl';
const i18n = I18n.keyset('dash.control-dialog.edit');
export const ConnectionSettings = ({
navigationPath,
changeNavigationPath,
rowClassName,
enableGlobalSelectors,
}: {
navigationPath: string | null;
changeNavigationPath: (newNavigationPath: string) => void;
rowClassName?: string;
enableGlobalSelectors?: boolean;
}) => {
const {connectionQueryTypes} = useSelector(selectSelectorDialog);
const {tabsScope, group} = useSelector(selectSelectorsGroup);
return (
<React.Fragment>
<ConnectionSelector
className={rowClassName}
navigationPath={navigationPath}
changeNavigationPath={changeNavigationPath}
/>
{connectionQueryTypes && connectionQueryTypes.length > 0 && (
<React.Fragment>
<ParameterNameInput
label={i18n('field_parameter-name')}
className={rowClassName}
/>
<QueryTypeControl connectionQueryTypes={connectionQueryTypes} />
</React.Fragment>
)}
{enableGlobalSelectors && (
<TabsScopeSelect
groupTabsScope={tabsScope}
hasMultipleSelectors={group.length > 1}
/>
)}
</React.Fragment>
);
};