Skip to content

Commit b8d3510

Browse files
[SearchProfiler] Move out of legacy (#55331)
* Initial move of searchprofiler into new platform directory, lots of things need testing * Whitespace, clean up types and remove unused files * First iteration of end-to-end plugin working - Updated license check to only check for presence of basic license (not search profiler as a feature - Updated the payload: removed types from validation - Also added README in public regarding the location of styles * Added extractProfilerErrorMessage function to interface with new error reporting from profiler endpoint * Fix paths to test_utils * Update I18n for search profiler * Fix react hooks ordering bug with license status updates and fix test (wait for first license object before rendering) * Added index.ts file to common in searchprofiler route Marked types and values as internal Removed unnecessary "async" from function Update import to not use "src" alias Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent d23d8f0 commit b8d3510

File tree

104 files changed

+372
-510
lines changed

Some content is hidden

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

104 files changed

+372
-510
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,6 @@
151151
/x-pack/legacy/plugins/license_management/ @elastic/es-ui
152152
/x-pack/legacy/plugins/remote_clusters/ @elastic/es-ui
153153
/x-pack/legacy/plugins/rollup/ @elastic/es-ui
154-
/x-pack/legacy/plugins/searchprofiler/ @elastic/es-ui
154+
/x-pack/plugins/searchprofiler/ @elastic/es-ui
155155
/x-pack/legacy/plugins/snapshot_restore/ @elastic/es-ui
156156
/x-pack/legacy/plugins/watcher/ @elastic/es-ui

x-pack/.i18nrc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"xpack.ml": "legacy/plugins/ml",
2929
"xpack.monitoring": "legacy/plugins/monitoring",
3030
"xpack.remoteClusters": "legacy/plugins/remote_clusters",
31-
"xpack.reporting": [ "plugins/reporting", "legacy/plugins/reporting" ],
31+
"xpack.reporting": ["plugins/reporting", "legacy/plugins/reporting"],
3232
"xpack.rollupJobs": "legacy/plugins/rollup",
33-
"xpack.searchProfiler": "legacy/plugins/searchprofiler",
33+
"xpack.searchProfiler": "plugins/searchprofiler",
3434
"xpack.security": ["legacy/plugins/security", "plugins/security"],
3535
"xpack.server": "legacy/server",
3636
"xpack.siem": "legacy/plugins/siem",

x-pack/legacy/plugins/searchprofiler/README.md

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

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

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
*/
66

77
import { resolve } from 'path';
8-
import Boom from 'boom';
98

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';
9+
// TODO:
10+
// Until we can process SCSS in new platform, this part of Searchprofiler
11+
// legacy must remain here.
1412

1513
export const searchprofiler = (kibana: any) => {
1614
const publicSrc = resolve(__dirname, 'public');
@@ -22,43 +20,8 @@ export const searchprofiler = (kibana: any) => {
2220
publicDir: publicSrc,
2321

2422
uiExports: {
25-
// NP Ready
26-
devTools: [`${publicSrc}/legacy`],
27-
styleSheetPaths: `${publicSrc}/np_ready/application/index.scss`,
28-
// Legacy
29-
home: ['plugins/searchprofiler/register_feature'],
30-
},
31-
init(server: Server) {
32-
const serverPlugin = plugin();
33-
const thisPlugin = this;
34-
35-
const commonRouteConfig = {
36-
pre: [
37-
function forbidApiAccess() {
38-
const licenseCheckResults = server.plugins.xpack_main.info
39-
.feature(thisPlugin.id)
40-
.getLicenseCheckResults();
41-
if (licenseCheckResults.showAppLink && licenseCheckResults.enableAppLink) {
42-
return null;
43-
} else {
44-
throw Boom.forbidden(licenseCheckResults.message);
45-
}
46-
},
47-
],
48-
};
49-
50-
const legacySetup: LegacySetup = {
51-
route: (args: Parameters<typeof server.route>[0]) => server.route(args),
52-
plugins: {
53-
__LEGACY: {
54-
thisPlugin,
55-
xpackMain: server.plugins.xpack_main,
56-
elasticsearch: server.plugins.elasticsearch,
57-
commonRouteConfig,
58-
},
59-
},
60-
};
61-
serverPlugin.setup({} as CoreSetup, legacySetup);
23+
styleSheetPaths: `${publicSrc}/index.scss`,
6224
},
25+
init() {},
6326
});
6427
};

x-pack/legacy/plugins/searchprofiler/public/legacy.ts

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

x-pack/legacy/plugins/searchprofiler/public/np_ready/plugin.ts

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

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

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

0 commit comments

Comments
 (0)