forked from opens3/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.tsx
More file actions
49 lines (46 loc) · 1.13 KB
/
Utils.tsx
File metadata and controls
49 lines (46 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import React from "react";
import { StatsResponseType } from "../SiteReplicationStatus";
import { Box } from "mds";
export function syncStatus(mismatch: boolean, set: boolean): string | boolean {
if (!set) {
return "";
}
return !mismatch;
}
export function isEntityNotFound(
sites: Partial<StatsResponseType>,
lookupList: Partial<StatsResponseType>,
lookupKey: string,
) {
const siteKeys: string[] = Object.keys(sites);
return siteKeys.find((sk: string) => {
// there is no way to find the type of this ! as it is an entry in the structure itself.
// @ts-ignore
const result: Record<string, any> = lookupList[sk] || {};
return !result[lookupKey];
});
}
export const EntityNotFound = ({
entityType,
entityValue,
}: {
entityType: string;
entityValue: string;
}) => {
return (
<Box
sx={{
marginTop: "45px",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
{entityType}:{" "}
<Box sx={{ marginLeft: "5px", marginRight: "5px", fontWeight: 600 }}>
{entityValue}
</Box>{" "}
not found.
</Box>
);
};