-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Make page titles more consistent for Overview, Alerts, Rules, Rule Detail and Cases pages #146150
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
Changes from all commits
7875b0d
7212f62
c3a7404
8b24a51
39e8d92
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 |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ import { AlertConsumers } from '@kbn/rule-data-utils'; | |
| import React, { useMemo, useRef, useCallback, useState, useEffect } from 'react'; | ||
|
|
||
| import { calculateBucketSize } from './helpers'; | ||
| import { PageHeaderProps } from './types'; | ||
| import { HeaderActionsProps } from './types'; | ||
|
|
||
| import { EmptySections } from '../../../../components/app/empty_sections'; | ||
| import { observabilityFeatureId } from '../../../../../common'; | ||
|
|
@@ -147,14 +147,17 @@ export function OverviewPage() { | |
| <ObservabilityPageTemplate | ||
| isPageDataLoaded={isAllRequestsComplete} | ||
| pageHeader={{ | ||
| children: ( | ||
| <PageHeader | ||
| pageTitle: i18n.translate('xpack.observability.overview.pageTitle', { | ||
| defaultMessage: 'Overview', | ||
| }), | ||
| rightSideItems: [ | ||
| <HeaderActions | ||
| showTour={isGuidedSetupTourVisible} | ||
| onTourDismiss={hideGuidedSetupTour} | ||
| handleGuidedSetupClick={handleGuidedSetupClick} | ||
| onTimeRangeRefresh={onTimeRangeRefresh} | ||
| /> | ||
| ), | ||
| />, | ||
| ], | ||
| }} | ||
| > | ||
| <> | ||
|
|
@@ -262,12 +265,12 @@ export function OverviewPage() { | |
| ); | ||
| } | ||
|
|
||
| function PageHeader({ | ||
| function HeaderActions({ | ||
| showTour = false, | ||
| onTourDismiss, | ||
| handleGuidedSetupClick, | ||
| onTimeRangeRefresh, | ||
| }: PageHeaderProps) { | ||
| }: HeaderActionsProps) { | ||
| const { relativeStart, relativeEnd, refreshInterval, refreshPaused } = useDatePickerContext(); | ||
| const { endTour: endObservabilityTour, isTourVisible: isObservabilityTourVisible } = | ||
| useObservabilityTourContext(); | ||
|
|
@@ -276,17 +279,13 @@ function PageHeader({ | |
|
|
||
| return ( | ||
| <EuiFlexGroup wrap gutterSize="s" justifyContent="flexEnd"> | ||
| <EuiFlexItem grow={1}> | ||
| <EuiTitle> | ||
| <h1 className="eui-textNoWrap">{overviewPageTitle}</h1> | ||
| </EuiTitle> | ||
| </EuiFlexItem> | ||
| <EuiFlexItem grow={false}> | ||
| <DatePicker | ||
| rangeFrom={relativeStart} | ||
| rangeTo={relativeEnd} | ||
| refreshInterval={refreshInterval} | ||
| refreshPaused={refreshPaused} | ||
| width="auto" | ||
|
Member
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. What is this change about?
Member
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.
Contributor
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 think the new Unified Search bar also employs this to make the size of the date picker component dynamic to the displayed value or label. I'm fine with moving in this direction, and we'll probably have to pick this up in other apps later on (if they're not already moving to the new Unified Search bar).
Member
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. Interesting, may I ask what was the reasoning behind it?
Contributor
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. @maryam-saeidi To save space in context of its surrounding elements, for instance the Unified Search bar date picker changes width depending on the value or content within. The previous date picker in the Observability overview page had a fixed size which was the largest width possible (when the date range would be absolute date formats) which is unnecessary for most use-cases. |
||
| onTimeRangeRefresh={onTimeRangeRefresh} | ||
| /> | ||
| </EuiFlexItem> | ||
|
|
@@ -345,7 +344,3 @@ function PageHeader({ | |
| </EuiFlexGroup> | ||
| ); | ||
| } | ||
|
|
||
| const overviewPageTitle = i18n.translate('xpack.observability.overview.pageTitle', { | ||
| defaultMessage: 'Overview', | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,20 +117,19 @@ function RulesPage() { | |
| pageHeader={{ | ||
| pageTitle: <>{RULES_PAGE_TITLE}</>, | ||
| rightSideItems: [ | ||
| authorizedToCreateAnyRules && ( | ||
| <EuiButton | ||
| iconType="plusInCircle" | ||
| key="create-alert" | ||
| data-test-subj="createRuleButton" | ||
| fill | ||
| onClick={() => setCreateRuleFlyoutVisibility(true)} | ||
| > | ||
| <FormattedMessage | ||
| id="xpack.observability.rules.addRuleButtonLabel" | ||
| defaultMessage="Create rule" | ||
| /> | ||
| </EuiButton> | ||
| ), | ||
| <EuiButton | ||
|
Contributor
Author
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. This reduces the 'pop in' effect on this page where buttons suddenly jump to the left
Member
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 like this improvement, just wondering if you checked with @maciejforcone whether disabling the button is the approach that we use in Kibana or do we need to use a loader for the title instead until we have the authorization information. (For the cases that the user actually doesn't have access)
Contributor
Author
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. Well @maciejforcone, what do you think? 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 checked how it works in Rules. So we do show "manage rules" always, but when user gets there and has no permissions to Create rule - then we don't show the button. But for example in Monitor view we show the button, but later in form we show the message "permissions needed". For some actions we also show disabled button So looks like we don't have a common pattern for that yet. I'd stick with what we have for now - showing the button, and then in form we show the info of missing permissions. And in case when there is instant action like this toggle:
Contributor
Author
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. Ok, @maciejforcone agrees that a less jumpy UI is better, so the fix in this PR is good. @maryam-saeidi hope this answers your question. 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. And to the question of loader vs element - less jumps is always better, so I like how @CoenWarmer solved that.
Member
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. @maciejforcone Thanks for the input, the loader option was for the whole page/title (not the button). I think I saw a similar approach on the cases page if I am not mistaken, so it will also not be jumpy. But if we use disable approach, that's also a good option. |
||
| fill | ||
| iconType="plusInCircle" | ||
| key="create-alert" | ||
| data-test-subj="createRuleButton" | ||
| disabled={!authorizedToCreateAnyRules} | ||
| onClick={() => setCreateRuleFlyoutVisibility(true)} | ||
| > | ||
| <FormattedMessage | ||
| id="xpack.observability.rules.addRuleButtonLabel" | ||
| defaultMessage="Create rule" | ||
| /> | ||
| </EuiButton>, | ||
| <EuiButtonEmpty | ||
| href={documentationLink} | ||
| target="_blank" | ||
|
|
||








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.
👍🏻