|
1 | 1 | 'use client';
|
2 |
| -import { PageDID as PageDIDStory } from '@/component-library/pages/legacy/DID/PageDID'; |
3 |
| -import useComDOM from '@/lib/infrastructure/hooks/useComDOM'; |
4 |
| -import { useEffect, useState } from 'react'; |
5 |
| -import { HTTPRequest } from '@/lib/sdk/http'; |
6 |
| -import { |
7 |
| - DIDDatasetReplicasViewModel, |
8 |
| - DIDKeyValuePairsDataViewModel, |
9 |
| - DIDMetaViewModel, |
10 |
| - DIDRulesViewModel, |
11 |
| - DIDViewModel, |
12 |
| - FileReplicaStateViewModel, |
13 |
| -} from '@/lib/infrastructure/data/view-model/did'; |
14 |
| -import { didKeyValuePairsDataQuery, didMetaQueryBase } from '@/app/(rucio)/did/queries'; |
15 |
| -import { Loading } from '@/component-library/pages/legacy/Helpers/Loading'; |
| 2 | + |
| 3 | +import { DetailsDID } from '@/component-library/pages/DID/details/DetailsDID'; |
| 4 | +import { useEffect } from 'react'; |
16 | 5 |
|
17 | 6 | export default function Page({ params }: { params: { scope: string; name: string } }) {
|
18 | 7 | const decodedScope = decodeURIComponent(params.scope);
|
19 | 8 | const decodedName = decodeURIComponent(params.name);
|
20 | 9 |
|
21 |
| - const [didMeta, setDIDMeta] = useState<DIDMetaViewModel>({ status: 'pending' } as DIDMetaViewModel); |
22 |
| - const [didKeyValuePairsData, setDIDKeyValuePairsData] = useState({ status: 'pending' } as DIDKeyValuePairsDataViewModel); |
23 |
| - const [fromDidList, setFromDidList] = useState<string>('yosearch'); |
24 |
| - useEffect(() => { |
25 |
| - didMetaQueryBase(decodedScope, decodedName).then(setDIDMeta); |
26 |
| - }, []); |
27 | 10 | useEffect(() => {
|
28 |
| - didKeyValuePairsDataQuery(decodedScope, decodedName).then(setDIDKeyValuePairsData); |
| 11 | + document.title = `${decodedScope}:${decodedName} - Rucio`; |
29 | 12 | }, []);
|
30 | 13 |
|
31 |
| - const didParentsComDOM = useComDOM<DIDViewModel>('page-did-parents-query', [], false, Infinity, 200, true); |
32 |
| - const didContentsComDOM = useComDOM<DIDViewModel>('page-did-contents-query', [], false, Infinity, 200, true); |
33 |
| - const didFileReplicasComDOM = useComDOM<FileReplicaStateViewModel>('page-did-filereplicas-query', [], false, Infinity, 200, true); |
34 |
| - const didFileReplicasDOnChange = (scope: string, name: string) => { |
35 |
| - didFileReplicasComDOM.setRequest({ |
36 |
| - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-file-replicas`), |
37 |
| - method: 'GET', |
38 |
| - params: { |
39 |
| - scope: scope, |
40 |
| - name: name, |
41 |
| - }, |
42 |
| - headers: new Headers({ |
43 |
| - 'Content-Type': 'application/json', |
44 |
| - } as HeadersInit), |
45 |
| - body: null, |
46 |
| - } as HTTPRequest); |
47 |
| - didFileReplicasComDOM.start(); |
48 |
| - }; |
49 |
| - const didRulesComDOM = useComDOM<DIDRulesViewModel>('page-did-rules-query', [], false, Infinity, 200, true); |
50 |
| - const didDatasetReplicasComDOM = useComDOM<DIDDatasetReplicasViewModel>('page-did-datasetreplicas-query', [], false, Infinity, 200, true); |
51 |
| - useEffect(() => { |
52 |
| - const setRequests = async () => { |
53 |
| - await didContentsComDOM.setRequest({ |
54 |
| - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-did-contents`), |
55 |
| - method: 'GET', |
56 |
| - params: { |
57 |
| - scope: decodedScope, |
58 |
| - name: decodedName, |
59 |
| - }, |
60 |
| - headers: new Headers({ |
61 |
| - 'Content-Type': 'application/json', |
62 |
| - } as HeadersInit), |
63 |
| - body: null, |
64 |
| - } as HTTPRequest); |
65 |
| - await didParentsComDOM.setRequest({ |
66 |
| - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-did-parents`), |
67 |
| - method: 'GET', |
68 |
| - params: { |
69 |
| - scope: decodedScope, |
70 |
| - name: decodedName, |
71 |
| - }, |
72 |
| - headers: new Headers({ |
73 |
| - 'Content-Type': 'application/json', |
74 |
| - } as HeadersInit), |
75 |
| - body: null, |
76 |
| - } as HTTPRequest); |
77 |
| - await didFileReplicasComDOM.setRequest({ |
78 |
| - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-file-replicas`), |
79 |
| - method: 'GET', |
80 |
| - params: { |
81 |
| - scope: decodedScope, |
82 |
| - name: decodedName, |
83 |
| - }, |
84 |
| - headers: new Headers({ |
85 |
| - 'Content-Type': 'application/json', |
86 |
| - } as HeadersInit), |
87 |
| - body: null, |
88 |
| - } as HTTPRequest); |
89 |
| - await didRulesComDOM.setRequest({ |
90 |
| - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-did-rules`), |
91 |
| - method: 'GET', |
92 |
| - params: { |
93 |
| - scope: decodedScope, |
94 |
| - name: decodedName, |
95 |
| - }, |
96 |
| - headers: new Headers({ |
97 |
| - 'Content-Type': 'application/json', |
98 |
| - } as HeadersInit), |
99 |
| - body: null, |
100 |
| - } as HTTPRequest); |
101 |
| - await didDatasetReplicasComDOM.setRequest({ |
102 |
| - url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/list-dataset-replicas`), |
103 |
| - method: 'GET', |
104 |
| - params: { |
105 |
| - scope: decodedScope, |
106 |
| - name: decodedName, |
107 |
| - }, |
108 |
| - headers: new Headers({ |
109 |
| - 'Content-Type': 'application/json', |
110 |
| - } as HeadersInit), |
111 |
| - body: null, |
112 |
| - } as HTTPRequest); |
113 |
| - }; |
114 |
| - setRequests(); |
115 |
| - }, []); |
116 |
| - if (didMeta.status === 'pending') { |
117 |
| - return <Loading title="View DID" subtitle={`For DID ${decodedScope}:${decodedName}`} />; |
118 |
| - } |
119 |
| - return ( |
120 |
| - <PageDIDStory |
121 |
| - didMeta={didMeta} |
122 |
| - fromDidList={fromDidList} |
123 |
| - didParentsComDOM={didParentsComDOM} |
124 |
| - didKeyValuePairsData={didKeyValuePairsData} |
125 |
| - didFileReplicasComDOM={didFileReplicasComDOM} |
126 |
| - didFileReplicasDOnChange={didFileReplicasDOnChange} |
127 |
| - didRulesComDOM={didRulesComDOM} |
128 |
| - didContentsComDOM={didContentsComDOM} |
129 |
| - didDatasetReplicasComDOM={didDatasetReplicasComDOM} |
130 |
| - /> |
131 |
| - ); |
| 14 | + return <DetailsDID scope={decodedScope} name={decodedName} />; |
132 | 15 | }
|
0 commit comments