From d9fdb0112746905e8a93ee33b6a3b83ff46b9b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Rica?= Date: Tue, 14 Jan 2025 18:31:41 +0100 Subject: [PATCH] [APM][ML] Update cytoscape with new index.d.ts def, fix typing issues --- package.json | 3 +-- .../pages/job_map/components/cytoscape.tsx | 4 ++-- .../components/app/service_map/cytoscape_options.ts | 2 +- yarn.lock | 13 ++++--------- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 4c55b0a830212..dfd9cfcd0fc2f 100644 --- a/package.json +++ b/package.json @@ -1093,7 +1093,7 @@ "css-box-model": "^1.2.1", "css.escape": "^1.5.1", "cypress-data-session": "^2.8.0", - "cytoscape": "^3.30.4", + "cytoscape": "^3.31.0", "cytoscape-dagre": "^2.5.0", "d3": "3.5.17", "d3-array": "2.12.1", @@ -1567,7 +1567,6 @@ "@types/cli-progress": "^3.11.5", "@types/color": "^3.0.3", "@types/cssstyle": "^2.2.4", - "@types/cytoscape": "^3.21.8", "@types/d3": "^3.5.43", "@types/d3-array": "^2.12.1", "@types/d3-brush": "^3.0.0", diff --git a/x-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx b/x-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx index 77affc598066a..55a6c5c21f85b 100644 --- a/x-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx +++ b/x-pack/platform/plugins/shared/ml/public/application/data_frame_analytics/pages/job_map/components/cytoscape.tsx @@ -8,7 +8,7 @@ import type { CSSProperties, PropsWithChildren } from 'react'; import React, { useState, useRef, useEffect, createContext, useCallback, useMemo } from 'react'; import { css } from '@emotion/react'; -import cytoscape, { type Stylesheet } from 'cytoscape'; +import cytoscape, { type StylesheetJson } from 'cytoscape'; // @ts-ignore no declaration file import dagre from 'cytoscape-dagre'; import { useCytoscapeOptions } from './cytoscape_options'; @@ -35,7 +35,7 @@ function useCytoscape(options: cytoscape.CytoscapeOptions) { setCy(cytoscape({ ...options, container: ref.current })); } else { // update styles for existing instance - cy.style(options.style as unknown as Stylesheet); + cy.style(options.style as StylesheetJson); } }, [options, cy]); diff --git a/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/cytoscape_options.ts b/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/cytoscape_options.ts index 9cf1acccd7b79..f54cf04d460ac 100644 --- a/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/cytoscape_options.ts +++ b/x-pack/solutions/observability/plugins/apm/public/components/app/service_map/cytoscape_options.ts @@ -100,7 +100,7 @@ function isService(el: cytoscape.NodeSingular) { const getStyle = ( euiTheme: EuiThemeComputed, isTraceExplorerEnabled: boolean -): cytoscape.Stylesheet[] => { +): cytoscape.StylesheetJson => { const lineColor = euiTheme.colors.mediumShade; return [ { diff --git a/yarn.lock b/yarn.lock index 71fa396f4b8e0..2dd5b0c9faf90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11446,11 +11446,6 @@ resolved "https://registry.yarnpkg.com/@types/cssstyle/-/cssstyle-2.2.4.tgz#3d333ab9f8e6c40183ad1d6ebeebfcb8da2bfe4b" integrity sha512-FTGMeuHZtLB7hRm+NGvOLZElslR1UkKvZmEmFevOZe/e7Av0nFleka1s8ZwoX+QvbJ2y7r9NDZXIzyqpRWDJXQ== -"@types/cytoscape@^3.21.8": - version "3.21.8" - resolved "https://registry.yarnpkg.com/@types/cytoscape/-/cytoscape-3.21.8.tgz#6166a2eabd66d3ae3259024875e037492adb8db6" - integrity sha512-6Bo9ZDrv0vfwe8Sg/ERc5VL0yU0gYvP4dgZi0fAXYkKHfyHaNqWRMcwYm3mu4sLsXbB8ZuXE75sR7qnaOL5JgQ== - "@types/d3-array@^2.12.1": version "2.12.3" resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-2.12.3.tgz#8d16d51fb04ad5a5a8ebe14eb8263a579f1efdd1" @@ -16575,10 +16570,10 @@ cytoscape-dagre@^2.5.0: dependencies: dagre "^0.8.5" -cytoscape@^3.30.4: - version "3.30.4" - resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.30.4.tgz#3404da0a159c00a1a3df2c85b2b43fdc66a0e28e" - integrity sha512-OxtlZwQl1WbwMmLiyPSEBuzeTIQnwZhJYYWFzZ2PhEHVFwpeaqNIkUzSiso00D98qk60l8Gwon2RP304d3BJ1A== +cytoscape@^3.31.0: + version "3.31.0" + resolved "https://registry.yarnpkg.com/cytoscape/-/cytoscape-3.31.0.tgz#cffbbb8ca51db01cbf360e0cf59088db6d429837" + integrity sha512-zDGn1K/tfZwEnoGOcHc0H4XazqAAXAuDpcYw9mUnUjATjqljyCNGJv8uEvbvxGaGHaVshxMecyl6oc6uKzRfbw== "d3-array@1 - 3", "d3-array@2 - 3", "d3-array@2.10.0 - 3", "d3-array@2.5.0 - 3", d3-array@3.2.2, d3-array@^3.2.2: version "3.2.2"