Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
leventebalogh committed Feb 7, 2025
1 parent a734969 commit 1cdaeff
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 88 deletions.
1 change: 0 additions & 1 deletion .config/webpack/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const config = async (env): Promise<Configuration> => {
'redux',
'rxjs',
'react-router',
'react-router-dom',
'd3',
'angular',
'@grafana/ui',
Expand Down
5 changes: 4 additions & 1 deletion .cprc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"features": {}
"features": {
"bundleGrafanaUI": false,
"useReactRouterV6": true
}
}
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"@types/jest": "^29.5.0",
"@types/lodash": "^4.14.194",
"@types/node": "^20.8.7",
"@types/react-router-dom": "^5.2.0",
"@types/react-scroll-sync": "^0.9.0",
"@types/react-table": "^7.7.20",
"@types/testing-library__jest-dom": "5.14.8",
Expand Down Expand Up @@ -105,7 +104,7 @@
"@grafana/data": "^11.3.0",
"@grafana/lezer-logql": "^0.2.7",
"@grafana/runtime": "^11.3.0",
"@grafana/scenes": "6.0.0--canary.979.12990094152.0",
"@grafana/scenes": "6.0.0--canary.979.13200094417.0",
"@grafana/ui": "^11.3.0",
"@hello-pangea/dnd": "^16.6.0",
"@lezer/common": "^1.2.1",
Expand All @@ -114,7 +113,7 @@
"@types/react-table": "^7.7.20",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-router-dom": "^5.2.0",
"react-router-dom": "^6.22.0",
"rxjs": "7.8.1",
"tslib": "2.5.3",
"uuid": "^10.0.0"
Expand Down
4 changes: 2 additions & 2 deletions src/Components/LogExplorationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useEffect } from 'react';

import { SceneApp, useSceneApp } from '@grafana/scenes';
import { config } from '@grafana/runtime';
import { Redirect } from 'react-router-dom';
import { Navigate } from 'react-router-dom';
import { makeIndexPage, makeRedirectPage } from './Pages';
import { initializeMetadataService } from '../services/metadata';

Expand Down Expand Up @@ -31,7 +31,7 @@ function LogExplorationView() {
const userPermissions = config.bootData.user.permissions;
const canUseApp = userPermissions?.['grafana-lokiexplore-app:read'] || userPermissions?.['datasources:explore'];
if (!canUseApp) {
return <Redirect to="/" />;
return <Navigate to="/" replace />;
}

if (!isInitialized) {
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export function makeBreakdownPage(
title: capitalizeFirstLetter(slug),
layout: PageLayoutType.Custom,
url: ROUTES[slug](labelValue, labelName),
routePath: slug,
routePath: ROUTE_DEFINITIONS[slug],
preserveUrlKeys: DRILLDOWN_URL_KEYS,
getParentPage: () => parent,
getScene: (routeMatch) => getServicesScene(routeMatch),
Expand Down Expand Up @@ -151,7 +151,7 @@ export function makeBreakdownValuePage(
title: capitalizeFirstLetter(breakdownLabel),
layout: PageLayoutType.Custom,
url: SUB_ROUTES[slug](labelValue, labelName, breakdownLabel),
routePath: slug,
routePath: CHILD_ROUTE_DEFINITIONS[slug],
preserveUrlKeys: DRILLDOWN_URL_KEYS,
getParentPage: () => parent,
getScene: (routeMatch) => getServicesScene(routeMatch),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export class PatternsLogsSampleScene extends SceneObjectBase<PatternsLogsSampleS
isHidden: false,
height: 'auto',
body: new SceneReactObject({
// @ts-ignore (HEADS UP! - Only added it temporarily to demonstrate that the scenes update works.)
reactNode: reactNode,
}),
});
Expand Down
6 changes: 3 additions & 3 deletions src/Components/ServiceScene/LogsPanelScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,11 @@ export class LogsPanelScene extends SceneObjectBase<LogsPanelSceneState> {
)
.setMenu(new PanelMenu({ addExplorationsLink: false }))
.setOption('showLogContextToggle', true)
// @ts-expect-error Requires Grafana 11.5
// @ts-ignore (HEADS UP! - Only added it temporarily to demonstrate that the scenes update works.)
.setOption('enableInfiniteScrolling', true)
// @ts-expect-error Grafana 11.5
// @ts-ignore (HEADS UP! - Only added it temporarily to demonstrate that the scenes update works.)
.setOption('onNewLogsReceived', this.updateVisibleRange)
// @ts-expect-error Grafana 11.5
// @ts-ignore (HEADS UP! - Only added it temporarily to demonstrate that the scenes update works.)
.setOption('logRowMenuIconsAfter', [<CopyLinkButton onClick={this.handleShareLogLineClick} key={0} />])

.setHeaderActions(
Expand Down
14 changes: 7 additions & 7 deletions src/services/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,16 @@ export const SUB_ROUTES = {
};

export const ROUTE_DEFINITIONS: Record<keyof typeof PageSlugs, string> = {
explore: prefixRoute(PageSlugs.explore),
logs: prefixRoute(`${PageSlugs.explore}/:labelName/:labelValue/${PageSlugs.logs}`),
fields: prefixRoute(`${PageSlugs.explore}/:labelName/:labelValue/${PageSlugs.fields}`),
patterns: prefixRoute(`${PageSlugs.explore}/:labelName/:labelValue/${PageSlugs.patterns}`),
labels: prefixRoute(`${PageSlugs.explore}/:labelName/:labelValue/${PageSlugs.labels}`),
explore: `${PageSlugs.explore}/*`,
logs: `:labelName/:labelValue/${PageSlugs.logs}`,
fields: `:labelName/:labelValue/${PageSlugs.fields}`,
patterns: `:labelName/:labelValue/${PageSlugs.patterns}`,
labels: `:labelName/:labelValue/${PageSlugs.labels}`,
};

export const CHILD_ROUTE_DEFINITIONS: Record<keyof typeof ValueSlugs, string> = {
field: prefixRoute(`${PageSlugs.explore}/:labelName/:labelValue/${ValueSlugs.field}/:breakdownLabel`),
label: prefixRoute(`${PageSlugs.explore}/:labelName/:labelValue/${ValueSlugs.label}/:breakdownLabel`),
field: `:labelName/:labelValue/${ValueSlugs.field}/:breakdownLabel`,
label: `:labelName/:labelValue/${ValueSlugs.label}/:breakdownLabel`,
};

export const EXPLORATIONS_ROUTE = `${PLUGIN_BASE_URL}/${PageSlugs.explore}`;
Expand Down
96 changes: 27 additions & 69 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
dependencies:
"@babel/helper-plugin-utils" "^7.25.9"

"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.24.1", "@babel/runtime@^7.24.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.11.1", "@babel/runtime@^7.11.2", "@babel/runtime@^7.12.0", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.5", "@babel/runtime@^7.18.0", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.7", "@babel/runtime@^7.23.2", "@babel/runtime@^7.23.9", "@babel/runtime@^7.24.1", "@babel/runtime@^7.24.5", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.26.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.26.0.tgz#8600c2f595f277c60815256418b85356a65173c1"
integrity sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==
Expand Down Expand Up @@ -1114,10 +1114,10 @@
rxjs "7.8.1"
tslib "2.7.0"

"@grafana/[email protected].12990094152.0":
version "6.0.0--canary.979.12990094152.0"
resolved "https://registry.yarnpkg.com/@grafana/scenes/-/scenes-6.0.0--canary.979.12990094152.0.tgz#9fafb500eb327038f67e90f4e29bd23513453d31"
integrity sha512-YIXoeJMTijLUthgHSA5R8NzywmxTz6nlwX2vEOODZ+4LSlTChlBCxK2rGaeKiE0xm1Ifygp5VDFi6Vm5DJuJ4g==
"@grafana/[email protected].13200094417.0":
version "6.0.0--canary.979.13200094417.0"
resolved "https://registry.yarnpkg.com/@grafana/scenes/-/scenes-6.0.0--canary.979.13200094417.0.tgz#f962aaa41e7e0b20a4670b9ab28beec93699dba3"
integrity sha512-NuKcKgLl6esRFJfHlpcT8WpzfEUPl9txM3cp9AlbsGHWzTVVyIKH6Oif3Xz+phE6Ii7+TXYORBTeayGxFuzipw==
dependencies:
"@floating-ui/react" "^0.26.16"
"@leeoniya/ufuzzy" "^1.0.16"
Expand Down Expand Up @@ -1989,6 +1989,11 @@
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.21.0.tgz#c65ae4262bdcfe415dbd4f64ec87676e4a56e2b5"
integrity sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA==

"@remix-run/[email protected]":
version "1.22.0"
resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.22.0.tgz#dd8096cb055c475a4de6b35322b8d3b118c17b43"
integrity sha512-MBOl8MeOzpK0HQQQshKB7pABXbmyHizdTpqnrIseTbsv0nAepwC2ENZa1aaBExNQcpLoXmWthhak8SABLzvGPw==

"@sinclair/typebox@^0.27.8":
version "0.27.8"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
Expand Down Expand Up @@ -2280,11 +2285,6 @@
dependencies:
"@types/node" "*"

"@types/history@^4.7.11":
version "4.7.11"
resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.11.tgz#56588b17ae8f50c53983a524fc3cc47437969d64"
integrity sha512-qjDJRrmvBMiTx+jyLxvLfJU7UznFuokDv4f3WRuriHKERccVpFU+8XMQUAbDzoiJCsmexxRExQeMwwCdamSKDA==

"@types/hoist-non-react-statics@^3.3.1":
version "3.3.6"
resolved "https://registry.yarnpkg.com/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.6.tgz#6bba74383cdab98e8db4e20ce5b4a6b98caed010"
Expand Down Expand Up @@ -2385,23 +2385,6 @@
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.5.tgz#45f9f87398c5dcea085b715c58ddcf1faf65f716"
integrity sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==

"@types/react-router-dom@^5.2.0":
version "5.3.3"
resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.3.3.tgz#e9d6b4a66fcdbd651a5f106c2656a30088cc1e83"
integrity sha512-kpqnYK4wcdm5UaWI3fLcELopqLrHgLqNsdpHauzlQktfkHL3npOSwtj1Uz9oKBAzs7lFtVkV8j83voAz2D8fhw==
dependencies:
"@types/history" "^4.7.11"
"@types/react" "*"
"@types/react-router" "*"

"@types/react-router@*":
version "5.1.20"
resolved "https://registry.yarnpkg.com/@types/react-router/-/react-router-5.1.20.tgz#88eccaa122a82405ef3efbcaaa5dcdd9f021387c"
integrity sha512-jGjmu/ZqS7FjSH6owMcD5qpq19+1RS9DeVRqfl1FeBMxTDQAGwlMWOcs52NDoXaNKyG3d1cYQFMs9rCrb88o9Q==
dependencies:
"@types/history" "^4.7.11"
"@types/react" "*"

"@types/react-scroll-sync@^0.9.0":
version "0.9.0"
resolved "https://registry.yarnpkg.com/@types/react-scroll-sync/-/react-scroll-sync-0.9.0.tgz#f9c556cc1441b28344f6b820cac34099cab74f2b"
Expand Down Expand Up @@ -5339,7 +5322,7 @@ highlight-words-core@^1.2.0:
resolved "https://registry.yarnpkg.com/highlight-words-core/-/highlight-words-core-1.2.3.tgz#781f37b2a220bf998114e4ef8c8cb6c7a4802ea8"
integrity sha512-m1O9HW3/GNHxzSIXWw1wCNXXsgLlxrP0OI6+ycGUhiUHkikqW3OrwVHz+lxeNBe5yqLESdIcj8PowHQ2zLvUvQ==

[email protected], history@^4.9.0:
[email protected]:
version "4.10.1"
resolved "https://registry.yarnpkg.com/history/-/history-4.10.1.tgz#33371a65e3a83b267434e2b3f3b1b4c58aad4cf3"
integrity sha512-36nwAD620w12kuzPAsyINPWJqlNbij+hpK1k9XRloDtym8mxzGYl2c17LnV6IAGB2Dmg4tEa7G7DlawS0+qjew==
Expand All @@ -5358,7 +5341,7 @@ history@^5.3.0:
dependencies:
"@babel/runtime" "^7.7.6"

[email protected], hoist-non-react-statics@^3.1.0, hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2:
[email protected], hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.1, hoist-non-react-statics@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45"
integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw==
Expand Down Expand Up @@ -5843,11 +5826,6 @@ is-window@^1.0.2:
resolved "https://registry.yarnpkg.com/is-window/-/is-window-1.0.2.tgz#2c896ca53db97de45d3c33133a65d8c9f563480d"
integrity sha512-uj00kdXyZb9t9RcAUAwMZAnkBUwdYGhYlt7djMXhfyhUCzwNba50tIiBKR7q0l7tdoBtFVw/3JmLY6fI3rmZmg==

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
integrity sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==

isarray@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723"
Expand Down Expand Up @@ -6593,7 +6571,7 @@ long@^5.0.0:
resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1"
integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==

loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
Expand Down Expand Up @@ -7195,13 +7173,6 @@ path-scurry@^1.11.1:
lru-cache "^10.2.0"
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"

path-to-regexp@^1.7.0:
version "1.9.0"
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.9.0.tgz#5dc0753acbf8521ca2e0f137b4578b917b10cf24"
integrity sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==
dependencies:
isarray "0.0.1"

path-type@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
Expand Down Expand Up @@ -7759,7 +7730,7 @@ [email protected]:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==

react-is@^16.12.0, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0:
react-is@^16.12.0, react-is@^16.13.1, react-is@^16.7.0:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==
Expand Down Expand Up @@ -7813,33 +7784,13 @@ react-router-dom-v5-compat@^6.26.1:
history "^5.3.0"
react-router "6.28.1"

react-router-dom@^5.2.0:
version "5.3.4"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-5.3.4.tgz#2ed62ffd88cae6db134445f4a0c0ae8b91d2e5e6"
integrity sha512-m4EqFMHv/Ih4kpcBCONHbkT68KoAeHN4p3lAGoNryfHi0dMy0kCzEZakiKRsvg5wHZ/JLrLW8o8KomWiz/qbYQ==
react-router-dom@^6.22.0:
version "6.29.0"
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.29.0.tgz#2ffb56b03ef3d6d6daafcfad9f3922132d2ced94"
integrity sha512-pkEbJPATRJ2iotK+wUwHfy0xs2T59YPEN8BQxVCPeBZvK7kfPESRc/nyxzdcxR17hXgUPYx2whMwl+eo9cUdnQ==
dependencies:
"@babel/runtime" "^7.12.13"
history "^4.9.0"
loose-envify "^1.3.1"
prop-types "^15.6.2"
react-router "5.3.4"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"

[email protected]:
version "5.3.4"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-5.3.4.tgz#8ca252d70fcc37841e31473c7a151cf777887bb5"
integrity sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==
dependencies:
"@babel/runtime" "^7.12.13"
history "^4.9.0"
hoist-non-react-statics "^3.1.0"
loose-envify "^1.3.1"
path-to-regexp "^1.7.0"
prop-types "^15.6.2"
react-is "^16.6.0"
tiny-invariant "^1.0.2"
tiny-warning "^1.0.0"
"@remix-run/router" "1.22.0"
react-router "6.29.0"

[email protected]:
version "6.28.1"
Expand All @@ -7848,6 +7799,13 @@ [email protected]:
dependencies:
"@remix-run/router" "1.21.0"

[email protected]:
version "6.29.0"
resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.29.0.tgz#14a329ca838b4de048fc5cca82874b727ee546b7"
integrity sha512-DXZJoE0q+KyeVw75Ck6GkPxFak63C4fGqZGNijnWgzB/HzSP1ZfTlBj5COaGWwhrMQ/R8bXiq5Ooy4KG+ReyjQ==
dependencies:
"@remix-run/router" "1.22.0"

react-scroll-sync@^0.11.2:
version "0.11.2"
resolved "https://registry.yarnpkg.com/react-scroll-sync/-/react-scroll-sync-0.11.2.tgz#fe8a3a09eab5a44323bdf0f63283c1dd0cd99b45"
Expand Down

0 comments on commit 1cdaeff

Please sign in to comment.