From 3d60652cf198bb80b5c094cc19c1ff614034a67c Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Sat, 2 Dec 2023 17:18:52 +0100 Subject: [PATCH 01/15] [Functionality] Request Consumer / Producer - request to get the data for consumer and producer data --- pkgs/ui/src/app/client-1/page.tsx | 100 +++++++++++++++++++++--------- 1 file changed, 69 insertions(+), 31 deletions(-) diff --git a/pkgs/ui/src/app/client-1/page.tsx b/pkgs/ui/src/app/client-1/page.tsx index 5abb913..07b79de 100644 --- a/pkgs/ui/src/app/client-1/page.tsx +++ b/pkgs/ui/src/app/client-1/page.tsx @@ -2,39 +2,77 @@ import SummaryDetails from "@/components/summary_card"; import { - Client1SummaryDetails, - Client1ConsumerData, - Client1ConsumerTableConfig, - Client1ProducerTableConfig, - Client1ProducerData, + Client1SummaryDetails, + Client1ConsumerData, + Client1ConsumerTableConfig, + Client1ProducerTableConfig, + Client1ProducerData, } from "@/mock/client_1"; import CustomTable from "@/components/table"; +import {useEffect, useState} from "react"; export default function Client1() { - return ( -
- -
-

Consumer View

- -
-
-

Producer View

- -
-
- ); + const [consumerData, setConsumerData] = useState(null); + const [producerData, setProducerData] = useState(null); + + useEffect(() => { + fetch('http://localhost:2979/api/v1/get_consumers', { + method: 'GET', + // credentials: 'include', + }) + .then(resp => resp.json().then(jsonData => { + console.log(jsonData); + if (jsonData.length > 0) { + setConsumerData(jsonData); + } else { + setConsumerData(Client1ConsumerData); + } + } + )) + .then(data => null) + .catch(err => null) + + fetch('http://localhost:2979/api/v1/get_producers', { + method: 'GET', + // credentials: 'include', + }) + .then(resp => resp.json().then(jsonData => { + console.log(jsonData); + if (jsonData.length > 0) { + setProducerData(jsonData); + } else { + setProducerData(Client1ProducerData); + } + } + )) + .then(data => null) + .catch(err => null) + }, []); + + return ( +
+ +
+

Consumer View

+ +
+
+

Producer View

+ +
+
+ ); } -- 2.51.0 From b89d2df31b115ec381dcace013860eeaf1ae8611 Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Sat, 2 Dec 2023 17:30:28 +0100 Subject: [PATCH 02/15] [Functionality] Request Consumer / Producer - fixed the hook data --- pkgs/ui/src/app/client-1/page.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/ui/src/app/client-1/page.tsx b/pkgs/ui/src/app/client-1/page.tsx index 07b79de..a676334 100644 --- a/pkgs/ui/src/app/client-1/page.tsx +++ b/pkgs/ui/src/app/client-1/page.tsx @@ -12,8 +12,8 @@ import CustomTable from "@/components/table"; import {useEffect, useState} from "react"; export default function Client1() { - const [consumerData, setConsumerData] = useState(null); - const [producerData, setProducerData] = useState(null); + const [consumerData, setConsumerData] = useState([]); + const [producerData, setProducerData] = useState([]); useEffect(() => { fetch('http://localhost:2979/api/v1/get_consumers', { @@ -29,8 +29,8 @@ export default function Client1() { } } )) - .then(data => null) - .catch(err => null) + .then() + .catch() fetch('http://localhost:2979/api/v1/get_producers', { method: 'GET', @@ -45,8 +45,8 @@ export default function Client1() { } } )) - .then(data => null) - .catch(err => null) + .then() + .catch() }, []); return ( -- 2.51.0 From cd0d3937c466aeb21f31db4cf5798511a3225c72 Mon Sep 17 00:00:00 2001 From: "Arslan, Erdem" Date: Sat, 2 Dec 2023 17:30:39 +0100 Subject: [PATCH 03/15] [Functionality] Request Service Repository - request backend endpoint and fill data if available --- pkgs/ui/src/app/access-point/page.tsx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 177073c..25bac10 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -9,9 +9,31 @@ import { APServiceRepositoryDummyData, APServiceRepositoryTableConfig, } from "@/mock/access_point"; +import {useEffect, useState} from "react"; export default function AccessPoint() { - return ( + const [repositoryData, setRepositoryData] = useState([]); + + useEffect(() => { + fetch('http://localhost:2979/api/v1/get_repositories', { + method: 'GET', + // credentials: 'include', + }) + .then(resp => resp.json().then(jsonData => { + console.log(jsonData); + if (jsonData.length > 0) { + setRepositoryData(jsonData); + } else { + setRepositoryData(APServiceRepositoryDummyData); + } + } + )) + .then() + .catch() + }, []); + + + return (

Service Repository View

-- 2.51.0 From d95c6ba98148f3bfc0777f4006efc98283225f51 Mon Sep 17 00:00:00 2001 From: "Arslan, Erdem" Date: Sat, 2 Dec 2023 18:48:08 +0100 Subject: [PATCH 04/15] fix formating --- pkgs/ui/src/app/access-point/page.tsx | 42 ++++---- pkgs/ui/src/app/client-1/page.tsx | 134 +++++++++++++------------- 2 files changed, 89 insertions(+), 87 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 25bac10..997f915 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -9,31 +9,31 @@ import { APServiceRepositoryDummyData, APServiceRepositoryTableConfig, } from "@/mock/access_point"; -import {useEffect, useState} from "react"; +import { useEffect, useState } from "react"; export default function AccessPoint() { - const [repositoryData, setRepositoryData] = useState([]); + const [repositoryData, setRepositoryData] = useState([]); - useEffect(() => { - fetch('http://localhost:2979/api/v1/get_repositories', { - method: 'GET', - // credentials: 'include', - }) - .then(resp => resp.json().then(jsonData => { - console.log(jsonData); - if (jsonData.length > 0) { - setRepositoryData(jsonData); - } else { - setRepositoryData(APServiceRepositoryDummyData); - } - } - )) - .then() - .catch() - }, []); + useEffect(() => { + fetch("http://localhost:2979/api/v1/get_repositories", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + if (jsonData.length > 0) { + setRepositoryData(jsonData); + } else { + setRepositoryData(APServiceRepositoryDummyData); + } + }), + ) + .then() + .catch(); + }, []); - - return ( + return (
{ - fetch('http://localhost:2979/api/v1/get_consumers', { - method: 'GET', - // credentials: 'include', - }) - .then(resp => resp.json().then(jsonData => { - console.log(jsonData); - if (jsonData.length > 0) { - setConsumerData(jsonData); - } else { - setConsumerData(Client1ConsumerData); - } - } - )) - .then() - .catch() + useEffect(() => { + fetch("http://localhost:2979/api/v1/get_consumers", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + if (jsonData.length > 0) { + setConsumerData(jsonData); + } else { + setConsumerData(Client1ConsumerData); + } + }), + ) + .then() + .catch(); - fetch('http://localhost:2979/api/v1/get_producers', { - method: 'GET', - // credentials: 'include', - }) - .then(resp => resp.json().then(jsonData => { - console.log(jsonData); - if (jsonData.length > 0) { - setProducerData(jsonData); - } else { - setProducerData(Client1ProducerData); - } - } - )) - .then() - .catch() - }, []); + fetch("http://localhost:2979/api/v1/get_producers", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + if (jsonData.length > 0) { + setProducerData(jsonData); + } else { + setProducerData(Client1ProducerData); + } + }), + ) + .then() + .catch(); + }, []); - return ( -
- -
-

Consumer View

- -
-
-

Producer View

- -
-
- ); + return ( +
+ +
+

Consumer View

+ +
+
+

Producer View

+ +
+
+ ); } -- 2.51.0 From 2c098f4ba02e38240536ef5eba49fb153e798786 Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Sat, 2 Dec 2023 21:12:04 +0100 Subject: [PATCH 05/15] [Functionality] Request Consumer / Producer - request consumer, producer data for client-2 - refactored statements --- pkgs/ui/src/app/access-point/page.tsx | 6 +---- pkgs/ui/src/app/client-1/page.tsx | 20 +++++---------- pkgs/ui/src/app/client-2/page.tsx | 36 +++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 21 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 997f915..277d5c0 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -22,11 +22,7 @@ export default function AccessPoint() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - if (jsonData.length > 0) { - setRepositoryData(jsonData); - } else { - setRepositoryData(APServiceRepositoryDummyData); - } + jsonData.length > 0 ? setRepositoryData(jsonData) : setRepositoryData(APServiceRepositoryDummyData); }), ) .then() diff --git a/pkgs/ui/src/app/client-1/page.tsx b/pkgs/ui/src/app/client-1/page.tsx index 90437e6..bf47d67 100644 --- a/pkgs/ui/src/app/client-1/page.tsx +++ b/pkgs/ui/src/app/client-1/page.tsx @@ -23,11 +23,7 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - if (jsonData.length > 0) { - setConsumerData(jsonData); - } else { - setConsumerData(Client1ConsumerData); - } + jsonData.length > 0 ? setConsumerData(jsonData) : setConsumerData(Client1ConsumerData); }), ) .then() @@ -37,15 +33,11 @@ export default function Client1() { method: "GET", // credentials: 'include', }) - .then((resp) => - resp.json().then((jsonData) => { - console.log(jsonData); - if (jsonData.length > 0) { - setProducerData(jsonData); - } else { - setProducerData(Client1ProducerData); - } - }), + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 ? setProducerData(jsonData) : setProducerData(Client1ProducerData); + }), ) .then() .catch(); diff --git a/pkgs/ui/src/app/client-2/page.tsx b/pkgs/ui/src/app/client-2/page.tsx index 80be865..b833d89 100644 --- a/pkgs/ui/src/app/client-2/page.tsx +++ b/pkgs/ui/src/app/client-2/page.tsx @@ -9,8 +9,40 @@ import { Client2SummaryDetails, } from "@/mock/client_2"; import CustomTable from "@/components/table"; +import {useEffect, useState} from "react"; export default function Client1() { + const [consumerData, setConsumerData] = useState([]); + const [producerData, setProducerData] = useState([]); + + useEffect(() => { + fetch("http://localhost:2979/api/v1/get_consumers", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 ? setConsumerData(jsonData) : setConsumerData(Client2ConsumerData); + }), + ) + .then() + .catch(); + + fetch("http://localhost:2979/api/v1/get_producers", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 ? setProducerData(jsonData) : setProducerData(Client2ProducerData); + }), + ) + .then() + .catch(); + }, []); + return (

Consumer View

Producer View

-- 2.51.0 From 9b4301d783c2136bf3ba3cf842ac7ab7f22c60c8 Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Sun, 3 Dec 2023 18:37:45 +0100 Subject: [PATCH 06/15] [Functionality] Request Consumer / Producer - adjusted some header names --- pkgs/ui/src/mock/access_point/index.ts | 32 +++++++++---------- pkgs/ui/src/mock/client_1/index.ts | 44 +++++++++++++------------- pkgs/ui/src/mock/client_2/index.ts | 44 +++++++++++++------------- 3 files changed, 60 insertions(+), 60 deletions(-) diff --git a/pkgs/ui/src/mock/access_point/index.ts b/pkgs/ui/src/mock/access_point/index.ts index 07ae286..1895a9b 100644 --- a/pkgs/ui/src/mock/access_point/index.ts +++ b/pkgs/ui/src/mock/access_point/index.ts @@ -20,25 +20,25 @@ export const APSummaryDetails = [ export const APAttachmentsDummyData = [ { entity_name: "C1", - entity_DID: "did:sov:test:1234", + entity_did: "did:sov:test:1234", network: "Carlo's Home Network", ip_address: "127.0.0.1", }, { entity_name: "C2", - entity_DID: "did:sov:test:4567", + entity_did: "did:sov:test:4567", network: "Steve's Home Network", ip_address: "127.0.0.1", }, { entity_name: "C1-TEST", - entity_DID: "did:sov:test:0001", + entity_did: "did:sov:test:0001", network: "Test Network A", ip_address: "127.0.0.1", }, { entity_name: "C2-TEST", - entity_DID: "did:sov:test:0002", + entity_did: "did:sov:test:0002", network: "Test Network B", ip_address: "127.0.0.1", }, @@ -49,7 +49,7 @@ export const APAttachmentsTableConfig = [ label: "Entity name", }, { - key: "entity_DID", + key: "entity_did", label: "Entity DID", }, { @@ -67,17 +67,17 @@ export const APServiceRepositoryDummyData = [ { service_name: "Carlo's Printing", service_type: "3D Printing", - end_point: "URL", - producer: "C1", - producer_DID: "did:sov:test:1234", + endpoint_url: "URL", + entity: "C1", + entity_did: "did:sov:test:1234", network: "Carlo's Home Network", }, { service_name: "Jeff's Printing", service_type: "3D Printing", - end_point: "URL", - producer: "C2", - producer_DID: "did:sov:test:5678", + endpoint_url: "URL", + entity: "C2", + entity_did: "did:sov:test:5678", network: "Jeff's Home Network", }, ]; @@ -91,16 +91,16 @@ export const APServiceRepositoryTableConfig = [ label: "Service type", }, { - key: "end_point", + key: "endpoint_url", label: "End point", }, { - key: "producer", - label: "Producer", + key: "entity", + label: "Entity", }, { - key: "producer_DID", - label: "Producer DID", + key: "entity_did", + label: "Entity DID", }, { key: "network", diff --git a/pkgs/ui/src/mock/client_1/index.ts b/pkgs/ui/src/mock/client_1/index.ts index 658b51e..2946c9b 100644 --- a/pkgs/ui/src/mock/client_1/index.ts +++ b/pkgs/ui/src/mock/client_1/index.ts @@ -19,33 +19,33 @@ export const Client1ConsumerData = [ { service_name: "Carlo's Printing", service_type: "3D Printing", - end_point: "Consume", - producer: "C2", - producer_did: "did:sov:test:1223", + endpoint_url: "Consume", + entity: "C2", + entity_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", + endpoint_url: "Consume", + entity: "C2", + entity_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", + endpoint_url: "Consume", + entity: "C2", + entity_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", + endpoint_url: "Consume", + entity: "C2", + entity_did: "did:sov:test:0062", network: "Test Network B", }, ]; @@ -60,16 +60,16 @@ export const Client1ConsumerTableConfig = [ label: "Service Type", }, { - key: "end_point", + key: "endpoint_url", label: "End Point", }, { - key: "producer", - label: "Producer", + key: "entity", + label: "Entity", }, { - key: "producer_did", - label: "Producer DID", + key: "entity_did", + label: "Entity DID", }, { key: "network", @@ -81,7 +81,7 @@ export const Client1ProducerData = [ { service_name: "Carlo's Printing", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "DRAFT, REGISTERED", action: "Register, Deregister, Delete", @@ -89,7 +89,7 @@ export const Client1ProducerData = [ { service_name: "Steve's Printing", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "REGISTERED", action: "Create", @@ -97,7 +97,7 @@ export const Client1ProducerData = [ { service_name: "Test Printing A", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "DRAFT", action: "Register, Deregister", @@ -105,7 +105,7 @@ export const Client1ProducerData = [ { service_name: "Test Printing B", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "DRAFT, REGISTERED", action: "Delete, Create", @@ -122,7 +122,7 @@ export const Client1ProducerTableConfig = [ label: "Service Type", }, { - key: "end_point", + key: "endpoint_url", label: "End Point", }, { diff --git a/pkgs/ui/src/mock/client_2/index.ts b/pkgs/ui/src/mock/client_2/index.ts index b0105fd..1f40fcd 100644 --- a/pkgs/ui/src/mock/client_2/index.ts +++ b/pkgs/ui/src/mock/client_2/index.ts @@ -19,33 +19,33 @@ export const Client2ConsumerData = [ { service_name: "Carlo's Printing", service_type: "3D Printing", - end_point: "Consume", - producer: "C2", - producer_did: "did:sov:test:1223", + endpoint_url: "Consume", + entity: "C2", + entity_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", + endpoint_url: "Consume", + entity: "C2", + entity_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", + endpoint_url: "Consume", + entity: "C2", + entity_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", + endpoint_url: "Consume", + entity: "C2", + entity_did: "did:sov:test:0062", network: "Test Network B", }, ]; @@ -60,16 +60,16 @@ export const Client2ConsumerTableConfig = [ label: "Service Type", }, { - key: "end_point", + key: "endpoint_url", label: "End Point", }, { - key: "producer", - label: "Producer", + key: "entity", + label: "Entity", }, { - key: "producer_did", - label: "Producer DID", + key: "entity_did", + label: "Entity DID", }, { key: "network", @@ -81,7 +81,7 @@ export const Client2ProducerData = [ { service_name: "Carlo's Printing", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "DRAFT, REGISTERED", action: "Register, Deregister, Delete", @@ -89,7 +89,7 @@ export const Client2ProducerData = [ { service_name: "Steve's Printing", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "REGISTERED", action: "Create", @@ -97,7 +97,7 @@ export const Client2ProducerData = [ { service_name: "Test Printing A", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "DRAFT", action: "Register, Deregister", @@ -105,7 +105,7 @@ export const Client2ProducerData = [ { service_name: "Test Printing B", service_type: "3D Printing", - end_point: "URL", + endpoint_url: "URL", usage: "C1(3), C3(4)", status: "DRAFT, REGISTERED", action: "Delete, Create", @@ -122,7 +122,7 @@ export const Client2ProducerTableConfig = [ label: "Service Type", }, { - key: "end_point", + key: "endpoint_url", label: "End Point", }, { -- 2.51.0 From c25ac3025c23e51658d9d1485a9ac427e662af95 Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Mon, 4 Dec 2023 23:02:54 +0100 Subject: [PATCH 07/15] [Entities] AP Service Repository View Table - adjusted repository data keys --- pkgs/ui/src/mock/access_point/index.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/ui/src/mock/access_point/index.ts b/pkgs/ui/src/mock/access_point/index.ts index 1895a9b..8af005c 100644 --- a/pkgs/ui/src/mock/access_point/index.ts +++ b/pkgs/ui/src/mock/access_point/index.ts @@ -94,16 +94,20 @@ export const APServiceRepositoryTableConfig = [ key: "endpoint_url", label: "End point", }, - { - key: "entity", - label: "Entity", - }, + // { + // key: "entity", + // label: "Entity", + // }, { key: "entity_did", label: "Entity DID", }, + // { + // key: "network", + // label: "Network", + // }, { - key: "network", - label: "Network", + key: "status", + label: "Status", }, ]; -- 2.51.0 From 10d9b995cb304f9097c72914e37dec07c0980dc0 Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Wed, 6 Dec 2023 19:01:00 +0100 Subject: [PATCH 08/15] [Functionality] Request Consumer / Producer - adjusted some header names --- pkgs/ui/src/mock/client_1/index.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pkgs/ui/src/mock/client_1/index.ts b/pkgs/ui/src/mock/client_1/index.ts index 2946c9b..9139156 100644 --- a/pkgs/ui/src/mock/client_1/index.ts +++ b/pkgs/ui/src/mock/client_1/index.ts @@ -125,16 +125,16 @@ export const Client1ProducerTableConfig = [ key: "endpoint_url", label: "End Point", }, - { - key: "usage", - label: "Usage", - }, + // { + // key: "usage", + // label: "Usage", + // }, { key: "status", label: "Status", }, - { - key: "action", - label: "Action", - }, + // { + // key: "action", + // label: "Action", + // }, ]; -- 2.51.0 From 647fc33acd7ddbfc5d45ec5596efb3adb826b317 Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Wed, 6 Dec 2023 19:25:08 +0100 Subject: [PATCH 09/15] [Functionality] Request Home Table - request entities for home view table --- pkgs/ui/src/app/home/page.tsx | 24 +++++++++++++++++++++--- pkgs/ui/src/mock/home/index.ts | 26 +++++++++++++------------- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/pkgs/ui/src/app/home/page.tsx b/pkgs/ui/src/app/home/page.tsx index 37e51de..4e14f4f 100644 --- a/pkgs/ui/src/app/home/page.tsx +++ b/pkgs/ui/src/app/home/page.tsx @@ -1,11 +1,29 @@ "use client"; -import { NoDataOverlay } from "@/components/noDataOverlay"; +import {NoDataOverlay} from "@/components/noDataOverlay"; import SummaryDetails from "@/components/summary_card"; import CustomTable from "@/components/table"; -import { HomeDummyData, HomeTableConfig } from "@/mock/home"; +import {HomeDummyData, HomeTableConfig} from "@/mock/home"; +import {useEffect, useState} from "react"; export default function Home() { + const [homeData, setHomeData] = useState([]); + + useEffect(() => { + fetch("http://localhost:2979/api/v1/get_entities", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 ? setHomeData(jsonData) : setHomeData(HomeDummyData); + }), + ) + .then() + .catch(); + }, []); + return (

Home View Table

- +
diff --git a/pkgs/ui/src/mock/home/index.ts b/pkgs/ui/src/mock/home/index.ts index ccff693..b6c2d4f 100644 --- a/pkgs/ui/src/mock/home/index.ts +++ b/pkgs/ui/src/mock/home/index.ts @@ -21,27 +21,27 @@ export const HomeDummyData = [ export const HomeTableConfig = [ { - key: "entity_name", + key: "name", label: "Entity name", }, { - key: "entity_DID", + key: "did", label: "Entity DID", }, + // { + // key: "network", + // label: "Network", + // }, { - key: "network", - label: "Network", - }, - { - key: "ip_address", + key: "ip", label: "IP address", }, + // { + // key: "roles", + // label: "Roles", + // }, { - key: "roles", - label: "Roles", - }, - { - key: "visible", - label: "Visible", + key: "attached", + label: "Attached", }, ]; -- 2.51.0 From 01ce85bb156c5c43d396858b3a8e51b5c9f41362 Mon Sep 17 00:00:00 2001 From: erdemarslan Date: Sat, 9 Dec 2023 18:36:24 +0100 Subject: [PATCH 10/15] fix formatting --- pkgs/ui/src/app/access-point/page.tsx | 4 ++- pkgs/ui/src/app/client-1/page.tsx | 16 ++++++----- pkgs/ui/src/app/client-2/page.tsx | 18 ++++++++----- pkgs/ui/src/app/home/page.tsx | 38 ++++++++++++++------------- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 277d5c0..0ea7a72 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -22,7 +22,9 @@ export default function AccessPoint() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 ? setRepositoryData(jsonData) : setRepositoryData(APServiceRepositoryDummyData); + jsonData.length > 0 + ? setRepositoryData(jsonData) + : setRepositoryData(APServiceRepositoryDummyData); }), ) .then() diff --git a/pkgs/ui/src/app/client-1/page.tsx b/pkgs/ui/src/app/client-1/page.tsx index bf47d67..3eb97c7 100644 --- a/pkgs/ui/src/app/client-1/page.tsx +++ b/pkgs/ui/src/app/client-1/page.tsx @@ -23,7 +23,9 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 ? setConsumerData(jsonData) : setConsumerData(Client1ConsumerData); + jsonData.length > 0 + ? setConsumerData(jsonData) + : setConsumerData(Client1ConsumerData); }), ) .then() @@ -33,11 +35,13 @@ export default function Client1() { method: "GET", // credentials: 'include', }) - .then((resp) => - resp.json().then((jsonData) => { - console.log(jsonData); - jsonData.length > 0 ? setProducerData(jsonData) : setProducerData(Client1ProducerData); - }), + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 + ? setProducerData(jsonData) + : setProducerData(Client1ProducerData); + }), ) .then() .catch(); diff --git a/pkgs/ui/src/app/client-2/page.tsx b/pkgs/ui/src/app/client-2/page.tsx index b833d89..43da43d 100644 --- a/pkgs/ui/src/app/client-2/page.tsx +++ b/pkgs/ui/src/app/client-2/page.tsx @@ -9,7 +9,7 @@ import { Client2SummaryDetails, } from "@/mock/client_2"; import CustomTable from "@/components/table"; -import {useEffect, useState} from "react"; +import { useEffect, useState } from "react"; export default function Client1() { const [consumerData, setConsumerData] = useState([]); @@ -23,7 +23,9 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 ? setConsumerData(jsonData) : setConsumerData(Client2ConsumerData); + jsonData.length > 0 + ? setConsumerData(jsonData) + : setConsumerData(Client2ConsumerData); }), ) .then() @@ -33,11 +35,13 @@ export default function Client1() { method: "GET", // credentials: 'include', }) - .then((resp) => - resp.json().then((jsonData) => { - console.log(jsonData); - jsonData.length > 0 ? setProducerData(jsonData) : setProducerData(Client2ProducerData); - }), + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 + ? setProducerData(jsonData) + : setProducerData(Client2ProducerData); + }), ) .then() .catch(); diff --git a/pkgs/ui/src/app/home/page.tsx b/pkgs/ui/src/app/home/page.tsx index 4e14f4f..08e702e 100644 --- a/pkgs/ui/src/app/home/page.tsx +++ b/pkgs/ui/src/app/home/page.tsx @@ -1,28 +1,30 @@ "use client"; -import {NoDataOverlay} from "@/components/noDataOverlay"; +import { NoDataOverlay } from "@/components/noDataOverlay"; import SummaryDetails from "@/components/summary_card"; import CustomTable from "@/components/table"; -import {HomeDummyData, HomeTableConfig} from "@/mock/home"; -import {useEffect, useState} from "react"; +import { HomeDummyData, HomeTableConfig } from "@/mock/home"; +import { useEffect, useState } from "react"; export default function Home() { - const [homeData, setHomeData] = useState([]); + const [homeData, setHomeData] = useState([]); - useEffect(() => { - fetch("http://localhost:2979/api/v1/get_entities", { - method: "GET", - // credentials: 'include', - }) - .then((resp) => - resp.json().then((jsonData) => { - console.log(jsonData); - jsonData.length > 0 ? setHomeData(jsonData) : setHomeData(HomeDummyData); - }), - ) - .then() - .catch(); - }, []); + useEffect(() => { + fetch("http://localhost:2979/api/v1/get_entities", { + method: "GET", + // credentials: 'include', + }) + .then((resp) => + resp.json().then((jsonData) => { + console.log(jsonData); + jsonData.length > 0 + ? setHomeData(jsonData) + : setHomeData(HomeDummyData); + }), + ) + .then() + .catch(); + }, []); return (
-- 2.51.0 From 084288232028355d9d28c7ad372ac46b86c9f848 Mon Sep 17 00:00:00 2001 From: "Arslan, Erdem" Date: Sat, 9 Dec 2023 18:55:19 +0100 Subject: [PATCH 11/15] try creating type RepositoryData to fix pipeline --- pkgs/ui/src/app/access-point/page.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 0ea7a72..19196a4 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -11,8 +11,15 @@ import { } from "@/mock/access_point"; import { useEffect, useState } from "react"; +interface RepositoryData { + entity_name: string; + entity_did: string; + network: string; + ip_address: string; +} + export default function AccessPoint() { - const [repositoryData, setRepositoryData] = useState([]); + const [repositoryData, setRepositoryData] = useState([]); useEffect(() => { fetch("http://localhost:2979/api/v1/get_repositories", { -- 2.51.0 From 129e25e52e834417a6731274d76546f1940b097d Mon Sep 17 00:00:00 2001 From: "Arslan, Erdem" Date: Sat, 9 Dec 2023 18:58:59 +0100 Subject: [PATCH 12/15] fix linting --- pkgs/ui/src/app/access-point/page.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 19196a4..0e22a84 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -12,14 +12,14 @@ import { import { useEffect, useState } from "react"; interface RepositoryData { - entity_name: string; - entity_did: string; - network: string; - ip_address: string; + entity_name: string; + entity_did: string; + network: string; + ip_address: string; } export default function AccessPoint() { - const [repositoryData, setRepositoryData] = useState([]); + const [repositoryData, setRepositoryData] = useState([]); useEffect(() => { fetch("http://localhost:2979/api/v1/get_repositories", { -- 2.51.0 From 1cfb5f9fa83a8e0e460081ed17d0f575df20fffe Mon Sep 17 00:00:00 2001 From: "Arslan, Erdem" Date: Sat, 9 Dec 2023 19:11:30 +0100 Subject: [PATCH 13/15] transform data received from endpoint --- pkgs/ui/src/app/access-point/page.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 0e22a84..05feee3 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -29,8 +29,16 @@ export default function AccessPoint() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); + + const transformedData = jsonData.map((item) => ({ + entity_name: item.service_name, + entity_did: item.entity_did, + network: item.network, + ip_address: "", // You might need to set an appropriate default value + })); + jsonData.length > 0 - ? setRepositoryData(jsonData) + ? setRepositoryData(transformedData) : setRepositoryData(APServiceRepositoryDummyData); }), ) -- 2.51.0 From 37d34d4f36b2201b0f01a46ac0de8965fa4ea73d Mon Sep 17 00:00:00 2001 From: Onur Arslan Date: Sat, 9 Dec 2023 19:29:42 +0100 Subject: [PATCH 14/15] fixed the issues for merge --- pkgs/ui/src/app/access-point/page.tsx | 9 +++------ pkgs/ui/src/app/client-1/page.tsx | 10 ++-------- pkgs/ui/src/app/client-2/page.tsx | 10 ++-------- pkgs/ui/src/app/home/page.tsx | 6 ++---- 4 files changed, 9 insertions(+), 26 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index 05feee3..ba05481 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -6,7 +6,6 @@ import { APSummaryDetails, APAttachmentsDummyData, APAttachmentsTableConfig, - APServiceRepositoryDummyData, APServiceRepositoryTableConfig, } from "@/mock/access_point"; import { useEffect, useState } from "react"; @@ -30,16 +29,14 @@ export default function AccessPoint() { resp.json().then((jsonData) => { console.log(jsonData); - const transformedData = jsonData.map((item) => ({ + const transformedData = jsonData.map((item: { service_name: any; entity_did: any; network: any; }) => ({ entity_name: item.service_name, entity_did: item.entity_did, network: item.network, - ip_address: "", // You might need to set an appropriate default value + ip_address: "", })); - jsonData.length > 0 - ? setRepositoryData(transformedData) - : setRepositoryData(APServiceRepositoryDummyData); + setRepositoryData(transformedData); }), ) .then() diff --git a/pkgs/ui/src/app/client-1/page.tsx b/pkgs/ui/src/app/client-1/page.tsx index 3eb97c7..a2f6b0e 100644 --- a/pkgs/ui/src/app/client-1/page.tsx +++ b/pkgs/ui/src/app/client-1/page.tsx @@ -3,10 +3,8 @@ import SummaryDetails from "@/components/summary_card"; import { Client1SummaryDetails, - Client1ConsumerData, Client1ConsumerTableConfig, Client1ProducerTableConfig, - Client1ProducerData, } from "@/mock/client_1"; import CustomTable from "@/components/table"; import { useEffect, useState } from "react"; @@ -23,9 +21,7 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 - ? setConsumerData(jsonData) - : setConsumerData(Client1ConsumerData); + setConsumerData(jsonData); }), ) .then() @@ -38,9 +34,7 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 - ? setProducerData(jsonData) - : setProducerData(Client1ProducerData); + setProducerData(jsonData); }), ) .then() diff --git a/pkgs/ui/src/app/client-2/page.tsx b/pkgs/ui/src/app/client-2/page.tsx index 43da43d..8b9a8d0 100644 --- a/pkgs/ui/src/app/client-2/page.tsx +++ b/pkgs/ui/src/app/client-2/page.tsx @@ -2,9 +2,7 @@ import SummaryDetails from "@/components/summary_card"; import { - Client2ConsumerData, Client2ConsumerTableConfig, - Client2ProducerData, Client2ProducerTableConfig, Client2SummaryDetails, } from "@/mock/client_2"; @@ -23,9 +21,7 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 - ? setConsumerData(jsonData) - : setConsumerData(Client2ConsumerData); + setConsumerData(jsonData); }), ) .then() @@ -38,9 +34,7 @@ export default function Client1() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 - ? setProducerData(jsonData) - : setProducerData(Client2ProducerData); + setProducerData(jsonData); }), ) .then() diff --git a/pkgs/ui/src/app/home/page.tsx b/pkgs/ui/src/app/home/page.tsx index 08e702e..16b0984 100644 --- a/pkgs/ui/src/app/home/page.tsx +++ b/pkgs/ui/src/app/home/page.tsx @@ -3,7 +3,7 @@ import { NoDataOverlay } from "@/components/noDataOverlay"; import SummaryDetails from "@/components/summary_card"; import CustomTable from "@/components/table"; -import { HomeDummyData, HomeTableConfig } from "@/mock/home"; +import { HomeTableConfig } from "@/mock/home"; import { useEffect, useState } from "react"; export default function Home() { @@ -17,9 +17,7 @@ export default function Home() { .then((resp) => resp.json().then((jsonData) => { console.log(jsonData); - jsonData.length > 0 - ? setHomeData(jsonData) - : setHomeData(HomeDummyData); + setHomeData(jsonData); }), ) .then() -- 2.51.0 From 556b3867876bf4f8e02b76a1f7a4e0aade7328b7 Mon Sep 17 00:00:00 2001 From: "Arslan, Erdem" Date: Sat, 9 Dec 2023 19:39:42 +0100 Subject: [PATCH 15/15] fix formatting --- pkgs/ui/src/app/access-point/page.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkgs/ui/src/app/access-point/page.tsx b/pkgs/ui/src/app/access-point/page.tsx index ba05481..230ee98 100644 --- a/pkgs/ui/src/app/access-point/page.tsx +++ b/pkgs/ui/src/app/access-point/page.tsx @@ -29,12 +29,14 @@ export default function AccessPoint() { resp.json().then((jsonData) => { console.log(jsonData); - const transformedData = jsonData.map((item: { service_name: any; entity_did: any; network: any; }) => ({ - entity_name: item.service_name, - entity_did: item.entity_did, - network: item.network, - ip_address: "", - })); + const transformedData = jsonData.map( + (item: { service_name: any; entity_did: any; network: any }) => ({ + entity_name: item.service_name, + entity_did: item.entity_did, + network: item.network, + ip_address: "", + }), + ); setRepositoryData(transformedData); }), -- 2.51.0