-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement no data and no permission screen
- Loading branch information
Showing
3 changed files
with
217 additions
and
83 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
x-pack/plugins/observability/public/pages/rules/components/prompts/noData_prompt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import React from 'react'; | ||
import { EuiButton, EuiEmptyPrompt, EuiLink, EuiButtonEmpty, EuiPageTemplate } from '@elastic/eui'; | ||
|
||
export function NoDataPrompt({ | ||
onCTAClicked, | ||
documentationLink, | ||
}: { | ||
onCTAClicked: () => void; | ||
documentationLink: string; | ||
}) { | ||
return ( | ||
<EuiPageTemplate | ||
template="centeredContent" | ||
pageContentProps={{ | ||
paddingSize: 'none', | ||
role: null, // For passing a11y tests in EUI docs only | ||
}} | ||
> | ||
<EuiEmptyPrompt | ||
color="plain" | ||
hasBorder={true} | ||
data-test-subj="createFirstRuleEmptyPrompt" | ||
title={ | ||
<h2> | ||
<FormattedMessage | ||
id="xpack.observability.rules.emptyPrompt.emptyTitle" | ||
defaultMessage="Create your first Rule" | ||
/> | ||
</h2> | ||
} | ||
body={ | ||
<p> | ||
<FormattedMessage | ||
id="xpack.triggersActionsUI.components.emptyPrompt.emptyDesc" | ||
defaultMessage="Rules allow you to receive alerts and automate custom actions when specific conditions are met." | ||
/> | ||
</p> | ||
} | ||
actions={[ | ||
<EuiButton | ||
iconType="plusInCircle" | ||
data-test-subj="createFirstRuleButton" | ||
key="create-action" | ||
fill | ||
onClick={onCTAClicked} | ||
> | ||
<FormattedMessage | ||
id="xpack.observability.rules.emptyPrompt.emptyButton" | ||
defaultMessage="Create Rule" | ||
/> | ||
</EuiButton>, | ||
<EuiButtonEmpty color="primary"> | ||
<EuiLink href={documentationLink} target="_blank"> | ||
Documentation | ||
</EuiLink> | ||
</EuiButtonEmpty>, | ||
]} | ||
/> | ||
</EuiPageTemplate> | ||
); | ||
} |
44 changes: 44 additions & 0 deletions
44
x-pack/plugins/observability/public/pages/rules/components/prompts/noPermission_prompt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FormattedMessage } from '@kbn/i18n-react'; | ||
import React from 'react'; | ||
import { EuiEmptyPrompt, EuiPageTemplate } from '@elastic/eui'; | ||
|
||
export function NoPermissionPrompt() { | ||
return ( | ||
<EuiPageTemplate | ||
template="centeredContent" | ||
pageContentProps={{ | ||
paddingSize: 'none', | ||
role: null, // For passing a11y tests in EUI docs only | ||
}} | ||
> | ||
<EuiEmptyPrompt | ||
color="plain" | ||
hasBorder={true} | ||
iconType="securityApp" | ||
title={ | ||
<h1> | ||
<FormattedMessage | ||
id="xpack.observability.rules.noPermissionToCreateTitle" | ||
defaultMessage="No permissions to create rules" | ||
/> | ||
</h1> | ||
} | ||
body={ | ||
<p data-test-subj="permissionDeniedMessage"> | ||
<FormattedMessage | ||
id="xpack.observability.rules.noPermissionToCreateDescription" | ||
defaultMessage="Contact your system administrator." | ||
/> | ||
</p> | ||
} | ||
/> | ||
</EuiPageTemplate> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters