Skip to content

Commit

Permalink
Add userSetup plugin skeleton.
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Jul 1, 2021
1 parent ba85f45 commit c6073c3
Show file tree
Hide file tree
Showing 12 changed files with 160 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ In general this plugin provides:
|The Usage Collection Service defines a set of APIs for other plugins to report the usage of their features. At the same time, it provides necessary the APIs for other services (i.e.: telemetry, monitoring, ...) to consume that usage data.
|{kib-repo}blob/{branch}/src/plugins/user_setup/README.md[userSetup]
|The plugin provides UI and APIs for the interactive setup mode.
|{kib-repo}blob/{branch}/src/plugins/vis_default_editor/README.md[visDefaultEditor]
|The default editor is used in most primary visualizations, e.x. Area, Data table, Pie, etc.
It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in public/components/sidebar/data_tab.tsx.
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/limits.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ pageLoadAssetSize:
screenshotMode: 17856
visTypePie: 35583
cases: 144442
userSetup: 18532
3 changes: 3 additions & 0 deletions src/plugins/user_setup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# `userSetup` plugin

The plugin provides UI and APIs for the interactive setup mode.
13 changes: 13 additions & 0 deletions src/plugins/user_setup/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/src/plugins/user_setup'],
};
8 changes: 8 additions & 0 deletions src/plugins/user_setup/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "userSetup",
"version": "8.0.0",
"kibanaVersion": "kibana",
"configPath": ["userSetup"],
"server": true,
"ui": true
}
27 changes: 27 additions & 0 deletions src/plugins/user_setup/public/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { EuiPageTemplate, EuiPanel, EuiText } from '@elastic/eui';
import React from 'react';

export const App = () => {
return (
<EuiPageTemplate
restrictWidth={false}
template="empty"
pageHeader={{
iconType: 'logoElastic',
pageTitle: 'Welcome to Elastic',
}}
>
<EuiPanel>
<EuiText>Kibana server is not ready yet.</EuiText>
</EuiPanel>
</EuiPageTemplate>
);
};
11 changes: 11 additions & 0 deletions src/plugins/user_setup/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { UserSetupPlugin } from './plugin';

export const plugin = () => new UserSetupPlugin();
29 changes: 29 additions & 0 deletions src/plugins/user_setup/public/plugin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import ReactDOM from 'react-dom';

import type { CoreSetup, CoreStart, Plugin } from 'src/core/public';
import { App } from './app';

export class UserSetupPlugin implements Plugin {
public setup(core: CoreSetup) {
core.application.register({
id: 'userSetup',
title: 'User Setup',
chromeless: true,
mount: (params) => {
ReactDOM.render(<App />, params.element);
return () => ReactDOM.unmountComponentAtNode(params.element);
},
});
}

public start(core: CoreStart) {}
}
16 changes: 16 additions & 0 deletions src/plugins/user_setup/server/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { TypeOf } from '@kbn/config-schema';
import { schema } from '@kbn/config-schema';

export type ConfigType = TypeOf<typeof ConfigSchema>;

export const ConfigSchema = schema.object({
enabled: schema.boolean({ defaultValue: false }),
});
19 changes: 19 additions & 0 deletions src/plugins/user_setup/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { TypeOf } from '@kbn/config-schema';
import type { PluginConfigDescriptor } from 'src/core/server';

import { ConfigSchema } from './config';
import { UserSetupPlugin } from './plugin';

export const config: PluginConfigDescriptor<TypeOf<typeof ConfigSchema>> = {
schema: ConfigSchema,
};

export const plugin = () => new UserSetupPlugin();
17 changes: 17 additions & 0 deletions src/plugins/user_setup/server/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import type { CoreSetup, CoreStart, Plugin } from 'src/core/server';

export class UserSetupPlugin implements Plugin {
public setup(core: CoreSetup) {}

public start(core: CoreStart) {}

public stop() {}
}
12 changes: 12 additions & 0 deletions src/plugins/user_setup/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"composite": true,
"outDir": "./target/types",
"emitDeclarationOnly": true,
"declaration": true,
"declarationMap": true
},
"include": ["public/**/*", "server/**/*"],
"references": [{ "path": "../../core/tsconfig.json" }]
}

0 comments on commit c6073c3

Please sign in to comment.