-
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.
Browse files
Browse the repository at this point in the history
# Backport This will backport the following commits from `main` to `8.x`: - [[Maps] Surface data request errors (#200860)](#200860) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Krzysztof Kowalczyk","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-26T10:18:45Z","message":"[Maps] Surface data request errors (#200860)\n\n## Summary\r\n\r\nThis PR makes it to so data request errors are surfaced to users, as a\r\nwarning.\r\n\r\nCloses: #195294","sha":"1f578909832a9e00342c33fee03f9bd79b5f28b1","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:Presentation","release_note:skip","v9.0.0","backport:prev-minor","Feature:Maps"],"title":"[Maps] Surface data request errors","number":200860,"url":"https://github.com/elastic/kibana/pull/200860","mergeCommit":{"message":"[Maps] Surface data request errors (#200860)\n\n## Summary\r\n\r\nThis PR makes it to so data request errors are surfaced to users, as a\r\nwarning.\r\n\r\nCloses: #195294","sha":"1f578909832a9e00342c33fee03f9bd79b5f28b1"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200860","number":200860,"mergeCommit":{"message":"[Maps] Surface data request errors (#200860)\n\n## Summary\r\n\r\nThis PR makes it to so data request errors are surfaced to users, as a\r\nwarning.\r\n\r\nCloses: #195294","sha":"1f578909832a9e00342c33fee03f9bd79b5f28b1"}}]}] BACKPORT--> Co-authored-by: Krzysztof Kowalczyk <[email protected]>
- Loading branch information
1 parent
678feac
commit 232515e
Showing
4 changed files
with
107 additions
and
24 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
x-pack/plugins/maps/public/classes/styles/vector/components/legend/style_error.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,72 @@ | ||
/* | ||
* 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 React, { useEffect, useState } from 'react'; | ||
import { EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiText, EuiToolTip } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { DynamicStyleProperty } from '../../properties/dynamic_style_property'; | ||
|
||
interface Props { | ||
error: Error; | ||
style: DynamicStyleProperty<object>; | ||
} | ||
|
||
export const StyleError = ({ error, style }: Props) => { | ||
const [label, setLabel] = useState(''); | ||
const styleName = style.getDisplayStyleName(); | ||
|
||
useEffect(() => { | ||
let canceled = false; | ||
const getLabel = async () => { | ||
const field = style.getField(); | ||
if (!field) { | ||
return; | ||
} | ||
|
||
const fieldLabel = await field.getLabel(); | ||
|
||
if (canceled) { | ||
return; | ||
} | ||
|
||
setLabel(fieldLabel); | ||
}; | ||
|
||
getLabel(); | ||
|
||
return () => { | ||
canceled = true; | ||
}; | ||
}, [style]); | ||
|
||
return ( | ||
<div> | ||
<EuiFlexGroup gutterSize="xs" justifyContent="spaceBetween"> | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip position="top" title={styleName} content={label}> | ||
<EuiText className="eui-textTruncate" size="xs" style={{ maxWidth: '180px' }}> | ||
<small> | ||
<strong>{label}</strong> | ||
</small> | ||
</EuiText> | ||
</EuiToolTip> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<EuiFlexGroup direction="column" gutterSize="none"> | ||
<EuiCallOut | ||
title={i18n.translate('xpack.maps.vectorStyleLegend.fetchStyleMetaDataError', { | ||
defaultMessage: 'Unable to fetch style meta data', | ||
})} | ||
color="warning" | ||
iconType="warning" | ||
> | ||
<p>{error.message}</p> | ||
</EuiCallOut> | ||
</EuiFlexGroup> | ||
</div> | ||
); | ||
}; |
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
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
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