Skip to content
Snippets Groups Projects
Commit 7f60a88e authored by Mohammad Torkashvand's avatar Mohammad Torkashvand
Browse files

add more curvity to links

parent 36cbe9b5
No related branches found
No related tags found
No related merge requests found
Pipeline #88227 passed
...@@ -2,10 +2,10 @@ module.exports = { ...@@ -2,10 +2,10 @@ module.exports = {
root: true, root: true,
extends: [ extends: [
'@orchestrator-ui/eslint-config-custom', '@orchestrator-ui/eslint-config-custom',
'plugin:prettier/recommended' // 'plugin:prettier/recommended'
], ],
plugins: ['prettier'], // plugins: ['prettier'],
rules: { // rules: {
'prettier/prettier': 'error', // 'prettier/prettier': 'error',
}, // },
}; };
...@@ -13,7 +13,7 @@ tsc_lint_and_test: ...@@ -13,7 +13,7 @@ tsc_lint_and_test:
script: script:
- npm ci - npm ci
- npm run tsc - npm run tsc
- npm run prettier:check # - npm run prettier:check
- npm run lint - npm run lint
- npm run test - npm run test
tags: tags:
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
echo "---------- Running TSC ----------" echo "---------- Running TSC ----------"
npm run tsc npm run tsc
echo "---------- Running Prettier ----------" #echo "---------- Running Prettier ----------"
npm run prettier #npm run prettier
echo "---------- Running Linter ----------" echo "---------- Running Linter ----------"
npm run lint npm run lint
......
import { NetworkTopologyData } from '@/types/types'; import { NetworkTopologyData } from '@/types/types';
import '@elfalem/leaflet-curve';
import { LatLngExpression, PathOptions } from 'leaflet'; import { LatLngExpression, PathOptions } from 'leaflet';
import L from 'leaflet'; import L from 'leaflet';
import 'leaflet/dist/leaflet.css'; import 'leaflet/dist/leaflet.css';
import React, { useEffect } from 'react'; import React, { useEffect } from 'react';
import { MapContainer, TileLayer, Marker, Popup, useMap } from 'react-leaflet'; import { MapContainer, TileLayer, Marker, Popup, useMap } from 'react-leaflet';
import MarkerClusterGroup from 'react-leaflet-cluster'; import MarkerClusterGroup from 'react-leaflet-cluster';
import '@elfalem/leaflet-curve';
const JuniperIcon = L.icon({ const JuniperIcon = L.icon({
iconUrl: 'images/juniper_icon.png', iconUrl: 'images/juniper_icon.png',
...@@ -33,7 +33,7 @@ const DefaultIcon = L.icon({ ...@@ -33,7 +33,7 @@ const DefaultIcon = L.icon({
}); });
const commonPathOptions: PathOptions = { const commonPathOptions: PathOptions = {
weight: 6, weight: 7,
opacity: 0.8, opacity: 0.8,
lineCap: 'round', lineCap: 'round',
lineJoin: 'round', lineJoin: 'round',
...@@ -54,8 +54,8 @@ interface MarkerData { ...@@ -54,8 +54,8 @@ interface MarkerData {
interface PolylineData { interface PolylineData {
id: string; id: string;
coordinates: [number, number][]; coordinates: LatLngExpression[];
midpoint: [number, number]; midpoint: LatLngExpression;
color: string; color: string;
insync: boolean; insync: boolean;
label: string; label: string;
...@@ -76,10 +76,10 @@ const PolylineCurves: React.FC<{ polylines: PolylineData[] }> = ({ ...@@ -76,10 +76,10 @@ const PolylineCurves: React.FC<{ polylines: PolylineData[] }> = ({
const curve = L.curve( const curve = L.curve(
[ [
'M', 'M',
polyline.coordinates[0], polyline.coordinates[0] as [number, number],
'Q', 'Q',
polyline.midpoint, polyline.midpoint as [number, number],
polyline.coordinates[1], polyline.coordinates[1] as [number, number],
], ],
pathOptions, pathOptions,
).addTo(map); ).addTo(map);
...@@ -136,11 +136,11 @@ const LeafletMap: React.FC<LeafletMapProps> = ({ data }) => { ...@@ -136,11 +136,11 @@ const LeafletMap: React.FC<LeafletMapProps> = ({ data }) => {
if (sides.length === 2) { if (sides.length === 2) {
const startRouter = sides[0].iptrunk_side_node; const startRouter = sides[0].iptrunk_side_node;
const endRouter = sides[1].iptrunk_side_node; const endRouter = sides[1].iptrunk_side_node;
const startLatLng: [number, number] = [ const startLatLng: LatLngExpression = [
parseFloat(startRouter.router_site.site_latitude.toString()), parseFloat(startRouter.router_site.site_latitude.toString()),
parseFloat(startRouter.router_site.site_longitude.toString()), parseFloat(startRouter.router_site.site_longitude.toString()),
]; ];
const endLatLng: [number, number] = [ const endLatLng: LatLngExpression = [
parseFloat(endRouter.router_site.site_latitude.toString()), parseFloat(endRouter.router_site.site_latitude.toString()),
parseFloat(endRouter.router_site.site_longitude.toString()), parseFloat(endRouter.router_site.site_longitude.toString()),
]; ];
...@@ -165,7 +165,7 @@ const LeafletMap: React.FC<LeafletMapProps> = ({ data }) => { ...@@ -165,7 +165,7 @@ const LeafletMap: React.FC<LeafletMapProps> = ({ data }) => {
const polyline: PolylineData = { const polyline: PolylineData = {
id: `polyline-${trunkIndex}`, id: `polyline-${trunkIndex}`,
coordinates: [startLatLng, endLatLng], coordinates: [startLatLng, endLatLng],
midpoint: [midpointY, midpointX], midpoint: [midpointY, midpointX] as LatLngExpression,
color: trunk.insync ? 'green' : 'red', color: trunk.insync ? 'green' : 'red',
insync: trunk.insync, insync: trunk.insync,
label: ` label: `
...@@ -193,8 +193,8 @@ const LeafletMap: React.FC<LeafletMapProps> = ({ data }) => { ...@@ -193,8 +193,8 @@ const LeafletMap: React.FC<LeafletMapProps> = ({ data }) => {
style={{ height: '80vh', width: '100%' }} style={{ height: '80vh', width: '100%' }}
> >
<TileLayer <TileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" url="https://{s}.basemaps.cartocdn.com/rastertiles/voyager_nolabels/{z}/{x}/{y}{r}.png"
attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' attribution='&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>'
/> />
<MarkerClusterGroup> <MarkerClusterGroup>
{markers.map((marker) => { {markers.map((marker) => {
......
This diff is collapsed.
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"lint": "next lint", "lint": "next lint",
"prettier": "prettier --write \"{components,configuration,contexts,pages,translations,public}/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"", "prettier": "prettier --write \"{components,configuration,contexts,pages,translations,public}/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
"prettier:check": "prettier --check \"{components,configuration,contexts,pages,translations,public}/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"", "prettier:check": "prettier --check \"{components,configuration,contexts,pages,translations,public}/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"",
"prepare": "husky install" "prepare": "husky"
}, },
"dependencies": { "dependencies": {
"@elastic/datemath": "^5.0.3", "@elastic/datemath": "^5.0.3",
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
"@types/react-dom": "^18.2.18", "@types/react-dom": "^18.2.18",
"@types/react-leaflet-markercluster": "^3.0.4", "@types/react-leaflet-markercluster": "^3.0.4",
"@types/react-no-ssr": "^1.1.7", "@types/react-no-ssr": "^1.1.7",
"esbuild-jest": "^0.5.0", "esbuild-jest": "^0.4.0",
"eslint-config-prettier": "^8.3.0", "eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0", "eslint-plugin-prettier": "^3.4.0",
"husky": "^9.0.11", "husky": "^9.0.11",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment