Skip to content

Commit

Permalink
Add initials files
Browse files Browse the repository at this point in the history
  • Loading branch information
jsanchez91 committed Nov 25, 2020
1 parent b092309 commit 96635c7
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 2 deletions.
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.{md,asciidoc}]
trim_trailing_whitespace = false
insert_final_newline = false
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ typings/

package-lock.json

target/
build/

yarn.lock
yarn.lock
3 changes: 2 additions & 1 deletion kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"configPath": [
"wazuh"
],
"requiredPlugins": ["navigation"],
"optionalPlugins": [
"security",
"opendistroSecurity"
],
"server": true,
"ui": false
"ui": true
}
20 changes: 20 additions & 0 deletions public/application.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { AppMountParameters, CoreStart } from 'kibana/public';
import { AppPluginStartDependencies } from './types';

export const renderApp = (
{ notifications, http }: CoreStart,
{ navigation }: AppPluginStartDependencies,
{ appBasePath, element }: AppMountParameters
) => {

ReactDOM.render(
<div>
Hello world!
</div>,
element
)

return () => ReactDOM.unmountComponentAtNode(element);
}
12 changes: 12 additions & 0 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React, { useState } from 'react';
import { BrowserRouter as Router } from 'react-router-dom';

import { CoreStart } from 'kibana/public';
import { NavigationPublicPluginStart } from '../../../../src/plugins/navigation/public';

interface TestPluginAppDeps {
basename: string;
notifications: CoreStart['notifications'];
http: CoreStart['http'];
navigation: NavigationPublicPluginStart;
}
11 changes: 11 additions & 0 deletions public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { PluginInitializer, PluginInitializerContext } from 'kibana/server';
import { WazuhSetup, WazuhStart, WazuhSetupDeps, WazuhStartDeps, WazuhPlugin } from './plugin';

export const plugin = (
initializerContext: PluginInitializerContext
) => {
return new WazuhPlugin();
};

// These are your public types & static code
export { WazuhSetup, WazuhStart };
31 changes: 31 additions & 0 deletions public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from 'kibana/public';
import { AppPluginStartDependencies } from './types';

export type WazuhSetupDeps = {}
export type WazuhStartDeps = {}

export type WazuhSetup = {}
export type WazuhStart = {}

export class WazuhPlugin implements Plugin<WazuhSetup, WazuhStart, WazuhSetupDeps, WazuhStartDeps> {

public setup(core: CoreSetup, plugins: WazuhStartDeps): WazuhSetup {
core.application.register({
id: `wazuh`,
title: 'Wazuh',
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in kibana.json
const [coreStart, depsStart] = await core.getStartServices();
// Render the application
return renderApp(coreStart, depsStart as AppPluginStartDependencies, params);
}
})
return {};
}

public start(core: CoreStart, plugins: WazuhStartDeps): WazuhStart {
return {};
}
}
5 changes: 5 additions & 0 deletions public/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';

export interface AppPluginStartDependencies {
navigation: NavigationPublicPluginStart;
}

0 comments on commit 96635c7

Please sign in to comment.