@@ -5,8 +5,7 @@ import cn from 'bem-cn-lite';
5
5
import _ from 'lodash' ;
6
6
import MonacoEditor from 'react-monaco-editor' ;
7
7
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' ;
10
9
import SplitPane from '../../../components/SplitPane' ;
11
10
12
11
import SaveQuery from './SaveQuery/SaveQuery' ;
@@ -553,10 +552,18 @@ function QueryEditor(props) {
553
552
} ;
554
553
555
554
const renderControls = ( ) => {
556
- const { executeQuery, explainQuery, savedQueries} = props ;
555
+ const { executeQuery, explainQuery, savedQueries, selectRunAction } = props ;
557
556
const { runAction} = executeQuery ;
558
557
const runIsDisabled = ! executeQuery . input || executeQuery . loading ;
559
558
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
+
560
567
return (
561
568
< div className = { b ( 'controls' ) } >
562
569
< div className = { b ( 'control-run' ) } >
@@ -570,27 +577,19 @@ function QueryEditor(props) {
570
577
< Icon name = "startPlay" viewBox = "0 0 16 16" width = { 16 } height = { 16 } />
571
578
{ runText }
572
579
</ 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
+ }
594
593
/>
595
594
</ div >
596
595
< Button
0 commit comments