Skip to content

Commit

Permalink
[Console] Move split_panel component to Console (#121283)
Browse files Browse the repository at this point in the history
* Move split_panel component to Console

Co-authored-by: Muhammad Ibragimov <muhammad.ibragimov@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 24, 2021
1 parent 5802c6e commit 54cc284
Show file tree
Hide file tree
Showing 15 changed files with 25 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { debounce } from 'lodash';
import { EuiProgress } from '@elastic/eui';

import { EditorContentSpinner } from '../../components';
import { Panel, PanelsContainer } from '../../../../../kibana_react/public';
import { Panel, PanelsContainer } from '../../containers';
import { Editor as EditorUI, EditorOutput } from './legacy/console_editor';
import { StorageKeys } from '../../../services';
import { useEditorReadContext, useServicesContext, useRequestReadContext } from '../../contexts';
Expand Down
1 change: 1 addition & 0 deletions src/plugins/console/public/application/containers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*/

export { Main } from './main';
export { Panel, PanelsContainer } from './split_panel';
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
* Side Public License, v 1.
*/

export { Panel } from './containers/panel';
export { PanelsContainer } from './containers/panel_container';
export { Panel } from './panel';
export { PanelsContainer } from './panel_container';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import React, { CSSProperties, ReactNode, useEffect, useRef, useState } from 'react';
import { usePanelContext } from '../context';
import { usePanelContext } from '../../contexts';

export interface Props {
children: ReactNode[] | ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
import React, { Children, ReactNode, useRef, useState, useCallback, useEffect } from 'react';

import { keys } from '@elastic/eui';
import { PanelContextProvider } from '../context';
import { Resizer, ResizerMouseEvent, ResizerKeyDownEvent } from '../components/resizer';
import { PanelRegistry } from '../registry';
import { Resizer, ResizerMouseEvent, ResizerKeyDownEvent } from './resizer';
import { PanelContextProvider, PanelRegistry } from '../../contexts';

export interface Props {
children: ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function Resizer(props: Props) {
<button
{...props}
data-test-subj="splitPanelResizer"
aria-label={i18n.translate('kibana-react.splitPanel.adjustPanelSizeAriaLabel', {
aria-label={i18n.translate('console.splitPanel.adjustPanelSizeAriaLabel', {
defaultMessage: 'Press left/right to adjust panels size',
})}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import { mount } from 'enzyme';
import toJson from 'enzyme-to-json';
import { spy } from 'sinon';

import { PanelsContainer, Panel } from './index';
import { Panel } from './panel';
import { PanelsContainer } from './panel_container';

const testComponentA = <p style={{ width: '50px' }}>A</p>;
const testComponentB = <p style={{ width: '50px' }}>B</p>;
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/console/public/application/contexts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ export {
useEditorReadContext,
EditorContextProvider,
} from './editor_context';

export { usePanelContext, PanelContextProvider, PanelRegistry } from './split_panel';
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

export { usePanelContext, PanelContextProvider } from './split_panel_context';
export { PanelRegistry } from './split_panel_registry';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import React, { createContext, useContext } from 'react';
import { PanelRegistry } from './registry';
import { PanelRegistry } from './split_panel_registry';

const PanelContext = createContext({ registry: new PanelRegistry() });

Expand Down
1 change: 0 additions & 1 deletion src/plugins/kibana_react/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export * from './overlays';
export * from './ui_settings';
export * from './table_list_view';
export * from './toolbar_button';
export * from './split_panel';
export * from './react_router_navigate';
export * from './page_template';
export type { Value } from './validated_range';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@
"console.settingsPage.templatesLabelText": "テンプレート",
"console.settingsPage.tripleQuotesMessage": "出力ウィンドウでは三重引用符を使用してください",
"console.settingsPage.wrapLongLinesLabelText": "長い行を改行",
"console.splitPanel.adjustPanelSizeAriaLabel": "左右のキーを押してパネルサイズを調整します",
"console.topNav.helpTabDescription": "ヘルプ",
"console.topNav.helpTabLabel": "ヘルプ",
"console.topNav.historyTabDescription": "履歴",
Expand Down Expand Up @@ -3459,7 +3460,6 @@
"kibana-react.solutionNav.collapsibleLabel": "サイドナビゲーションを折りたたむ",
"kibana-react.solutionNav.mobileTitleText": "{solutionName}メニュー",
"kibana-react.solutionNav.openLabel": "サイドナビゲーションを開く",
"kibana-react.splitPanel.adjustPanelSizeAriaLabel": "左右のキーを押してパネルサイズを調整します",
"kibana-react.tableListView.listing.createNewItemButtonLabel": "Create {entityName}",
"kibana-react.tableListView.listing.deleteButtonMessage": "{itemCount} 件の {entityName} を削除",
"kibana-react.tableListView.listing.deleteConfirmModalDescription": "削除された {entityNamePlural} は復元できません。",
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
"console.settingsPage.templatesLabelText": "模板",
"console.settingsPage.tripleQuotesMessage": "在输出窗格中使用三重引号",
"console.settingsPage.wrapLongLinesLabelText": "长行换行",
"console.splitPanel.adjustPanelSizeAriaLabel": "按左/右箭头键调整面板大小",
"console.topNav.helpTabDescription": "帮助",
"console.topNav.helpTabLabel": "帮助",
"console.topNav.historyTabDescription": "历史记录",
Expand Down Expand Up @@ -3484,7 +3485,6 @@
"kibana-react.solutionNav.collapsibleLabel": "折叠侧边导航",
"kibana-react.solutionNav.mobileTitleText": "{solutionName} 菜单",
"kibana-react.solutionNav.openLabel": "打开侧边导航",
"kibana-react.splitPanel.adjustPanelSizeAriaLabel": "按左/右箭头键调整面板大小",
"kibana-react.tableListView.listing.createNewItemButtonLabel": "创建 {entityName}",
"kibana-react.tableListView.listing.deleteButtonMessage": "删除 {itemCount} 个 {entityName}",
"kibana-react.tableListView.listing.deleteConfirmModalDescription": "无法恢复删除的 {entityNamePlural}。",
Expand Down

0 comments on commit 54cc284

Please sign in to comment.