Skip to content

Commit b218fe0

Browse files
committed
[SearchProfiler] SearchProfiler to NP (#48795)
* Added the following components: - highlight details (with render test) - searchprofiler tabs - (wip) profile tree - (wip) shard details * First iteration of ProfileTree component (needs render test) * Remove space * ProfileTree render test * Add profile tree test to git index * First iteration of editor component with render test * First iteration of nearly functional public * Fix highlight_details_flyout render test * Move NP directory to public and fix import issue created by directly importing FormattedMessage * Rendering and looking more normal * Fix type issues and fix a11y for ace editor * Added ability to do profile requests again and render into UI (styling WiP) * Fix props in editor test * Added empty tree placeholder component (with test), moved styling around into individual files (wip) * Fix path * Lots of style updates and added util for determining visible children (+test) * Re-add missing badge and make it slightly wider (otherwise 100.00% cuts off to 100.0...) * Delete legacy public! * SCSS refactor + fix for re-rendering editor * UI and server updates after license checks * [skip ci] Add server np_ready code * fix i18n * Re-enable error annotations * Minor UX improvements (focus editor after failed request and no tabindex for textarea without active license) Added some spaces to make code more readable * Removed xpackMain from ServerShim Updated use of notifications -> notifications.toasts from np core setup Removed TODO for using core.application.register (not available for legacy apps) * Added placeholder component for loading state and implemented useReducer * Refactor actions * Changes after PR feedback: - TS for unsafe utils test fixtures - Safer use of .selfTime (no more NaN) - Sentence case where applicable - Cleaned up TODOs - Fix styling issue with percentage on badges of profile tree - Refactor name of profile hook (now useRequestProfile) - Fixed copy paste issue in highlight flyout `Total time` -> `Self time` - Restyled the profile button to be fill and not take up the full horizontal space - Removed the `Type` input from the profiler query section * Removed .type from backend and cleanup translations * Disable responsive UI layout for now * Remove buggy error annotation code * - Refactored percentage badge to own component - Updated styles after testing on IE11 - Updated styles after testing on Safari - Chrome and FF worked on this commit * Update missing i18n and fix use ace ui keyboard hook * Update useEffect dependencies array for editor component * Use absolute path to dev tools app (to fix CI) * Remove file extensions * Re-add missing data-test-subj
1 parent 4dc3e7c commit b218fe0

File tree

106 files changed

+3685
-2057
lines changed

Some content is hidden

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

106 files changed

+3685
-2057
lines changed

x-pack/legacy/plugins/searchprofiler/index.js

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { resolve } from 'path';
8+
import Boom from 'boom';
9+
10+
import { CoreSetup } from 'src/core/server';
11+
import { Server } from 'src/legacy/server/kbn_server';
12+
import { LegacySetup } from './server/np_ready/types';
13+
import { plugin } from './server/np_ready';
14+
15+
export const searchprofiler = (kibana: any) => {
16+
const publicSrc = resolve(__dirname, 'public');
17+
18+
return new kibana.Plugin({
19+
require: ['elasticsearch', 'xpack_main'],
20+
id: 'searchprofiler',
21+
configPrefix: 'xpack.searchprofiler',
22+
publicDir: publicSrc,
23+
24+
uiExports: {
25+
// NP Ready
26+
devTools: [`${publicSrc}/legacy`],
27+
styleSheetPaths: `${publicSrc}/np_ready/application/index.scss`,
28+
// Legacy
29+
hacks: ['plugins/searchprofiler/register'],
30+
home: ['plugins/searchprofiler/register_feature'],
31+
},
32+
init(server: Server) {
33+
const serverPlugin = plugin();
34+
const thisPlugin = this;
35+
36+
const commonRouteConfig = {
37+
pre: [
38+
function forbidApiAccess() {
39+
const licenseCheckResults = server.plugins.xpack_main.info
40+
.feature(thisPlugin.id)
41+
.getLicenseCheckResults();
42+
if (licenseCheckResults.showAppLink && licenseCheckResults.enableAppLink) {
43+
return null;
44+
} else {
45+
throw Boom.forbidden(licenseCheckResults.message);
46+
}
47+
},
48+
],
49+
};
50+
51+
const legacySetup: LegacySetup = {
52+
route: (args: Parameters<typeof server.route>[0]) => server.route(args),
53+
plugins: {
54+
__LEGACY: {
55+
thisPlugin,
56+
xpackMain: server.plugins.xpack_main,
57+
elasticsearch: server.plugins.elasticsearch,
58+
commonRouteConfig,
59+
},
60+
},
61+
};
62+
serverPlugin.setup({} as CoreSetup, legacySetup);
63+
},
64+
});
65+
};

x-pack/legacy/plugins/searchprofiler/public/app.js

Lines changed: 0 additions & 193 deletions
This file was deleted.

x-pack/legacy/plugins/searchprofiler/public/components/searchprofiler_tabs.js

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)