Skip to content

Commit

Permalink
[Upgrade Assistant] Move out of legacy folder (#58034)
Browse files Browse the repository at this point in the history
* Create x-pack/plugins skeleton for upgrade assistant

* Move public folder contents

Move the public folder of Upgrade Assistant and migrate public to use HttpSetup (remove axios)

* Include stylesheets in public

* Move server side out of legacy

Begin migration of Reindex worker to new platform

Move imports around so that it satsifies new platform constraints like not importing
server side code (even types) in client.

* Updated the routes with new dependencies and removed server shim

* Fix router unit tests

* Fix server lib tests

After changing function signatures for the reindex server factory (and others) all
of the tests needed to be revisited and brought in line with the new APIs.

Also used core/server mocks where appropriate

* Clean up types issues

* Fix setting credentials on request header

* Removed the security plugin from Upgrade Assistant

The security plugin is a potential future consumer of the Upgrade Assistant's deprecation feature
and we would therefore not want to create a circular depedency here. We pull in the licensing plugin
rather (as it is less likely that we will depend on that) and use it to determine whether security
is available and enabled.

* Migrate to config to new platform config

xpack.upgrade_assistant.enabled

* Remove unused types

* Fix import issue

* Move upgrade assistant back to Elasticsearch management section

* Update dotfiles

Added elasticsearch ui team as upgrade assistant code owner
Updated i18nrc.json path

* Alphabetical ordering in xpack/i18nrc.json

* Implemented PR feedback

Renamed callCluster -> callAsUser to be more consistent
with platform naming.

Added comment about why we are not using security plugin
directly inside of Upgrade Assistant.

Fixed long path imports and use 'src/core/..' throughout.

Fixed import ordering.

Renamed variables inside of telemetry lib.

* Revert to longer import path

In plugin.ts importing from 'kibana/server' or 'src/core/server'
results in a module not found error.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
jloleysens and elasticmachine authored Feb 25, 2020
1 parent d339740 commit 899270a
Show file tree
Hide file tree
Showing 129 changed files with 1,234 additions and 1,343 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@
/x-pack/legacy/plugins/rollup/ @elastic/es-ui
/x-pack/plugins/searchprofiler/ @elastic/es-ui
/x-pack/legacy/plugins/snapshot_restore/ @elastic/es-ui
/x-pack/legacy/plugins/upgrade_assistant/ @elastic/es-ui
/x-pack/plugins/upgrade_assistant/ @elastic/es-ui
/x-pack/plugins/watcher/ @elastic/es-ui

# Endpoint
Expand Down
2 changes: 1 addition & 1 deletion x-pack/.i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"xpack.taskManager": "legacy/plugins/task_manager",
"xpack.transform": "legacy/plugins/transform",
"xpack.triggersActionsUI": "plugins/triggers_actions_ui",
"xpack.upgradeAssistant": "legacy/plugins/upgrade_assistant",
"xpack.upgradeAssistant": "plugins/upgrade_assistant",
"xpack.uptime": "legacy/plugins/uptime",
"xpack.watcher": "plugins/watcher"
},
Expand Down
44 changes: 1 addition & 43 deletions x-pack/legacy/plugins/upgrade_assistant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,14 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import _ from 'lodash';
import Joi from 'joi';
import { Legacy } from 'kibana';
import { resolve } from 'path';
import mappings from './mappings.json';
import { plugin } from './server/np_ready';
import { CloudSetup } from '../../../plugins/cloud/server';

export function upgradeAssistant(kibana: any) {
const publicSrc = resolve(__dirname, 'public');
const npSrc = resolve(publicSrc, 'np_ready');

const config: Legacy.PluginSpecOptions = {
id: 'upgrade_assistant',
configPrefix: 'xpack.upgrade_assistant',
require: ['elasticsearch'],
uiExports: {
// @ts-ignore
managementSections: ['plugins/upgrade_assistant'],
savedObjectSchemas: {
'upgrade-assistant-reindex-operation': {
isNamespaceAgnostic: true,
Expand All @@ -30,41 +19,10 @@ export function upgradeAssistant(kibana: any) {
isNamespaceAgnostic: true,
},
},
styleSheetPaths: resolve(npSrc, 'application/index.scss'),
mappings,
},
publicDir: publicSrc,

config() {
return Joi.object({
enabled: Joi.boolean().default(true),
}).default();
},

init(server: Legacy.Server) {
// Add server routes and initialize the plugin here
const instance = plugin({} as any);

const { usageCollection, cloud } = server.newPlatform.setup.plugins;
instance.setup(server.newPlatform.setup.core, {
usageCollection,
cloud: cloud as CloudSetup,
__LEGACY: {
// Legacy objects
events: server.events,
savedObjects: server.savedObjects,

// Legacy functions
log: server.log.bind(server),

// Legacy plugins
plugins: {
elasticsearch: server.plugins.elasticsearch,
xpack_main: server.plugins.xpack_main,
},
},
});
},
init() {},
};
return new kibana.Plugin(config);
}
7 changes: 0 additions & 7 deletions x-pack/legacy/plugins/upgrade_assistant/public/index.ts

This file was deleted.

106 changes: 0 additions & 106 deletions x-pack/legacy/plugins/upgrade_assistant/public/legacy.ts

This file was deleted.

This file was deleted.

This file was deleted.

24 changes: 0 additions & 24 deletions x-pack/legacy/plugins/upgrade_assistant/public/np_ready/plugin.ts

This file was deleted.

7 changes: 0 additions & 7 deletions x-pack/legacy/plugins/upgrade_assistant/server/index.ts

This file was deleted.

This file was deleted.

Loading

0 comments on commit 899270a

Please sign in to comment.