Compare commits

...

9 Commits

Author SHA1 Message Date
DmitriyA 306ac00efe Привел граф в рвбочее состояние, улучшил интерфейс 2025-03-12 17:29:36 -04:00
YurijO f525d216e3 Merge pull request 'refactoring' (#17) from refactoring into rc
test-org/trust-module-frontend/pipeline/pr-main Build succeeded
Reviewed-on: http://192.168.2.61/deployer3000/trust-module-frontend/pulls/17
2025-03-12 21:19:53 +03:00
yuobrezkov 448ea7a5a6 Added / to curl request
test-org/trust-module-frontend/pipeline/pr-main Build succeeded
2025-03-10 17:48:38 +03:00
yuobrezkov 5ef440384d Deleted Debug info 2025-03-10 17:47:09 +03:00
yuobrezkov 8a7d47bc47 DEBUG info 2
test-org/trust-module-frontend/pipeline/pr-main Build succeeded
2025-03-10 17:42:40 +03:00
yuobrezkov c3f1192de4 DEBUG info
test-org/trust-module-frontend/pipeline/pr-main Build started... Details
2025-03-10 17:39:09 +03:00
yuobrezkov 101ce14197 Notify after PR 2
test-org/trust-module-frontend/pipeline/pr-main Build succeeded
2025-03-10 17:20:13 +03:00
yuobrezkov bda6197120 Notify after PR
test-org/trust-module-frontend/pipeline/pr-main Build succeeded
2025-03-10 17:10:20 +03:00
yuobrezkov 231bc84ccc Test for notifying
Build succeeded Details
test-org/trust-module-frontend/pipeline/pr-main Build succeeded Details
2025-03-10 15:29:13 +03:00
10 changed files with 546 additions and 167 deletions

24
Jenkinsfile vendored
View File

@ -1,3 +1,24 @@
def notify(
String context,
String giteaUser,
String giteaPass,
String repositoryUrl,
String repositoryName,
String commitHash,
String buildStatus
) {
def status = buildStatus == 'success' ? 'success' : 'failure'
def description = buildStatus == 'success' ? 'Build succeeded' : 'Build failed'
sh """
curl -X POST \
-u "${giteaUser}:${giteaPass}" \
-H "Content-Type: application/json" \
-d '{"context":"${context}","state": "${status}", "description": "${description}"}' \
${repositoryUrl}deployer3000/${repositoryName}/statuses/${commitHash}
"""
}
pipeline { pipeline {
agent any agent any
environment { environment {
@ -58,6 +79,9 @@ pipeline {
http://git.entcor/api/v1/repos/deployer3000/trust-module-frontend/pulls/${prId}/merge http://git.entcor/api/v1/repos/deployer3000/trust-module-frontend/pulls/${prId}/merge
""" """
echo "PR ${prId} merged successfully into master!" echo "PR ${prId} merged successfully into master!"
def context = "test-org/trust-module-frontend/pipeline/pr-${env.CHANGE_TARGET}"
def commitHash = sh(script: "git rev-parse HEAD~1", returnStdout: true).trim()
notify(context, GITEA_USER, GITEA_PASS, env.GITEA_REPOSITORY_URL, "trust-module-frontend", commitHash, "success")
} }
} }
} }

View File

@ -1,13 +1,16 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head>
<meta charset="UTF-8" /> <head>
<link rel="icon" type="image/svg+xml" href="/system_monitor_icon.svg" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link rel="icon" type="image/svg+xml" href="/system_monitor_icon.svg" />
<title>Модуль доверия</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head> <title>Модуль устойчивого функционирования</title>
<body> </head>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script> <body>
</body> <div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html> </html>

340
package-lock.json generated
View File

@ -11,10 +11,13 @@
"axios": "^1.7.9", "axios": "^1.7.9",
"chart.js": "^4.0.0", "chart.js": "^4.0.0",
"chartjs-adapter-date-fns": "^3.0.0", "chartjs-adapter-date-fns": "^3.0.0",
"chartjs-chart-box-and-violin-plot": "^4.0.0",
"d3": "^7.9.0", "d3": "^7.9.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-chartjs-2": "^5.0.0", "react-chartjs-2": "^5.0.0",
"react-dom": "^18.3.1" "react-datepicker": "^8.1.0",
"react-dom": "^18.3.1",
"recharts": "^2.15.1"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.17.0", "@eslint/js": "^9.17.0",
@ -267,6 +270,17 @@
"@babel/core": "^7.0.0-0" "@babel/core": "^7.0.0-0"
} }
}, },
"node_modules/@babel/runtime": {
"version": "7.26.9",
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz",
"integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==",
"dependencies": {
"regenerator-runtime": "^0.14.0"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/template": { "node_modules/@babel/template": {
"version": "7.25.9", "version": "7.25.9",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.25.9.tgz",
@ -891,6 +905,54 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0" "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
} }
}, },
"node_modules/@floating-ui/core": {
"version": "1.6.9",
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.9.tgz",
"integrity": "sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==",
"dependencies": {
"@floating-ui/utils": "^0.2.9"
}
},
"node_modules/@floating-ui/dom": {
"version": "1.6.13",
"resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.6.13.tgz",
"integrity": "sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==",
"dependencies": {
"@floating-ui/core": "^1.6.0",
"@floating-ui/utils": "^0.2.9"
}
},
"node_modules/@floating-ui/react": {
"version": "0.27.5",
"resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.27.5.tgz",
"integrity": "sha512-BX3jKxo39Ba05pflcQmqPPwc0qdNsdNi/eweAFtoIdrJWNen2sVEWMEac3i6jU55Qfx+lOcdMNKYn2CtWmlnOQ==",
"dependencies": {
"@floating-ui/react-dom": "^2.1.2",
"@floating-ui/utils": "^0.2.9",
"tabbable": "^6.0.0"
},
"peerDependencies": {
"react": ">=17.0.0",
"react-dom": ">=17.0.0"
}
},
"node_modules/@floating-ui/react-dom": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.2.tgz",
"integrity": "sha512-06okr5cgPzMNBy+Ycse2A6udMi4bqwW/zgBF/rwjcNqWkyr82Mcg8b0vjX8OJpZFy/FKjJmw6wV7t44kK6kW7A==",
"dependencies": {
"@floating-ui/dom": "^1.0.0"
},
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
}
},
"node_modules/@floating-ui/utils": {
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.9.tgz",
"integrity": "sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg=="
},
"node_modules/@humanfs/core": { "node_modules/@humanfs/core": {
"version": "0.19.1", "version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
@ -1281,6 +1343,11 @@
"win32" "win32"
] ]
}, },
"node_modules/@sgratzl/science": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@sgratzl/science/-/science-2.0.0.tgz",
"integrity": "sha512-LO3gArm8rVczcksg35xnZbOLEOE091VjyvvzR8mnPjP5K5+xqZEWhBi+lDcEk50dAlfPBoBHfwmu+MmiiSpXHw=="
},
"node_modules/@types/babel__core": { "node_modules/@types/babel__core": {
"version": "7.20.5", "version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@ -1326,6 +1393,60 @@
"@babel/types": "^7.20.7" "@babel/types": "^7.20.7"
} }
}, },
"node_modules/@types/d3-array": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.1.tgz",
"integrity": "sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg=="
},
"node_modules/@types/d3-color": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz",
"integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A=="
},
"node_modules/@types/d3-ease": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz",
"integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA=="
},
"node_modules/@types/d3-interpolate": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz",
"integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==",
"dependencies": {
"@types/d3-color": "*"
}
},
"node_modules/@types/d3-path": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz",
"integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg=="
},
"node_modules/@types/d3-scale": {
"version": "4.0.9",
"resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz",
"integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==",
"dependencies": {
"@types/d3-time": "*"
}
},
"node_modules/@types/d3-shape": {
"version": "3.1.7",
"resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz",
"integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==",
"dependencies": {
"@types/d3-path": "*"
}
},
"node_modules/@types/d3-time": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz",
"integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g=="
},
"node_modules/@types/d3-timer": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz",
"integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw=="
},
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.6.tgz",
@ -1796,6 +1917,63 @@
"date-fns": ">=2.0.0" "date-fns": ">=2.0.0"
} }
}, },
"node_modules/chartjs-chart-box-and-violin-plot": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/chartjs-chart-box-and-violin-plot/-/chartjs-chart-box-and-violin-plot-4.0.0.tgz",
"integrity": "sha512-5rjlkEhZa2KOPg99ViKuuzKWXD2cfRx5tXDCJdLsdg+WUW8euYJEyPb94fNgV2yUz4W4+S3yhZf3zTNuKfIKAg==",
"deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
"dependencies": {
"@sgratzl/science": "^2.0.0",
"chart.js": "^2.8.0"
}
},
"node_modules/chartjs-chart-box-and-violin-plot/node_modules/chart.js": {
"version": "2.9.4",
"resolved": "https://registry.npmjs.org/chart.js/-/chart.js-2.9.4.tgz",
"integrity": "sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==",
"dependencies": {
"chartjs-color": "^2.1.0",
"moment": "^2.10.2"
}
},
"node_modules/chartjs-color": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/chartjs-color/-/chartjs-color-2.4.1.tgz",
"integrity": "sha512-haqOg1+Yebys/Ts/9bLo/BqUcONQOdr/hoEr2LLTRl6C5LXctUdHxsCYfvQVg5JIxITrfCNUDr4ntqmQk9+/0w==",
"dependencies": {
"chartjs-color-string": "^0.6.0",
"color-convert": "^1.9.3"
}
},
"node_modules/chartjs-color-string": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/chartjs-color-string/-/chartjs-color-string-0.6.0.tgz",
"integrity": "sha512-TIB5OKn1hPJvO7JcteW4WY/63v6KwEdt6udfnDE9iCAZgy+V4SrbSxoIbTw/xkUIapjEI4ExGtD0+6D3KyFd7A==",
"dependencies": {
"color-name": "^1.0.0"
}
},
"node_modules/chartjs-color/node_modules/color-convert": {
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dependencies": {
"color-name": "1.1.3"
}
},
"node_modules/chartjs-color/node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw=="
},
"node_modules/clsx": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
"engines": {
"node": ">=6"
}
},
"node_modules/color-convert": { "node_modules/color-convert": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
@ -1813,7 +1991,6 @@
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/combined-stream": { "node_modules/combined-stream": {
@ -1868,7 +2045,6 @@
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/d3": { "node_modules/d3": {
@ -2299,7 +2475,6 @@
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz",
"integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==",
"peer": true,
"funding": { "funding": {
"type": "github", "type": "github",
"url": "https://github.com/sponsors/kossnocorp" "url": "https://github.com/sponsors/kossnocorp"
@ -2323,6 +2498,11 @@
} }
} }
}, },
"node_modules/decimal.js-light": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz",
"integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg=="
},
"node_modules/deep-is": { "node_modules/deep-is": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@ -2395,6 +2575,15 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/dom-helpers": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/dom-helpers/-/dom-helpers-5.2.1.tgz",
"integrity": "sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==",
"dependencies": {
"@babel/runtime": "^7.8.7",
"csstype": "^3.0.2"
}
},
"node_modules/dunder-proto": { "node_modules/dunder-proto": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
@ -2857,6 +3046,11 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/eventemitter3": {
"version": "4.0.7",
"resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz",
"integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw=="
},
"node_modules/fast-deep-equal": { "node_modules/fast-deep-equal": {
"version": "3.1.3", "version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@ -2864,6 +3058,14 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/fast-equals": {
"version": "5.2.2",
"resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-5.2.2.tgz",
"integrity": "sha512-V7/RktU11J3I36Nwq2JnZEM7tNm17eBJz+u25qdxBZeCKiX6BkVSZQjwWIr+IobgnZy+ag73tTZgZi7tr0LrBw==",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/fast-json-stable-stringify": { "node_modules/fast-json-stable-stringify": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
@ -3837,6 +4039,11 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/lodash.merge": { "node_modules/lodash.merge": {
"version": "4.6.2", "version": "4.6.2",
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
@ -3907,6 +4114,14 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/moment": {
"version": "2.30.1",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
"engines": {
"node": "*"
}
},
"node_modules/ms": { "node_modules/ms": {
"version": "2.1.3", "version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
@ -3951,7 +4166,6 @@
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@ -4222,7 +4436,6 @@
"version": "15.8.1", "version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
"integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"loose-envify": "^1.4.0", "loose-envify": "^1.4.0",
@ -4266,6 +4479,20 @@
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
} }
}, },
"node_modules/react-datepicker": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/react-datepicker/-/react-datepicker-8.2.0.tgz",
"integrity": "sha512-zmUSOKxLrdYA6+etDU8N/w3vC9BZ4qRQ9azvp1seFgW4kk7QZJLB9aB7PJcw/EYWOK/1X7un9rUMXWPlcuZ4dw==",
"dependencies": {
"@floating-ui/react": "^0.27.3",
"clsx": "^2.1.1",
"date-fns": "^4.1.0"
},
"peerDependencies": {
"react": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc",
"react-dom": "^16.9.0 || ^17 || ^18 || ^19 || ^19.0.0-rc"
}
},
"node_modules/react-dom": { "node_modules/react-dom": {
"version": "18.3.1", "version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
@ -4283,7 +4510,6 @@
"version": "16.13.1", "version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/react-refresh": { "node_modules/react-refresh": {
@ -4296,6 +4522,70 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/react-smooth": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/react-smooth/-/react-smooth-4.0.4.tgz",
"integrity": "sha512-gnGKTpYwqL0Iii09gHobNolvX4Kiq4PKx6eWBCYYix+8cdw+cGo3do906l1NBPKkSWx1DghC1dlWG9L2uGd61Q==",
"dependencies": {
"fast-equals": "^5.0.1",
"prop-types": "^15.8.1",
"react-transition-group": "^4.4.5"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/react-transition-group": {
"version": "4.4.5",
"resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz",
"integrity": "sha512-pZcd1MCJoiKiBR2NRxeCRg13uCXbydPnmB4EOeRrY7480qNWO8IIgQG6zlDkm6uRMsURXPuKq0GWtiM59a5Q6g==",
"dependencies": {
"@babel/runtime": "^7.5.5",
"dom-helpers": "^5.0.1",
"loose-envify": "^1.4.0",
"prop-types": "^15.6.2"
},
"peerDependencies": {
"react": ">=16.6.0",
"react-dom": ">=16.6.0"
}
},
"node_modules/recharts": {
"version": "2.15.1",
"resolved": "https://registry.npmjs.org/recharts/-/recharts-2.15.1.tgz",
"integrity": "sha512-v8PUTUlyiDe56qUj82w/EDVuzEFXwEHp9/xOowGAZwfLjB9uAy3GllQVIYMWF6nU+qibx85WF75zD7AjqoT54Q==",
"dependencies": {
"clsx": "^2.0.0",
"eventemitter3": "^4.0.1",
"lodash": "^4.17.21",
"react-is": "^18.3.1",
"react-smooth": "^4.0.4",
"recharts-scale": "^0.4.4",
"tiny-invariant": "^1.3.1",
"victory-vendor": "^36.6.8"
},
"engines": {
"node": ">=14"
},
"peerDependencies": {
"react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/recharts-scale": {
"version": "0.4.5",
"resolved": "https://registry.npmjs.org/recharts-scale/-/recharts-scale-0.4.5.tgz",
"integrity": "sha512-kivNFO+0OcUNu7jQquLXAxz1FIwZj8nrj+YkOKc5694NbjCvcT6aSZiIzNzd2Kul4o4rTto8QVR9lMNtxD4G1w==",
"dependencies": {
"decimal.js-light": "^2.4.1"
}
},
"node_modules/recharts/node_modules/react-is": {
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg=="
},
"node_modules/reflect.getprototypeof": { "node_modules/reflect.getprototypeof": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz",
@ -4319,6 +4609,11 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/regenerator-runtime": {
"version": "0.14.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
"integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
},
"node_modules/regexp.prototype.flags": { "node_modules/regexp.prototype.flags": {
"version": "1.5.4", "version": "1.5.4",
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz",
@ -4791,6 +5086,16 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/tabbable": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.2.0.tgz",
"integrity": "sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew=="
},
"node_modules/tiny-invariant": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
"integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="
},
"node_modules/type-check": { "node_modules/type-check": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
@ -4942,6 +5247,27 @@
"punycode": "^2.1.0" "punycode": "^2.1.0"
} }
}, },
"node_modules/victory-vendor": {
"version": "36.9.2",
"resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-36.9.2.tgz",
"integrity": "sha512-PnpQQMuxlwYdocC8fIJqVXvkeViHYzotI+NJrCuav0ZYFoq912ZHBk3mCeuj+5/VpodOjPe1z0Fk2ihgzlXqjQ==",
"dependencies": {
"@types/d3-array": "^3.0.3",
"@types/d3-ease": "^3.0.0",
"@types/d3-interpolate": "^3.0.1",
"@types/d3-scale": "^4.0.2",
"@types/d3-shape": "^3.1.0",
"@types/d3-time": "^3.0.0",
"@types/d3-timer": "^3.0.0",
"d3-array": "^3.1.6",
"d3-ease": "^3.0.1",
"d3-interpolate": "^3.0.1",
"d3-scale": "^4.0.2",
"d3-shape": "^3.1.0",
"d3-time": "^3.0.0",
"d3-timer": "^3.0.1"
}
},
"node_modules/vite": { "node_modules/vite": {
"version": "6.0.11", "version": "6.0.11",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.0.11.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.11.tgz",

View File

@ -109,7 +109,7 @@ const Dashboard = () => {
return ( return (
<div> <div>
<h2>Общий мониторинг состояния системы</h2> <h2>Общий мониторинг состояния системы</h2>
<label>Процент доверия системы</label> <label>Надежность системы</label>
<SystemStatusChart data={statusHistories.history1} /> <SystemStatusChart data={statusHistories.history1} />
<label>Функциональность системы</label> <label>Функциональность системы</label>
<SystemStatusChart data={statusHistories.history2} /> <SystemStatusChart data={statusHistories.history2} />

View File

@ -7,25 +7,23 @@ const MenuItem = ({ item, onSelectItem, sidebarWidth }) => {
const hasChildren = Array.isArray(item.items) && item.items.length > 0; const hasChildren = Array.isArray(item.items) && item.items.length > 0;
const statusColor = getStatusColor(item.status); const statusColor = getStatusColor(item.status);
// Обработчик одинарного клика (разворачивание/сворачивание или открытие элемента)
const handleSingleClick = () => { const handleSingleClick = () => {
if (hasChildren) { if (hasChildren) {
setIsOpen(!isOpen); // Разворачиваем/сворачиваем дочерние элементы setIsOpen(!isOpen);
} else { } else {
onSelectItem(item); // Если нет потомков, открываем элемент как вкладку onSelectItem(item);
} }
}; };
// Обработчик клика для открытия родителя
const handleOpenParent = (e) => { const handleOpenParent = (e) => {
e.stopPropagation(); // Останавливаем всплытие события, чтобы не сработал handleSingleClick e.stopPropagation();
onSelectItem(item); // Открываем родителя onSelectItem(item);
}; };
return ( return (
<div className="menu-item" style={{ width: sidebarWidth - 20 }}> {/* Динамическая ширина */} <div className={`menu-item ${hasChildren ? "has-children" : ""}`} style={{ width: sidebarWidth - 20 }}>
<div <div
onClick={handleSingleClick} // Одинарный клик для разворачивания/сворачивания или открытия onClick={handleSingleClick}
className="menu-item-header" className="menu-item-header"
> >
{/* Круглый индикатор статуса */} {/* Круглый индикатор статуса */}
@ -33,21 +31,26 @@ const MenuItem = ({ item, onSelectItem, sidebarWidth }) => {
className={`status-indicator ${statusColor === "red" ? "blinking" : ""}`} className={`status-indicator ${statusColor === "red" ? "blinking" : ""}`}
style={{ backgroundColor: statusColor }} style={{ backgroundColor: statusColor }}
/> />
{/* Текст элемента меню */}
<span>{item.title}</span> <span>{item.title}</span>
{/* Иконка для открытия родителя */} {/* Иконки */}
{hasChildren && ( {hasChildren && (
<span <div style={{ display: "flex", alignItems: "center" }}>
onClick={handleOpenParent} {/* Иконка для открытия родителя */}
className="open-parent-icon" <span
title="Открыть родителя" onClick={handleOpenParent}
> className="open-parent-icon"
📂 title="Открыть родителя"
</span> >
📂
</span>
{/* Иконка для разворачивания/сворачивания */}
<span className="toggle-icon">
{isOpen ? "▲" : "▼"}
</span>
</div>
)} )}
{/* Иконка для разворачивания/сворачивания */}
{hasChildren && <span>{isOpen ? "▲" : "▼"}</span>}
</div> </div>
{isOpen && hasChildren && ( {isOpen && hasChildren && (
<div className="submenu"> <div className="submenu">

View File

@ -5,7 +5,6 @@ import { getStatusColor } from "./dataUtils";
const TreeChart = ({ data, onNodeClick }) => { const TreeChart = ({ data, onNodeClick }) => {
const chartRef = useRef(); const chartRef = useRef();
const simulationRef = useRef(null);
const nodePositions = useRef(new Map()); const nodePositions = useRef(new Map());
const { root, nodes, links } = useMemo(() => { const { root, nodes, links } = useMemo(() => {
@ -23,22 +22,63 @@ const TreeChart = ({ data, onNodeClick }) => {
target: d, target: d,
})); }));
// Применяем сохраненные позиции к узлам // Размещаем узлы иерархически
const center = { x: 0, y: 0 }; // Центральная точка
const baseRadius = 150; // Базовый радиус для 1-го уровня
const branchOffset = 80; // Смещение узлов вдоль ветки
const angleOffset = Math.PI / 4; // Угол смещения для дочерних ветвей
const spreadFactor = 1.5; // Коэффициент растяжения для последних узлов
nodes.forEach((node) => { nodes.forEach((node) => {
const prev = nodePositions.current.get(node.data.id); const prev = nodePositions.current.get(node.data.id);
if (prev) { if (prev) {
node.x = prev.x; node.x = prev.x;
node.y = prev.y; node.y = prev.y;
node.fx = prev.fx ?? null;
node.fy = prev.fy ?? null;
} else { } else {
const parent = node.parent; if (node.depth === 0) {
node.x = parent ? parent.x + Math.random() * 50 - 25 : Math.random() * 1000; // Центральный узел
node.y = parent ? parent.y + Math.random() * 50 - 25 : Math.random() * 1000; node.x = center.x;
node.y = center.y;
} else if (node.depth === 1) {
// Первый уровень - равномерно по окружности
const parent = node.parent;
const index = parent.children.indexOf(node);
const totalSiblings = parent.children.length;
const radius = baseRadius * node.depth;
const sectorAngle = (Math.PI * 2) / totalSiblings;
const angle = index * sectorAngle;
node.x = parent.x + radius * Math.cos(angle);
node.y = parent.y + radius * Math.sin(angle);
node.angle = angle; // Запоминаем угол для веток
} else {
// Второй уровень и дальше - ветка растет в направлении родителя
const parent = node.parent;
const siblings = parent.children || [];
const index = siblings.indexOf(node);
const totalSiblings = siblings.length;
const direction = parent.angle || 0;
const offsetAngle = ((index - (totalSiblings - 1) / 2) * angleOffset) / totalSiblings;
let distance = branchOffset;
if (!node.children || node.children.length === 0) {
// Если это последний узел, увеличиваем расстояние
distance *= spreadFactor + node.depth * 0.2; // Чем глубже, тем больше разброс
}
node.x = parent.x + distance * Math.cos(direction + offsetAngle);
node.y = parent.y + distance * Math.sin(direction + offsetAngle);
node.angle = direction + offsetAngle;
}
} }
nodePositions.current.set(node.data.id, { x: node.x, y: node.y, fx: node.fx, fy: node.fy }); nodePositions.current.set(node.data.id, { x: node.x, y: node.y });
}); });
return { root, nodes, links }; return { root, nodes, links };
}, [data]); }, [data]);
@ -55,48 +95,26 @@ const TreeChart = ({ data, onNodeClick }) => {
svg.append("g").attr("class", "nodes"); svg.append("g").attr("class", "nodes");
svg.append("g").attr("class", "labels"); svg.append("g").attr("class", "labels");
// Инициализация симуляции // Очищаем предыдущие элементы
simulationRef.current = d3.forceSimulation() svg.selectAll(".links line").remove();
.force("link", d3.forceLink().id((d) => d.data.id).distance(80).strength(1)) svg.selectAll(".nodes circle").remove();
.force("charge", d3.forceManyBody().strength(-200)) svg.selectAll(".labels text").remove();
.force("center", d3.forceCenter(0, 0))
.force("collision", d3.forceCollide().radius(20))
.force("x", d3.forceX(0).strength(0.05))
.force("y", d3.forceY(0).strength(0.05))
.force("radial", d3.forceRadial(200, 0, 0).strength(0.02))
.alphaDecay(0.02)
.alphaTarget(0.1);
// Запускаем симуляцию на 15 секунд, затем отключаем // Рисуем связи
setTimeout(() => {
if (simulationRef.current) {
simulationRef.current.stop(); // Останавливаем симуляцию
nodes.forEach((node) => {
node.fx = node.x; // Фиксируем текущие позиции узлов
node.fy = node.y;
});
}
}, 15000); // 15 секунд
}, []);
useEffect(() => {
if (!root || !chartRef.current || !simulationRef.current) return; // Проверяем, что симуляция инициализирована
const svg = d3.select(chartRef.current);
const linkGroup = svg.select(".links"); const linkGroup = svg.select(".links");
const nodeGroup = svg.select(".nodes");
const labelGroup = svg.select(".labels");
// Обновляем связи
const link = linkGroup const link = linkGroup
.selectAll("line") .selectAll("line")
.data(links, (d) => `${d.source.data.id}-${d.target.data.id}`) .data(links, (d) => `${d.source.data.id}-${d.target.data.id}`)
.join("line") .join("line")
.attr("stroke", "#999") .attr("stroke", "#999")
.attr("stroke-opacity", 0.6); .attr("stroke-opacity", 0.6)
.attr("x1", (d) => d.source.x)
.attr("y1", (d) => d.source.y)
.attr("x2", (d) => d.target.x)
.attr("y2", (d) => d.target.y);
// Обновляем узлы // Рисуем узлы
const nodeGroup = svg.select(".nodes");
const node = nodeGroup const node = nodeGroup
.selectAll("circle") .selectAll("circle")
.data(nodes, (d) => d.data.id) .data(nodes, (d) => d.data.id)
@ -104,6 +122,8 @@ const TreeChart = ({ data, onNodeClick }) => {
.attr("fill", (d) => getStatusColor(d.data.status)) .attr("fill", (d) => getStatusColor(d.data.status))
.attr("stroke", "#fff") .attr("stroke", "#fff")
.attr("r", 7) .attr("r", 7)
.attr("cx", (d) => d.x)
.attr("cy", (d) => d.y)
.call(drag()); .call(drag());
node.on("click", (event, d) => { node.on("click", (event, d) => {
@ -112,7 +132,8 @@ const TreeChart = ({ data, onNodeClick }) => {
} }
}); });
// Обновляем текстовые метки // Рисуем текстовые метки
const labelGroup = svg.select(".labels");
const text = labelGroup const text = labelGroup
.selectAll("text") .selectAll("text")
.data(nodes, (d) => d.data.id) .data(nodes, (d) => d.data.id)
@ -121,46 +142,42 @@ const TreeChart = ({ data, onNodeClick }) => {
.attr("dx", 12) .attr("dx", 12)
.attr("dy", 4) .attr("dy", 4)
.style("user-select", "none") // Запрет выделения текста .style("user-select", "none") // Запрет выделения текста
.style("pointer-events", "none"); // Запрет взаимодействия с текстом .style("pointer-events", "none") // Запрет взаимодействия с текстом
.style("fill", "var(--TreeChart-text-color)") // Используем переменную для цвета текста
// Обновляем симуляцию .attr("x", (d) => d.x + 12)
simulationRef.current.nodes(nodes); .attr("y", (d) => d.y + 4);
simulationRef.current.force("link").links(links);
simulationRef.current.alphaTarget(0.1).restart();
simulationRef.current.on("tick", () => {
link
.attr("x1", (d) => d.source.x)
.attr("y1", (d) => d.source.y)
.attr("x2", (d) => d.target.x)
.attr("y2", (d) => d.target.y);
node
.attr("cx", (d) => d.x)
.attr("cy", (d) => d.y);
text
.attr("x", (d) => d.x + 12)
.attr("y", (d) => d.y + 4);
});
}, [root, links, nodes, onNodeClick]); }, [root, links, nodes, onNodeClick]);
const drag = () => { const drag = () => {
function dragstarted(event, d) { function dragstarted(event, d) {
if (!event.active && simulationRef.current) simulationRef.current.alphaTarget(0.3).restart(); d3.select(this).raise().attr("stroke", "#000");
d.fx = d.x;
d.fy = d.y;
} }
function dragged(event, d) { function dragged(event, d) {
d.fx = event.x; d.x = event.x;
d.fy = event.y; d.y = event.y;
d3.select(this).attr("cx", d.x).attr("cy", d.y);
// Обновляем текстовую метку
d3.select(this.parentNode)
.select("text")
.attr("x", d.x + 12)
.attr("y", d.y + 4);
// Обновляем связи
d3.select(chartRef.current)
.selectAll(".links line")
.filter((link) => link.source === d || link.target === d)
.attr("x1", (link) => link.source.x)
.attr("y1", (link) => link.source.y)
.attr("x2", (link) => link.target.x)
.attr("y2", (link) => link.target.y);
} }
function dragended(event, d) { function dragended(event, d) {
if (!event.active && simulationRef.current) simulationRef.current.alphaTarget(0); d3.select(this).attr("stroke", "#fff");
nodePositions.current.set(d.data.id, { x: d.x, y: d.y, fx: d.fx, fy: d.fy }); nodePositions.current.set(d.data.id, { x: d.x, y: d.y });
} }
return d3.drag().on("start", dragstarted).on("drag", dragged).on("end", dragended); return d3.drag().on("start", dragstarted).on("drag", dragged).on("end", dragended);

View File

@ -36,14 +36,6 @@
"id": "4", "id": "4",
"title": "OS Linux (module$4) АО", "title": "OS Linux (module$4) АО",
"items": [ "items": [
{
"id": "188",
"title": "Наименование"
},
{
"id": "189",
"title": "Время работы"
},
{ {
"id": "190", "id": "190",
"title": "Загрузка процессора за 1 минуту" "title": "Загрузка процессора за 1 минуту"
@ -153,21 +145,13 @@
] ]
}, },
{ {
"id": "261", "id": "280",
"title": "Сетевой адаптер №1 (port$261) Eth_1", "title": "Сетевой адаптер №1 (port$261) Eth_1",
"items": [ "items": [
{
"id": "206",
"title": "Наименование порта Eth_1"
},
{ {
"id": "207", "id": "207",
"title": "Скорость порта Eth_1" "title": "Скорость порта Eth_1"
}, },
{
"id": "208",
"title": "Физический адрес порта Eth_1"
},
{ {
"id": "209", "id": "209",
"title": "Административное состояние порта Eth_1" "title": "Административное состояние порта Eth_1"
@ -227,21 +211,13 @@
] ]
}, },
{ {
"id": "262", "id": "281",
"title": "Сетевой адаптер №2 (port$262) Eth_2", "title": "Сетевой адаптер №2 (port$262) Eth_2",
"items": [ "items": [
{
"id": "223",
"title": "Наименование порта Eth_2"
},
{ {
"id": "224", "id": "224",
"title": "Скорость порта Eth_2" "title": "Скорость порта Eth_2"
}, },
{
"id": "225",
"title": "Физический адрес порта Eth_2"
},
{ {
"id": "226", "id": "226",
"title": "Административное состояние порта Eth_2" "title": "Административное состояние порта Eth_2"
@ -301,21 +277,13 @@
] ]
}, },
{ {
"id": "263", "id": "282",
"title": "Сетевой адаптер №3 (port$263) Eth_3", "title": "Сетевой адаптер №3 (port$263) Eth_3",
"items": [ "items": [
{
"id": "240",
"title": "Наименование порта Eth_3"
},
{ {
"id": "241", "id": "241",
"title": "Скорость порта Eth_3" "title": "Скорость порта Eth_3"
}, },
{
"id": "242",
"title": "Физический адрес порта Eth_3"
},
{ {
"id": "243", "id": "243",
"title": "Административное состояние порта Eth_3" "title": "Административное состояние порта Eth_3"
@ -375,21 +343,13 @@
] ]
}, },
{ {
"id": "264", "id": "283",
"title": "Сетевой адаптер №4 (port$264) Eth_4", "title": "Сетевой адаптер №4 (port$264) Eth_4",
"items": [ "items": [
{
"id": "257",
"title": "Наименование порта Eth_4"
},
{ {
"id": "258", "id": "258",
"title": "Скорость порта Eth_4" "title": "Скорость порта Eth_4"
}, },
{
"id": "259",
"title": "Физический адрес порта Eth_4"
},
{ {
"id": "260", "id": "260",
"title": "Административное состояние порта Eth_4" "title": "Административное состояние порта Eth_4"

View File

@ -3,7 +3,6 @@
height: 100vh; height: 100vh;
background-color: var(--sidebar-color); background-color: var(--sidebar-color);
color: var(--sidebar-text-color); color: var(--sidebar-text-color);
/* Используем переменную для цвета текста */
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;
@ -20,6 +19,8 @@
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
padding-bottom: 20px; padding-bottom: 20px;
padding-right: 10px;
/* Отступ справа для скроллбара */
} }
/* Заголовок меню */ /* Заголовок меню */
@ -28,7 +29,6 @@
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
color: var(--sidebar-text-color); color: var(--sidebar-text-color);
/* Используем переменную для цвета текста */
padding: 10px; padding: 10px;
} }
@ -36,7 +36,6 @@
.menu-item { .menu-item {
margin-bottom: 10px; margin-bottom: 10px;
color: var(--sidebar-text-color); color: var(--sidebar-text-color);
/* Используем переменную для цвета текста */
width: 100%; width: 100%;
} }
@ -57,13 +56,42 @@
background-color: rgba(255, 255, 255, 0.3); background-color: rgba(255, 255, 255, 0.3);
} }
/* Стили для заголовка элемента меню */
.menu-item-header { .menu-item-header {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between;
/* Распределяем пространство между элементами */
padding: 10px; padding: 10px;
border-radius: 5px; border-radius: 5px;
cursor: pointer; cursor: pointer;
transition: background-color 0.3s ease; transition: background-color 0.3s ease;
width: 100%;
/* Занимаем всю доступную ширину */
box-sizing: border-box;
/* Учитываем padding в ширине */
}
/* Стили для текста элемента меню */
.menu-item-header span {
flex: 1;
/* Текст занимает все доступное пространство */
margin-right: 14px;
/* Отступ справа для текста */
overflow: hidden;
/* Скрываем текст, который не помещается */
text-overflow: ellipsis;
/* Добавляем многоточие, если текст не помещается */
}
/* Стили для иконок */
.menu-item-header .open-parent-icon,
.menu-item-header .toggle-icon {
flex-shrink: 0;
/* Запрещаем сжатие иконок */
margin-left: 1px;
/* Отступ между иконками */
cursor: pointer;
} }
.menu-item-header:hover { .menu-item-header:hover {
@ -82,9 +110,18 @@
/* Подменю */ /* Подменю */
.submenu { .submenu {
margin-left: 20px; margin-left: 20px;
/* Отступ слева для вложенных элементов */
margin-top: 10px; margin-top: 10px;
} }
/* Стили для элементов нижнего уровня вложенности */
/* Дополнительные отступы для элементов без иконок */
.menu-item:not(.has-children) .menu-item-header {
padding-right: 25px;
/* Добавляем отступ справа для элементов без иконок */
}
/* Футер сайдбара */ /* Футер сайдбара */
.sidebar-footer { .sidebar-footer {
padding: 10px; padding: 10px;
@ -98,7 +135,6 @@
.help, .help,
.settings { .settings {
color: var(--sidebar-text-color); color: var(--sidebar-text-color);
/* Используем переменную для цвета текста */
margin: 5px 0; margin: 5px 0;
overflow-x: hidden; overflow-x: hidden;
text-align: left; text-align: left;

View File

@ -15,5 +15,7 @@
--table-cell-background: #333333; --table-cell-background: #333333;
--table-text-color: #E0E0E0; --table-text-color: #E0E0E0;
/* Светлый текст в таблице */ /* Светлый текст в таблице */
--TreeChart-text-color: #ffffff;
--scrollbar-track-color: #333;
} }
} }

View File

@ -75,24 +75,32 @@ button:focus-visible {
/* Глобальный стиль для WebKit-браузеров (Chrome, Edge, Safari) */ /* Глобальный стиль для WebKit-браузеров (Chrome, Edge, Safari) */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; /* Толщина вертикального скролла */ width: 10px;
height: 10px; /* Толщина горизонтального скролла */ /* Толщина вертикального скролла */
height: 10px;
/* Толщина горизонтального скролла */
} }
/* Фон скроллбара */ /* Фон скроллбара */
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: #f1f1f1; /* Цвет фона */ background: var(--scrollbar-track-color, #f1f1f1);
border-radius: 10px; /* Скругление углов */ /* Цвет фона */
border-radius: 10px;
/* Скругление углов */
} }
/* Ползунок */ /* Ползунок */
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: #3d74c7; /* Основной цвет */ background: #3d74c7;
border-radius: 10px; /* Скругляем края */ /* Основной цвет */
border: 1px solid #1c36c9; /* Белая обводка */ border-radius: 10px;
/* Скругляем края */
border: 1px solid #1c36c9;
/* Белая обводка */
} }
/* Эффект при наведении */ /* Эффект при наведении */
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background: #2b5aa5; /* Чуть темнее при наведении */ background: #2b5aa5;
/* Чуть темнее при наведении */
} }