Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Address UX feedback. Issues: #33 #35

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions public/pages/Dashboard/Components/AnomaliesDistribution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,13 @@ export const AnomaliesDistributionChart = (
return d;
},
fillLabel: {
textInvertible: false,
textInvertible: true,
},
shape: {
fillColor: d => {
return fillOutColors(
d,
(d.x0 + d.x1) / 3 / (2 * Math.PI),
(d.x0 + d.x1) / 2 / (2 * Math.PI),
[]
);
},
Expand Down Expand Up @@ -224,10 +224,9 @@ export const AnomaliesDistributionChart = (
config={{
partitionLayout: PartitionLayout.sunburst,
fontFamily: 'Arial',
outerSizeRatio: 0.6,
outerSizeRatio: 1,
fillLabel: {
textInvertible: true,
fontStyle: 'italic',
},
// TODO: Given only 1 detector exists, the inside Index circle will have issue in following scenarios:
// 1: if Linked Label is configured for identifying index, label of Index circle will be invisible;
Expand Down
23 changes: 12 additions & 11 deletions public/pages/Dashboard/Components/AnomaliesLiveChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const AnomaliesLiveChart = (props: AnomaliesLiveChartProps) => {
(state: AppState) => state.elasticsearch
);

const [lastAnomalyResult, setLastAnomalyResult] = useState();
const [lastAnomalyResult, setLastAnomalyResult] = useState<object>();

const [liveAnomalyData, setLiveAnomalyData] = useState([] as object[]);

Expand Down Expand Up @@ -157,12 +157,13 @@ export const AnomaliesLiveChart = (props: AnomaliesLiveChartProps) => {
// Issue link: https://github.com/opendistro-for-elasticsearch/anomaly-detection-kibana-plugin/issues/26
return (
<ContentPanel
title={[
<EuiTitle size={'s'} className={'content-panel-title'}>
<h3>{'Live Anomalies'}</h3>
</EuiTitle>,
<EuiBadge color={'#db1374'}>{'Live'}</EuiBadge>,
]}
title={
<EuiTitle size="s" className="content-panel-title">
<h3>
Live anomalies <EuiBadge color={'#DB1374'}>Live</EuiBadge>
</h3>
</EuiTitle>
}
subTitle={
<EuiFlexItem>
<EuiText className={'live-anomaly-results-subtile'}>
Expand Down Expand Up @@ -206,7 +207,7 @@ export const AnomaliesLiveChart = (props: AnomaliesLiveChartProps) => {
</EuiFlexGroup>
<div
style={{
height: '300px',
height: '200px',
width: '100%',
opacity: 1,
}}
Expand All @@ -225,9 +226,9 @@ export const AnomaliesLiveChart = (props: AnomaliesLiveChartProps) => {
</EuiFlexGroup>
) : (
[
<EuiTitle size="xxs" style={{ 'margin-left': '10px' }}>
<h4>10 detectors with the most recent anomaly occurrence</h4>
</EuiTitle>,
<EuiText size="s" style={{ marginLeft: '10px' }}>
<p>10 detectors with the most recent anomaly occurrence</p>
</EuiText>,
<Chart>
<Settings showLegend legendPosition={Position.Right} />
<LineAnnotation
Expand Down
37 changes: 32 additions & 5 deletions public/pages/Dashboard/Components/utils/DashboardHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,38 @@
import React from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add copyright header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will add it.

import { EuiPageHeader, EuiTitle } from '@elastic/eui';
export const DashboardHeader = () => {
import {
EuiButton,
EuiFlexGroup,
EuiFlexItem,
EuiPageHeader,
EuiTitle,
} from '@elastic/eui';
import { PLUGIN_NAME, APP_PATH } from '../../../../utils/constants';
export interface DashboardHeaderProps {
hasDetectors: boolean;
}

export const DashboardHeader = (props: DashboardHeaderProps) => {
return (
<EuiPageHeader>
<EuiTitle size="l">
<h1>Dashboard</h1>
</EuiTitle>
<EuiFlexGroup justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<EuiTitle size="l">
<h1>Dashboard</h1>
</EuiTitle>
</EuiFlexItem>
{props.hasDetectors ? (
<EuiFlexItem grow={false}>
<EuiButton
fill
href={`${PLUGIN_NAME}#${APP_PATH.CREATE_DETECTOR}`}
target="_blank"
data-test-subj="add_detector"
>
Create detector
</EuiButton>
</EuiFlexItem>
) : null}
</EuiFlexGroup>
</EuiPageHeader>
);
};
6 changes: 4 additions & 2 deletions public/pages/Dashboard/Container/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ export const Dashboard = () => {
(state: AppState) => state.ad.totalDetectors
);

const hasDetectors = totalDetectors > 0;

useEffect(() => {
onRefreshPage();
}, []);
return (
<Fragment>
<DashboardHeader />
<DashboardHeader hasDetectors={hasDetectors} />
{isLoading == true ? (
<div>
<EuiLoadingSpinner size="s" />
Expand All @@ -61,7 +63,7 @@ export const Dashboard = () => {
&nbsp;&nbsp;
<EuiLoadingSpinner size="xl" />
</div>
) : totalDetectors == 0 ? (
) : !hasDetectors ? (
<EmptyDashboard />
) : (
<DashboardOverview />
Expand Down
11 changes: 0 additions & 11 deletions public/pages/Dashboard/Container/DashboardOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,6 @@ export function DashboardOverview() {

return (
<Fragment>
<EuiFlexGroup justifyContent="flexEnd" style={{ padding: '0px 10px' }}>
<EuiButton
fill
href={`${PLUGIN_NAME}#${APP_PATH.CREATE_DETECTOR}`}
target="_blank"
data-test-subj="add_detector"
>
Create detector
</EuiButton>
</EuiFlexGroup>
<EuiSpacer />
<EuiFlexGroup justifyContent="flexStart">
<EuiFlexItem grow={1}>
<EuiComboBox
Expand Down
4 changes: 2 additions & 2 deletions public/pages/Dashboard/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
}

.anomalies-distribution-sunburst {
height: 443px;
width: 441px;
height: 500px;
width: 500px;
}
Loading