-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathCommonSettingsSection.tsx
More file actions
63 lines (58 loc) · 2.18 KB
/
CommonSettingsSection.tsx
File metadata and controls
63 lines (58 loc) · 2.18 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
54
55
56
57
58
59
60
61
62
63
import React from 'react';
import {I18n} from 'i18n';
import {useSelector} from 'react-redux';
import {DashTabItemControlSourceType} from 'shared';
import {selectSelectorDialog} from 'ui/store/selectors/controlDialog';
import {ConnectionSettings} from './ConnectionSettings/ConnectionSettings';
import {DatasetSelector} from './DatasetSelector/DatasetSelector';
import {ExternalSelectorSettings} from './ExternalSelectorSettings/ExternalSelectorSettings';
import {ParameterNameInput} from './ParameterNameInput/ParameterNameInput';
const i18n = I18n.keyset('dash.control-dialog.edit');
export const CommonSettingsSection = ({
navigationPath,
changeNavigationPath,
enableAutoheightDefault,
className,
}: {
navigationPath: string | null;
changeNavigationPath: (newNavigationPath: string) => void;
enableAutoheightDefault?: boolean;
className?: string;
}) => {
const {sourceType} = useSelector(selectSelectorDialog);
switch (sourceType) {
case DashTabItemControlSourceType.External:
return (
<ExternalSelectorSettings
rowClassName={className}
changeNavigationPath={changeNavigationPath}
navigationPath={navigationPath}
enableAutoheightDefault={enableAutoheightDefault}
/>
);
case DashTabItemControlSourceType.Manual:
return (
<ParameterNameInput
label={i18n('field_field-name')}
note={i18n('field_field-name-note')}
className={className}
/>
);
case DashTabItemControlSourceType.Connection:
return (
<ConnectionSettings
rowClassName={className}
changeNavigationPath={changeNavigationPath}
navigationPath={navigationPath}
/>
);
default:
return (
<DatasetSelector
rowClassName={className}
navigationPath={navigationPath}
changeNavigationPath={changeNavigationPath}
/>
);
}
};