Signed-off-by: Bernard Setz <bernard.setz@portainer.io> Co-authored-by: bernard-portainer <bernard.setz@portainer.io> Co-authored-by: Ali <83188384+testA113@users.noreply.github.com> Co-authored-by: Yajith Dayarathna <yajith.dayarathna@portainer.io> Co-authored-by: Chaim Lev-Ari <chiptus@users.noreply.github.com> Co-authored-by: andres-portainer <91705312+andres-portainer@users.noreply.github.com> Co-authored-by: Josiah Clumont <josiah.clumont@portainer.io> Co-authored-by: Dakota Walsh <101994734+dakota-portainer@users.noreply.github.com>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { Activity } from 'lucide-react';
|
|
|
|
import { isoDateFromTimestamp } from '@/portainer/filters/filters';
|
|
import { Environment } from '@/react/portainer/environments/types';
|
|
|
|
import { EnvironmentStatusBadgeItem } from './EnvironmentStatusBadgeItem';
|
|
|
|
interface Props {
|
|
showLastCheckInDate?: boolean;
|
|
environment: Environment;
|
|
}
|
|
|
|
export function EdgeIndicator({
|
|
environment,
|
|
showLastCheckInDate = false,
|
|
}: Props) {
|
|
const associated = !!environment.EdgeID;
|
|
if (!associated) {
|
|
return (
|
|
<span role="status" aria-label="edge-status">
|
|
<EnvironmentStatusBadgeItem aria-label="unassociated">
|
|
<span className="whitespace-nowrap">Not associated</span>
|
|
</EnvironmentStatusBadgeItem>
|
|
</span>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<span
|
|
role="status"
|
|
aria-label="edge-status"
|
|
className="flex items-center gap-1"
|
|
>
|
|
{showLastCheckInDate && !!environment.LastCheckInDate && (
|
|
<span
|
|
className="small text-muted vertical-center"
|
|
aria-label="edge-last-checkin"
|
|
title="Last edge check-in"
|
|
>
|
|
<Activity className="icon icon-sm space-right" aria-hidden="true" />
|
|
{isoDateFromTimestamp(environment.LastCheckInDate)}
|
|
</span>
|
|
)}
|
|
</span>
|
|
);
|
|
}
|