github.com/minio/console@v1.4.1/web-app/src/screens/Console/Configurations/SiteReplication/LookupStatus/Utils.tsx (about) 1 import React from "react"; 2 import { StatsResponseType } from "../SiteReplicationStatus"; 3 import { Box } from "mds"; 4 5 export function syncStatus(mismatch: boolean, set: boolean): string | boolean { 6 if (!set) { 7 return ""; 8 } 9 return !mismatch; 10 } 11 12 export function isEntityNotFound( 13 sites: Partial<StatsResponseType>, 14 lookupList: Partial<StatsResponseType>, 15 lookupKey: string, 16 ) { 17 const siteKeys: string[] = Object.keys(sites); 18 return siteKeys.find((sk: string) => { 19 // there is no way to find the type of this ! as it is an entry in the structure itself. 20 // @ts-ignore 21 const result: Record<string, any> = lookupList[sk] || {}; 22 return !result[lookupKey]; 23 }); 24 } 25 26 export const EntityNotFound = ({ 27 entityType, 28 entityValue, 29 }: { 30 entityType: string; 31 entityValue: string; 32 }) => { 33 return ( 34 <Box 35 sx={{ 36 marginTop: "45px", 37 display: "flex", 38 alignItems: "center", 39 justifyContent: "center", 40 }} 41 > 42 {entityType}:{" "} 43 <Box sx={{ marginLeft: "5px", marginRight: "5px", fontWeight: 600 }}> 44 {entityValue} 45 </Box>{" "} 46 not found. 47 </Box> 48 ); 49 };