Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remove discover] Implement embeddable dashboard on server management cluster module #6561

Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions plugins/main/public/components/index.js
Expand Up @@ -15,8 +15,6 @@ import { WzVisualize } from './visualize/wz-visualize';
import { WzMenuWrapper } from '../components/wz-menu/wz-menu-wrapper';
import { WzAgentSelectorWrapper } from '../components/wz-agent-selector/wz-agent-selector-wrapper';
import { WzBlankScreen } from '../components/wz-blank-screen/wz-blank-screen';
import { ClusterDisabled } from '../components/management/cluster/cluster-disabled';
import { ClusterTimelions } from '../components/management/cluster/cluster-timelions';
import { KibanaVisWrapper } from '../components/management/cluster/cluster-visualization';
import { ToastNotificationsModal } from '../components/notifications/modal';
import { getAngularModule } from '../kibana-services';
Expand All @@ -29,8 +27,6 @@ app.value('WzVisualize', WzVisualize);
app.value('WzMenuWrapper', WzMenuWrapper);
app.value('WzAgentSelectorWrapper', WzAgentSelectorWrapper);
app.value('WzBlankScreen', WzBlankScreen);
app.value('ClusterDisabled', ClusterDisabled);
app.value('ClusterTimelions', ClusterTimelions);
app.value('KibanaVisualization', KibanaVisWrapper);
app.value('ToastNotificationsModal', ToastNotificationsModal);
app.value('WzUpdatesNotification', WzUpdatesNotification);
Expand Up @@ -2,47 +2,50 @@ import React, { Component, Fragment } from 'react';
import { EuiLink, EuiEmptyPrompt } from '@elastic/eui';
import { withErrorBoundary } from '../../common/hocs';
import { webDocumentationLink } from '../../../../common/services/web_documentation';
export const ClusterDisabled = withErrorBoundary (class ClusterDisabled extends Component {
constructor(props) {
super(props);
this.state = {};
}
export const ClusterDisabled = withErrorBoundary(
class ClusterDisabled extends Component {
constructor(props) {
super(props);
this.state = {};
}

render() {
return (
<EuiEmptyPrompt
iconType="iInCircle"
title={
<h2>
{!this.props.enabled
? 'The cluster is disabled'
: !this.props.running
? 'The cluster is not running'
: ''}
</h2>
}
body={
<Fragment>
{!this.props.enabled && (
<p>
Visit the documentation on{' '}
<EuiLink
href={webDocumentationLink('user-manual/configuring-cluster/index.html')}
external
target='_blank'
rel='noopener noreferrer'
>
this link
</EuiLink>{' '}
to learn about how to enable it.
</p>
)}
{!this.props.running && (
<p>The cluster is enabled but it is not running.</p>
)}
</Fragment>
}
/>
);
}
})
render() {
return (
<EuiEmptyPrompt
iconType='iInCircle'
title={
<h2>
{!this.props.enabled
? 'The cluster is disabled'
: !this.props.running
? 'The cluster is not running'
: ''}
</h2>
}
body={
<Fragment>
{!this.props.enabled ? (
<p>
Visit the documentation on{' '}
<EuiLink
href={webDocumentationLink(
'user-manual/configuring-cluster/index.html',
)}
external
target='_blank'
rel='noopener noreferrer'
>
this link
</EuiLink>{' '}
to learn about how to enable it.
</p>
) : !this.props.running ? (
<p>The cluster is enabled but it is not running.</p>
) : null}
</Fragment>
}
/>
);
}
},
);
@@ -0,0 +1,196 @@
import React from 'react';
import {
EuiFlexItem,
EuiButtonIcon,
EuiCard,
EuiDescriptionList,
EuiSpacer,
EuiToolTip,
EuiFlexGroup,
EuiTitle,
} from '@elastic/eui';
import { ViewMode } from '../../../../../../../src/plugins/embeddable/public';
import { getPlugins } from '../../../../kibana-services';
import { DiscoverNoResults } from '../../../common/no-results/no-results';
import { getDashboardConfigurationPanels } from '../dashboard/dashboard_configuration_panels';
import '../dashboard/cluster_dashboard.scss';
import { tFilter } from '../../../common/data-source';

interface ConfigurationCardsProps {
goBack: () => void;
configuration: any;
searchBarProps: any;
results: any;
indexPatternId?: string;
filters: tFilter[];
}

const plugins = getPlugins();

const DashboardByRenderer = plugins.dashboard.DashboardContainerByValueRenderer;

export const ConfigurationCards = ({
goBack,
configuration,
searchBarProps,
results,
indexPatternId,
filters,
}: ConfigurationCardsProps) => {
return (
<EuiFlexGroup direction='column' gutterSize='s'>
<EuiFlexItem>
<EuiFlexGroup responsive={false} alignItems='center' gutterSize='s'>
<EuiFlexItem grow={false}>
<EuiToolTip content='Go back' position='bottom'>
<EuiButtonIcon
color='primary'
size='m'
display='empty'
iconType='arrowLeft'
aria-label='Back'
onClick={goBack}
/>
</EuiToolTip>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiTitle>
<h2>Overview</h2>
</EuiTitle>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexGroup responsive alignItems='flexStart' gutterSize='s'>
<EuiFlexItem
grow={false}
style={{
minWidth: '500px',
overflow: 'hidden',
height: '100%',
}}
>
{results?.hits?.total > 0 ? (
<DashboardByRenderer
input={{
viewMode: ViewMode.VIEW,
panels: getDashboardConfigurationPanels(indexPatternId),
isFullScreenMode: false,
filters: filters,
useMargins: true,
id: 'ct-dashboard-configuration-tab',
timeRange: {
from: searchBarProps.dateRangeFrom,
to: searchBarProps.dateRangeTo,
},
title: 'Cluster configuration dashboard',
description: 'Dashboard of the Cluster configuration',
query: searchBarProps.query,
refreshConfig: {
pause: false,
value: 15,
},
hidePanelTitles: false,
}}
/>
) : (
<DiscoverNoResults
message='There are no results for selected time range. Try another
one.'
/>
)}
</EuiFlexItem>
<EuiFlexItem style={{ padding: '8px 0 0 0', height: '364px' }}>
<EuiCard
textAlign='left'
title={
<EuiTitle size='s'>
<h2>Configuration</h2>
</EuiTitle>
}
>
<EuiSpacer size='m' />
<EuiDescriptionList
type='column'
compressed={true}
align='left'
listItems={[
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Disabled
</span>
),
description: configuration?.disabled ? 'true' : 'false',
jbiset marked this conversation as resolved.
Show resolved Hide resolved
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Hidden
</span>
),
description: configuration?.hidden ? 'true' : 'false',
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Name
</span>
),
description: configuration?.name,
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Node name
</span>
),
description: configuration?.node_name,
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Node type
</span>
),
description: configuration?.node_type,
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Bind address
</span>
),
description: configuration?.bind_addr,
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
IP
</span>
),
description: configuration?.nodes[0] || '-',
},
{
title: (
<span style={{ fontWeight: 400, fontSize: '1rem' }}>
Port
</span>
),
description: configuration?.port,
},
]}
titleProps={{
className: 'cluster-descriptionList-title',
}}
descriptionProps={{
className: 'color-grey cluster-descriptionList-description',
}}
/>
</EuiCard>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
);
};