style: auto-fix lint and format
This commit is contained in:
1 parent
d0709a684c
commit
525eda3cbb
8 files changed
+20
-27
No files matched your search
@@ -66,20 +66,12 @@ export function InstanceCard({ instance, options, isTiny, widgetKey }: InstanceC
|
|||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
{options.showApplications && (
|
{options.showApplications && (
|
||||||
<Badge
|
<Badge variant="dot" color={getBadgeColor(runningApps, applications.length)} size="xs">
|
||||||
variant="dot"
|
|
||||||
color={getBadgeColor(runningApps, applications.length)}
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
{runningApps}/{applications.length}
|
{runningApps}/{applications.length}
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
{options.showServices && (
|
{options.showServices && (
|
||||||
<Badge
|
<Badge variant="dot" color={getBadgeColor(runningServices, services.length)} size="xs">
|
||||||
variant="dot"
|
|
||||||
color={getBadgeColor(runningServices, services.length)}
|
|
||||||
size="xs"
|
|
||||||
>
|
|
||||||
{runningServices}/{services.length}
|
{runningServices}/{services.length}
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
@@ -100,9 +92,7 @@ export function InstanceCard({ instance, options, isTiny, widgetKey }: InstanceC
|
|||||||
{options.showApplications && (
|
{options.showApplications && (
|
||||||
<ApplicationsSection applications={applications} baseUrl={baseUrl} isTiny={isTiny} />
|
<ApplicationsSection applications={applications} baseUrl={baseUrl} isTiny={isTiny} />
|
||||||
)}
|
)}
|
||||||
{options.showServices && (
|
{options.showServices && <ServicesSection services={services} baseUrl={baseUrl} isTiny={isTiny} />}
|
||||||
<ServicesSection services={services} baseUrl={baseUrl} isTiny={isTiny} />
|
|
||||||
)}
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Group justify="space-between" p={4} style={{ borderTop: "1px solid var(--mantine-color-dark-4)" }}>
|
<Group justify="space-between" p={4} style={{ borderTop: "1px solid var(--mantine-color-dark-4)" }}>
|
||||||
|
|||||||
@@ -70,9 +70,7 @@ export function SingleInstanceLayout({ instance, options, isTiny, widgetKey }: S
|
|||||||
{options.showApplications && (
|
{options.showApplications && (
|
||||||
<ApplicationsSection applications={applications} baseUrl={baseUrl} isTiny={isTiny} />
|
<ApplicationsSection applications={applications} baseUrl={baseUrl} isTiny={isTiny} />
|
||||||
)}
|
)}
|
||||||
{options.showServices && (
|
{options.showServices && <ServicesSection services={services} baseUrl={baseUrl} isTiny={isTiny} />}
|
||||||
<ServicesSection services={services} baseUrl={baseUrl} isTiny={isTiny} />
|
|
||||||
)}
|
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<Group
|
<Group
|
||||||
|
|||||||
@@ -104,7 +104,9 @@ export default function DownloadClientsWidget({
|
|||||||
const [quickFilters, setQuickFilters] = useState<QuickFilter>({ integrationKinds: [], statuses: [] });
|
const [quickFilters, setQuickFilters] = useState<QuickFilter>({ integrationKinds: [], statuses: [] });
|
||||||
const availableStatuses = useMemo<QuickFilter["statuses"]>(() => {
|
const availableStatuses = useMemo<QuickFilter["statuses"]>(() => {
|
||||||
//Redefine list of available statuses from current items
|
//Redefine list of available statuses from current items
|
||||||
const statuses = Array.from(new Set(currentItems.flatMap(({ data }) => (data.items ?? []).map(({ state }) => state))));
|
const statuses = Array.from(
|
||||||
|
new Set(currentItems.flatMap(({ data }) => (data.items ?? []).map(({ state }) => state))),
|
||||||
|
);
|
||||||
//Reset user filters accordingly to remove unavailable statuses
|
//Reset user filters accordingly to remove unavailable statuses
|
||||||
setQuickFilters(({ integrationKinds: names, statuses: prevStatuses }) => {
|
setQuickFilters(({ integrationKinds: names, statuses: prevStatuses }) => {
|
||||||
return { integrationKinds: names, statuses: prevStatuses.filter((status) => statuses.includes(status)) };
|
return { integrationKinds: names, statuses: prevStatuses.filter((status) => statuses.includes(status)) };
|
||||||
|
|||||||
@@ -54,10 +54,7 @@ export const ClusterHealthMonitoring = ({
|
|||||||
const usedMem = nodes.reduce((sum, item) => (item.isRunning ? item.memory.used + sum : sum), 0);
|
const usedMem = nodes.reduce((sum, item) => (item.isRunning ? item.memory.used + sum : sum), 0);
|
||||||
const maxMem = nodes.reduce((sum, item) => (item.isRunning ? item.memory.total + sum : sum), 0);
|
const maxMem = nodes.reduce((sum, item) => (item.isRunning ? item.memory.total + sum : sum), 0);
|
||||||
const maxCpu = nodes.reduce((sum, item) => (item.isRunning ? item.cpu.cores + sum : sum), 0);
|
const maxCpu = nodes.reduce((sum, item) => (item.isRunning ? item.cpu.cores + sum : sum), 0);
|
||||||
const usedCpu = nodes.reduce(
|
const usedCpu = nodes.reduce((sum, item) => (item.isRunning ? item.cpu.utilization * item.cpu.cores + sum : sum), 0);
|
||||||
(sum, item) => (item.isRunning ? item.cpu.utilization * item.cpu.cores + sum : sum),
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
const uptime = nodes.reduce((sum, { uptime }) => (sum > uptime ? sum : uptime), 0);
|
const uptime = nodes.reduce((sum, { uptime }) => (sum > uptime ? sum : uptime), 0);
|
||||||
|
|
||||||
const cpuPercent = maxCpu ? (usedCpu / maxCpu) * 100 : 0;
|
const cpuPercent = maxCpu ? (usedCpu / maxCpu) * 100 : 0;
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ export default function MediaServerWidget({
|
|||||||
const board = useRequiredBoard();
|
const board = useRequiredBoard();
|
||||||
|
|
||||||
if (!requestStats) return <WidgetEmptyState />;
|
if (!requestStats) return <WidgetEmptyState />;
|
||||||
if ((requestStats.users ?? []).length === 0 && (requestStats.stats ?? []).length === 0) throw new NoIntegrationDataError();
|
if ((requestStats.users ?? []).length === 0 && (requestStats.stats ?? []).length === 0)
|
||||||
|
throw new NoIntegrationDataError();
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ export default function SpeedtestTrackerWidget({ options, integrationIds }: Widg
|
|||||||
);
|
);
|
||||||
|
|
||||||
const twelveHoursAgo = Date.now() - 12 * 60 * 60 * 1000;
|
const twelveHoursAgo = Date.now() - 12 * 60 * 60 * 1000;
|
||||||
const recentFiltered = combined.recentResults.filter((result) => new Date(result.created_at).getTime() > twelveHoursAgo);
|
const recentFiltered = combined.recentResults.filter(
|
||||||
|
(result) => new Date(result.created_at).getTime() > twelveHoursAgo,
|
||||||
|
);
|
||||||
|
|
||||||
const hasStatSection =
|
const hasStatSection =
|
||||||
(options.showLatestResult && combined.latestResult !== null) || (options.showStats && combined.stats !== null);
|
(options.showLatestResult && combined.latestResult !== null) || (options.showStats && combined.stats !== null);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function buildXAxisTicks(data: { ts: number }[]): XAxisTicks {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
midnightTs: foundMidnight,
|
midnightTs: foundMidnight,
|
||||||
xTicks: Array.from(tickSet).sort((tsA, tsB) => tsA - tsB),
|
xTicks: Array.from(tickSet).toSorted((tsA, tsB) => tsA - tsB),
|
||||||
topDateTicks: topTicks,
|
topDateTicks: topTicks,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ function SpeedHistoryChart({ results, height }: { results: SpeedtestTrackerResul
|
|||||||
const data = useMemo(
|
const data = useMemo(
|
||||||
() =>
|
() =>
|
||||||
[...results]
|
[...results]
|
||||||
.sort((resultA, resultB) => new Date(resultA.created_at).getTime() - new Date(resultB.created_at).getTime())
|
.toSorted((resultA, resultB) => new Date(resultA.created_at).getTime() - new Date(resultB.created_at).getTime())
|
||||||
.filter((result) => (result.download_bits ?? 0) > 0)
|
.filter((result) => (result.download_bits ?? 0) > 0)
|
||||||
.map((result) => ({
|
.map((result) => ({
|
||||||
ts: new Date(result.created_at).getTime(),
|
ts: new Date(result.created_at).getTime(),
|
||||||
@@ -273,7 +273,7 @@ function PingHistoryChart({ results, height }: { results: SpeedtestTrackerResult
|
|||||||
const data = useMemo(
|
const data = useMemo(
|
||||||
() =>
|
() =>
|
||||||
[...results]
|
[...results]
|
||||||
.sort((resultA, resultB) => new Date(resultA.created_at).getTime() - new Date(resultB.created_at).getTime())
|
.toSorted((resultA, resultB) => new Date(resultA.created_at).getTime() - new Date(resultB.created_at).getTime())
|
||||||
.map((result) =>
|
.map((result) =>
|
||||||
result.ping === null
|
result.ping === null
|
||||||
? null
|
? null
|
||||||
|
|||||||
@@ -37,7 +37,10 @@ function TracearrContent({ integrationIds, options, width }: TracearrContentProp
|
|||||||
const { stats, streams, violations, recentActivity } = item.dashboard;
|
const { stats, streams, violations, recentActivity } = item.dashboard;
|
||||||
const vData = violations ?? { data: [], meta: { total: 0, page: 1, pageSize: 5 } };
|
const vData = violations ?? { data: [], meta: { total: 0, page: 1, pageSize: 5 } };
|
||||||
const aData = recentActivity ?? { data: [], meta: { total: 0, page: 1, pageSize: 5 } };
|
const aData = recentActivity ?? { data: [], meta: { total: 0, page: 1, pageSize: 5 } };
|
||||||
const sData = streams ?? { data: [], summary: { total: 0, transcodes: 0, directStreams: 0, directPlays: 0, totalBitrate: "0", byServer: [] } };
|
const sData = streams ?? {
|
||||||
|
data: [],
|
||||||
|
summary: { total: 0, transcodes: 0, directStreams: 0, directPlays: 0, totalBitrate: "0", byServer: [] },
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
stats: {
|
stats: {
|
||||||
|
|||||||
Reference in new issue
Block a user