Skip to content

Commit

Permalink
chore(rxPage): multiple fix
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed May 7, 2024
1 parent 738fcf9 commit 1884955
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 274 deletions.
2 changes: 0 additions & 2 deletions plugins/lime-plugin-rx/src/components/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ export const SectionTitle: FunctionalComponent<SectionTitleProps> = ({
}) => {
return (
<div className="flex items-center gap-x-4 ml-6 mt-6">
{/*@ts-ignore*/}
<span className={"text-primary-dark fill-current"}>{icon}</span>
{/*@ts-ignore*/}
<h1 className="text-4xl font-bold text-left">{children}</h1>
</div>
);
Expand Down
61 changes: 5 additions & 56 deletions plugins/lime-plugin-rx/src/rxApi.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,9 @@
import api from "utils/uhttpd.service";

interface DeviceStatus {
version: string;
address: string;
}

export interface SwitchStatus {
device: string;
num: number;
role: string;
link: string;
}
import {
IGetInternetStatus,
StatusResponse,
} from "plugins/lime-plugin-rx/src/rxTypes";

interface MostActive {
rx_short_gi: boolean;
station_mac: string;
tx_bytes: number;
rx_vht: boolean;
rx_mhz: number;
rx_40mhz: boolean;
tx_packets: number;
tx_mhz: number;
rx_packets: number;
rx_ht: boolean;
tx_mcs: number;
noise: number;
rx_mcs: number;
chains: number[];
rx_bytes: number;
tx_ht: boolean;
iface: string;
tx_rate: number;
inactive: number;
tx_short_gi: boolean;
tx_40mhz: boolean;
expected_throughput: number;
tx_vht: boolean;
rx_rate: number;
signal: number;
}

export interface StatusResponse {
ips: DeviceStatus[];
hostname: string;
switch_status: SwitchStatus[];
status: string;
uptime: string;
most_active: MostActive;
}

export interface IGetInternetStatus {
DNS: { working: boolean };
IPv6: { working: boolean };
IPv4: { working: boolean };
status: string;
}
import api from "utils/uhttpd.service";

export const getNodeStatus = (): Promise<StatusResponse> =>
api.call("lime-utils", "get_node_status", {});
Expand Down
204 changes: 0 additions & 204 deletions plugins/lime-plugin-rx/src/rxPageBAK.js

This file was deleted.

55 changes: 55 additions & 0 deletions plugins/lime-plugin-rx/src/rxTypes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
interface DeviceStatus {
version: string;
address: string;
}

export interface SwitchStatus {
device: string;
num: number;
role: string;
link: string;
}

interface MostActive {
rx_short_gi: boolean;
station_mac: string;
tx_bytes: number;
rx_vht: boolean;
rx_mhz: number;
rx_40mhz: boolean;
tx_packets: number;
tx_mhz: number;
rx_packets: number;
rx_ht: boolean;
tx_mcs: number;
noise: number;
rx_mcs: number;
chains: number[];
rx_bytes: number;
tx_ht: boolean;
iface: string;
tx_rate: number;
inactive: number;
tx_short_gi: boolean;
tx_40mhz: boolean;
expected_throughput: number;
tx_vht: boolean;
rx_rate: number;
signal: number;
}

export interface StatusResponse {
ips: DeviceStatus[];
hostname: string;
switch_status: SwitchStatus[];
status: string;
uptime: string;
most_active: MostActive;
}

export interface IGetInternetStatus {
DNS: { working: boolean };
IPv6: { working: boolean };
IPv4: { working: boolean };
status: string;
}
2 changes: 1 addition & 1 deletion plugins/lime-plugin-rx/src/sections/wired.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
SectionTitle,
} from "plugins/lime-plugin-rx/src/components/components";
import { PortsIcon } from "plugins/lime-plugin-rx/src/icons/portsIcon";
import { SwitchStatus } from "plugins/lime-plugin-rx/src/rxApi";
import { useNodeStatus } from "plugins/lime-plugin-rx/src/rxQueries";
import { SwitchStatus } from "plugins/lime-plugin-rx/src/rxTypes";

const Ports = ({ switches }: { switches: SwitchStatus[] }) => {
const ports = switches.reduce((acc, obj) => {
Expand Down
20 changes: 11 additions & 9 deletions src/components/elements/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,19 @@ export const Button = ({

const cls = `cursor-pointer text-white font-semibold rounded-xl text-center place-content-center
justify-center border-0 ${sizeClasses} ${colorClasses}`;
const Btn = () => (
// @ts-ignore

if (href) {
return (
<a href={href}>
<div type="button" onClick={onClick} className={cls} {...props}>
{children}
</div>
</a>
);
}
return (
<div type="button" onClick={onClick} className={cls} {...props}>
{children}
</div>
);
return href ? (
<a href={href}>
<Btn />
</a>
) : (
<Btn />
);
};
3 changes: 1 addition & 2 deletions src/components/icons/SvgIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ export interface IconProps {
}

interface SvgIconProps {
// children?: VNode;
children?: any; // Type 'VNode<{}>' is not assignable to type 'ReactNode'.
children?: VNode;
viewBox?: string;
}

Expand Down

0 comments on commit 1884955

Please sign in to comment.