Skip to content

Commit 46756b0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ML-18090-single-metric-force-partition-field
2 parents cb452e9 + 85e6092 commit 46756b0

98 files changed

Lines changed: 2242 additions & 855 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/kbn-ui-framework/src/components/local_nav/_local_title.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.kuiLocalTitle {
22
display: flex;
33
align-items: center;
4-
height: 100%;
54
padding: ($localNavSideSpacing * 1.5) $localNavSideSpacing;
65
font-size: $kuiFontSize;
76
font-weight: bold;

src/core/public/chrome/ui/header/header.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -410,22 +410,20 @@ class HeaderUI extends Component<Props, State> {
410410
defaultMessage: 'Primary',
411411
})}
412412
>
413-
<>
414-
<EuiNavDrawerGroup
415-
listItems={recentLinksArray}
416-
aria-label={i18n.translate('core.ui.recentLinks.screenReaderLabel', {
417-
defaultMessage: 'Recently viewed links, navigation',
418-
})}
419-
/>
420-
<EuiHorizontalRule margin="none" />
421-
<EuiNavDrawerGroup
422-
data-test-subj="navDrawerAppsMenu"
423-
listItems={navLinksArray}
424-
aria-label={i18n.translate('core.ui.primaryNavList.screenReaderLabel', {
425-
defaultMessage: 'Primary navigation links',
426-
})}
427-
/>
428-
</>
413+
<EuiNavDrawerGroup
414+
listItems={recentLinksArray}
415+
aria-label={i18n.translate('core.ui.recentLinks.screenReaderLabel', {
416+
defaultMessage: 'Recently viewed links, navigation',
417+
})}
418+
/>
419+
<EuiHorizontalRule margin="none" />
420+
<EuiNavDrawerGroup
421+
data-test-subj="navDrawerAppsMenu"
422+
listItems={navLinksArray}
423+
aria-label={i18n.translate('core.ui.primaryNavList.screenReaderLabel', {
424+
defaultMessage: 'Primary navigation links',
425+
})}
426+
/>
429427
</EuiNavDrawer>
430428
</header>
431429
);

src/dev/precommit_hook/casing_check_config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ export const IGNORE_DIRECTORY_GLOBS = [
106106
export const TEMPORARILY_IGNORED_PATHS = [
107107
'src/legacy/core_plugins/console/public/src/directives/helpExample.txt',
108108
'src/legacy/core_plugins/console/public/src/sense_editor/theme-sense-dark.js',
109-
'src/legacy/core_plugins/kibana/public/assets/play-circle.svg',
110109
'src/legacy/core_plugins/tests_bundle/webpackShims/angular-mocks.js',
111110
'src/legacy/core_plugins/tile_map/public/__tests__/scaledCircleMarkers.png',
112111
'src/legacy/core_plugins/tile_map/public/__tests__/shadedCircleMarkers.png',

src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jest.mock('../../../../components/editor_example.tsx', () => {});
3030
jest.mock('../../../../../../../public/quarantined/src/mappings.js', () => ({
3131
retrieveAutoCompleteInfo: () => {},
3232
}));
33-
jest.mock('../../../../../../../public/quarantined/src/input.js', () => {
33+
jest.mock('../../../../../../../public/quarantined/src/input.ts', () => {
3434
return {
35-
initializeInput: () => ({
35+
initializeEditor: () => ({
3636
$el: {
3737
css: () => {},
3838
},

src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_editor/editor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import { registerCommands } from './keyboard_shortcuts';
3333
import { applyCurrentSettings } from './apply_editor_settings';
3434

3535
// @ts-ignore
36-
import { initializeInput } from '../../../../../../../public/quarantined/src/input';
36+
import { initializeEditor } from '../../../../../../../public/quarantined/src/input';
3737
// @ts-ignore
3838
import mappings from '../../../../../../../public/quarantined/src/mappings';
3939

@@ -88,7 +88,7 @@ function _Editor({ previousStateLocation = 'stored' }: EditorProps) {
8888
useEffect(() => {
8989
const $editor = $(editorRef.current!);
9090
const $actions = $(actionsRef.current!);
91-
editorInstanceRef.current = initializeInput($editor, $actions);
91+
editorInstanceRef.current = initializeEditor($editor, $actions);
9292

9393
if (previousStateLocation === 'stored') {
9494
const { content } = history.getSavedEditorState() || {

src/legacy/core_plugins/console/np_ready/public/application/containers/editor/legacy/console_menu_actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function getDocumentation(editor: any, docLinkVersion: string): Promise<s
3535
}
3636
const position = requests[0].range.end;
3737
position.column = position.column - 1;
38-
const endpoint = getEndpointFromPosition(editor, position);
38+
const endpoint = getEndpointFromPosition(editor, position, editor.parser);
3939
if (endpoint && endpoint.documentation && endpoint.documentation.indexOf('http') !== -1) {
4040
const nextDocumentation = endpoint.documentation
4141
.replace('/master/', `/${docLinkVersion}/`)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export * from './token_iterator';
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
import { CoreEditor, Position } from '../../types';
20+
import { TokenIterator } from '../../lib/token_iterator';
21+
22+
interface Dependencies {
23+
position: Position;
24+
editor: CoreEditor;
25+
}
26+
27+
export function createTokenIterator({ editor, position }: Dependencies) {
28+
const provider = editor.getTokenProvider();
29+
return new TokenIterator(provider, position);
30+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
export * from './legacy_editor';
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { Editor as IAceEditor, Range as AceRange } from 'brace';
21+
import { CoreEditor, Position, Range, Token, TokensProvider } from '../../types';
22+
import { AceTokensProvider } from '../../lib/ace_token_provider';
23+
24+
export class LegacyEditor implements CoreEditor {
25+
constructor(private readonly editor: IAceEditor) {}
26+
27+
getLineState(lineNumber: number) {
28+
const session = this.editor.getSession();
29+
return session.getState(lineNumber - 1);
30+
}
31+
32+
getValueInRange({ start, end }: Range): string {
33+
const session = this.editor.getSession();
34+
const aceRange = new AceRange(
35+
start.lineNumber - 1,
36+
start.column - 1,
37+
end.lineNumber - 1,
38+
end.column - 1
39+
);
40+
return session.doc.getTextRange(aceRange);
41+
}
42+
43+
getTokenProvider(): TokensProvider {
44+
return new AceTokensProvider(this.editor.getSession());
45+
}
46+
47+
getValue(): string {
48+
return this.editor.getValue();
49+
}
50+
51+
getLineValue(lineNumber: number): string {
52+
const session = this.editor.getSession();
53+
return session.getLine(lineNumber - 1);
54+
}
55+
56+
getCurrentPosition(): Position {
57+
const cursorPosition = this.editor.getCursorPosition();
58+
return {
59+
lineNumber: cursorPosition.row + 1,
60+
column: cursorPosition.column + 1,
61+
};
62+
}
63+
64+
clearSelection(): void {
65+
this.editor.clearSelection();
66+
}
67+
68+
getTokenAt(pos: Position): Token | null {
69+
const provider = this.getTokenProvider();
70+
return provider.getTokenAt(pos);
71+
}
72+
73+
insert(valueOrPos: string | Position, value?: string): void {
74+
if (typeof valueOrPos === 'string') {
75+
this.editor.insert(valueOrPos);
76+
return;
77+
}
78+
const document = this.editor.getSession().getDocument();
79+
document.insert(
80+
{
81+
column: valueOrPos.column - 1,
82+
row: valueOrPos.lineNumber - 1,
83+
},
84+
value || ''
85+
);
86+
}
87+
88+
moveCursorToPosition(pos: Position): void {
89+
this.editor.moveCursorToPosition({ row: pos.lineNumber - 1, column: pos.column - 1 });
90+
}
91+
92+
replace({ start, end }: Range, value: string): void {
93+
const aceRange = new AceRange(
94+
start.lineNumber - 1,
95+
start.column - 1,
96+
end.lineNumber - 1,
97+
end.column - 1
98+
);
99+
const session = this.editor.getSession();
100+
session.replace(aceRange, value);
101+
}
102+
103+
getLines(startLine: number, endLine: number): string[] {
104+
const session = this.editor.getSession();
105+
return session.getLines(startLine - 1, endLine - 1);
106+
}
107+
}

0 commit comments

Comments
 (0)