2023-12-17 19:08:11 +08:00
|
|
|
import { Empty } from 'antd';
|
|
|
|
import React from 'react';
|
2023-12-17 19:25:57 +08:00
|
|
|
import { trpc } from '../../../api/trpc';
|
|
|
|
import { Loading } from '../../Loading';
|
|
|
|
import { MonitorListItem } from '../MonitorListItem';
|
2023-12-17 19:08:11 +08:00
|
|
|
|
|
|
|
interface StatusPageServicesProps {
|
|
|
|
workspaceId: string;
|
|
|
|
monitorList: PrismaJson.MonitorStatusPageList;
|
|
|
|
}
|
|
|
|
export const StatusPageServices: React.FC<StatusPageServicesProps> = React.memo(
|
|
|
|
(props) => {
|
|
|
|
const { workspaceId, monitorList } = props;
|
|
|
|
|
2023-12-17 19:25:57 +08:00
|
|
|
const { data: list = [], isLoading } = trpc.monitor.getPublicInfo.useQuery({
|
|
|
|
monitorIds: monitorList.map((item) => item.id),
|
|
|
|
});
|
|
|
|
|
|
|
|
if (isLoading) {
|
|
|
|
return <Loading />;
|
|
|
|
}
|
|
|
|
|
2023-12-17 19:08:11 +08:00
|
|
|
return (
|
|
|
|
<div className="shadow-2xl p-2.5 flex flex-col gap-4">
|
2023-12-17 19:25:57 +08:00
|
|
|
{list.length > 0 ? (
|
|
|
|
list.map((item) => (
|
2023-12-18 00:57:51 +08:00
|
|
|
<MonitorListItem
|
|
|
|
key={item.id}
|
|
|
|
workspaceId={workspaceId}
|
|
|
|
monitorId={item.id}
|
|
|
|
monitorName={item.name}
|
|
|
|
/>
|
2023-12-17 19:08:11 +08:00
|
|
|
))
|
|
|
|
) : (
|
|
|
|
<Empty description="No any monitor has been set" />
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
StatusPageServices.displayName = 'StatusPageServices';
|