added Map objekt polygon

This commit is contained in:
PxlLoewe
2025-04-08 09:16:00 -07:00
parent 133eee50fd
commit 5c9134a278
22 changed files with 333 additions and 122 deletions

View File

@@ -1,10 +1,11 @@
import { useMapStore } from "_store/mapStore";
import { MapPinned, Search } from "lucide-react";
import { useEffect } from "react";
import { Popup, useMap } from "react-leaflet";
export const ContextMenu = () => {
const map = useMap();
const { popup, map: mapStore, setPopup } = useMapStore();
const { popup, setSearchElements, setPopup } = useMapStore();
useEffect(() => {
map.on("contextmenu", (e) => {
@@ -17,9 +18,9 @@ export const ContextMenu = () => {
return (
<Popup position={[popup.lat, popup.lng]}>
{/* // TODO: maske: */}
<div>
<div className="absolute transform -translate-y-1/2 z-1000 opacity-100 pointer-events-auto p-3">
<button
className="btn btn-sm"
className="btn btn-sm rounded-full bg-amber-600 hover:bg-amber-700 aspect-square"
onClick={async () => {
const address = await fetch(
`https://nominatim.openstreetmap.org/reverse?lat=${popup.lat}&lon=${popup.lng}&format=json`,
@@ -51,7 +52,48 @@ export const ContextMenu = () => {
};
}}
>
Neues Einsatz hier Erstellen
<MapPinned size={20} />
</button>
<button
className="btn btn-sm rounded-full bg-amber-600 hover:bg-amber-700 aspect-square"
onClick={async () => {
const res = await fetch(
`https://overpass-api.de/api/interpreter?data=${encodeURIComponent(`
[out:json];
(
way["building"](around:50, ${popup.lat}, ${popup.lng});
relation["building"](around:50, ${popup.lat}, ${popup.lng});
);
out body;
>;
out skel qt;
`)}`,
);
const data = await res.json();
setSearchElements(
data.elements
.filter((e: any) => e.type === "way")
.map((e: any) => {
return {
id: e.id,
nodes: e.nodes.map((nodeId: string) => {
const node = data.elements.find(
(element: any) => element.id === nodeId,
);
return {
lat: node.lat,
lon: node.lon,
};
}),
tags: e.tags,
type: e.type,
};
}),
);
console.log(data);
}}
>
<Search size={20} />
</button>
</div>
</Popup>

View File

@@ -5,6 +5,7 @@ import { MapContainer } from "react-leaflet";
import { BaseMaps } from "(dispatch)/_components/map/BaseMaps";
import { ContextMenu } from "(dispatch)/_components/map/ContextMenu";
import { MissionMarkers } from "(dispatch)/_components/map/MissionMarkers";
import { SearchElements } from "(dispatch)/_components/map/SearchElements";
export default ({}) => {
const { map } = useMapStore();
@@ -12,6 +13,7 @@ export default ({}) => {
return (
<MapContainer className="flex-1" center={map.center} zoom={map.zoom}>
<BaseMaps />
<SearchElements />
<ContextMenu />
<MissionMarkers />
</MapContainer>

View File

@@ -15,7 +15,7 @@ export const MissionMarker = ({
const markerRef = useRef<LMarker<any>>(null);
useEffect(() => {
markerRef.current?.openPopup();
// markerRef.current?.openPopup();
const handleZoom = () => {
setZoom(map.getZoom());

View File

@@ -0,0 +1,74 @@
import { useMapStore } from "_store/mapStore";
import { Marker as LMarker } from "leaflet";
import { Ref, use, useEffect, useRef } from "react";
import { Marker, Polygon, Polyline, Popup } from "react-leaflet";
import L from "leaflet";
export const SearchElements = () => {
const { searchElements, searchPopup, setSearchPopup } = useMapStore();
const poppupRef = useRef<LMarker>(null);
useEffect(() => {
if (searchPopup?.isOpen) {
poppupRef.current?.openPopup();
} else {
poppupRef.current?.closePopup();
}
}, [searchPopup]);
const SearchElement = ({
element,
}: {
element: (typeof searchElements)[1];
}) => {
const ref = useRef<any>(null);
useEffect(() => {
if (ref.current) {
console.log(ref.current);
ref.current.on("click", () => {
console.log("click");
const center = ref.current.getBounds().getCenter();
setSearchPopup({
isOpen: true,
lat: center.lat,
lng: center.lng,
elementId: element.id,
});
console.log(element);
});
}
}, []);
return (
<Polygon
key={element.id}
positions={element.nodes.map((node) => [node.lat, node.lon])}
color="#46b7a3"
ref={ref}
/>
);
};
return (
<>
{searchElements.map((element) => {
return <SearchElement key={element.id} element={element} />;
})}
{searchPopup && (
<Marker
position={[searchPopup.lat, searchPopup.lng]}
ref={poppupRef}
icon={new L.DivIcon()}
opacity={0}
>
<Popup>
<div className="absolute z-1000 opacity-100 pointer-events-auto w-[500px] text-white">
<div className="bg-red-600 w-7 h-6">test</div>
</div>
</Popup>
</Marker>
)}
</>
);
};

View File

@@ -11,7 +11,33 @@ interface MapStore {
center: L.LatLngExpression;
zoom: number;
};
searchElements: {
id: number;
nodes: {
lat: number;
lon: number;
}[];
tags: {
addr: {
city?: string;
housenumber?: string;
postcode?: string;
street?: string;
suburb?: string;
};
building?: string;
};
type: string;
}[];
setSearchElements: (elements: MapStore["searchElements"]) => void;
setPopup: (popup: MapStore["popup"]) => void;
searchPopup?: {
isOpen: boolean;
lat: number;
lng: number;
elementId: number;
};
setSearchPopup: (popup: MapStore["searchPopup"]) => void;
}
export const useMapStore = create<MapStore>((set, get) => ({
@@ -19,9 +45,18 @@ export const useMapStore = create<MapStore>((set, get) => ({
center: [51.5, 10.5],
zoom: 6,
},
searchElements: [],
setSearchPopup: (popup) =>
set((state) => ({
searchPopup: popup,
})),
popup: null,
setPopup: (popup) =>
set((state) => ({
popup: popup,
})),
setSearchElements: (elements) =>
set((state) => ({
searchElements: elements,
})),
}));

View File

@@ -12,6 +12,7 @@ export default {
colors: {
background: "var(--background)",
foreground: "var(--foreground)",
rescuetrack: "#46b7a3",
},
transitionProperty: {
width: "width",

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,2 +1,2 @@
"use strict";(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[631],{9631:(e,a,n)=>{n.r(a),n.d(a,{default:()=>p});var r=n(5959),l=n.n(r);const t=(0,r.lazy)((()=>Promise.all([n.e(854),n.e(944),n.e(105),n.e(341),n.e(220)]).then(n.bind(n,6220)))),s=l().createContext(null);class o extends l().PureComponent{render(){return l().createElement(s.Provider,{value:this.props},l().createElement(t,null))}}const p=o}}]);
"use strict";(self.webpackChunkgrafana_lokiexplore_app=self.webpackChunkgrafana_lokiexplore_app||[]).push([[631],{9631:(e,a,n)=>{n.r(a),n.d(a,{default:()=>p});var r=n(5959),l=n.n(r);const t=(0,r.lazy)((()=>Promise.all([n.e(854),n.e(944),n.e(105),n.e(747),n.e(220)]).then(n.bind(n,6220)))),s=l().createContext(null);class o extends l().PureComponent{render(){return l().createElement(s.Provider,{value:this.props},l().createElement(t,null))}}const p=o}}]);
//# sourceMappingURL=631.js.map

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,27 @@
#### 1.0.10 (2025-04-03)
##### Chores
* Fix e2e test (#1135) (7873d6dd)
##### Documentation Changes
* Update readme to include discover_log_levels config requirement (#1143) (359e9766)
##### New Features
* Add critical/fatal log level (#1146) (038a8146)
* Add support for uppercase log level and color warning as a warn (#1137) (4675f4a7)
##### Bug Fixes
* Error thrown when toggling case sensitivity with an empty value (#1153) (156245c9)
* Set step as 10s for aggregated metric queries (#1145) (b370c190)
##### Other Changes
* Make extensions compatibly with different Grafana versions (#1148) (e2c75d29)
# Changelog
View [releases](https://github.com/grafana/explore-logs/releases/) on GitHub for up-to-date changelog information.

View File

@@ -8,8 +8,8 @@ Hash: SHA512
"signedByOrg": "grafana",
"signedByOrgName": "Grafana Labs",
"plugin": "grafana-lokiexplore-app",
"version": "1.0.9",
"time": 1742399021184,
"version": "1.0.10",
"time": 1743678868266,
"keyId": "7e4d0c6a708866e7",
"files": {
"105.js": "edee7847f3427cc7c2a0f5f8725ae8b1403076faa4883a9825356b4ffd922d28",
@@ -18,20 +18,20 @@ Hash: SHA512
"1759fd27b2c9f73dea05.wasm": "c79b8fa1bea557bdcd6b743a00e5c47aef7f71a457dcbaa63218dd4a706475b6",
"220.js": "a01b3cfdffea44bdead95d49980696e170b44719c09162077a5ff57b0aa1251d",
"220.js.map": "a3258afce70521793cfa720c06011a43625fd4251efaa08f23150fbe86ac68aa",
"341.js": "2abe46583f3d8379bd2f5899fa00649579996d99f92afb5a35a7bfda017a8f76",
"341.js.map": "81b3e3e8cd466f58e849c7616e1297c749eee693ec8dcd1474273ff6ae15b062",
"543.js": "87b65f17eeb500d732c45fb315c8a62a9a123c9cdd87ed9c6307453363685587",
"543.js.map": "413c0f7fa95767cb471c1233ed487662b191bcf38604482668152e0eafb3f044",
"599.js": "fdd48b18a822784bc6a4b1507392ecacdd5a20baa2838359257dbea4f441ad6c",
"599.js.map": "c39c9adbe22500dd6e60c01925866a84e04ab8929fe36368360e328aa3a91dcb",
"631.js": "b8896fe8a06a48011baccef2450df637f961d0f81ece8ff8a3cefe7b66a52a9f",
"631.js": "0b2fe6a8dbd97cbff2fcb9c0c0eb4c8748fd78b5dd5bae23152cbb568d312ec8",
"631.js.map": "72778084036addd3019d565b8460ac2965b6ea26648324a6a2a45457bfa39b49",
"649058283f564041551d.wasm": "84a1635aaca10061a9fad641983327dc9d261fb2cd3ca5ff3dd26bf3072664df",
"747.js": "245381b84770febdec88e6109abc18e1197e7c368081de39d2c86a07b310bb02",
"747.js.map": "1a0bf44ee920111cda192efa0a633518ed0bf8c7ee762b07c9c8c65e0998c056",
"854.js": "f7b5c0281ea90108ac385972e8b5c3d53d694269b4e30c41a2676c695073a216",
"854.js.map": "2ca819a163e860e4d4cf72f96ce1c6f5f73117083d3cf5023bd3da7d40e4e7fb",
"944.js": "04ccf9314434a9b994567a225259f2f0b3a8286eba750cc34dd559401fda8f5b",
"944.js.map": "1c04a358822e19bba71f7ae6ab627054ad6e2a0ddd101628671b0b82ff87548c",
"CHANGELOG.md": "a63ee66bc91f790d57061782cf01de8941bcd4b39959150191b2c0e331dd7da8",
"CHANGELOG.md": "acff566528153dcd33d0b6d3ad9041a247af2bee7d8b178a1512c636a52e1d4f",
"LICENSE": "8486a10c4393cee1c25392769ddd3b2d6c242d6ec7928e1414efff7dfb2f07ef",
"README.md": "c0bb6ec895f571f81feb93086942219c7aa987c824134791ecc81724bcabab56",
"img/3d96a93cfcb32df74eef.svg": "11ca1cf6edec87db3a9725b071f17c93c2313d9130d31d37da3458509a8ff67b",
@@ -45,19 +45,19 @@ Hash: SHA512
"img/patterns.png": "bf100549ec168420e9a7b6d759f492a761f964d33d45a3217ba30b9827b2bece",
"img/service_logs.jpg": "42f41204403337358ae437a7ad052daec6f9b6f9bef7f297fd065c1e68133bf4",
"img/table.png": "fe2fa65a8a761feb0a93c62231644645fb60ee06c44dda3ab16dc4e432286572",
"module.js": "1eba59c92b959d7f6bdf7b366f31d91886ffb62bb4c6156e6944c40830e7a276",
"module.js.map": "a44c075ab07272610e5b0777abd505f11a282fab6fead4f6fb16b066a13a7b48",
"plugin.json": "48599cd3e79fe8431bd0d19ced31a7401d932fc3eb2591407c13c71fc28fd583"
"module.js": "d5e2e8addac6b4df344ee9f7418712f305acd470fd7ec356896de7f88f17844f",
"module.js.map": "a7bac029a39c60ea58f4e1ec1946bdf34b9c9d11f33ba23042c15fea0fe9966e",
"plugin.json": "826a5f03283689fa061fe21d0f4cd6ba2a1bf95907cc72a0793b84682bd7a313"
}
}
-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v4.10.11
Comment: https://openpgpjs.org
wrkEARMKAAYFAmfa5i0AIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
cIhm50ZaAgkBH5fjd0ZHqVI4xxqTxN/RUKbLiVWo6s4NpL1MxO9Md/m2lkiM
5Ks9qBw+GE+nbr0k8bzhCnti/A9mOwNOLU7JNNUCCQHpSVdKH/0g7cZEcC8W
YLNqkBzXpaGsaNDswxrPhRmlta0KrzlSMqCEc1tKZaa+A+ozTDGcHBEaa8Ps
2jV4CsSK7A==
=ZPAz
wrkEARMKAAYFAmfubZQAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
cIhm57/nAgkBsw9oPef+o/m4oC2nT1yxJBKpfDV3sT+srJuky5Y8OE/y3wBm
2kKaqJWMKM06G+lhjtY2tHmTUOXH0Ktr4mzJ3psCCQEwX+1U1fCrFMbLI8Jm
WBaSaeNs6CGDBnce0lQUE8NeyYC2m+I/LeNaunwT7aXPsT4A+PPn7+U4vLQn
rSx1kJg42A==
=6yYA
-----END PGP SIGNATURE-----

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -54,11 +54,11 @@
"name": "Grafana"
},
"build": {
"time": 1742399020282,
"time": 1743678867477,
"repo": "https://github.com/grafana/logs-drilldown",
"branch": "main",
"hash": "7e460b5135a94ff8da2e783c1dbe08d5944de772",
"build": 2015
"hash": "0c279fb9cfb3a309c2d55ae176ebbfc2e0a1d7c2",
"build": 2115
},
"description": "Visualize log volumes to easily detect anomalies or significant changes over time, without needing to compose LogQL queries.",
"keywords": [
@@ -99,8 +99,8 @@
"path": "img/table.png"
}
],
"updated": "2025-03-19",
"version": "1.0.9"
"updated": "2025-04-03",
"version": "1.0.10"
},
"name": "Grafana Logs Drilldown",
"preload": true,

View File

@@ -1,3 +1,36 @@
## [1.2.3](https://github.com/grafana/explore-profiles/compare/v1.2.2...v1.2.3) (2025-04-03)
### Bug Fixes
* Get suggestions for optimize code ([#480](https://github.com/grafana/explore-profiles/issues/480)) ([23674c3](https://github.com/grafana/explore-profiles/commit/23674c3eaf8adf5572a725bade08f0a53038e77b))
## [1.2.2](https://github.com/grafana/explore-profiles/compare/v1.2.1...v1.2.2) (2025-04-03)
### Bug Fixes
* revert "profiling insights" extension ([#447](https://github.com/grafana/explore-profiles/issues/447)) ([43b35dc](https://github.com/grafana/explore-profiles/commit/43b35dc8f929e922bb8d554b92c6a763581d3443))
## [1.2.1](https://github.com/grafana/explore-profiles/compare/v1.2.0...v1.2.1) (2025-04-02)
### Bug Fixes
* **FlameGraph:** Use entire file as context in "Optimize Code" prompt ([#459](https://github.com/grafana/explore-profiles/issues/459)) ([569c17c](https://github.com/grafana/explore-profiles/commit/569c17c41511167add7a7a4db3f90cbc88897d68))
* **llm:** Add extra context in AI prompt about other lines in a file ([#460](https://github.com/grafana/explore-profiles/issues/460)) ([004b7aa](https://github.com/grafana/explore-profiles/commit/004b7aa04a136b02f036c0e33a27d1b333cbbf93))
### Features
* "profiling insights" extension ([#447](https://github.com/grafana/explore-profiles/issues/447)) ([13ff552](https://github.com/grafana/explore-profiles/commit/13ff552083cc4555aa21e8401be1516a364b8271))
# [1.2.0](https://github.com/grafana/explore-profiles/compare/v1.1.0...v1.2.0) (2025-03-10)

View File

@@ -8,13 +8,13 @@ Hash: SHA512
"signedByOrg": "grafana",
"signedByOrgName": "Grafana Labs",
"plugin": "grafana-pyroscope-app",
"version": "1.2.0",
"time": 1741608488645,
"version": "1.2.3",
"time": 1743715995969,
"keyId": "7e4d0c6a708866e7",
"files": {
"module.js.LICENSE.txt": "84798babe5a84ee41efdf41174af68e377c212b027183ecdd830747793156ded",
"LICENSE": "8486a10c4393cee1c25392769ddd3b2d6c242d6ec7928e1414efff7dfb2f07ef",
"CHANGELOG.md": "e47c37065788fde18c5fd946f6e3390bf8e774a6dab0da96777f6e00d30db569",
"CHANGELOG.md": "f9447ad55912a8192ba0ab54e2e2a167057ff9724edbc15ef316ffdc62e34ed4",
"img/bafee50693eb02088442.png": "66d5311c4ca898cdae2d0a23a414f04a7c49052f0035c1a2906b9e9bb15d628d",
"img/9c9cdd5175734d579007.png": "ab65c374d22c5faad274f6b8b2ab00bf404bb988803f09d375326cd692fce821",
"img/58f0b0e1cfa063e4b662.png": "87598baf93192a8dc7ee923e0af6a0c5e4b3359b00b7391fc9530108feb7aac0",
@@ -27,25 +27,25 @@ Hash: SHA512
"img/hero-image.png": "87598baf93192a8dc7ee923e0af6a0c5e4b3359b00b7391fc9530108feb7aac0",
"img/8cdf4d2e2df8326311ab.gif": "72afdd2fcad33e13db33af765a3fae9528315d78391684190dd23e40bd688852",
"README.md": "da879e54a2da3e7134c14016f0e5b59c9255da5b81d03a02e3e8d47356e15638",
"module.js.map": "9250610e159f0ff9c969115bf5397bb2facf30df644740f77b03e46758191a95",
"module.js.map": "9404b5b8c0c79c5582b356309ffa9b6548f1801195bd2ecb3600d5144d5260d5",
"e6c722427cfa8715e19d.svg": "559341996765c2d5639a2818d76bcd88ffe252212193a573f2f9f77dae5064dd",
"shared/infrastructure/profile-metrics/profile-metrics.json": "0a3a345a365e72f4278d3a76d5739600483bed8f374ddc1c2af85029057b8d07",
"pages/ProfilesExplorerView/components/SceneByVariableRepeaterGrid/components/SceneEmptyState/ui/img/grot-404-light.svg": "89ea40b6dcf2dc8dfe146f8acac42b604e4d3c3dad03e539551d58a21f80654d",
"pages/ProfilesExplorerView/components/SceneByVariableRepeaterGrid/components/SceneEmptyState/ui/img/grot-404-dark.svg": "a0c8acbcf5685a8950ce1c67722579dc745585fb0d668ce965327955e5e829ff",
"e79edcfbe2068fae2364.svg": "89ea40b6dcf2dc8dfe146f8acac42b604e4d3c3dad03e539551d58a21f80654d",
"plugin.json": "9d683fbd399d13b3bcfac34180a30811f886467867c5623774b8e8a044b543f6",
"plugin.json": "ace999534674d0864a104665afc9143c039e6c86b90aaa6e4a205be765f2cfa0",
"944c737f589d02ecf603.svg": "a0c8acbcf5685a8950ce1c67722579dc745585fb0d668ce965327955e5e829ff",
"module.js": "82d44ac2beb28d6cfc231b95a1e3bb827595fce4b9132dea50864dbcc8bba84d"
"module.js": "a7cc2a0b7e676fddfa69f94b46f67c73b5abb81133620b70e731736fbd6f7f95"
}
}
-----BEGIN PGP SIGNATURE-----
Version: OpenPGP.js v4.10.11
Comment: https://openpgpjs.org
wrkEARMKAAYFAmfO1igAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
cIhm5zX0AgkAcX5xYTb23qnCS4L2Q8q34fhVnXdn2UKn4N/oUWoVQRPwbDGZ
1flIEbe6FcWV6xC9W5rQJDrQwA6KF/mj0zTSCqkCCQEwEGnM3u0nyOYIqhP/
cSjUK+DTheWaybLqHhydG/65nDOCselqAB+zIEfk8TNnO6w0zE0AevGNxqVo
IRzQwzYP6A==
=XcY0
wrkEARMKAAYFAmfu/pwAIQkQfk0ManCIZucWIQTzOyW2kQdOhGNlcPN+TQxq
cIhm50GOAgkAMYEWBTEBliMidQSc9CsoD+h1V3hM4mdQSDrYjPXVO/aPvZ8z
zm8s9ZVIuSggnEYranWKRSAOtOp00864RRe8HqwCCQEYMOfD9Icg03GlEWcv
XvRG/A1/WJXQSVOQaGbc8pgb2FG7OIF/yWreBzsfObtEaMbfv2wx+8IE7QyZ
eMk0sVCg8w==
=eeMe
-----END PGP SIGNATURE-----

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -20,7 +20,7 @@
"performance",
"drilldown"
],
"description": "Continuous profiling service powered by Grafana Pyroscope",
"description": "View and analyze high-level service performance, identify problem processes for optimization, and diagnose issues to determine root causes.",
"author": {
"name": "Grafana"
},
@@ -34,8 +34,8 @@
"path": "img/hero-image.png"
}
],
"version": "1.2.0",
"updated": "2025-03-10",
"version": "1.2.3",
"updated": "2025-04-03",
"links": [
{
"name": "GitHub",