Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/shared/constants/dash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,3 @@ export const DASH_DATA_REQUIRED_FIELDS: Array<keyof DashData> = [
'tabs',
'settings',
];

export const TABS_SCOPE_ALL = 'all' as const;
10 changes: 6 additions & 4 deletions src/shared/types/dash.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type {ItemDropProps} from '@gravity-ui/dashkit';

import type {TABS_SCOPE_ALL} from '../constants/dash';
import type {Operations} from '../modules';

export type TabsScope = typeof TABS_SCOPE_ALL | string | string[] | undefined;
export type ImpactType = 'allTabs' | 'currentTab' | 'selectedTabs' | undefined;
export type ImpactTabsIds = string[] | null | undefined;

import type {
ClientChartsConfig,
Expand Down Expand Up @@ -236,7 +236,8 @@ export interface DashTabItemControlData {
width?: string;
defaults?: StringParams;
namespace: string;
tabsScope?: TabsScope;
impactType?: ImpactType;
impactTabsIds?: ImpactTabsIds;
}

export type DashTabItemControlSingle = DashTabItemControlDataset | DashTabItemControlManual;
Expand Down Expand Up @@ -344,7 +345,8 @@ export interface DashTabItemGroupControlData {
autoHeight: boolean;
buttonApply: boolean;
buttonReset: boolean;
tabsScope?: TabsScope;
impactType?: ImpactType;
impactTabsIds?: ImpactTabsIds;

updateControlsOnChange?: boolean;

Expand Down
6 changes: 4 additions & 2 deletions src/shared/zod-schemas/dash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ const controlSchema = z
namespace: z.literal(DASH_DEFAULT_NAMESPACE),
title: z.string().min(1),
sourceType: z.enum(DashTabItemControlSourceType),
tabsScope: z.union([z.string(), z.array(z.string())]).optional(),
impactType: z.enum(['allTabs', 'currentTab', 'selectedTabs']).optional(),
impactTabsIds: z.array(z.string()).optional(),
})
.and(
z.discriminatedUnion('sourceType', [
Expand Down Expand Up @@ -148,7 +149,8 @@ const groupControlItemsSchema = z
defaults: z.record(z.any(), z.any()),
placementMode: z.enum(CONTROLS_PLACEMENT_MODE).optional(),
width: z.string().optional(),
tabsScope: z.union([z.string(), z.array(z.string())]).optional(),
impactType: z.enum(['allTabs', 'currentTab', 'selectedTabs']).optional(),
impactTabsIds: z.array(z.string()).optional(),
})
.and(
z.discriminatedUnion('sourceType', [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {selectSelectorDialog, selectSelectorsGroup} from 'ui/store/selectors/con

import {ConnectionSettings} from './ConnectionSettings/ConnectionSettings';
import {DatasetSelectorSettings} from './DatasetSelectorSettings/DatasetSelectorSettings';
import {ImpactTypeSelect} from './ImpactTypeSelect/ImpactTypeSelect';
import {ParameterNameInput} from './ParameterNameInput/ParameterNameInput';
import {TabsScopeSelect} from './TabsScopeSelect/TabsScopeSelect';

const i18n = I18n.keyset('dash.control-dialog.edit');

Expand All @@ -24,7 +24,7 @@ export const CommonGroupSettingsSection = ({
className?: string;
}) => {
const {sourceType} = useSelector(selectSelectorDialog);
const {group, tabsScope} = useSelector(selectSelectorsGroup);
const {group, impactType, impactTabsIds} = useSelector(selectSelectorsGroup);

const hasMultipleSelectors = group.length > 1;

Expand All @@ -38,8 +38,9 @@ export const CommonGroupSettingsSection = ({
className={className}
/>
{enableGlobalSelectors && (
<TabsScopeSelect
groupTabsScope={tabsScope}
<ImpactTypeSelect
groupImpactType={impactType}
groupImpactTabsIds={impactTabsIds}
hasMultipleSelectors={hasMultipleSelectors}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {I18n} from 'i18n';
import {useSelector} from 'react-redux';
import {selectSelectorDialog, selectSelectorsGroup} from 'ui/store/selectors/controlDialog';

import {ImpactTypeSelect} from '../ImpactTypeSelect/ImpactTypeSelect';
import {ParameterNameInput} from '../ParameterNameInput/ParameterNameInput';
import {TabsScopeSelect} from '../TabsScopeSelect/TabsScopeSelect';

import {ConnectionSelector} from './components/ConnectionSelector/ConnectionSelector';
import {QueryTypeControl} from './components/QueryTypeControl/QueryTypeControl';
Expand All @@ -24,7 +24,7 @@ export const ConnectionSettings = ({
enableGlobalSelectors?: boolean;
}) => {
const {connectionQueryTypes} = useSelector(selectSelectorDialog);
const {tabsScope, group} = useSelector(selectSelectorsGroup);
const {impactType, impactTabsIds, group} = useSelector(selectSelectorsGroup);

return (
<React.Fragment>
Expand All @@ -43,8 +43,9 @@ export const ConnectionSettings = ({
</React.Fragment>
)}
{enableGlobalSelectors && (
<TabsScopeSelect
groupTabsScope={tabsScope}
<ImpactTypeSelect
groupImpactType={impactType}
groupImpactTabsIds={impactTabsIds}
hasMultipleSelectors={group.length > 1}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import type {SelectorElementType, SetSelectorDialogItemArgs} from 'ui/store/typi

import {DatasetField} from '../../Switchers/DatasetField/DatasetField';
import {EntrySelector} from '../EntrySelector/EntrySelector';
import {TabsScopeSelect} from '../TabsScopeSelect/TabsScopeSelect';
import {ImpactTypeSelect} from '../ImpactTypeSelect/ImpactTypeSelect';

const i18n = I18n.keyset('dash.control-dialog.edit');

Expand All @@ -40,7 +40,7 @@ function DatasetSelectorSettings(props: {
const {datasetId, datasetFieldId, isManualTitle, title, fieldType, validation} =
useSelector(selectSelectorDialog);
const {workbookId} = useSelector(selectOpenedItemMeta);
const {tabsScope, group} = useSelector(selectSelectorsGroup);
const {impactType, impactTabsIds, group} = useSelector(selectSelectorsGroup);
const [isInvalid, setIsInvalid] = React.useState(false);

const fetchDataset = React.useCallback((entryId: string) => {
Expand Down Expand Up @@ -179,10 +179,11 @@ function DatasetSelectorSettings(props: {
</FieldWrapper>
</FormRow>
{props.enableGlobalSelectors && (
<TabsScopeSelect
<ImpactTypeSelect
hasMultipleSelectors={group.length > 1}
groupTabsScope={tabsScope}
></TabsScopeSelect>
groupImpactType={impactType}
groupImpactTabsIds={impactTabsIds}
></ImpactTypeSelect>
)}
</React.Fragment>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {selectOpenedItemMeta, selectSelectorDialog} from 'ui/store/selectors/con
import {EntryTypeNode} from 'ui/units/dash/modules/constants';

import {EntrySelector} from '../EntrySelector/EntrySelector';
import {TabsScopeSelect} from '../TabsScopeSelect/TabsScopeSelect';
import {ImpactTypeSelect} from '../ImpactTypeSelect/ImpactTypeSelect';

import './ExternalSelectorSettings.scss';

Expand Down Expand Up @@ -123,7 +123,7 @@ const ExternalSelectorSettings: React.FC<{
changeNavigationPath={props.changeNavigationPath}
/>

{props.enableGlobalSelectors && <TabsScopeSelect />}
{props.enableGlobalSelectors && <ImpactTypeSelect />}

{!props.enableAutoheightDefault && (
<FormRow
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.tabs-scope-select {
.impact-type-select {
&__group-hint,
&__tab-hint {
color: var(--g-color-text-secondary);
Expand Down
Loading
Loading