mirror of
https://github.com/9technologygroup/patchmon.net.git
synced 2025-11-05 14:35:35 +00:00
fix(frontend): Avoid using the index of an array as key property in an element
This commit is contained in:
@@ -1154,7 +1154,10 @@ const Dashboard = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{cardGroups.map((group, groupIndex) => (
|
{cardGroups.map((group, groupIndex) => (
|
||||||
<div key={groupIndex} className={getGroupClassName(group.type)}>
|
<div
|
||||||
|
key={`${group.type}-${group.cards[0]?.cardId || groupIndex}`}
|
||||||
|
className={getGroupClassName(group.type)}
|
||||||
|
>
|
||||||
{group.cards.map((card) => (
|
{group.cards.map((card) => (
|
||||||
<div key={card.cardId}>{renderCard(card.cardId)}</div>
|
<div key={card.cardId}>{renderCard(card.cardId)}</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ const HostDetail = () => {
|
|||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{host.dns_servers.map((dns, index) => (
|
{host.dns_servers.map((dns, index) => (
|
||||||
<p
|
<p
|
||||||
key={index}
|
key={dns}
|
||||||
className="font-medium text-secondary-900 dark:text-white font-mono text-sm"
|
className="font-medium text-secondary-900 dark:text-white font-mono text-sm"
|
||||||
>
|
>
|
||||||
{dns}
|
{dns}
|
||||||
@@ -510,7 +510,7 @@ const HostDetail = () => {
|
|||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
{host.network_interfaces.map((iface, index) => (
|
{host.network_interfaces.map((iface, index) => (
|
||||||
<p
|
<p
|
||||||
key={index}
|
key={iface.name}
|
||||||
className="font-medium text-secondary-900 dark:text-white text-sm"
|
className="font-medium text-secondary-900 dark:text-white text-sm"
|
||||||
>
|
>
|
||||||
{iface.name}
|
{iface.name}
|
||||||
@@ -699,7 +699,7 @@ const HostDetail = () => {
|
|||||||
{host.load_average
|
{host.load_average
|
||||||
.filter((load) => load != null)
|
.filter((load) => load != null)
|
||||||
.map((load, index) => (
|
.map((load, index) => (
|
||||||
<span key={index}>
|
<span key={`load-${index}-${load}`}>
|
||||||
{typeof load === "number"
|
{typeof load === "number"
|
||||||
? load.toFixed(2)
|
? load.toFixed(2)
|
||||||
: String(load)}
|
: String(load)}
|
||||||
@@ -727,7 +727,7 @@ const HostDetail = () => {
|
|||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3">
|
||||||
{host.disk_details.map((disk, index) => (
|
{host.disk_details.map((disk, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={disk.name || `disk-${index}`}
|
||||||
className="bg-secondary-50 dark:bg-secondary-700 p-3 rounded-lg"
|
className="bg-secondary-50 dark:bg-secondary-700 p-3 rounded-lg"
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-2 mb-2">
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
|||||||
@@ -2139,7 +2139,7 @@ const BulkAssignModal = ({
|
|||||||
</p>
|
</p>
|
||||||
<div className="max-h-32 overflow-y-auto bg-secondary-50 rounded-md p-3">
|
<div className="max-h-32 overflow-y-auto bg-secondary-50 rounded-md p-3">
|
||||||
{selectedHostNames.map((friendlyName, index) => (
|
{selectedHostNames.map((friendlyName, index) => (
|
||||||
<div key={index} className="text-sm text-secondary-700">
|
<div key={friendlyName} className="text-sm text-secondary-700">
|
||||||
• {friendlyName}
|
• {friendlyName}
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@@ -2250,7 +2250,7 @@ const BulkDeleteModal = ({
|
|||||||
<div className="max-h-32 overflow-y-auto bg-secondary-50 dark:bg-secondary-700 rounded-md p-3">
|
<div className="max-h-32 overflow-y-auto bg-secondary-50 dark:bg-secondary-700 rounded-md p-3">
|
||||||
{selectedHostNames.map((friendlyName, index) => (
|
{selectedHostNames.map((friendlyName, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={friendlyName}
|
||||||
className="text-sm text-secondary-700 dark:text-secondary-300"
|
className="text-sm text-secondary-700 dark:text-secondary-300"
|
||||||
>
|
>
|
||||||
• {friendlyName}
|
• {friendlyName}
|
||||||
|
|||||||
@@ -987,7 +987,7 @@ const TfaTab = () => {
|
|||||||
<div className="grid grid-cols-2 gap-2 font-mono text-sm">
|
<div className="grid grid-cols-2 gap-2 font-mono text-sm">
|
||||||
{backupCodes.map((code, index) => (
|
{backupCodes.map((code, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={code}
|
||||||
className="flex items-center justify-between py-1"
|
className="flex items-center justify-between py-1"
|
||||||
>
|
>
|
||||||
<span className="text-secondary-600 dark:text-secondary-400">
|
<span className="text-secondary-600 dark:text-secondary-400">
|
||||||
|
|||||||
Reference in New Issue
Block a user