5
5
/* // eslint-disable no-console */
6
6
/* eslint-disable react-hooks/exhaustive-deps */
7
7
8
- import { useCallback } from 'react' ;
9
8
import {
10
9
EuiBreadcrumb ,
11
10
EuiButton ,
@@ -27,60 +26,34 @@ import {
27
26
OnTimeChangeProps ,
28
27
ShortDate ,
29
28
} from '@elastic/eui' ;
30
- import { last } from 'lodash' ;
31
- import React , { useEffect , useState } from 'react' ;
32
29
import { DurationRange } from '@elastic/eui/src/components/date_picker/types' ;
30
+ import { last } from 'lodash' ;
33
31
import moment from 'moment' ;
34
- import _ from 'lodash ' ;
32
+ import React , { useCallback , useEffect , useState } from 'react ' ;
35
33
import { useDispatch , useSelector } from 'react-redux' ;
36
- import { useRef } from 'react ' ;
37
- import DSLService from '../../services/requests/dsl ' ;
38
- import { CoreStart , SimpleSavedObject } from '../../../../../src/core/public ' ;
39
- import { EmptyPanelView } from './panel_modules/empty_panel ' ;
40
- import {
41
- CREATE_PANEL_MESSAGE ,
42
- CUSTOM_PANELS_API_PREFIX ,
43
- CUSTOM_PANELS_SAVED_OBJECT_TYPE ,
44
- } from '../../../ common/constants/custom_panels ' ;
45
- import { CustomPanelType , PanelType } from '../../../ common/types/custom_panels ' ;
46
- import { PanelGridSO } from './panel_modules/panel_grid/panel_grid_so ' ;
47
-
34
+ import { CoreStart } from '../../../../../src/core/public ' ;
35
+ import { CREATE_PANEL_MESSAGE } from '../../../common/constants/custom_panels ' ;
36
+ import { UI_DATE_FORMAT } from '../../../common/constants/shared ' ;
37
+ import { CustomPanelType } from '../../../common/types/custom_panels ' ;
38
+ import { uiSettingsService } from '../../../common/utils' ;
39
+ import { coreRefs } from '../../framework/core_refs' ;
40
+ import { PPLReferenceFlyout } from '../common/helpers' ;
41
+ import { DeleteModal } from '../common/helpers/delete_modal' ;
42
+ import { Autocomplete } from '../common/search/autocomplete ' ;
43
+ import { onItemSelect , parseGetSuggestions } from '../common/search/autocomplete_logic ' ;
44
+ import { addVisualizationPanel } from './helpers/add_visualization_helper ' ;
45
+ import { AddVisualizationPopover } from './helpers/add_visualization_popover' ;
48
46
import { getCustomModal } from './helpers/modal_containers' ;
49
- import PPLService from '../../services/requests/ppl' ;
50
47
import {
51
- isDateValid ,
52
48
convertDateTime ,
49
+ isDateValid ,
53
50
isPPLFilterValid ,
54
- isNameValid ,
55
51
prependRecentlyUsedRange ,
56
52
} from './helpers/utils' ;
57
- import { UI_DATE_FORMAT } from '../../../common/constants/shared' ;
58
- import { VisaulizationFlyout } from './panel_modules/visualization_flyout' ;
59
- import { uiSettingsService } from '../../../common/utils' ;
60
- import { PPLReferenceFlyout } from '../common/helpers' ;
61
- import { Autocomplete } from '../common/search/autocomplete' ;
62
- import {
63
- parseGetSuggestions ,
64
- onItemSelect ,
65
- parseForIndices ,
66
- } from '../common/search/autocomplete_logic' ;
67
- import { AddVisualizationPopover } from './helpers/add_visualization_popover' ;
68
- import { DeleteModal } from '../common/helpers/delete_modal' ;
53
+ import { EmptyPanelView } from './panel_modules/empty_panel' ;
54
+ import { PanelGridSO } from './panel_modules/panel_grid/panel_grid_so' ;
69
55
import { VisaulizationFlyoutSO } from './panel_modules/visualization_flyout/visualization_flyout_so' ;
70
- import { addVisualizationPanel } from './helpers/add_visualization_helper' ;
71
- import {
72
- clonePanel ,
73
- createPanel ,
74
- fetchPanel ,
75
- newPanelTemplate ,
76
- selectPanel ,
77
- setPanel ,
78
- setPanelEt ,
79
- setPanelId ,
80
- setPanelSt ,
81
- updatePanel ,
82
- } from './redux/panel_slice' ;
83
- import { coreRefs } from '../../framework/core_refs' ;
56
+ import { clonePanel , fetchPanel , selectPanel , setPanel , updatePanel } from './redux/panel_slice' ;
84
57
85
58
/*
86
59
* "CustomPanelsView" module used to render an Observability Dashboard
@@ -377,6 +350,7 @@ export const CustomPanelViewSO = (props: CustomPanelViewProps) => {
377
350
} ;
378
351
379
352
const cloneVisualization = ( visualzationTitle : string , savedVisualizationId : string ) => {
353
+ addVisualizationToCurrentPanel ( { savedVisualizationId } ) ;
380
354
// http
381
355
// .post(`${CUSTOM_PANELS_API_PREFIX}/visualizations`, {
382
356
// body: JSON.stringify({
@@ -550,7 +524,9 @@ export const CustomPanelViewSO = (props: CustomPanelViewProps) => {
550
524
// Toggle input type (disabled or not disabled)
551
525
// Disabled when there no visualizations in panels or when the panel is in edit mode
552
526
useEffect ( ( ) => {
553
- ! loading && checkDisabledInputs ( ) ;
527
+ if ( ! loading ) {
528
+ checkDisabledInputs ( ) ;
529
+ }
554
530
} , [ isEditing , loading ] ) ;
555
531
556
532
// Build base query with all of the indices included in the current visualizations
0 commit comments