Fix ping / sm, refactor group vs name
This commit is contained in:
parent
ad18ea29d6
commit
e4212f527f
@ -74,7 +74,12 @@ export default function ServicesGroup({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Disclosure.Panel className="transition-all overflow-hidden duration-300 ease-out" ref={panel} static>
|
<Disclosure.Panel className="transition-all overflow-hidden duration-300 ease-out" ref={panel} static>
|
||||||
<List group={group} services={group.services} layout={layout} useEqualHeights={useEqualHeights} />
|
<List
|
||||||
|
groupName={group.name}
|
||||||
|
services={group.services}
|
||||||
|
layout={layout}
|
||||||
|
useEqualHeights={useEqualHeights}
|
||||||
|
/>
|
||||||
{group.groups?.length > 0 && (
|
{group.groups?.length > 0 && (
|
||||||
<div
|
<div
|
||||||
className={`grid ${
|
className={`grid ${
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import Kubernetes from "widgets/kubernetes/component";
|
|||||||
import { SettingsContext } from "utils/contexts/settings";
|
import { SettingsContext } from "utils/contexts/settings";
|
||||||
import ResolvedIcon from "components/resolvedicon";
|
import ResolvedIcon from "components/resolvedicon";
|
||||||
|
|
||||||
export default function Item({ service, group, useEqualHeights }) {
|
export default function Item({ service, groupName, useEqualHeights }) {
|
||||||
const hasLink = service.href && service.href !== "#";
|
const hasLink = service.href && service.href !== "#";
|
||||||
const { settings } = useContext(SettingsContext);
|
const { settings } = useContext(SettingsContext);
|
||||||
const showStats = service.showStats === false ? false : settings.showStats;
|
const showStats = service.showStats === false ? false : settings.showStats;
|
||||||
@ -90,14 +90,14 @@ export default function Item({ service, group, useEqualHeights }) {
|
|||||||
>
|
>
|
||||||
{service.ping && (
|
{service.ping && (
|
||||||
<div className="flex-shrink-0 flex items-center justify-center service-tag service-ping">
|
<div className="flex-shrink-0 flex items-center justify-center service-tag service-ping">
|
||||||
<Ping group={group} service={service.name} style={statusStyle} />
|
<Ping groupName={groupName} serviceName={service.name} style={statusStyle} />
|
||||||
<span className="sr-only">Ping status</span>
|
<span className="sr-only">Ping status</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{service.siteMonitor && (
|
{service.siteMonitor && (
|
||||||
<div className="flex-shrink-0 flex items-center justify-center service-tag service-site-monitor">
|
<div className="flex-shrink-0 flex items-center justify-center service-tag service-site-monitor">
|
||||||
<SiteMonitor group={group} service={service.name} style={statusStyle} />
|
<SiteMonitor groupName={groupName} serviceName={service.name} style={statusStyle} />
|
||||||
<span className="sr-only">Site monitor status</span>
|
<span className="sr-only">Site monitor status</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { columnMap } from "../../utils/layout/columns";
|
|||||||
|
|
||||||
import Item from "components/services/item";
|
import Item from "components/services/item";
|
||||||
|
|
||||||
export default function List({ group, services, layout, useEqualHeights }) {
|
export default function List({ groupName, services, layout, useEqualHeights }) {
|
||||||
return (
|
return (
|
||||||
<ul
|
<ul
|
||||||
className={classNames(
|
className={classNames(
|
||||||
@ -16,7 +16,7 @@ export default function List({ group, services, layout, useEqualHeights }) {
|
|||||||
<Item
|
<Item
|
||||||
key={[service.container, service.app, service.name].filter((s) => s).join("-")}
|
key={[service.container, service.app, service.name].filter((s) => s).join("-")}
|
||||||
service={service}
|
service={service}
|
||||||
group={group}
|
groupName={groupName}
|
||||||
useEqualHeights={layout?.useEqualHeights ?? useEqualHeights}
|
useEqualHeights={layout?.useEqualHeights ?? useEqualHeights}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
export default function Ping({ group, service, style }) {
|
export default function Ping({ groupName, serviceName, style }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, error } = useSWR(`/api/ping?${new URLSearchParams({ group, service }).toString()}`, {
|
const { data, error } = useSWR(`/api/ping?${new URLSearchParams({ groupName, serviceName }).toString()}`, {
|
||||||
refreshInterval: 30000,
|
refreshInterval: 30000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import useSWR from "swr";
|
import useSWR from "swr";
|
||||||
|
|
||||||
export default function SiteMonitor({ group, service, style }) {
|
export default function SiteMonitor({ groupName, serviceName, style }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, error } = useSWR(`/api/siteMonitor?${new URLSearchParams({ group, service }).toString()}`, {
|
const { data, error } = useSWR(`/api/siteMonitor?${new URLSearchParams({ groupName, serviceName }).toString()}`, {
|
||||||
refreshInterval: 30000,
|
refreshInterval: 30000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,10 @@ import createLogger from "utils/logger";
|
|||||||
const logger = createLogger("ping");
|
const logger = createLogger("ping");
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
const { group, service } = req.query;
|
const { groupName, serviceName } = req.query;
|
||||||
const serviceItem = await getServiceItem(group, service);
|
const serviceItem = await getServiceItem(groupName, serviceName);
|
||||||
if (!serviceItem) {
|
if (!serviceItem) {
|
||||||
logger.debug(`No service item found for group ${group} named ${service}`);
|
logger.debug(`No service item found for group ${groupName} named ${serviceName}`);
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
error: "Unable to find service, see log for details.",
|
error: "Unable to find service, see log for details.",
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import { httpProxy } from "utils/proxy/http";
|
|||||||
const logger = createLogger("siteMonitor");
|
const logger = createLogger("siteMonitor");
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
const { group, service } = req.query;
|
const { groupName, serviceName } = req.query;
|
||||||
const serviceItem = await getServiceItem(group, service);
|
const serviceItem = await getServiceItem(groupName, serviceName);
|
||||||
if (!serviceItem) {
|
if (!serviceItem) {
|
||||||
logger.debug(`No service item found for group ${group} named ${service}`);
|
logger.debug(`No service item found for group ${groupName} named ${serviceName}`);
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
error: "Unable to find service, see log for details.",
|
error: "Unable to find service, see log for details.",
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user