,
+ label: "C1",
+ to: "/client-1",
+ disabled: false,
+ },
+ {
+ icon:
,
+ label: "C2",
+ to: "/client-2",
+ disabled: false,
+ },
+];
+
const menuEntries: MenuEntry[] = [
{
icon:
,
label: "Entities",
to: "/entities",
- disabled: true,
- },
- {
- icon:
,
- label: "C1",
- to: "/client-1",
- disabled: false,
- },
- {
- icon:
,
- label: "C2",
- to: "/client-2",
disabled: false,
},
{
@@ -74,10 +80,17 @@ interface SidebarProps {
show: boolean;
onClose: () => void;
}
+
export function Sidebar(props: SidebarProps) {
const { show, onClose } = props;
+ const [activeMenuItem, setActiveMenuItem] = React.useState(
+ typeof window !== "undefined" ? window.location.pathname : "",
+ );
+ const [collapseMenuOpen, setCollapseMenuOpen] = React.useState(true);
- const [activeMenuItem, setActiveMenuItem] = React.useState("/");
+ const handleCollapseClick = () => {
+ setCollapseMenuOpen(!collapseMenuOpen);
+ };
const handleMenuItemClick = (path: string) => {
setActiveMenuItem(path);
@@ -93,10 +106,10 @@ export function Sidebar(props: SidebarProps) {
@@ -119,28 +132,88 @@ export function Sidebar(props: SidebarProps) {
disablePadding
className="!overflow-hidden py-2"
>
-
handleMenuItemClick(menuEntry.to)}
- >
- handleMenuItemClick(menuEntry.to)}
>
- {menuEntry.icon}
-
-
-
+
+ {menuEntry.icon}
+
+
+
+ ) : (
+
+
+
+ {menuEntry.icon}
+
+
+ {collapseMenuOpen ? : }
+
+
+
+ {menuEntityEntries.map((menuEntry, idx) => (
+ handleMenuItemClick(menuEntry.to)}
+ >
+
+ {menuEntry.icon}
+
+
+
+ ))}
+
+
+
+ )}
);
})}
diff --git a/pkgs/ui/src/components/table/index.tsx b/pkgs/ui/src/components/table/index.tsx
index cbfec7e..36714df 100644
--- a/pkgs/ui/src/components/table/index.tsx
+++ b/pkgs/ui/src/components/table/index.tsx
@@ -9,6 +9,7 @@ import Paper from "@mui/material/Paper";
import { NoDataOverlay } from "@/components/noDataOverlay";
import { StyledTableCell, StyledTableRow } from "./style";
import { ICustomTable, CustomTableConfiguration } from "@/types";
+import { Checkbox } from "@mui/material";
const CustomTable = ({ configuration, data }: ICustomTable) => {
// display empty icon in case there is no data
@@ -25,6 +26,10 @@ const CustomTable = ({ configuration, data }: ICustomTable) => {
// cover use case if the data is an array
if (Array.isArray(value)) renderedValue = value.join(", ");
+ // cover use case if the data is an boolean
+ if (typeof value === "boolean")
+ renderedValue =
;
+
// cover use case if we want to render a component
if (render) renderedValue = render(value);
diff --git a/pkgs/ui/src/mock/client_1/index.ts b/pkgs/ui/src/mock/client_1/index.ts
index 030cc7f..658b51e 100644
--- a/pkgs/ui/src/mock/client_1/index.ts
+++ b/pkgs/ui/src/mock/client_1/index.ts
@@ -14,3 +14,127 @@ export const Client1SummaryDetails = [
value: "Carlo's Home Network",
},
];
+
+export const Client1ConsumerData = [
+ {
+ service_name: "Carlo's Printing",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:1223",
+ network: "Carlo's Home Network",
+ },
+ {
+ service_name: "Steve's Printing",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:1234",
+ network: "Steve's Home Network",
+ },
+ {
+ service_name: "Test A",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:4567",
+ network: "Test Network A",
+ },
+ {
+ service_name: "Test B",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:0062",
+ network: "Test Network B",
+ },
+];
+
+export const Client1ConsumerTableConfig = [
+ {
+ key: "service_name",
+ label: "Service name",
+ },
+ {
+ key: "service_type",
+ label: "Service Type",
+ },
+ {
+ key: "end_point",
+ label: "End Point",
+ },
+ {
+ key: "producer",
+ label: "Producer",
+ },
+ {
+ key: "producer_did",
+ label: "Producer DID",
+ },
+ {
+ key: "network",
+ label: "Network",
+ },
+];
+
+export const Client1ProducerData = [
+ {
+ service_name: "Carlo's Printing",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "DRAFT, REGISTERED",
+ action: "Register, Deregister, Delete",
+ },
+ {
+ service_name: "Steve's Printing",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "REGISTERED",
+ action: "Create",
+ },
+ {
+ service_name: "Test Printing A",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "DRAFT",
+ action: "Register, Deregister",
+ },
+ {
+ service_name: "Test Printing B",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "DRAFT, REGISTERED",
+ action: "Delete, Create",
+ },
+];
+
+export const Client1ProducerTableConfig = [
+ {
+ key: "service_name",
+ label: "Service name",
+ },
+ {
+ key: "service_type",
+ label: "Service Type",
+ },
+ {
+ key: "end_point",
+ label: "End Point",
+ },
+ {
+ key: "usage",
+ label: "Usage",
+ },
+ {
+ key: "status",
+ label: "Status",
+ },
+ {
+ key: "action",
+ label: "Action",
+ },
+];
diff --git a/pkgs/ui/src/mock/client_2/index.ts b/pkgs/ui/src/mock/client_2/index.ts
index 19e6936..b0105fd 100644
--- a/pkgs/ui/src/mock/client_2/index.ts
+++ b/pkgs/ui/src/mock/client_2/index.ts
@@ -14,3 +14,127 @@ export const Client2SummaryDetails = [
value: "Carlo's Home Network",
},
];
+
+export const Client2ConsumerData = [
+ {
+ service_name: "Carlo's Printing",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:1223",
+ network: "Carlo's Home Network",
+ },
+ {
+ service_name: "Steve's Printing",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:1234",
+ network: "Steve's Home Network",
+ },
+ {
+ service_name: "Test A",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:4567",
+ network: "Test Network A",
+ },
+ {
+ service_name: "Test B",
+ service_type: "3D Printing",
+ end_point: "Consume",
+ producer: "C2",
+ producer_did: "did:sov:test:0062",
+ network: "Test Network B",
+ },
+];
+
+export const Client2ConsumerTableConfig = [
+ {
+ key: "service_name",
+ label: "Service name",
+ },
+ {
+ key: "service_type",
+ label: "Service Type",
+ },
+ {
+ key: "end_point",
+ label: "End Point",
+ },
+ {
+ key: "producer",
+ label: "Producer",
+ },
+ {
+ key: "producer_did",
+ label: "Producer DID",
+ },
+ {
+ key: "network",
+ label: "Network",
+ },
+];
+
+export const Client2ProducerData = [
+ {
+ service_name: "Carlo's Printing",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "DRAFT, REGISTERED",
+ action: "Register, Deregister, Delete",
+ },
+ {
+ service_name: "Steve's Printing",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "REGISTERED",
+ action: "Create",
+ },
+ {
+ service_name: "Test Printing A",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "DRAFT",
+ action: "Register, Deregister",
+ },
+ {
+ service_name: "Test Printing B",
+ service_type: "3D Printing",
+ end_point: "URL",
+ usage: "C1(3), C3(4)",
+ status: "DRAFT, REGISTERED",
+ action: "Delete, Create",
+ },
+];
+
+export const Client2ProducerTableConfig = [
+ {
+ key: "service_name",
+ label: "Service name",
+ },
+ {
+ key: "service_type",
+ label: "Service Type",
+ },
+ {
+ key: "end_point",
+ label: "End Point",
+ },
+ {
+ key: "usage",
+ label: "Usage",
+ },
+ {
+ key: "status",
+ label: "Status",
+ },
+ {
+ key: "action",
+ label: "Action",
+ },
+];
diff --git a/pkgs/ui/src/mock/home/index.ts b/pkgs/ui/src/mock/home/index.ts
new file mode 100644
index 0000000..ccff693
--- /dev/null
+++ b/pkgs/ui/src/mock/home/index.ts
@@ -0,0 +1,47 @@
+// HOME - Table Data
+
+export const HomeDummyData = [
+ {
+ entity_name: "C1",
+ entity_DID: "did:sov:test:1234",
+ network: "Carlo's Home Network",
+ ip_address: "127.0.0.1",
+ roles: "service repository, service consumer, DLG",
+ visible: true,
+ },
+ {
+ entity_name: "C2",
+ entity_DID: "did:sov:test:4567",
+ network: "Steve's Home Network",
+ ip_address: "127.0.0.1",
+ roles: "service repository, service consumer, DLG",
+ visible: false,
+ },
+];
+
+export const HomeTableConfig = [
+ {
+ key: "entity_name",
+ label: "Entity name",
+ },
+ {
+ key: "entity_DID",
+ label: "Entity DID",
+ },
+ {
+ key: "network",
+ label: "Network",
+ },
+ {
+ key: "ip_address",
+ label: "IP address",
+ },
+ {
+ key: "roles",
+ label: "Roles",
+ },
+ {
+ key: "visible",
+ label: "Visible",
+ },
+];