Skip to content

Commit

Permalink
Merge pull request Graylog2#4597 from Graylog2/enterprise-integration…
Browse files Browse the repository at this point in the history
…-issue-10

Merge Enterprise Integration plugin into Graylog core
  • Loading branch information
edmundoa authored Feb 21, 2018
2 parents eed4df3 + d4c7849 commit a3da591
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.enterprise-plugins {
margin-left: 0;
padding-left: 0;
}
49 changes: 49 additions & 0 deletions graylog2-web-interface/src/components/enterprise/PluginList.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import { Row, Col } from 'react-bootstrap';

import { PluginStore } from 'graylog-web-plugin/plugin';

const PluginList = React.createClass({
componentDidMount() {
this.style.use();
},

componentWillUnmount() {
this.style.unuse();
},

style: require('!style/useable!css!./PluginList.css'),

ENTERPRISE_PLUGINS: {
ArchivePlugin: 'Archive plugin',
LicensePlugin: 'License plugin',
'graylog-plugin-auditlog': 'Audit log plugin',
},

_formatPlugin(pluginName) {
const plugin = PluginStore.get().filter(p => p.metadata.name === pluginName)[0];
return (
<li key={pluginName} className={plugin ? 'text-success' : 'text-danger'}>
<i className={`fa fa-${plugin ? 'check-circle' : 'minus-circle'}`}/>&nbsp;
{this.ENTERPRISE_PLUGINS[pluginName]} is {plugin ? 'installed' : 'not installed'}
</li>
);
},

render() {
const enterprisePluginList = Object.keys(this.ENTERPRISE_PLUGINS).map(pluginName => this._formatPlugin(pluginName));

return (
<Row className="content">
<Col md={12}>
<p>This is the status of Graylog Enterprise modules in this cluster:</p>
<ul className="enterprise-plugins">
{enterprisePluginList}
</ul>
</Col>
</Row>
);
},
});

export default PluginList;
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ const Navigation = React.createClass({
if (this._isActive('/system/pipelines')) {
return `${prefix} / Pipelines`;
}
if (this._isActive('/system/enterprise')) {
return `${prefix} / Enterprise`;
}

const pluginRoute = PluginStore.exports('systemnavigation').filter(route => this._isActive(route.path))[0];
if (pluginRoute) {
Expand Down Expand Up @@ -241,6 +244,9 @@ const Navigation = React.createClass({
<MenuItem>Pipelines</MenuItem>
</LinkContainer>
}
<LinkContainer to={Routes.SYSTEM.ENTERPRISE}>
<MenuItem>Enterprise</MenuItem>
</LinkContainer>
{pluginSystemNavigations}
</NavDropdown>
</Nav>
Expand Down
49 changes: 49 additions & 0 deletions graylog2-web-interface/src/pages/EnterprisePage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react';
import Reflux from 'reflux';

import { DocumentTitle, PageHeader } from 'components/common';
import { GraylogClusterOverview } from 'components/cluster';
import PluginList from 'components/enterprise/PluginList';

import StoreProvider from 'injection/StoreProvider';
const NodesStore = StoreProvider.getStore('Nodes');

const EnterprisePage = React.createClass({
mixins: [Reflux.connect(NodesStore)],

_isLoading() {
return !this.state.nodes;
},

render() {
let orderLink = 'https://www.graylog.org/enterprise';

if (this.state.clusterId) {
orderLink = `https://www.graylog.org/enterprise?cid=${this.state.clusterId}&nodes=${this.state.nodeCount}`;
}

return (
<DocumentTitle title="Graylog Enterprise">
<div>
<PageHeader title="Graylog Enterprise">
{null}

<span>
Graylog Enterprise adds commercial functionality to the Open Source Graylog core. You can learn more
about Graylog Enterprise and order a license on the <a href={orderLink} target="_blank">product page</a>.
</span>

<span>
<a className="btn btn-lg btn-success" href={orderLink} target="_blank">Order a license</a>
</span>
</PageHeader>

<GraylogClusterOverview />
<PluginList/>
</div>
</DocumentTitle>
);
},
});

export default EnterprisePage;
2 changes: 2 additions & 0 deletions graylog2-web-interface/src/routing/AppRouter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import PipelineDetailsPage from 'pages/PipelineDetailsPage';
import SimulatorPage from 'pages/SimulatorPage';
import RulesPage from 'pages/RulesPage';
import RuleDetailsPage from 'pages/RuleDetailsPage';
import EnterprisePage from 'pages/EnterprisePage';

const AppRouter = React.createClass({
render() {
Expand Down Expand Up @@ -155,6 +156,7 @@ const AppRouter = React.createClass({
</Route>
<Route path={Routes.SYSTEM.OVERVIEW} component={SystemOverviewPage} />
<Route path={Routes.SYSTEM.THREADDUMP(':nodeId')} component={ThreadDumpPage} />
<Route path={Routes.SYSTEM.ENTERPRISE} component={EnterprisePage} />
{pluginRoutes}
</Route>
</Route>
Expand Down
3 changes: 2 additions & 1 deletion graylog2-web-interface/src/routing/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ const Routes = {
RULES: '/system/pipelines/rules',
RULE: ruleId => `/system/pipelines/rules/${ruleId}`,
SIMULATOR: '/system/pipelines/simulate',
}
},
ENTERPRISE: '/system/enterprise',
},
search_with_query: (query, rangeType, timeRange) => {
const route = new URI(Routes.SEARCH);
Expand Down

0 comments on commit a3da591

Please sign in to comment.