Skip to content

Commit d06cd6a

Browse files
committed
fix: query run type select should be styled as action button [YDB-1567]
1 parent 4acd2a3 commit d06cd6a

File tree

2 files changed

+27
-24
lines changed

2 files changed

+27
-24
lines changed

src/containers/Tenant/QueryEditor/QueryEditor.js

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import cn from 'bem-cn-lite';
55
import _ from 'lodash';
66
import MonacoEditor from 'react-monaco-editor';
77
import DataTable from '@yandex-cloud/react-data-table';
8-
import {Button} from '@yandex-cloud/uikit';
9-
import {Select} from '@yandex-cloud/uikit/build/esm/components/unstable/Select';
8+
import {Button, DropdownMenu} from '@yandex-cloud/uikit';
109
import SplitPane from '../../../components/SplitPane';
1110

1211
import SaveQuery from './SaveQuery/SaveQuery';
@@ -553,10 +552,18 @@ function QueryEditor(props) {
553552
};
554553

555554
const renderControls = () => {
556-
const {executeQuery, explainQuery, savedQueries} = props;
555+
const {executeQuery, explainQuery, savedQueries, selectRunAction} = props;
557556
const {runAction} = executeQuery;
558557
const runIsDisabled = !executeQuery.input || executeQuery.loading;
559558
const runText = _.find(RUN_ACTIONS, {value: runAction}).content;
559+
560+
const menuItems = RUN_ACTIONS.map((action) => {
561+
return {
562+
text: action.content,
563+
action: () => selectRunAction(action.value),
564+
};
565+
});
566+
560567
return (
561568
<div className={b('controls')}>
562569
<div className={b('control-run')}>
@@ -570,27 +577,19 @@ function QueryEditor(props) {
570577
<Icon name="startPlay" viewBox="0 0 16 16" width={16} height={16} />
571578
{runText}
572579
</Button>
573-
<Select
574-
view="action"
575-
options={RUN_ACTIONS}
576-
value={undefined}
577-
disabled={runIsDisabled}
578-
pin="brick-round"
579-
// renderSwitcher={() => (
580-
// <div className={b('run-switcher')}>
581-
// <Button
582-
// view="action"
583-
// pin="brick-round"
584-
// disabled={runIsDisabled}
585-
// loading={executeQuery.loading}
586-
// >
587-
// <Icon name="chevron-down" width={16} height={16} />
588-
// </Button>
589-
// </div>
590-
// )}
591-
onUpdate={(value) => {
592-
props.selectRunAction(value[0]);
593-
}}
580+
<DropdownMenu
581+
items={menuItems}
582+
switcher={
583+
<Button
584+
view="action"
585+
pin="brick-round"
586+
disabled={runIsDisabled}
587+
loading={executeQuery.loading}
588+
className={b('select-query-action')}
589+
>
590+
<Icon name="chevron-down" width={16} height={16} />
591+
</Button>
592+
}
594593
/>
595594
</div>
596595
<Button

src/containers/Tenant/QueryEditor/QueryEditor.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,8 @@
9797
&__cell {
9898
@include cell-container;
9999
}
100+
101+
&__select-query-action {
102+
margin-left: 2px;
103+
}
100104
}

0 commit comments

Comments
 (0)