-
Notifications
You must be signed in to change notification settings - Fork 18
Add detector state page #65
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import { DETECTOR_INIT_FAILURES, DEFAULT_ACTION_ITEM } from './constants'; | ||
|
||
export const getInitFailureMessageAndActionItem = (error: string): object => { | ||
const failureDetails = Object.values(DETECTOR_INIT_FAILURES); | ||
const failureDetail = failureDetails.find(failure => | ||
error.includes(failure.keyword) | ||
); | ||
if (!failureDetail) { | ||
return { | ||
cause: 'unknown error', | ||
actionItem: DEFAULT_ACTION_ITEM, | ||
}; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this the case where the detector has an unexpected failure ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could maybe add this as a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will add 'We might have bugs' case to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool, sounds good |
||
return failureDetail; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
import React from 'react'; | ||
import { EuiButton, EuiEmptyPrompt, EuiIcon } from '@elastic/eui'; | ||
import { Fragment } from 'react'; | ||
import { Detector } from '../../../../models/interfaces'; | ||
|
||
export interface DetectorInitializationFailureProps { | ||
detector: Detector; | ||
onStartDetector(): void; | ||
failureDetail: any; | ||
onSwitchToConfiguration(): void; | ||
} | ||
|
||
export const DetectorInitializationFailure = ( | ||
props: DetectorInitializationFailureProps | ||
) => { | ||
return ( | ||
<EuiEmptyPrompt | ||
style={{ maxWidth: '75%' }} | ||
title={ | ||
<div> | ||
<EuiIcon type="alert" size="l" color="danger" /> | ||
|
||
<h2> | ||
{`The detector cannot be initialized due to ${props.failureDetail.cause}`} | ||
</h2> | ||
</div> | ||
} | ||
body={ | ||
<Fragment> | ||
<p>{`${props.failureDetail.actionItem}`}</p> | ||
</Fragment> | ||
} | ||
actions={[ | ||
<EuiButton | ||
onClick={props.onSwitchToConfiguration} | ||
style={{ width: '250px' }} | ||
> | ||
View detector configuration | ||
</EuiButton>, | ||
<EuiButton | ||
onClick={props.onStartDetector} | ||
iconType={'play'} | ||
style={{ width: '250px' }} | ||
> | ||
Restart detector | ||
</EuiButton>, | ||
]} | ||
/> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
import React from 'react'; | ||
import { EuiButton, EuiEmptyPrompt, EuiLoadingSpinner } from '@elastic/eui'; | ||
import { Fragment } from 'react'; | ||
import { Detector } from '../../../../models/interfaces'; | ||
|
||
export interface DetectorInitializingProps { | ||
detector: Detector; | ||
onSwitchToConfiguration(): void; | ||
} | ||
|
||
export const DetectorInitializing = (props: DetectorInitializingProps) => { | ||
return ( | ||
<EuiEmptyPrompt | ||
style={{ maxWidth: '75%' }} | ||
title={ | ||
<div> | ||
<EuiLoadingSpinner size="l" /> | ||
<h2>The detector is initializing...</h2> | ||
</div> | ||
} | ||
body={ | ||
<Fragment> | ||
<p> | ||
Based on your latest update to the detector configuration, the | ||
detector is collecting sufficient data to generate accurate | ||
real-time anomalies. | ||
</p> | ||
<p> | ||
The longer the detector interval is, the longer the initialization | ||
will take. | ||
</p> | ||
</Fragment> | ||
} | ||
actions={ | ||
<EuiButton | ||
onClick={props.onSwitchToConfiguration} | ||
style={{ width: '250px' }} | ||
> | ||
View detector configuration | ||
</EuiButton> | ||
} | ||
/> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { EuiButton, EuiEmptyPrompt } from '@elastic/eui'; | ||
import { Fragment } from 'react'; | ||
import { Detector } from '../../../../models/interfaces'; | ||
|
||
export interface DetectorStoppedProps { | ||
detector: Detector; | ||
onStartDetector(): void; | ||
onSwitchToConfiguration(): void; | ||
} | ||
|
||
export const DetectorStopped = (props: DetectorStoppedProps) => { | ||
return ( | ||
<EuiEmptyPrompt | ||
style={{ maxWidth: '75%' }} | ||
title={<h2>The detector is stopped</h2>} | ||
body={ | ||
<Fragment> | ||
{props.detector.enabledTime ? ( | ||
<p> | ||
The detector is stopped due to your latest update to the detector | ||
configuration. Run the detector to see anomalies. | ||
</p> | ||
) : ( | ||
<p> | ||
The detector is never started. Please start the detector to see | ||
anomalies. | ||
</p> | ||
)} | ||
</Fragment> | ||
} | ||
actions={[ | ||
<EuiButton | ||
onClick={props.onSwitchToConfiguration} | ||
style={{ width: '250px' }} | ||
> | ||
View detector configuration | ||
</EuiButton>, | ||
<EuiButton | ||
fill={!props.detector.enabledTime} | ||
onClick={props.onStartDetector} | ||
iconType={'play'} | ||
style={{ width: '250px' }} | ||
> | ||
{props.detector.enabledTime ? 'Restart detector' : 'Start detector'} | ||
</EuiButton>, | ||
]} | ||
/> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another action item: scale up with an instance type of more memory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done