diff --git a/apps/whois/package.json b/apps/whois/package.json index 12b489b2b..6f8cbfdb4 100644 --- a/apps/whois/package.json +++ b/apps/whois/package.json @@ -59,6 +59,11 @@ "value": "theme-dark", "type": "optional", "description": "Override the default theme. Possible values are theme-light or theme-dark (default)" + }, + "endpoint": { + "value": "", + "type": "required", + "description": "Endpoint URL of the API" } } } diff --git a/apps/whois/src/App.js b/apps/whois/src/App.js index ebc22f847..b7c788740 100644 --- a/apps/whois/src/App.js +++ b/apps/whois/src/App.js @@ -42,7 +42,7 @@ const App = (props) => { const [items, setItems] = React.useState(null) const [error, setError] = React.useState(null) const [statusCode, setStatusCode] = React.useState(null) - const { embedded } = props + const { embedded, endpoint } = props const resultsShown = items !== null @@ -59,7 +59,7 @@ const App = (props) => { setProcessing(true) // search - searchByInput(term, options) + searchByInput(endpoint, term, options) .then((response) => { // get status code from response setStatusCode(response.status) diff --git a/apps/whois/src/ResultItem.js b/apps/whois/src/ResultItem.js index 56ee30869..48ce4262a 100644 --- a/apps/whois/src/ResultItem.js +++ b/apps/whois/src/ResultItem.js @@ -1,4 +1,4 @@ -import React, { useState } from "react" +import React, { useState, useMemo, useEffect } from "react" import ReactJson from "react-json-view" import { DateTime } from "luxon" import { Icon, Stack } from "juno-ui-components" @@ -39,7 +39,15 @@ const capitalize = (string) => { const ResultItem = ({ content, expand }) => { const [isExpanded, setIsExpanded] = useState(false) - React.useEffect(() => { + const responsibles = useMemo(() => { + if (!content?.responsibles) return null + // billing api do not return anymore following values. We extract them active and we leave the rest as it is. + const { controller, securityExpert, productOwner, ...rest } = + content.responsibles + return rest + }, [content.responsibles]) + + useEffect(() => { setIsExpanded(expand) }, [expand]) @@ -61,11 +69,11 @@ const ResultItem = ({ content, expand }) => { {content.region && (