mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Graph] Replace Fontawesome with EUI + Maki icons (#162048)
## Summary Fixes #160232 This PR removes completely FontAwesome from the Graph plugin and replace its usage with mostly EUI + few Maki icons. As for the Google icon, @MichaelMarcialis do you think we should just have a custom SVG icon within the Graph app? Here's a list of the replaced icons, but if I forgot anything let me know: * [x] Created generic `IconRenderer` component to abstract away the package type from the rendering * [x] Add logic for color switch based on background color * Replace icons in graph visualization * [x] Replace with EUI icons * [x] Replace with Maki icons * [x] Add `prevName` to recover old saved graph SO * [x] Fix selection preview icon * For the `at` and `key` icons it needs to wait for a new EUI release with https://github.com/elastic/eui/pull/6934 * Replace drill down icons * [x] Replace with EUI icons * [x] Replace with Maki icons * [x] Find a substitute for Google icon * [x] Add `prevName` to recover old saved graph SO * App toolbars * [x] Replace app toolbar icons with EUI icons * [x] Changed blocked list icon from `ban` to `filterIgnore` * [x] Replace styling icon + color swatches * The EUI `dot` icon was too small, so switches to rect icons * [x] Replace merge icons on link selection * [x] Replace group/ungroup icons with `fold/unfold` * [x] Custom drilldowns * [x] Removed `LegacyIcon` * Replaced usage in various places New icons within field configuration + graph visualization <img width="1061" alt="Screenshot 2023-07-17 at 11 00 35" src="59f981e7
-64b7-4ce5-b3ae-2582d46fc373"> <img width="302" alt="Screenshot 2023-07-17 at 15 13 04" src="fb8d0e63
-e982-406f-bd8d-036d71d37442"> New toolbar with blocked icon changed <img width="202" alt="Screenshot 2023-07-17 at 15 13 40" src="241206c4
-7d3b-4296-bd6b-c2df3f3eabe5"> <img width="220" alt="Screenshot 2023-07-17 at 15 13 35" src="5a648932
-2f79-4c0e-a8d0-3ab165f68036"> <img width="272" alt="Screenshot 2023-07-17 at 12 41 12" src="e3778d20
-3000-496e-881b-61e5f086ae52"> New group/ungroup icons <img width="168" alt="Screenshot 2023-07-17 at 12 41 25" src="ffc963e6
-4fea-4cb5-b0ef-cf8a71a71d6a"> <img width="252" alt="Screenshot 2023-07-17 at 15 15 27" src="98b8b025
-32fd-465e-9a66-40f4f866eb6e"> Selection with icons preview <img width="260" alt="Screenshot 2023-07-17 at 15 07 17" src="08dbda17
-0c12-4fa4-8c92-77bbe90d7e14"> <img width="268" alt="Screenshot 2023-07-17 at 15 07 35" src="78987838
-42d5-46bf-9e46-b12cc603fa4e"> Panel with color styling open <img width="266" alt="Screenshot 2023-07-17 at 15 07 44" src="f5866e29
-cf22-4e62-a2ff-3ef901c0d564"> Custom drilldowns (note Google icon has been replaced with a magnifier icon) <img width="331" alt="Screenshot 2023-07-18 at 17 49 07" src="42e307d1
-69b6-4e79-9e19-64c5efb7ee46"> <img width="381" alt="Screenshot 2023-07-18 at 17 51 44" src="bc70c506
-4390-45c1-aff5-8e22a68d7130"> <img width="271" alt="Screenshot 2023-07-17 at 15 08 31" src="59fea7e4
-a775-4006-805d-0610d7861890"> <img width="269" alt="Screenshot 2023-07-17 at 15 08 38" src="f6c247a0
-921d-4d9c-881a-796e02488df5"> Link selection <img width="295" alt="Screenshot 2023-07-17 at 15 09 06" src="d6a73013
-130e-45a8-bdfc-48ac20e66a85"> ### Checklist Delete any items that are not applicable to this PR. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] Any UI touched in this PR is usable by keyboard only (learn more about [keyboard accessibility](https://webaim.org/techniques/keyboard/)) - [ ] Any UI touched in this PR does not create any new axe failures (run axe in browser: [FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/), [Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US)) - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This renders correctly on smaller devices using a responsive layout. (You can test this [in your browser](https://www.browserstack.com/guide/responsive-testing-on-local-server)) - [ ] This was checked for [cross-browser compatibility](https://www.elastic.co/support/matrix#matrix_browsers) ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Michael Marcialis <michael.l.marcialis@gmail.com>
This commit is contained in:
parent
446157f6d0
commit
d064bfe62a
42 changed files with 749 additions and 517 deletions
|
@ -30,7 +30,6 @@ import { Start as InspectorPublicPluginStart } from '@kbn/inspector-plugin/publi
|
|||
import { TableListViewKibanaProvider } from '@kbn/content-management-table-list-view-table';
|
||||
|
||||
import './index.scss';
|
||||
import('./font_awesome');
|
||||
import { SpacesApi } from '@kbn/spaces-plugin/public';
|
||||
import { KibanaThemeProvider, toMountPoint } from '@kbn/kibana-react-plugin/public';
|
||||
import { SavedObjectsManagementPluginStart } from '@kbn/saved-objects-management-plugin/public';
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
@import './graph_visualization/index';
|
||||
@import './venn_diagram/index';
|
||||
@import './settings/index';
|
||||
@import './legacy_icon/index';
|
||||
@import './field_manager/index';
|
||||
@import './graph';
|
||||
@import './sidebar';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
|
||||
import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
|
||||
import { ControlType, Workspace, WorkspaceField } from '../../types';
|
||||
|
||||
interface ControlPanelToolBarProps {
|
||||
|
@ -90,123 +90,112 @@ export const ControlPanelToolBar = ({
|
|||
<EuiFlexGroup gutterSize="xs" responsive={false}>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={undoButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
<EuiButtonIcon
|
||||
iconType={'editorUndo'}
|
||||
size="xs"
|
||||
aria-label={undoButtonMsg}
|
||||
type="button"
|
||||
isDisabled={workspace.undoLog.length < 1}
|
||||
onClick={onUndoClick}
|
||||
disabled={workspace.undoLog.length < 1}
|
||||
>
|
||||
<span className="kuiIcon fa-history" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={redoButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
<EuiButtonIcon
|
||||
iconType="editorRedo"
|
||||
size="xs"
|
||||
aria-label={redoButtonMsg}
|
||||
type="button"
|
||||
isDisabled={workspace.redoLog.length === 0}
|
||||
onClick={onRedoClick}
|
||||
disabled={workspace.redoLog.length === 0}
|
||||
>
|
||||
<span className="kuiIcon fa-repeat" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={expandButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
<EuiButtonIcon
|
||||
iconType="plus"
|
||||
size="xs"
|
||||
aria-label={expandButtonMsg}
|
||||
disabled={liveResponseFields.length === 0 || workspace.nodes.length === 0}
|
||||
isDisabled={liveResponseFields.length === 0 || workspace.nodes.length === 0}
|
||||
onClick={onExpandButtonClick}
|
||||
>
|
||||
<span className="kuiIcon fa-plus" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={addLinksButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
<EuiButtonIcon
|
||||
iconType="link"
|
||||
size="xs"
|
||||
aria-label={addLinksButtonMsg}
|
||||
disabled={haveNodes}
|
||||
isDisabled={haveNodes}
|
||||
onClick={onAddLinksClick}
|
||||
>
|
||||
<span className="kuiIcon fa-link" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={removeVerticesButtonMsg}>
|
||||
<button
|
||||
<EuiButtonIcon
|
||||
data-test-subj="graphRemoveSelection"
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
disabled={haveNodes}
|
||||
iconType="trash"
|
||||
size="xs"
|
||||
aria-label={removeVerticesButtonMsg}
|
||||
isDisabled={haveNodes}
|
||||
onClick={onRemoveVerticesClick}
|
||||
>
|
||||
<span className="kuiIcon fa-trash" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={blocklistButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
disabled={workspace.selectedNodes.length === 0}
|
||||
<EuiButtonIcon
|
||||
iconType="eyeClosed"
|
||||
size="xs"
|
||||
aria-label={blocklistButtonMsg}
|
||||
isDisabled={workspace.selectedNodes.length === 0}
|
||||
onClick={onBlockListClick}
|
||||
>
|
||||
<span className="kuiIcon fa-ban" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={customStyleButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
disabled={workspace.selectedNodes.length === 0}
|
||||
<EuiButtonIcon
|
||||
iconType="brush"
|
||||
size="xs"
|
||||
aria-label={customStyleButtonMsg}
|
||||
isDisabled={workspace.selectedNodes.length === 0}
|
||||
onClick={onCustomStyleClick}
|
||||
>
|
||||
<span className="kuiIcon fa-paint-brush" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={drillDownButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
disabled={haveNodes}
|
||||
<EuiButtonIcon
|
||||
iconType="iInCircle"
|
||||
size="xs"
|
||||
aria-label={drillDownButtonMsg}
|
||||
isDisabled={haveNodes}
|
||||
onClick={onDrillDownClick}
|
||||
>
|
||||
<span className="kuiIcon fa-info" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
|
||||
{(workspace.nodes.length === 0 || workspace.force === null) && (
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={runLayoutButtonMsg}>
|
||||
<button
|
||||
<EuiButtonIcon
|
||||
data-test-subj="graphResumeLayout"
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
disabled={workspace.nodes.length === 0}
|
||||
iconType="playFilled"
|
||||
size="xs"
|
||||
aria-label={runLayoutButtonMsg}
|
||||
isDisabled={workspace.nodes.length === 0}
|
||||
onClick={onRunLayoutClick}
|
||||
>
|
||||
<span className="kuiIcon fa-play" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
)}
|
||||
|
@ -214,14 +203,13 @@ export const ControlPanelToolBar = ({
|
|||
{workspace.force !== null && workspace.nodes.length > 0 && (
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={pauseLayoutButtonMsg}>
|
||||
<button
|
||||
<EuiButtonIcon
|
||||
data-test-subj="graphPauseLayout"
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
iconType="pause"
|
||||
size="xs"
|
||||
aria-label={pauseLayoutButtonMsg}
|
||||
onClick={onPauseLayoutClick}
|
||||
>
|
||||
<span className="kuiIcon fa-pause" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
)}
|
||||
|
|
|
@ -5,9 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
|
||||
import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
import { UrlTemplate } from '../../types';
|
||||
import { IconRenderer } from '../icon_renderer';
|
||||
|
||||
interface UrlTemplateButtonsProps {
|
||||
urlTemplates: UrlTemplate[];
|
||||
|
@ -21,7 +22,7 @@ export const DrillDownIconLinks = ({
|
|||
openUrlTemplate,
|
||||
}: UrlTemplateButtonsProps) => {
|
||||
const drillDownsWithIcons = urlTemplates.filter(
|
||||
({ icon }: UrlTemplate) => icon && icon.class !== ''
|
||||
({ icon }: UrlTemplate) => icon && icon.id !== ''
|
||||
);
|
||||
|
||||
if (drillDownsWithIcons.length === 0) {
|
||||
|
@ -34,14 +35,12 @@ export const DrillDownIconLinks = ({
|
|||
return (
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiToolTip content={cur.description}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
type="button"
|
||||
disabled={hasNodes}
|
||||
<EuiButtonIcon
|
||||
iconType={cur.icon ? () => <IconRenderer icon={cur.icon} /> : ''}
|
||||
size="xs"
|
||||
isDisabled={hasNodes}
|
||||
onClick={onUrlTemplateClick}
|
||||
>
|
||||
<span className={`kuiIcon ${cur.icon?.class || ''}`} />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</EuiFlexItem>
|
||||
);
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiIcon } from '@elastic/eui';
|
||||
import { UrlTemplate } from '../../types';
|
||||
import { IconRenderer } from '../icon_renderer';
|
||||
|
||||
interface DrillDownsProps {
|
||||
urlTemplates: UrlTemplate[];
|
||||
|
@ -18,7 +20,7 @@ export const DrillDowns = ({ urlTemplates, openUrlTemplate }: DrillDownsProps) =
|
|||
return (
|
||||
<div>
|
||||
<div className="gphSidebar__header">
|
||||
<span className="kuiIcon fa-info" />
|
||||
<EuiIcon type="iInCircle" />{' '}
|
||||
{i18n.translate('xpack.graph.sidebar.drillDownsTitle', {
|
||||
defaultMessage: 'Drill-downs',
|
||||
})}
|
||||
|
@ -41,7 +43,7 @@ export const DrillDowns = ({ urlTemplates, openUrlTemplate }: DrillDownsProps) =
|
|||
<li className="list-group-item">
|
||||
{urlTemplate.icon && (
|
||||
<>
|
||||
<span className="kuiIcon gphNoUserSelect">{urlTemplate.icon?.code}</span>{' '}
|
||||
<IconRenderer icon={urlTemplate.icon} className="gphNoUserSelect" />{' '}
|
||||
</>
|
||||
)}
|
||||
<a aria-hidden="true" onClick={onOpenUrlTemplate}>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiFlexGroup, EuiFlexItem, EuiToolTip } from '@elastic/eui';
|
||||
import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem, EuiIcon, EuiToolTip } from '@elastic/eui';
|
||||
import { ControlType, TermIntersect, Workspace } from '../../types';
|
||||
import { VennDiagram } from '../venn_diagram';
|
||||
|
||||
|
@ -44,7 +44,7 @@ export const MergeCandidates = ({
|
|||
return (
|
||||
<div className="gphSidebar__panel">
|
||||
<div className="gphSidebar__header">
|
||||
<span className="kuiIcon fa-link" />
|
||||
<EuiIcon type="link" />{' '}
|
||||
{i18n.translate('xpack.graph.sidebar.linkSummaryTitle', {
|
||||
defaultMessage: 'Link summary',
|
||||
})}
|
||||
|
@ -102,28 +102,26 @@ export const MergeCandidates = ({
|
|||
<div>
|
||||
<span>
|
||||
<EuiToolTip content={mergeTerm1ToTerm2ButtonMsg}>
|
||||
<button
|
||||
type="button"
|
||||
<EuiButtonIcon
|
||||
iconType="doubleArrowRight"
|
||||
size="xs"
|
||||
style={{ opacity: 0.2 + mc.overlap / mc.v1 }}
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
aria-label={mergeTerm1ToTerm2ButtonMsg}
|
||||
onClick={onMergeTerm1ToTerm2Click}
|
||||
>
|
||||
<span className="kuiIcon fa-chevron-circle-right" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
|
||||
<span className="gphLinkSummary__term--1">{mc.term1}</span>
|
||||
<span className="gphLinkSummary__term--2">{mc.term2}</span>
|
||||
|
||||
<EuiToolTip content={mergeTerm2ToTerm1ButtonMsg}>
|
||||
<button
|
||||
type="button"
|
||||
className="kuiButton kuiButton--basic kuiButton--small"
|
||||
<EuiButtonIcon
|
||||
iconType="doubleArrowLeft"
|
||||
size="xs"
|
||||
style={{ opacity: 0.2 + mc.overlap / mc.v2 }}
|
||||
aria-label={mergeTerm2ToTerm1ButtonMsg}
|
||||
onClick={onMergeTerm2ToTerm1Click}
|
||||
>
|
||||
<span className="kuiIcon fa-chevron-circle-left" />
|
||||
</button>
|
||||
/>
|
||||
</EuiToolTip>
|
||||
</span>
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiIcon } from '@elastic/eui';
|
||||
import { Workspace } from '../../types';
|
||||
|
||||
interface SelectStyleProps {
|
||||
|
@ -18,7 +19,7 @@ export const SelectStyle = ({ colors, workspace }: SelectStyleProps) => {
|
|||
return (
|
||||
<div className="gphSidebar__panel">
|
||||
<div className="gphSidebar__header">
|
||||
<span className="kuiIcon fa-paint-brush" />
|
||||
<EuiIcon type="brush" size="s" />{' '}
|
||||
{i18n.translate('xpack.graph.sidebar.styleVerticesTitle', {
|
||||
defaultMessage: 'Style selected vertices',
|
||||
})}
|
||||
|
@ -31,11 +32,12 @@ export const SelectStyle = ({ colors, workspace }: SelectStyleProps) => {
|
|||
workspace.changeHandler();
|
||||
};
|
||||
return (
|
||||
<span
|
||||
<EuiIcon
|
||||
type="stopFilled"
|
||||
color={c}
|
||||
className="gphColorPicker__color"
|
||||
aria-hidden="true"
|
||||
onClick={onSelectColor}
|
||||
style={{ color: c }}
|
||||
className="kuiIcon gphColorPicker__color fa-circle"
|
||||
/>
|
||||
);
|
||||
})}
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
|
||||
import React from 'react';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { EuiToolTip } from '@elastic/eui';
|
||||
import { EuiButtonEmpty, EuiToolTip, useEuiTheme } from '@elastic/eui';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { Workspace, WorkspaceNode } from '../../types';
|
||||
import { IconRenderer } from '../icon_renderer';
|
||||
|
||||
interface SelectedNodeEditorProps {
|
||||
workspace: Workspace;
|
||||
|
@ -17,6 +18,7 @@ interface SelectedNodeEditorProps {
|
|||
}
|
||||
|
||||
export const SelectedNodeEditor = ({ workspace, selectedNode }: SelectedNodeEditorProps) => {
|
||||
const { euiTheme } = useEuiTheme();
|
||||
const groupButtonMsg = i18n.translate('xpack.graph.sidebar.groupButtonTooltip', {
|
||||
defaultMessage: 'group the currently selected items into {latestSelectionLabel}',
|
||||
values: { latestSelectionLabel: selectedNode.label },
|
||||
|
@ -40,35 +42,27 @@ export const SelectedNodeEditor = ({ workspace, selectedNode }: SelectedNodeEdit
|
|||
return (
|
||||
<div className="gphSidebar__panel">
|
||||
<div className="gphSidebar__header">
|
||||
{selectedNode.icon && <span className={`kuiIcon ${selectedNode.icon.class}`} />}
|
||||
<IconRenderer icon={selectedNode.icon} color={euiTheme.colors.darkShade} />{' '}
|
||||
{selectedNode.data.field} {selectedNode.data.term}
|
||||
</div>
|
||||
|
||||
{(workspace.selectedNodes.length > 1 ||
|
||||
(workspace.selectedNodes.length > 0 && workspace.selectedNodes[0] !== selectedNode)) && (
|
||||
<EuiToolTip content={groupButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--iconText kuiButton--small"
|
||||
onClick={onGroupButtonClick}
|
||||
>
|
||||
<span className="kuiButton__icon kuiIcon fa-object-group" />
|
||||
<EuiButtonEmpty iconType="fold" onClick={onGroupButtonClick}>
|
||||
<FormattedMessage id="xpack.graph.sidebar.groupButtonLabel" defaultMessage="group" />
|
||||
</button>
|
||||
</EuiButtonEmpty>
|
||||
</EuiToolTip>
|
||||
)}
|
||||
|
||||
{selectedNode.numChildren > 0 && (
|
||||
<EuiToolTip content={ungroupButtonMsg}>
|
||||
<button
|
||||
className="kuiButton kuiButton--basic kuiButton--iconText kuiButton--small"
|
||||
onClick={onClickUngroup}
|
||||
>
|
||||
<span className="kuiIcon fa-object-ungroup" />
|
||||
<EuiButtonEmpty iconType="unfold" onClick={onClickUngroup}>
|
||||
<FormattedMessage
|
||||
id="xpack.graph.sidebar.ungroupButtonLabel"
|
||||
defaultMessage="ungroup"
|
||||
/>
|
||||
</button>
|
||||
</EuiButtonEmpty>
|
||||
</EuiToolTip>
|
||||
)}
|
||||
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { hexToRgb, isColorDark } from '@elastic/eui';
|
||||
import classNames from 'classnames';
|
||||
import React from 'react';
|
||||
import { WorkspaceNode } from '../../types';
|
||||
|
||||
const isHexColorDark = (color: string) => isColorDark(...hexToRgb(color));
|
||||
import { getIconOffset, IconRenderer } from '../icon_renderer';
|
||||
|
||||
interface SelectedNodeItemProps {
|
||||
node: WorkspaceNode;
|
||||
|
@ -19,6 +17,16 @@ interface SelectedNodeItemProps {
|
|||
onSelectedFieldClick: (node: WorkspaceNode) => void;
|
||||
}
|
||||
|
||||
function fixIconOffset(node: WorkspaceNode) {
|
||||
const offset = getIconOffset(node.icon) || { x: 0, y: 0 };
|
||||
const finalOffset = { x: offset.x / 2, y: offset.y / 2 };
|
||||
// Maki icons need to be offset a little bit more on the right (~0.5px)
|
||||
if (node.icon?.package === 'maki') {
|
||||
finalOffset.x += 0.5;
|
||||
}
|
||||
return finalOffset;
|
||||
}
|
||||
|
||||
export const SelectedNodeItem = ({
|
||||
node,
|
||||
isHighlighted,
|
||||
|
@ -28,9 +36,7 @@ export const SelectedNodeItem = ({
|
|||
const fieldClasses = classNames('gphSelectionList__field', {
|
||||
['gphSelectionList__field--selected']: isHighlighted,
|
||||
});
|
||||
const fieldIconClasses = classNames('fa', 'gphNode__text', 'gphSelectionList__icon', {
|
||||
['gphNode__text--inverse']: isHexColorDark(node.color),
|
||||
});
|
||||
const offset = fixIconOffset(node);
|
||||
|
||||
return (
|
||||
<div aria-hidden="true" className={fieldClasses} onClick={() => onSelectedFieldClick(node)}>
|
||||
|
@ -42,19 +48,15 @@ export const SelectedNodeItem = ({
|
|||
cy="12"
|
||||
style={{ fill: node.color }}
|
||||
onClick={() => onDeselectNode(node)}
|
||||
data-test-subj={`graph-selected-${node.label}`}
|
||||
/>
|
||||
<IconRenderer
|
||||
color={node.color}
|
||||
icon={node.icon}
|
||||
className="gphSelectionList__icon"
|
||||
x={offset.x}
|
||||
y={offset.y}
|
||||
/>
|
||||
|
||||
{node.icon && (
|
||||
<text
|
||||
className={fieldIconClasses}
|
||||
textAnchor="middle"
|
||||
x="12"
|
||||
y="16"
|
||||
onClick={() => onDeselectNode(node)}
|
||||
>
|
||||
{node.icon.code}
|
||||
</text>
|
||||
)}
|
||||
</svg>
|
||||
<span>{node.label}</span>
|
||||
{node.numChildren > 0 && <span> (+{node.numChildren})</span>}
|
||||
|
|
|
@ -29,10 +29,10 @@ import { FieldIcon } from '@kbn/react-field';
|
|||
import classNames from 'classnames';
|
||||
import { WorkspaceField } from '../../types';
|
||||
import { iconChoices } from '../../helpers/style_choices';
|
||||
import { LegacyIcon } from '../legacy_icon';
|
||||
import { UpdateableFieldProperties } from './field_manager';
|
||||
|
||||
import { isEqual } from '../helpers';
|
||||
import { IconRenderer } from '../icon_renderer';
|
||||
|
||||
export interface FieldPickerProps {
|
||||
field: WorkspaceField;
|
||||
|
@ -145,7 +145,11 @@ export function FieldEditor({
|
|||
}
|
||||
}}
|
||||
>
|
||||
<LegacyIcon className={'gphFieldEditor__badgeIcon'} icon={initialField.icon} />
|
||||
<IconRenderer
|
||||
className="gphFieldEditor__badgeIcon"
|
||||
icon={initialField.icon}
|
||||
color={color}
|
||||
/>
|
||||
{initialField.name}
|
||||
</EuiBadge>
|
||||
}
|
||||
|
@ -286,7 +290,7 @@ export function FieldEditor({
|
|||
const { label, value } = option;
|
||||
return (
|
||||
<span className={contentClassName}>
|
||||
<LegacyIcon icon={value!} />{' '}
|
||||
<IconRenderer icon={value!} />{' '}
|
||||
<EuiHighlight search={searchValue}>{label}</EuiHighlight>
|
||||
</span>
|
||||
);
|
||||
|
|
|
@ -91,15 +91,19 @@ exports[`graph_visualization should render to svg elements 1`] = `
|
|||
}
|
||||
}
|
||||
/>
|
||||
<text
|
||||
className="fa gphNode__text gphNode__text--inverse"
|
||||
textAnchor="middle"
|
||||
transform="translate(0,5)"
|
||||
x={5}
|
||||
y={5}
|
||||
>
|
||||
a
|
||||
</text>
|
||||
<IconRenderer
|
||||
color="black"
|
||||
icon={
|
||||
Object {
|
||||
"id": "a",
|
||||
"label": "",
|
||||
"package": "eui",
|
||||
"prevName": "",
|
||||
}
|
||||
}
|
||||
x={-2.5}
|
||||
y={-3.5}
|
||||
/>
|
||||
<text
|
||||
className="gphNode__label"
|
||||
textAnchor="middle"
|
||||
|
@ -145,15 +149,19 @@ exports[`graph_visualization should render to svg elements 1`] = `
|
|||
}
|
||||
}
|
||||
/>
|
||||
<text
|
||||
className="fa gphNode__text gphNode__text--inverse"
|
||||
textAnchor="middle"
|
||||
transform="translate(0,5)"
|
||||
x={7}
|
||||
y={9}
|
||||
>
|
||||
b
|
||||
</text>
|
||||
<IconRenderer
|
||||
color="red"
|
||||
icon={
|
||||
Object {
|
||||
"id": "b",
|
||||
"label": "",
|
||||
"package": "eui",
|
||||
"prevName": "",
|
||||
}
|
||||
}
|
||||
x={-0.5}
|
||||
y={0.5}
|
||||
/>
|
||||
<text
|
||||
className="gphNode__label"
|
||||
textAnchor="middle"
|
||||
|
@ -181,15 +189,19 @@ exports[`graph_visualization should render to svg elements 1`] = `
|
|||
}
|
||||
}
|
||||
/>
|
||||
<text
|
||||
className="fa gphNode__text gphNode__text--inverse"
|
||||
textAnchor="middle"
|
||||
transform="translate(0,5)"
|
||||
x={12}
|
||||
y={2}
|
||||
>
|
||||
c
|
||||
</text>
|
||||
<IconRenderer
|
||||
color="yellow"
|
||||
icon={
|
||||
Object {
|
||||
"id": "c",
|
||||
"label": "",
|
||||
"package": "eui",
|
||||
"prevName": "",
|
||||
}
|
||||
}
|
||||
x={4.5}
|
||||
y={-6.5}
|
||||
/>
|
||||
<text
|
||||
className="gphNode__label"
|
||||
textAnchor="middle"
|
||||
|
|
|
@ -72,11 +72,3 @@
|
|||
stroke: transparentize($euiColorPrimary, .25);
|
||||
}
|
||||
}
|
||||
|
||||
.gphNode__text {
|
||||
fill: $euiColorInk;
|
||||
|
||||
&--inverse {
|
||||
fill: $euiColorGhost;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,9 @@ describe('graph_visualization', () => {
|
|||
term: '1',
|
||||
},
|
||||
icon: {
|
||||
class: 'a',
|
||||
code: 'a',
|
||||
id: 'a',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: '',
|
||||
},
|
||||
isSelected: true,
|
||||
|
@ -42,8 +43,9 @@ describe('graph_visualization', () => {
|
|||
term: '2',
|
||||
},
|
||||
icon: {
|
||||
class: 'b',
|
||||
code: 'b',
|
||||
id: 'b',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: '',
|
||||
},
|
||||
isSelected: false,
|
||||
|
@ -64,8 +66,9 @@ describe('graph_visualization', () => {
|
|||
term: '3',
|
||||
},
|
||||
icon: {
|
||||
class: 'c',
|
||||
code: 'c',
|
||||
id: 'c',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: '',
|
||||
},
|
||||
isSelected: false,
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
import React, { useRef } from 'react';
|
||||
import classNames from 'classnames';
|
||||
import d3, { ZoomEvent } from 'd3';
|
||||
import { isColorDark, hexToRgb } from '@elastic/eui';
|
||||
import { Workspace, WorkspaceNode, TermIntersect, ControlType, WorkspaceEdge } from '../../types';
|
||||
import { makeNodeId } from '../../services/persistence';
|
||||
import { getIconOffset, IconRenderer } from '../icon_renderer';
|
||||
|
||||
export interface GraphVisualizationProps {
|
||||
workspace: Workspace;
|
||||
|
@ -144,90 +144,88 @@ export function GraphVisualization({
|
|||
{workspace.nodes &&
|
||||
workspace.nodes
|
||||
.filter((node) => !node.parent)
|
||||
.map((node) => (
|
||||
<g
|
||||
key={makeNodeId(node.data.field, node.data.term)}
|
||||
onClick={(e) => {
|
||||
nodeClick(node, e);
|
||||
}}
|
||||
onMouseDown={(e) => {
|
||||
// avoid selecting text when selecting nodes
|
||||
if (e.ctrlKey || e.shiftKey) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}}
|
||||
className="gphNode"
|
||||
>
|
||||
<circle
|
||||
cx={node.kx}
|
||||
cy={node.ky}
|
||||
r={node.scaledSize}
|
||||
className={classNames('gphNode__circle', {
|
||||
'gphNode__circle--selected': node.isSelected,
|
||||
})}
|
||||
style={{ fill: node.color }}
|
||||
/>
|
||||
{node.icon && (
|
||||
<text
|
||||
className={classNames('fa gphNode__text', {
|
||||
'gphNode__text--inverse': isColorDark(...hexToRgb(node.color)),
|
||||
.map((node) => {
|
||||
const iconOffset = getIconOffset(node.icon);
|
||||
const kx = node.kx || 0;
|
||||
const ky = node.ky || 0;
|
||||
return (
|
||||
<g
|
||||
key={makeNodeId(node.data.field, node.data.term)}
|
||||
onClick={(e) => {
|
||||
nodeClick(node, e);
|
||||
}}
|
||||
onMouseDown={(e) => {
|
||||
// avoid selecting text when selecting nodes
|
||||
if (e.ctrlKey || e.shiftKey) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}}
|
||||
className="gphNode"
|
||||
>
|
||||
<circle
|
||||
cx={kx}
|
||||
cy={ky}
|
||||
r={node.scaledSize}
|
||||
className={classNames('gphNode__circle', {
|
||||
'gphNode__circle--selected': node.isSelected,
|
||||
})}
|
||||
transform="translate(0,5)"
|
||||
textAnchor="middle"
|
||||
x={node.kx}
|
||||
y={node.ky}
|
||||
>
|
||||
{node.icon.code}
|
||||
</text>
|
||||
)}
|
||||
style={{ fill: node.color }}
|
||||
/>
|
||||
<IconRenderer
|
||||
icon={node.icon}
|
||||
color={node.color}
|
||||
x={kx - (iconOffset?.x || 0)}
|
||||
y={ky - (iconOffset?.y || 0)}
|
||||
/>
|
||||
|
||||
{node.label.length < 30 && (
|
||||
<text
|
||||
className="gphNode__label"
|
||||
textAnchor="middle"
|
||||
transform="translate(0,22)"
|
||||
x={node.kx}
|
||||
y={node.ky}
|
||||
>
|
||||
{node.label}
|
||||
</text>
|
||||
)}
|
||||
{node.label.length >= 30 && (
|
||||
<foreignObject
|
||||
width="100"
|
||||
height="20"
|
||||
transform="translate(-50,15)"
|
||||
x={node.kx}
|
||||
y={node.ky}
|
||||
>
|
||||
<p className="gphNode__label gphNode__label--html gphNoUserSelect">
|
||||
{node.label}
|
||||
</p>
|
||||
</foreignObject>
|
||||
)}
|
||||
|
||||
{node.numChildren > 0 && (
|
||||
<g>
|
||||
<circle
|
||||
r="5"
|
||||
className="gphNode__markerCircle"
|
||||
transform="translate(10,10)"
|
||||
cx={node.kx}
|
||||
cy={node.ky}
|
||||
/>
|
||||
{node.label.length < 30 && (
|
||||
<text
|
||||
className="gphNode__markerText"
|
||||
className="gphNode__label"
|
||||
textAnchor="middle"
|
||||
transform="translate(10,12)"
|
||||
x={node.kx}
|
||||
y={node.ky}
|
||||
transform="translate(0,22)"
|
||||
x={kx}
|
||||
y={ky}
|
||||
>
|
||||
{node.numChildren}
|
||||
{node.label}
|
||||
</text>
|
||||
</g>
|
||||
)}
|
||||
</g>
|
||||
))}
|
||||
)}
|
||||
{node.label.length >= 30 && (
|
||||
<foreignObject
|
||||
width="100"
|
||||
height="20"
|
||||
transform="translate(-50,15)"
|
||||
x={kx}
|
||||
y={ky}
|
||||
>
|
||||
<p className="gphNode__label gphNode__label--html gphNoUserSelect">
|
||||
{node.label}
|
||||
</p>
|
||||
</foreignObject>
|
||||
)}
|
||||
|
||||
{node.numChildren > 0 && (
|
||||
<g>
|
||||
<circle
|
||||
r="5"
|
||||
className="gphNode__markerCircle"
|
||||
transform="translate(10,10)"
|
||||
cx={kx}
|
||||
cy={ky}
|
||||
/>
|
||||
<text
|
||||
className="gphNode__markerText"
|
||||
textAnchor="middle"
|
||||
transform="translate(10,12)"
|
||||
x={kx}
|
||||
y={ky}
|
||||
>
|
||||
{node.numChildren}
|
||||
</text>
|
||||
</g>
|
||||
)}
|
||||
</g>
|
||||
);
|
||||
})}
|
||||
</g>
|
||||
</svg>
|
||||
);
|
||||
|
|
73
x-pack/plugins/graph/public/components/icon_renderer.tsx
Normal file
73
x-pack/plugins/graph/public/components/icon_renderer.tsx
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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 { isColorDark, EuiIcon, EuiIconProps } from '@elastic/eui';
|
||||
import chroma from 'chroma-js';
|
||||
import React from 'react';
|
||||
import type { GenericIcon } from '../helpers/style_choices';
|
||||
import { MAKI_ICONS } from './maki_icons/assets';
|
||||
|
||||
function getIconColor(color?: string) {
|
||||
if (color == null) {
|
||||
return 'black';
|
||||
}
|
||||
return isColorDark(...chroma(color).rgb()) ? 'white' : 'black';
|
||||
}
|
||||
|
||||
interface IconRendererProps extends Omit<EuiIconProps, 'type'> {
|
||||
icon: GenericIcon | null;
|
||||
}
|
||||
|
||||
export const getIconOffset = (icon: GenericIcon | null) => {
|
||||
if (icon == null) {
|
||||
return;
|
||||
}
|
||||
return {
|
||||
x: 7.5,
|
||||
y: 8.5,
|
||||
};
|
||||
};
|
||||
|
||||
export const IconRenderer = ({
|
||||
icon,
|
||||
color,
|
||||
className,
|
||||
onClick,
|
||||
x,
|
||||
y,
|
||||
...otherIconProps
|
||||
}: IconRendererProps) => {
|
||||
if (icon == null) {
|
||||
return null;
|
||||
}
|
||||
const backgroundColor = getIconColor(color);
|
||||
if (icon.package === 'maki') {
|
||||
return (
|
||||
<EuiIcon
|
||||
type={MAKI_ICONS[icon.id].Svg}
|
||||
aria-label={MAKI_ICONS[icon.id].label}
|
||||
color={backgroundColor}
|
||||
className={className}
|
||||
onClick={onClick}
|
||||
x={x}
|
||||
y={y}
|
||||
{...otherIconProps}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<EuiIcon
|
||||
type={icon.id}
|
||||
color={backgroundColor}
|
||||
className={className}
|
||||
onClick={onClick}
|
||||
x={x}
|
||||
y={y}
|
||||
{...otherIconProps}
|
||||
/>
|
||||
);
|
||||
};
|
|
@ -1 +0,0 @@
|
|||
@import './legacy_icon';
|
|
@ -1,20 +0,0 @@
|
|||
.gphLegacyIcon {
|
||||
width: $euiSizeS * 2;
|
||||
|
||||
&--list {
|
||||
margin-right: $euiSizeM;
|
||||
}
|
||||
|
||||
&--pickable {
|
||||
margin: $euiSizeXS;
|
||||
cursor: pointer;
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
&--pickable:hover,
|
||||
&--pickable:focus,
|
||||
&--selected {
|
||||
transform: scale(1.4);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export * from './legacy_icon';
|
|
@ -1,49 +0,0 @@
|
|||
/*
|
||||
* 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 classNames from 'classnames';
|
||||
import React from 'react';
|
||||
import { EuiButtonEmpty } from '@elastic/eui';
|
||||
import { FontawesomeIcon } from '../../helpers/style_choices';
|
||||
|
||||
export interface LegacyIconProps {
|
||||
icon: FontawesomeIcon;
|
||||
selected?: boolean;
|
||||
onClick?: () => void;
|
||||
asListIcon?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function LegacyIcon(props: LegacyIconProps) {
|
||||
const icon = (
|
||||
<i
|
||||
className={classNames('fa', props.className, 'gphLegacyIcon', {
|
||||
'gphLegacyIcon--selected': props.selected,
|
||||
'gphLegacyIcon--pickable': !!props.onClick,
|
||||
'gphLegacyIcon--list': props.asListIcon,
|
||||
})}
|
||||
aria-label={props.icon.label}
|
||||
>
|
||||
{props.icon.code}
|
||||
</i>
|
||||
);
|
||||
|
||||
if (props.onClick) {
|
||||
return (
|
||||
<EuiButtonEmpty
|
||||
role="option"
|
||||
aria-selected={props.selected}
|
||||
color={props.selected ? 'primary' : 'text'}
|
||||
onClick={props.onClick}
|
||||
>
|
||||
{icon}
|
||||
</EuiButtonEmpty>
|
||||
);
|
||||
} else {
|
||||
return icon;
|
||||
}
|
||||
}
|
147
x-pack/plugins/graph/public/components/maki_icons/assets.tsx
Normal file
147
x-pack/plugins/graph/public/components/maki_icons/assets.tsx
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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, { SVGProps } from 'react';
|
||||
|
||||
const Airport = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="airport-15"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15px"
|
||||
height="15px"
|
||||
viewBox="0 0 15 15"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
id="path7712-0"
|
||||
d="M15,6.8182L15,8.5l-6.5-1
	l-0.3182,4.7727L11,14v1l-3.5-0.6818L4,15v-1l2.8182-1.7273L6.5,7.5L0,8.5V6.8182L6.5,4.5v-3c0,0,0-1.5,1-1.5s1,1.5,1,1.5v2.8182
	L15,6.8182z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
const Car = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="car-15"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15px"
|
||||
height="15px"
|
||||
viewBox="0 0 15 15"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M14,7c-0.004-0.6904-0.4787-1.2889-1.15-1.45l-1.39-3.24l0,0l0,0l0,0C11.3833,2.1233,11.2019,2.001,11,2H4
	C3.8124,2.0034,3.6425,2.1115,3.56,2.28l0,0l0,0l0,0L2.15,5.54C1.475,5.702,0.9994,6.3059,1,7v3.5h1v1c0,0.5523,0.4477,1,1,1
	s1-0.4477,1-1v-1h7v1c0,0.5523,0.4477,1,1,1s1-0.4477,1-1v-1h1V7z M4.3,3h6.4l1.05,2.5h-8.5L4.3,3z M3,9C2.4477,9,2,8.5523,2,8
	s0.4477-1,1-1s1,0.4477,1,1S3.5523,9,3,9z M12,9c-0.5523,0-1-0.4477-1-1s0.4477-1,1-1s1,0.4477,1,1S12.5523,9,12,9z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
const Industry = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="industry-15"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15px"
|
||||
height="15px"
|
||||
viewBox="0 0 15 15"
|
||||
{...props}
|
||||
>
|
||||
{' '}
|
||||
<path
|
||||
d="M14,1v12H1V8.72c0.0016-0.1419,0.0634-0.2764,0.17-0.37l3-3.22c0.2074-0.1823,0.5234-0.1618,0.7056,0.0456
	C4.9568,5.268,5.0011,5.387,5,5.51v3l3.16-3.37c0.2025-0.1878,0.5188-0.1759,0.7066,0.0266C8.9532,5.2599,9.0009,5.3827,9,5.51V11h3
	V1H14z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
const TownHall = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="town-hall-15"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15px"
|
||||
height="15px"
|
||||
viewBox="0 0 15 15"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
id="path7509"
|
||||
d="M7.5,0L1,3.4453V4h13V3.4453L7.5,0z M2,5v5l-1,1.5547V13h13v-1.4453L13,10V5H2z M4,6h1v5.5H4V6z M7,6h1v5.5H7
	V6z M10,6h1v5.5h-1V6z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
const Music = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="music-15"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15px"
|
||||
height="15px"
|
||||
viewBox="0 0 15 15"
|
||||
{...props}
|
||||
>
|
||||
<path
|
||||
d="M13.5,1c-0.0804,0.0008-0.1594,0.0214-0.23,0.06L4.5,3.5C4.2239,3.5,4,3.7239,4,4v6.28C3.6971,10.1002,3.3522,10.0037,3,10
	c-1.1046,0-2,0.8954-2,2s0.8954,2,2,2s2-0.8954,2-2V7.36l8-2.22v3.64c-0.3029-0.1798-0.6478-0.2763-1-0.28c-1.1046,0-2,0.8954-2,2
	s0.8954,2,2,2s2-0.8954,2-2v-9C14,1.2239,13.7761,1,13.5,1z M13,4.14L5,6.36v-2l8-2.22C13,2.14,13,4.14,13,4.14z"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
const Telephone = (props: SVGProps<SVGSVGElement>) => {
|
||||
return (
|
||||
<svg
|
||||
version="1.1"
|
||||
id="telephone-15"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="15px"
|
||||
height="15px"
|
||||
viewBox="0 0 15 15"
|
||||
{...props}
|
||||
>
|
||||
<path d="M4.51,8.88a0.51,0.51,0,0,0,0,.72l0.72,0.72L3.07,12.5,2.7,12.13A2.24,2.24,0,0,1,2,10.69V9.24a2.24,2.24,0,0,1,.7-1.45L7.77,2.72A2.24,2.24,0,0,1,9.22,2h1.45a2.24,2.24,0,0,1,1.45.72l0.36,0.36L10.31,5.26,9.58,4.53a0.51,0.51,0,0,0-.72,0ZM4.13,13.6a1,1,0,0,0,1.4137.0363Q5.5623,13.6186,5.58,13.6l0.72-.72a1,1,0,0,0,.0363-1.4137Q6.3186,11.4477,6.3,11.43Zm7.25-7.28a1,1,0,0,0,1.4137.0363C12.8061,6.3445,13.55,5.6,13.55,5.6a1,1,0,0,0,.0363-1.4137Q13.5686,4.1677,13.55,4.15Z" />
|
||||
</svg>
|
||||
);
|
||||
};
|
||||
|
||||
export const MAKI_ICONS: Record<
|
||||
string,
|
||||
{ label: string; Svg: (props: SVGProps<SVGSVGElement>) => JSX.Element }
|
||||
> = {
|
||||
airport: {
|
||||
label: 'Airport',
|
||||
Svg: Airport,
|
||||
},
|
||||
car: {
|
||||
label: 'Car',
|
||||
Svg: Car,
|
||||
},
|
||||
industry: {
|
||||
label: 'Industry',
|
||||
Svg: Industry,
|
||||
},
|
||||
town_hall: {
|
||||
label: 'Town Hall',
|
||||
Svg: TownHall,
|
||||
},
|
||||
music: {
|
||||
label: 'Music',
|
||||
Svg: Music,
|
||||
},
|
||||
telephone: {
|
||||
label: 'Telephone',
|
||||
Svg: Telephone,
|
||||
},
|
||||
};
|
|
@ -1 +1,2 @@
|
|||
@import './url_template_list';
|
||||
@import './_legacy_icon';
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
.gphLegacyIcon {
|
||||
width: $euiSizeS * 2;
|
||||
}
|
||||
|
||||
.gphLegacyIcon--list {
|
||||
margin-right: $euiSizeM;
|
||||
&--list {
|
||||
margin-right: $euiSizeM;
|
||||
}
|
||||
|
||||
&--pickable {
|
||||
margin: $euiSizeXS;
|
||||
cursor: pointer;
|
||||
opacity: .7;
|
||||
}
|
||||
|
||||
&--pickable:hover,
|
||||
&--pickable:focus,
|
||||
&--selected {
|
||||
transform: scale(1.4);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,11 +15,12 @@ import {
|
|||
EuiSpacer,
|
||||
EuiText,
|
||||
EuiCallOut,
|
||||
EuiIcon,
|
||||
} from '@elastic/eui';
|
||||
|
||||
import { SettingsWorkspaceProps } from './settings';
|
||||
import { LegacyIcon } from '../legacy_icon';
|
||||
import { useListKeys } from './use_list_keys';
|
||||
import { IconRenderer } from '../icon_renderer';
|
||||
|
||||
export function BlocklistForm({
|
||||
blocklistedNodes,
|
||||
|
@ -41,7 +42,9 @@ export function BlocklistForm({
|
|||
<FormattedMessage
|
||||
id="xpack.graph.blocklist.noEntriesDescription"
|
||||
defaultMessage="You don't have any blocked terms. Select vertices and click {stopSign} in the control panel on the right to block them. Documents that match blocked terms are no longer explored and relationships to them are hidden."
|
||||
values={{ stopSign: <span className="kuiIcon fa-ban" /> }}
|
||||
values={{
|
||||
stopSign: <EuiIcon type="eyeClosed" />,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
@ -52,7 +55,9 @@ export function BlocklistForm({
|
|||
<EuiListGroup bordered maxWidth={false}>
|
||||
{blocklistedNodes.map((node) => (
|
||||
<EuiListGroupItem
|
||||
icon={<LegacyIcon icon={node.icon} asListIcon />}
|
||||
icon={
|
||||
<IconRenderer icon={node.icon} className="gphLegacyIcon gphLegacyIcon--list" />
|
||||
}
|
||||
key={getListKey(node)}
|
||||
label={node.label}
|
||||
extraAction={{
|
||||
|
|
|
@ -51,8 +51,9 @@ describe('settings', () => {
|
|||
},
|
||||
url: 'http://example.org',
|
||||
icon: {
|
||||
class: 'test',
|
||||
code: '1',
|
||||
id: 'test',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: 'test',
|
||||
},
|
||||
isDefault: false,
|
||||
|
@ -72,8 +73,9 @@ describe('settings', () => {
|
|||
},
|
||||
label: 'blocklisted node 1',
|
||||
icon: {
|
||||
class: 'test',
|
||||
code: '1',
|
||||
id: 'test',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: 'test',
|
||||
},
|
||||
},
|
||||
|
@ -89,8 +91,9 @@ describe('settings', () => {
|
|||
},
|
||||
label: 'blocklisted node 2',
|
||||
icon: {
|
||||
class: 'test',
|
||||
code: '1',
|
||||
id: 'test',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: 'test',
|
||||
},
|
||||
},
|
||||
|
@ -122,8 +125,9 @@ describe('settings', () => {
|
|||
name: 'B',
|
||||
type: 'string',
|
||||
icon: {
|
||||
class: 'test',
|
||||
code: '1',
|
||||
id: 'test',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: 'test',
|
||||
},
|
||||
aggregatable: true,
|
||||
|
@ -134,8 +138,9 @@ describe('settings', () => {
|
|||
name: 'C',
|
||||
type: 'string',
|
||||
icon: {
|
||||
class: 'test',
|
||||
code: '1',
|
||||
id: 'test',
|
||||
package: 'eui',
|
||||
prevName: '',
|
||||
label: 'test',
|
||||
},
|
||||
aggregatable: true,
|
||||
|
@ -241,9 +246,10 @@ describe('settings', () => {
|
|||
},
|
||||
label: 'blocklisted node 3',
|
||||
icon: {
|
||||
class: 'test',
|
||||
code: '1',
|
||||
id: 'test',
|
||||
package: 'eui',
|
||||
label: 'test',
|
||||
prevName: '',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -20,11 +20,11 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import classNames from 'classnames';
|
||||
import { UrlTemplate } from '../../types';
|
||||
import { LegacyIcon } from '../legacy_icon';
|
||||
import { outlinkEncoders } from '../../helpers/outlink_encoders';
|
||||
import { urlTemplateIconChoices } from '../../helpers/style_choices';
|
||||
import { isUrlTemplateValid, isKibanaUrl, replaceKibanaUrlParam } from '../../helpers/url_template';
|
||||
import { isEqual } from '../helpers';
|
||||
import { IconRenderer } from '../icon_renderer';
|
||||
|
||||
export interface NewFormProps {
|
||||
onSubmit: (template: UrlTemplate) => void;
|
||||
|
@ -126,7 +126,12 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {
|
|||
}
|
||||
extraAction={
|
||||
isUpdateForm(props) &&
|
||||
props.initialTemplate.icon && <LegacyIcon asListIcon icon={props.initialTemplate.icon} />
|
||||
props.initialTemplate.icon && (
|
||||
<IconRenderer
|
||||
icon={props.initialTemplate.icon}
|
||||
className="gphLegacyIcon gphLegacyIcon--list"
|
||||
/>
|
||||
)
|
||||
}
|
||||
className={classNames('gphUrlTemplateList__accordion', {
|
||||
'gphUrlTemplateList__accordion--isOpen': open,
|
||||
|
@ -271,10 +276,7 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {
|
|||
)}
|
||||
>
|
||||
{urlTemplateIconChoices.map((icon) => (
|
||||
<LegacyIcon
|
||||
aria-label={icon.label}
|
||||
key={icon.class}
|
||||
selected={icon === currentTemplate.icon}
|
||||
<IconRenderer
|
||||
icon={icon}
|
||||
onClick={() => {
|
||||
if (currentTemplate.icon === icon) {
|
||||
|
@ -283,6 +285,9 @@ export function UrlTemplateForm(props: UrlTemplateFormProps) {
|
|||
setValue('icon', icon);
|
||||
}
|
||||
}}
|
||||
className={classNames('gphLegacyIcon gphLegacyIcon--pickable', {
|
||||
'gphLegacyIcon--selected': icon === currentTemplate.icon,
|
||||
})}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
@font-face {
|
||||
font-family: 'FontAwesome';
|
||||
src: url('~font-awesome/fonts/fontawesome-webfont.eot?v=4.7.0');
|
||||
src: url('~font-awesome/fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),
|
||||
url('~font-awesome/fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),
|
||||
url('~font-awesome/fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),
|
||||
url('~font-awesome/fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),
|
||||
url('~font-awesome/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@import 'font-awesome/scss/variables';
|
||||
@import 'font-awesome/scss/core';
|
||||
@import 'font-awesome/scss/icons';
|
||||
|
||||
// new file icon
|
||||
.#{$fa-css-prefix}-file-new-o:before { content: $fa-var-file-o; }
|
||||
.#{$fa-css-prefix}-file-new-o:after { content: $fa-var-plus; position: relative; margin-left: -1.0em; font-size: .5em; }
|
||||
|
||||
// alias for alert types - allows class="fa fa-{{alertType}}"
|
||||
.fa-success:before { content: $fa-var-check; }
|
||||
.fa-danger:before { content: $fa-var-exclamation-circle; }
|
|
@ -1,8 +0,0 @@
|
|||
/*
|
||||
* 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 './font_awesome.scss';
|
|
@ -59,7 +59,7 @@ function mapHits(hit: any, url: string): GraphWorkspaceSavedObject {
|
|||
source.id = hit.id;
|
||||
source.url = url;
|
||||
source.updatedAt = hit.updatedAt;
|
||||
source.icon = 'fa-share-alt'; // looks like a graph
|
||||
source.icon = 'cluster'; // maybe there's a better choice here?
|
||||
return source;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,72 +9,82 @@ import { i18n } from '@kbn/i18n';
|
|||
// @ts-ignore
|
||||
import { euiPaletteColorBlind } from '@elastic/eui/lib/services';
|
||||
|
||||
export interface FontawesomeIcon {
|
||||
class: string;
|
||||
code: string;
|
||||
patterns?: RegExp[];
|
||||
export interface GenericIcon {
|
||||
label: string;
|
||||
patterns?: RegExp[];
|
||||
id: string;
|
||||
package: 'maki' | 'eui';
|
||||
prevName: string;
|
||||
}
|
||||
|
||||
export const iconChoices = [
|
||||
// Patterns are used to help default icon choices for common field names
|
||||
export const iconChoices: GenericIcon[] = [
|
||||
{
|
||||
class: 'fa-folder-open-o',
|
||||
code: '\uf115',
|
||||
id: 'folderOpen',
|
||||
prevName: 'fa-folder-open-o',
|
||||
package: 'eui',
|
||||
patterns: [/category/i, /folder/i, /group/i],
|
||||
label: i18n.translate('xpack.graph.icon.folderOpen', { defaultMessage: 'Folder open' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-cube',
|
||||
code: '\uf1b2',
|
||||
id: 'kubernetesPod',
|
||||
prevName: 'fa-cube',
|
||||
package: 'eui',
|
||||
patterns: [/prod/i, /sku/i],
|
||||
label: i18n.translate('xpack.graph.icon.cube', { defaultMessage: 'Cube' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-key',
|
||||
code: '\uf084',
|
||||
id: 'key',
|
||||
prevName: 'fa-key',
|
||||
package: 'eui',
|
||||
patterns: [/key/i],
|
||||
label: i18n.translate('xpack.graph.icon.key', { defaultMessage: 'Key' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-bank',
|
||||
code: '\uf19c',
|
||||
id: 'town_hall',
|
||||
prevName: 'fa-bank',
|
||||
package: 'maki',
|
||||
patterns: [/bank/i, /account/i],
|
||||
label: i18n.translate('xpack.graph.icon.bank', { defaultMessage: 'Bank' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-automobile',
|
||||
code: '\uf1b9',
|
||||
id: 'car',
|
||||
prevName: 'fa-automobile',
|
||||
package: 'maki',
|
||||
patterns: [/car/i, /veh/i],
|
||||
label: i18n.translate('xpack.graph.icon.automobile', { defaultMessage: 'Automobile' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-home',
|
||||
code: '\uf015',
|
||||
id: 'home',
|
||||
prevName: 'fa-home',
|
||||
package: 'eui',
|
||||
patterns: [/address/i, /home/i],
|
||||
label: i18n.translate('xpack.graph.icon.home', { defaultMessage: 'Home' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-question',
|
||||
code: '\uf128',
|
||||
id: 'questionInCircle',
|
||||
prevName: 'fa-question',
|
||||
package: 'eui',
|
||||
patterns: [/query/i, /search/i],
|
||||
label: i18n.translate('xpack.graph.icon.question', { defaultMessage: 'Question' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-plane',
|
||||
code: '\uf072',
|
||||
id: 'airport',
|
||||
prevName: 'fa-plane',
|
||||
package: 'maki',
|
||||
patterns: [/flight/i, /plane/i],
|
||||
label: i18n.translate('xpack.graph.icon.plane', { defaultMessage: 'Plane' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-file-o',
|
||||
code: '\uf016',
|
||||
id: 'document',
|
||||
prevName: 'fa-file-o',
|
||||
package: 'eui',
|
||||
patterns: [/file/i, /doc/i],
|
||||
label: i18n.translate('xpack.graph.icon.file', { defaultMessage: 'File open' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-user',
|
||||
code: '\uf007',
|
||||
id: 'user',
|
||||
prevName: 'fa-user',
|
||||
package: 'eui',
|
||||
patterns: [
|
||||
/user/i,
|
||||
/person/i,
|
||||
|
@ -88,172 +98,253 @@ export const iconChoices = [
|
|||
label: i18n.translate('xpack.graph.icon.user', { defaultMessage: 'User' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-users',
|
||||
code: '\uf0c0',
|
||||
id: 'users',
|
||||
prevName: 'fa-users',
|
||||
package: 'eui',
|
||||
patterns: [/group/i, /team/i, /meeting/i],
|
||||
label: i18n.translate('xpack.graph.icon.users', { defaultMessage: 'Users' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-music',
|
||||
code: '\uf001',
|
||||
id: 'music',
|
||||
prevName: 'fa-music',
|
||||
package: 'maki',
|
||||
patterns: [/artist/i, /sound/i, /music/i],
|
||||
label: i18n.translate('xpack.graph.icon.music', { defaultMessage: 'Music' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-flag',
|
||||
code: '\uf024',
|
||||
id: 'flag',
|
||||
prevName: 'fa-flag',
|
||||
package: 'eui',
|
||||
patterns: [/country/i, /warn/i, /flag/i],
|
||||
label: i18n.translate('xpack.graph.icon.flag', { defaultMessage: 'Flag' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-tag',
|
||||
code: '\uf02b',
|
||||
id: 'tag',
|
||||
prevName: 'fa-flag',
|
||||
package: 'eui',
|
||||
patterns: [/tag/i, /label/i],
|
||||
label: 'Tag',
|
||||
},
|
||||
{
|
||||
class: 'fa-phone',
|
||||
code: '\uf095',
|
||||
id: 'telephone',
|
||||
prevName: 'fa-phone',
|
||||
package: 'maki',
|
||||
patterns: [/phone/i],
|
||||
label: i18n.translate('xpack.graph.icon.phone', { defaultMessage: 'Phone' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-desktop',
|
||||
code: '\uf108',
|
||||
id: 'desktop',
|
||||
prevName: 'fa-desktop',
|
||||
package: 'eui',
|
||||
patterns: [/host/i, /server/i],
|
||||
label: i18n.translate('xpack.graph.icon.desktop', { defaultMessage: 'Desktop' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-font',
|
||||
code: '\uf031',
|
||||
id: 'lettering',
|
||||
prevName: 'fa-font',
|
||||
package: 'eui',
|
||||
patterns: [/text/i, /title/i, /body/i, /desc/i],
|
||||
label: i18n.translate('xpack.graph.icon.font', { defaultMessage: 'Font' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-at',
|
||||
code: '\uf1fa',
|
||||
id: 'at',
|
||||
prevName: 'fa-at',
|
||||
package: 'eui',
|
||||
patterns: [/account/i, /email/i],
|
||||
label: i18n.translate('xpack.graph.icon.at', { defaultMessage: 'At' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-heart',
|
||||
code: '\uf004',
|
||||
id: 'heart',
|
||||
prevName: 'fa-heart',
|
||||
package: 'eui',
|
||||
patterns: [/like/i, /favourite/i, /favorite/i],
|
||||
label: i18n.translate('xpack.graph.icon.heart', { defaultMessage: 'Heart' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-bolt',
|
||||
code: '\uf0e7',
|
||||
id: 'bolt',
|
||||
prevName: 'fa-bolt',
|
||||
package: 'eui',
|
||||
patterns: [/action/i],
|
||||
label: i18n.translate('xpack.graph.icon.bolt', { defaultMessage: 'Bolt' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-map-marker',
|
||||
code: '\uf041',
|
||||
id: 'mapMarker',
|
||||
prevName: 'fa-map-marker',
|
||||
package: 'eui',
|
||||
patterns: [/location/i, /geo/i, /position/i],
|
||||
label: i18n.translate('xpack.graph.icon.mapMarker', { defaultMessage: 'Map marker' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-exclamation',
|
||||
code: '\uf12a',
|
||||
id: 'warning',
|
||||
prevName: 'fa-exclamation',
|
||||
package: 'eui',
|
||||
patterns: [/risk/i, /error/i, /warn/i],
|
||||
label: i18n.translate('xpack.graph.icon.exclamation', { defaultMessage: 'Exclamation' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-industry',
|
||||
code: '\uf275',
|
||||
id: 'industry',
|
||||
prevName: 'fa-industry',
|
||||
package: 'maki',
|
||||
patterns: [/business/i, /company/i, /industry/i, /organisation/i],
|
||||
label: i18n.translate('xpack.graph.icon.industry', { defaultMessage: 'Industry' }),
|
||||
},
|
||||
];
|
||||
|
||||
export const getSuitableIcon = (fieldName: string) =>
|
||||
iconChoices.find((choice) => choice.patterns.some((pattern) => pattern.test(fieldName))) ||
|
||||
export interface FontawesomeIcon {
|
||||
class: string;
|
||||
code: string;
|
||||
patterns?: RegExp[];
|
||||
label: string;
|
||||
}
|
||||
|
||||
export const getSuitableIcon = (fieldName: string): GenericIcon =>
|
||||
iconChoices.find((choice) => choice.patterns?.some((pattern) => pattern.test(fieldName))) ||
|
||||
iconChoices[0];
|
||||
|
||||
export const iconChoicesByClass: Partial<Record<string, FontawesomeIcon>> = {};
|
||||
export const iconChoicesByClass: Partial<Record<string, GenericIcon>> = {};
|
||||
|
||||
iconChoices.forEach((icon) => {
|
||||
iconChoicesByClass[icon.class] = icon;
|
||||
iconChoicesByClass[icon.id] = icon;
|
||||
});
|
||||
|
||||
export const urlTemplateIconChoices = [
|
||||
export const urlTemplateIconChoices: GenericIcon[] = [
|
||||
// Patterns are used to help default icon choices for common field names
|
||||
{
|
||||
class: 'fa-line-chart',
|
||||
code: '\uf201',
|
||||
id: 'visLine',
|
||||
prevName: 'fa-line-chart',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.lineChart', { defaultMessage: 'Line chart' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-pie-chart',
|
||||
code: '\uf200',
|
||||
id: 'visPie',
|
||||
prevName: 'fa-pie-chart',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.pieChart', { defaultMessage: 'Pie chart' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-area-chart',
|
||||
code: '\uf1fe',
|
||||
id: 'visArea',
|
||||
prevName: 'fa-area-chart',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.areaChart', { defaultMessage: 'Area chart' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-bar-chart',
|
||||
code: '\uf080',
|
||||
id: 'visBarVertical',
|
||||
prevName: 'fa-bar-chart',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.barChart', { defaultMessage: 'Bar chart' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-globe',
|
||||
code: '\uf0ac',
|
||||
id: 'globe',
|
||||
prevName: 'fa-globe',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.globe', { defaultMessage: 'Globe' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-file-text-o',
|
||||
code: '\uf0f6',
|
||||
id: 'document',
|
||||
prevName: 'fa-file-text-o',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.fileText', { defaultMessage: 'File' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-google',
|
||||
code: '\uf1a0',
|
||||
label: i18n.translate('xpack.graph.icon.google', { defaultMessage: 'Google' }),
|
||||
id: 'search',
|
||||
prevName: 'fa-google',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.search', { defaultMessage: 'Search' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-eye',
|
||||
code: '\uf06e',
|
||||
id: 'eye',
|
||||
prevName: 'fa-eye',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.eye', { defaultMessage: 'Eye' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-tachometer',
|
||||
code: '\uf0e4',
|
||||
id: 'visGauge',
|
||||
prevName: 'fa-tachimeter',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.tachometer', { defaultMessage: 'Tachometer' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-info',
|
||||
code: '\uf129',
|
||||
id: 'iInCircle',
|
||||
prevName: 'fa-info',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.info', { defaultMessage: 'Info' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-external-link',
|
||||
code: '\uf08e',
|
||||
id: 'link',
|
||||
prevName: 'fa-external-link',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.externalLink', { defaultMessage: 'External link' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-table',
|
||||
code: '\uf0ce',
|
||||
id: 'visTable',
|
||||
prevName: 'fa-table',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.table', { defaultMessage: 'Table' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-list',
|
||||
code: '\uf03a',
|
||||
id: 'list',
|
||||
prevName: 'fa-list',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.list', { defaultMessage: 'List' }),
|
||||
},
|
||||
{
|
||||
class: 'fa-share-alt',
|
||||
code: '\uf1e0',
|
||||
label: i18n.translate('xpack.graph.icon.shareAlt', { defaultMessage: 'Share alt' }),
|
||||
id: 'cluster',
|
||||
prevName: 'fa-share-alt',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.shareAlt', { defaultMessage: 'Share' }),
|
||||
},
|
||||
];
|
||||
export const urlTemplateIconChoicesByClass: Partial<Record<string, FontawesomeIcon>> = {};
|
||||
|
||||
export const urlTemplateIconChoicesByClass: Partial<Record<string, GenericIcon>> = {};
|
||||
|
||||
urlTemplateIconChoices.forEach((icon) => {
|
||||
urlTemplateIconChoicesByClass[icon.class] = icon;
|
||||
urlTemplateIconChoicesByClass[icon.id] = icon;
|
||||
});
|
||||
|
||||
export const colorChoices = euiPaletteColorBlind();
|
||||
|
||||
type AnyIconType = FontawesomeIcon | GenericIcon | string;
|
||||
|
||||
function hasIcon(icon: AnyIconType | undefined): icon is AnyIconType {
|
||||
return icon != null;
|
||||
}
|
||||
|
||||
export function isNewIcon(icon: AnyIconType | undefined): icon is GenericIcon {
|
||||
if (!hasIcon(icon)) {
|
||||
return false;
|
||||
}
|
||||
return typeof icon !== 'string' ? 'package' in icon : iconChoices.some(({ id }) => id === icon);
|
||||
}
|
||||
|
||||
export function getIcon(icon: AnyIconType): GenericIcon {
|
||||
if (isNewIcon(icon)) {
|
||||
return typeof icon === 'string' ? iconChoicesByClass[icon]! : icon;
|
||||
}
|
||||
return getIconFromList(icon, iconChoices);
|
||||
}
|
||||
|
||||
export function getTemplateIcon(icon: AnyIconType): GenericIcon {
|
||||
if (isNewIcon(icon)) {
|
||||
return typeof icon === 'string' ? urlTemplateIconChoicesByClass[icon]! : icon;
|
||||
}
|
||||
return getIconFromList(icon, urlTemplateIconChoices);
|
||||
}
|
||||
|
||||
const EMPTY_ICON: GenericIcon = {
|
||||
id: 'empty',
|
||||
prevName: '',
|
||||
package: 'eui',
|
||||
label: i18n.translate('xpack.graph.icon.empty', { defaultMessage: 'Empty icon' }),
|
||||
};
|
||||
|
||||
function getIconFromList(
|
||||
icon: Exclude<AnyIconType, GenericIcon>,
|
||||
list: GenericIcon[]
|
||||
): GenericIcon {
|
||||
if (!hasIcon(icon)) {
|
||||
return EMPTY_ICON;
|
||||
}
|
||||
const iconName = typeof icon === 'string' ? icon : icon.class;
|
||||
const newIcon = list.find(({ prevName }) => prevName === iconName);
|
||||
return newIcon ?? EMPTY_ICON;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { getIcon } from '../helpers/style_choices';
|
||||
import { WorkspaceField, ServerResultNode } from '../types';
|
||||
|
||||
const DEFAULT_SHARD_SIZE = 5000;
|
||||
|
@ -76,7 +77,7 @@ export function createServerResultNode(
|
|||
term,
|
||||
id: '',
|
||||
color: field.color,
|
||||
icon: field.icon,
|
||||
icon: getIcon(field.icon),
|
||||
data: {
|
||||
field: fieldName,
|
||||
term,
|
||||
|
|
|
@ -144,7 +144,12 @@ describe('deserialize', () => {
|
|||
"aggregatable": true,
|
||||
"color": "black",
|
||||
"hopSize": undefined,
|
||||
"icon": undefined,
|
||||
"icon": Object {
|
||||
"id": "empty",
|
||||
"label": "Empty icon",
|
||||
"package": "eui",
|
||||
"prevName": "",
|
||||
},
|
||||
"lastValidHopSize": undefined,
|
||||
"name": "field1",
|
||||
"selected": true,
|
||||
|
@ -154,7 +159,12 @@ describe('deserialize', () => {
|
|||
"aggregatable": true,
|
||||
"color": "black",
|
||||
"hopSize": undefined,
|
||||
"icon": undefined,
|
||||
"icon": Object {
|
||||
"id": "empty",
|
||||
"label": "Empty icon",
|
||||
"package": "eui",
|
||||
"prevName": "",
|
||||
},
|
||||
"lastValidHopSize": undefined,
|
||||
"name": "field2",
|
||||
"selected": true,
|
||||
|
@ -165,14 +175,15 @@ describe('deserialize', () => {
|
|||
"color": "#D36086",
|
||||
"hopSize": 5,
|
||||
"icon": Object {
|
||||
"class": "fa-folder-open-o",
|
||||
"code": "",
|
||||
"id": "folderOpen",
|
||||
"label": "Folder open",
|
||||
"package": "eui",
|
||||
"patterns": Array [
|
||||
/category/i,
|
||||
/folder/i,
|
||||
/group/i,
|
||||
],
|
||||
"prevName": "fa-folder-open-o",
|
||||
},
|
||||
"lastValidHopSize": 5,
|
||||
"name": "field3",
|
||||
|
|
|
@ -20,12 +20,7 @@ import {
|
|||
SerializedField,
|
||||
} from '../../types';
|
||||
import { outlinkEncoders } from '../../helpers/outlink_encoders';
|
||||
import {
|
||||
urlTemplateIconChoicesByClass,
|
||||
getSuitableIcon,
|
||||
colorChoices,
|
||||
iconChoicesByClass,
|
||||
} from '../../helpers/style_choices';
|
||||
import { getSuitableIcon, colorChoices, getIcon } from '../../helpers/style_choices';
|
||||
|
||||
const defaultAdvancedSettings: AdvancedSettings = {
|
||||
useSignificance: true,
|
||||
|
@ -52,8 +47,8 @@ function deserializeUrlTemplate({
|
|||
};
|
||||
|
||||
if (iconClass) {
|
||||
const iconCandidate = urlTemplateIconChoicesByClass[iconClass];
|
||||
template.icon = iconCandidate ? iconCandidate : null;
|
||||
const iconCandidate = getIcon(iconClass);
|
||||
template.icon = iconCandidate || null;
|
||||
}
|
||||
|
||||
return template;
|
||||
|
@ -140,7 +135,7 @@ function getFieldsWithWorkspaceSettings(indexPattern: DataView, selectedFields:
|
|||
workspaceField.hopSize = serializedField.hopSize;
|
||||
workspaceField.lastValidHopSize = serializedField.lastValidHopSize;
|
||||
workspaceField.color = serializedField.color;
|
||||
workspaceField.icon = iconChoicesByClass[serializedField.iconClass]!;
|
||||
workspaceField.icon = getIcon(serializedField.iconClass);
|
||||
workspaceField.selected = true;
|
||||
});
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ describe('serialize', () => {
|
|||
selectedFields: [
|
||||
{
|
||||
color: 'black',
|
||||
icon: { class: 'a', code: '', label: '' },
|
||||
icon: { id: 'a', package: 'eui', label: '', prevName: '' },
|
||||
name: 'field1',
|
||||
selected: true,
|
||||
type: 'string',
|
||||
|
@ -46,7 +46,7 @@ describe('serialize', () => {
|
|||
},
|
||||
{
|
||||
color: 'black',
|
||||
icon: { class: 'b', code: '', label: '' },
|
||||
icon: { id: 'b', package: 'eui', label: '', prevName: '' },
|
||||
name: 'field2',
|
||||
selected: true,
|
||||
type: 'string',
|
||||
|
@ -62,7 +62,7 @@ describe('serialize', () => {
|
|||
{
|
||||
description: 'Template',
|
||||
encoder: outlinkEncoders[0],
|
||||
icon: { class: 'd', code: '', label: '' },
|
||||
icon: { id: 'd', package: 'eui', label: '', prevName: '' },
|
||||
url: 'test-url',
|
||||
},
|
||||
],
|
||||
|
@ -71,7 +71,7 @@ describe('serialize', () => {
|
|||
{
|
||||
color: 'black',
|
||||
data: { field: 'field1', term: 'A' },
|
||||
icon: { class: 'a', code: '' },
|
||||
icon: { id: 'a', package: 'eui' },
|
||||
label: 'A',
|
||||
x: 1,
|
||||
y: 2,
|
||||
|
@ -81,7 +81,7 @@ describe('serialize', () => {
|
|||
{
|
||||
color: 'black',
|
||||
data: { field: 'field1', term: 'B' },
|
||||
icon: { class: 'a', code: '' },
|
||||
icon: { id: 'a', package: 'eui' },
|
||||
label: 'B',
|
||||
x: 3,
|
||||
y: 4,
|
||||
|
@ -91,7 +91,7 @@ describe('serialize', () => {
|
|||
{
|
||||
color: 'black',
|
||||
data: { field: 'field1', term: 'C' },
|
||||
icon: { class: 'a', code: '' },
|
||||
icon: { id: 'a', package: 'eui' },
|
||||
label: 'B',
|
||||
x: 5,
|
||||
y: 6,
|
||||
|
@ -101,7 +101,7 @@ describe('serialize', () => {
|
|||
{
|
||||
color: 'black',
|
||||
data: { field: 'field2', term: 'D' },
|
||||
icon: { class: 'a', code: '' },
|
||||
icon: { id: 'a', package: 'eui' },
|
||||
label: 'D',
|
||||
x: 7,
|
||||
y: 8,
|
||||
|
@ -111,7 +111,7 @@ describe('serialize', () => {
|
|||
{
|
||||
color: 'black',
|
||||
data: { field: 'field2', term: 'E' },
|
||||
icon: { class: 'a', code: '' },
|
||||
icon: { id: 'a', package: 'eui' },
|
||||
label: 'E',
|
||||
x: 9,
|
||||
y: 10,
|
||||
|
@ -123,7 +123,7 @@ describe('serialize', () => {
|
|||
{
|
||||
color: 'black',
|
||||
data: { field: 'field1', term: 'Z' },
|
||||
icon: { class: 'a', code: '' },
|
||||
icon: { id: 'a', package: 'eui' },
|
||||
label: 'Z',
|
||||
x: 1,
|
||||
y: 2,
|
||||
|
|
|
@ -58,7 +58,7 @@ function serializeUrlTemplate({ encoder, icon, url, description, isDefault }: Ur
|
|||
encoderID: encoder.id,
|
||||
};
|
||||
if (icon) {
|
||||
serializedTemplate.iconClass = icon.class;
|
||||
serializedTemplate.iconClass = icon.id;
|
||||
}
|
||||
return serializedTemplate;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ function serializeField({
|
|||
lastValidHopSize,
|
||||
color,
|
||||
selected,
|
||||
iconClass: icon.class,
|
||||
iconClass: icon.id,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import $ from 'jquery';
|
|||
|
||||
// Kibana wrapper
|
||||
import d3 from 'd3';
|
||||
import { getIcon } from '../../helpers/style_choices';
|
||||
|
||||
// Pluggable function to handle the comms with a server. Default impl here is
|
||||
// for use outside of Kibana server with direct access to elasticsearch
|
||||
|
@ -849,7 +850,7 @@ function GraphWorkspace(options) {
|
|||
id: dedupedNode.id,
|
||||
label: label,
|
||||
color: dedupedNode.color,
|
||||
icon: dedupedNode.icon,
|
||||
icon: getIcon(dedupedNode.icon),
|
||||
data: dedupedNode,
|
||||
};
|
||||
// node.scaledSize = sizeScale(node.data.weight);
|
||||
|
@ -1047,7 +1048,7 @@ function GraphWorkspace(options) {
|
|||
targetFields.some((fieldDef) => {
|
||||
if (node.field === fieldDef.name) {
|
||||
node.color = fieldDef.color;
|
||||
node.icon = fieldDef.icon;
|
||||
node.icon = getIcon(fieldDef.icon);
|
||||
node.fieldDef = fieldDef;
|
||||
return true;
|
||||
}
|
||||
|
@ -1563,7 +1564,7 @@ function GraphWorkspace(options) {
|
|||
self.options.vertex_fields.some((fieldDef) => {
|
||||
if (node.field === fieldDef.name) {
|
||||
node.color = fieldDef.color;
|
||||
node.icon = fieldDef.icon;
|
||||
node.icon = getIcon(fieldDef.icon);
|
||||
node.fieldDef = fieldDef;
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -50,9 +50,10 @@ describe('legacy sync sagas', () => {
|
|||
term: 'A',
|
||||
},
|
||||
icon: {
|
||||
class: 'a',
|
||||
code: 'a',
|
||||
id: 'a',
|
||||
package: 'eui',
|
||||
label: '',
|
||||
prevName: 'a',
|
||||
},
|
||||
} as WorkspaceNode);
|
||||
env.mockedDeps.getWorkspace()!.nodes.push({
|
||||
|
@ -62,9 +63,10 @@ describe('legacy sync sagas', () => {
|
|||
term: 'B',
|
||||
},
|
||||
icon: {
|
||||
class: 'b',
|
||||
code: 'b',
|
||||
id: 'b',
|
||||
package: 'eui',
|
||||
label: '',
|
||||
prevName: 'b',
|
||||
},
|
||||
} as WorkspaceNode);
|
||||
});
|
||||
|
@ -107,17 +109,18 @@ describe('legacy sync sagas', () => {
|
|||
fieldProperties: {
|
||||
color: 'red',
|
||||
icon: {
|
||||
class: 'x',
|
||||
code: 'x',
|
||||
id: 'x',
|
||||
package: 'eui',
|
||||
label: '',
|
||||
prevName: 'x',
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
const workspace = env.mockedDeps.getWorkspace()!;
|
||||
expect(workspace.nodes[0].color).toEqual('red');
|
||||
expect(workspace.nodes[0].icon.class).toEqual('x');
|
||||
expect(workspace.nodes[0].icon.id).toEqual('x');
|
||||
expect(workspace.nodes[1].color).toEqual('pink');
|
||||
expect(workspace.nodes[1].icon.class).toEqual('b');
|
||||
expect(workspace.nodes[1].icon.id).toEqual('b');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
|
||||
import { SimpleSavedObject } from '@kbn/core/public';
|
||||
import type { DataView } from '@kbn/data-views-plugin/public';
|
||||
import { FontawesomeIcon } from '../helpers/style_choices';
|
||||
import type { GenericIcon } from '../helpers/style_choices';
|
||||
import { OutlinkEncoder } from '../helpers/outlink_encoders';
|
||||
|
||||
export interface UrlTemplate {
|
||||
url: string;
|
||||
description: string;
|
||||
icon: FontawesomeIcon | null;
|
||||
icon: GenericIcon | null;
|
||||
encoder: OutlinkEncoder;
|
||||
isDefault?: boolean;
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ export interface WorkspaceField {
|
|||
hopSize?: number;
|
||||
lastValidHopSize?: number; // TODO handle this by an "active" flag
|
||||
color: string;
|
||||
icon: FontawesomeIcon;
|
||||
icon: GenericIcon;
|
||||
selected: boolean;
|
||||
type: string;
|
||||
aggregatable: boolean;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { JsonObject } from '@kbn/utility-types';
|
||||
import d3 from 'd3';
|
||||
import { TargetOptions } from '../components/control_panel';
|
||||
import { FontawesomeIcon } from '../helpers/style_choices';
|
||||
import { GenericIcon } from '../helpers/style_choices';
|
||||
import { WorkspaceField, AdvancedSettings } from './app_state';
|
||||
|
||||
export interface WorkspaceNode {
|
||||
|
@ -16,7 +16,7 @@ export interface WorkspaceNode {
|
|||
x: number;
|
||||
y: number;
|
||||
label: string;
|
||||
icon: FontawesomeIcon;
|
||||
icon: GenericIcon;
|
||||
data: {
|
||||
field: string;
|
||||
term: string;
|
||||
|
@ -49,7 +49,7 @@ export interface ServerResultNode {
|
|||
id: string;
|
||||
label: string;
|
||||
color: string;
|
||||
icon: FontawesomeIcon;
|
||||
icon: GenericIcon;
|
||||
data: {
|
||||
field: string;
|
||||
term: string;
|
||||
|
|
|
@ -17115,7 +17115,6 @@
|
|||
"xpack.graph.icon.folderOpen": "Dossier ouvert",
|
||||
"xpack.graph.icon.font": "Police",
|
||||
"xpack.graph.icon.globe": "Globe",
|
||||
"xpack.graph.icon.google": "Google",
|
||||
"xpack.graph.icon.heart": "Cœur",
|
||||
"xpack.graph.icon.home": "Accueil",
|
||||
"xpack.graph.icon.industry": "Industrie",
|
||||
|
|
|
@ -17128,7 +17128,6 @@
|
|||
"xpack.graph.icon.folderOpen": "開いているフォルダ",
|
||||
"xpack.graph.icon.font": "フォント",
|
||||
"xpack.graph.icon.globe": "球",
|
||||
"xpack.graph.icon.google": "Google",
|
||||
"xpack.graph.icon.heart": "ハート",
|
||||
"xpack.graph.icon.home": "ホーム",
|
||||
"xpack.graph.icon.industry": "業界",
|
||||
|
|
|
@ -17128,7 +17128,6 @@
|
|||
"xpack.graph.icon.folderOpen": "文件夹打开",
|
||||
"xpack.graph.icon.font": "字体",
|
||||
"xpack.graph.icon.globe": "地球",
|
||||
"xpack.graph.icon.google": "Google",
|
||||
"xpack.graph.icon.heart": "心形",
|
||||
"xpack.graph.icon.home": "主页",
|
||||
"xpack.graph.icon.industry": "工业",
|
||||
|
|
|
@ -100,7 +100,7 @@ export class GraphPageObject extends FtrService {
|
|||
const selectionLabel = await labelElement.getVisibleText();
|
||||
this.log.debug('Looking at selection ' + selectionLabel);
|
||||
if (selectionLabel !== from && selectionLabel !== to) {
|
||||
(await selection.findByClassName('gphNode__text')).click();
|
||||
(await selection.findByTestSubject(`graph-selected-${selectionLabel}`)).click();
|
||||
await this.common.sleep(200);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue