Skip to content

Commit 6afb8f1

Browse files
authored
[Watcher] Move out of legacy (#54752) (#55713)
* Moved out of legacy folder * First iteration of watcher plugin that renders * Move create Timebuckets to plugin root Update route registration and fix license checking for NP * Re-enable Component integration tests * Minor fix for data deserializer in api.ts * Slight logic refactor, more defensive plugin startup * Re-add legacy folder for SCSS pipeline * Remove duplicate style sheet * Fix type issue with TimeBuckets export * Update license management routing logic (issued warning for using basepath on navigating away from license management) Remove commented out code in watcher * More defensive plugin registration * Fix i18n issues and restore registration of feature on home view * Remove watcher license error check copy * Restore license error message in watcher * Fix mock context value Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # .github/CODEOWNERS # x-pack/legacy/plugins/watcher/public/7_x_only.ts # x-pack/plugins/watcher/public/application/boot.tsx
1 parent ce919e3 commit 6afb8f1

File tree

308 files changed

+1504
-810
lines changed

Some content is hidden

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

308 files changed

+1504
-810
lines changed

x-pack/.i18nrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"xpack.transform": "legacy/plugins/transform",
4040
"xpack.upgradeAssistant": "legacy/plugins/upgrade_assistant",
4141
"xpack.uptime": "legacy/plugins/uptime",
42-
"xpack.watcher": "legacy/plugins/watcher"
42+
"xpack.watcher": "plugins/watcher"
4343
},
4444
"translations": [
4545
"plugins/translations/translations/zh-CN.json",

x-pack/dev-tools/jest/create_jest_config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export function createJestConfig({ kibanaDirectory, xPackKibanaDirectory }) {
2121
'uiExports/(.*)': fileMockPath,
2222
'^src/core/(.*)': `${kibanaDirectory}/src/core/$1`,
2323
'^src/legacy/(.*)': `${kibanaDirectory}/src/legacy/$1`,
24-
'^plugins/watcher/np_ready/application/models/(.*)': `${xPackKibanaDirectory}/legacy/plugins/watcher/public/np_ready/application/models/$1`,
2524
'^plugins/([^/.]*)(.*)': `${kibanaDirectory}/src/legacy/core_plugins/$1/public$2`,
2625
'^plugins/xpack_main/(.*);': `${xPackKibanaDirectory}/legacy/plugins/xpack_main/public/$1`,
2726
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': fileMockPath,

x-pack/legacy/plugins/license_management/public/np_ready/application/app.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React, { Component } from 'react';
88
import { FormattedMessage } from '@kbn/i18n/react';
99
import { LicenseDashboard, UploadLicense } from './sections';
1010
import { Switch, Route } from 'react-router-dom';
11-
import { APP_PERMISSION } from '../../../common/constants';
11+
import { APP_PERMISSION, BASE_PATH } from '../../../common/constants';
1212
import { EuiPageBody, EuiEmptyPrompt, EuiText, EuiLoadingSpinner, EuiCallOut } from '@elastic/eui';
1313

1414
export class App extends Component {
@@ -88,10 +88,8 @@ export class App extends Component {
8888
return (
8989
<EuiPageBody>
9090
<Switch>
91-
<Route path={`/upload_license`} component={UploadLicense} />
92-
93-
{/* Match all */}
94-
<Route component={LicenseDashboard} />
91+
<Route path={`${BASE_PATH}upload_license`} component={UploadLicense} />
92+
<Route path={BASE_PATH} component={LicenseDashboard} />
9593
</Switch>
9694
</EuiPageBody>
9795
);

x-pack/legacy/plugins/license_management/public/np_ready/application/boot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const boot = (deps: AppDependencies) => {
6363
render(
6464
<I18nContext>
6565
<Provider store={store}>
66-
<HashRouter basename={BASE_PATH}>
66+
<HashRouter>
6767
<App />
6868
</HashRouter>
6969
</Provider>

x-pack/legacy/plugins/license_management/public/np_ready/application/sections/license_dashboard/license_dashboard.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import React from 'react';
8-
7+
import React, { useEffect } from 'react';
98
import { LicenseStatus } from './license_status';
109
import { RevertToBasic } from './revert_to_basic';
1110
import { StartTrial } from './start_trial';
@@ -14,7 +13,10 @@ import { RequestTrialExtension } from './request_trial_extension';
1413
import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui';
1514

1615
export const LicenseDashboard = ({ setBreadcrumb } = { setBreadcrumb: () => {} }) => {
17-
setBreadcrumb('dashboard');
16+
useEffect(() => {
17+
setBreadcrumb('dashboard');
18+
});
19+
1820
return (
1921
<div>
2022
<LicenseStatus />
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
import { resolve } from 'path';
7+
8+
const pluginDefinition = {
9+
id: 'watcher',
10+
configPrefix: 'xpack.watcher',
11+
publicDir: resolve(__dirname, 'public'),
12+
require: ['kibana'],
13+
uiExports: {
14+
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
15+
},
16+
init(server: any) {},
17+
};
18+
19+
export const watcher = (kibana: any) => new kibana.Plugin(pluginDefinition);

x-pack/legacy/plugins/watcher/plugin_definition.ts

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

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

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

x-pack/legacy/plugins/watcher/public/manage_angular_lifecycle.ts

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

0 commit comments

Comments
 (0)