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

[7.x] [Embeddables] Time range per panel design fixes (#46630) #46877

Merged
merged 1 commit into from
Sep 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export class EmbeddableChildPanel extends React.Component<EmbeddableChildPanelPr
}

public render() {
const classes = classNames('embPanel embPanel__content', {
'embPanel__content-isLoading': this.state.loading,
const classes = classNames('embPanel', {
'embPanel-isLoading': this.state.loading,
});

return (
Expand Down
41 changes: 27 additions & 14 deletions src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
min-height: $euiSizeL + 2px; // + 2px to account for border
position: relative;

&-isLoading {
// completely center the loading indicator
justify-content: center;
align-items: center;
}

// SASSTODO: The inheritence factor stemming from embeddables makes this class hard to change
.embPanel__content {
display: flex;
Expand All @@ -20,12 +26,6 @@
.embPanel__content--fullWidth {
width: 100%;
}

.embPanel__content-isLoading {
// completely center the loading indicator
justify-content: center;
align-items: center;
}
}

// HEADER
Expand All @@ -38,13 +38,27 @@
}

.embPanel__title {
@include euiTextTruncate;
@include euiTitle('xxxs');
overflow: hidden;
line-height: 1.5;
flex-grow: 1;
display: flex;
flex-wrap: wrap;
align-items: center;

&:not(:empty) {
padding: ($euiSizeXS * 1.5) $euiSizeS 0;
line-height: $euiSizeL;
padding-left: $euiSizeS;
}

.embPanel__titleInner {
overflow: hidden;
display: flex;
padding-right: $euiSizeS;
}

.embPanel__titleText {
@include euiTextTruncate;
}
}

Expand All @@ -69,7 +83,7 @@
*/

.embPanel__optionsMenuButton {
background-color: transparentize($euiColorDarkestShade, .9);
background-color: transparentize($euiColorDarkestShade, 0.9);
border-bottom-right-radius: 0;
border-top-left-radius: 0;

Expand All @@ -78,17 +92,16 @@
}
}

.embPanel
.embPanel__optionsMenuButton {
.embPanel .embPanel__optionsMenuButton {
opacity: 0; /* 1 */

&:focus {
opacity: 1; /* 2 */
}
}

.embPanel__optionsMenuPopover[class*="-isOpen"],
.embPanel:hover {
.embPanel__optionsMenuPopover[class*='-isOpen'],
.embPanel:hover {
.embPanel__optionsMenuButton {
opacity: 1;
}
Expand Down Expand Up @@ -127,4 +140,4 @@
overflow: auto;
text-align: center;
padding: $euiSizeS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function renderBadges(badges: IAction[], embeddable: IEmbeddable) {
return badges.map(badge => (
<EuiBadge
key={badge.id}
className="embPanel__headerBadge"
iconType={badge.getIconType({ embeddable })}
onClick={() => badge.execute({ embeddable })}
onClickAriaLabel={badge.getDisplayName({ embeddable })}
Expand All @@ -60,13 +61,13 @@ export function PanelHeader({
badges,
embeddable,
}: PanelHeaderProps) {
const classes = classNames('embPanel__header', {
'embPanel__header--floater': !title || hidePanelTitles,
});

const showTitle = !isViewMode || (title && !hidePanelTitles);
const showPanelBar = badges.length > 0 || showTitle;

const classes = classNames('embPanel__header', {
'embPanel__header--floater': !showPanelBar,
});

if (!showPanelBar) {
return (
<div className={classes}>
Expand Down Expand Up @@ -107,15 +108,20 @@ export function PanelHeader({
}
)}
>
{showTitle ? `${title} ` : ''}
{renderBadges(badges, embeddable)}
{viewDescr !== '' ? (
<EuiToolTip content={viewDescr} delay="regular" position="right">
<EuiIcon type="iInCircle" />
</EuiToolTip>
{showTitle || viewDescr !== '' ? (
<span className="embPanel__titleInner">
<span className="embPanel__titleText">{title}</span>

{viewDescr !== '' && (
<EuiToolTip content={viewDescr} delay="regular" position="right">
<EuiIcon type="iInCircle" />
</EuiToolTip>
)}
</span>
) : (
''
undefined
)}
{renderBadges(badges, embeddable)}
</div>

<PanelOptionsMenu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,26 @@ export class CustomizeTimeRangeModal extends Component<CustomizeTimeRangeProps,
</EuiFormRow>
</EuiModalBody>
<EuiModalFooter>
<EuiFlexGroup gutterSize="s" responsive={false}>
<EuiFlexItem>
<EuiButtonEmpty
onClick={this.inheritFromParent}
color="danger"
data-test-subj="removePerPanelTimeRangeButton"
disabled={this.state.inheritTimeRange}
>
{i18n.translate(
'xpack.advancedUiActions.customizePanelTimeRange.modal.removeButtonTitle',
{
defaultMessage: 'Remove',
}
)}
</EuiButtonEmpty>
<EuiFlexGroup gutterSize="s" responsive={false} justifyContent="spaceBetween">
<EuiFlexItem grow={true}>
<div>
<EuiButtonEmpty
onClick={this.inheritFromParent}
color="danger"
data-test-subj="removePerPanelTimeRangeButton"
disabled={this.state.inheritTimeRange}
flush="left"
>
{i18n.translate(
'xpack.advancedUiActions.customizePanelTimeRange.modal.removeButtonTitle',
{
defaultMessage: 'Remove',
}
)}
</EuiButtonEmpty>
</div>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonEmpty onClick={this.cancel} data-test-subj="cancelPerPanelTimeRangeButton">
{i18n.translate(
'xpack.advancedUiActions.customizePanelTimeRange.modal.cancelButtonTitle',
Expand All @@ -156,7 +159,7 @@ export class CustomizeTimeRangeModal extends Component<CustomizeTimeRangeProps,
)}
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton data-test-subj="addPerPanelTimeRangeButton" onClick={this.addToPanel} fill>
{this.state.inheritTimeRange
? i18n.translate(
Expand Down