diff --git a/src/components/apis/details-of-api/react/runtime/ApiDetails.tsx b/src/components/apis/details-of-api/react/runtime/ApiDetails.tsx index 9697550f3..28cc5d95b 100644 --- a/src/components/apis/details-of-api/react/runtime/ApiDetails.tsx +++ b/src/components/apis/details-of-api/react/runtime/ApiDetails.tsx @@ -4,12 +4,12 @@ import { Resolve } from "@paperbits/react/decorators"; import { Router } from "@paperbits/common/routing"; import { Stack } from "@fluentui/react"; import { Badge, Dropdown, FluentProvider, Option, Spinner } from "@fluentui/react-components"; +import { MarkdownRenderer } from "@microsoft/api-docs-ui"; import { Api } from "../../../../../models/api"; import { KnownMimeTypes } from "../../../../../models/knownMimeTypes" import { ApiService } from "../../../../../services/apiService"; import { RouteHelper } from "../../../../../routing/routeHelper"; import { TypeOfApi, fuiTheme } from "../../../../../constants"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; interface ApiDetailsProps { changeLogPageUrl?: string @@ -165,7 +165,7 @@ const ApiDetailsFC = ({ } {api.description && - + } {(api.contact || api.license || api.termsOfServiceUrl) &&
diff --git a/src/components/apis/history-of-api/react/runtime/ApiHistory.tsx b/src/components/apis/history-of-api/react/runtime/ApiHistory.tsx index 60d655009..47ed1e230 100644 --- a/src/components/apis/history-of-api/react/runtime/ApiHistory.tsx +++ b/src/components/apis/history-of-api/react/runtime/ApiHistory.tsx @@ -3,15 +3,14 @@ import { useEffect, useState } from "react"; import { Resolve } from "@paperbits/react/decorators"; import { Router } from "@paperbits/common/routing"; import { Stack } from "@fluentui/react"; -import { FluentProvider, Spinner, Table, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow } from "@fluentui/react-components"; +import { FluentProvider, Spinner, TableCell, TableRow } from "@fluentui/react-components"; +import { InfoTable } from "@microsoft/api-docs-ui"; import { Api } from "../../../../../models/api"; import { Page } from "../../../../../models/page"; import { ChangeLogContract } from "../../../../../contracts/apiChangeLog"; import { ApiService } from "../../../../../services/apiService"; import { RouteHelper } from "../../../../../routing/routeHelper"; import { Pagination } from "../../../../utils/react/Pagination"; -import { NoRecordsRow } from "../../../../utils/react/NoRecordsRow"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; import { defaultPageSize, fuiTheme } from "../../../../../constants"; import { Utils } from "../../../../../utils"; @@ -91,27 +90,19 @@ const ApiHistoryFC = ({ Go back to the API reference page } - - - - - Release date - Notes - - - - {currentChangelogPage?.value?.length > 0 - ? currentChangelogPage.value.map((changelog, index) => ( - - {Utils.formatDateTime(changelog.createdDateTime)} - {changelog.notes} - - )) - : - } - -
-
+ 0 + && currentChangelogPage.value.map((changelog, index) => ( + + {Utils.formatDateTime(changelog.createdDateTime)} + {changelog.notes} + + )) + } + noDataMessage="No records to show" + /> {currentChangelogPage?.count > 1 &&
diff --git a/src/components/apis/list-of-apis/react/runtime/ApisCards.tsx b/src/components/apis/list-of-apis/react/runtime/ApisCards.tsx index 10227bda3..b5b928f0d 100644 --- a/src/components/apis/list-of-apis/react/runtime/ApisCards.tsx +++ b/src/components/apis/list-of-apis/react/runtime/ApisCards.tsx @@ -1,10 +1,8 @@ import * as React from "react"; import { useState } from "react"; -import { Stack } from "@fluentui/react"; +import { ApiCard } from "@microsoft/api-docs-ui"; import { Api } from "../../../../../models/api"; import { TagGroup } from "../../../../../models/tagGroup"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; -import { markdownMaxCharsMap } from "../../../../../constants"; import { isApisGrouped, toggleValueInSet, TagGroupToggleBtn, TApisData } from "./utils"; type Props = { @@ -13,36 +11,6 @@ type Props = { detailsPageTarget: string; }; -const ApiCard = ({ api, getReferenceUrl, showApiType, detailsPageTarget }: Props & { api: Api }) => { - return ( -
-
- {showApiType && ( -
- API - {api.typeName} -
- )} -

{api.displayName}

- - -
- - - - Go to API - - -
- ); -}; - const ApisCardsContainer = ({ apis, ...props }: Props & { apis: Api[] }) => ( <> {apis?.length > 0 diff --git a/src/components/apis/list-of-apis/react/runtime/ApisTable.tsx b/src/components/apis/list-of-apis/react/runtime/ApisTable.tsx index 9fd76d4e0..d2ebc0d07 100644 --- a/src/components/apis/list-of-apis/react/runtime/ApisTable.tsx +++ b/src/components/apis/list-of-apis/react/runtime/ApisTable.tsx @@ -1,19 +1,11 @@ import * as React from "react"; import { useState } from "react"; -import { - Table, - TableBody, - TableCell, - TableHeader, - TableHeaderCell, - TableRow, -} from "@fluentui/react-components"; +import { TableCell, TableRow } from "@fluentui/react-components"; +import { InfoTable, MarkdownRenderer } from "@microsoft/api-docs-ui"; import { Api } from "../../../../../models/api"; import { Page } from "../../../../../models/page"; import { TagGroup } from "../../../../../models/tagGroup"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; import { NoRecordsRow } from "../../../../utils/react/NoRecordsRow"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; import { markdownMaxCharsMap } from "../../../../../constants"; import { isApisGrouped, @@ -40,7 +32,7 @@ const TableBodyApis = ({ showApiType, apis, getReferenceUrl, detailsPageTarget } - + {showApiType && {api.typeName}} @@ -88,38 +80,23 @@ const TableBodyTags = ({ tags, ...props }: Props & { tags: Page> } ); }; -export const ApisTable = ({ apis, ...props }: Props & { apis: TApisData }) => ( - - - - - - Name - - - Description - - {props.showApiType && ( - - Type - - )} - - +export const ApisTable = ({ apis, ...props }: Props & { apis: TApisData }) => { + const tableColumns = ["Name", "Description"]; + props.showApiType && tableColumns.push("Type"); - - {isApisGrouped(apis) ? ( - + return ( + ) : ( - - )} - -
-
-); + + ) + } + noDataMessage="No APIs to display" + /> + ); +} diff --git a/src/components/operations/operation-details/react/runtime/OperationConsoleGql.tsx b/src/components/operations/operation-details/react/runtime/OperationConsoleGql.tsx index 45f7fcb36..5e6e873b3 100644 --- a/src/components/operations/operation-details/react/runtime/OperationConsoleGql.tsx +++ b/src/components/operations/operation-details/react/runtime/OperationConsoleGql.tsx @@ -1,7 +1,5 @@ import * as React from "react"; import { useCallback, useEffect, useState } from "react"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { a11yLight } from "react-syntax-highlighter/dist/esm/styles/hljs"; import Editor, { Monaco } from '@monaco-editor/react'; import { ISettingsProvider } from "@paperbits/common/configuration"; import { SessionManager } from "@paperbits/common/persistence/sessionManager"; @@ -36,6 +34,7 @@ import { truncateBreadcrumbLongName } from "@fluentui/react-components"; import { DismissRegular, SearchRegular } from "@fluentui/react-icons"; +import { MarkdownRenderer, SyntaxHighlighter } from "@microsoft/api-docs-ui"; import { RouteHelper } from "../../../../../routing/routeHelper"; import { Api } from "../../../../../models/api"; import { ConsoleHeader } from "../../../../../models/console/consoleHeader"; @@ -49,7 +48,6 @@ import { ProductService } from "../../../../../services/productService"; import { UsersService } from "../../../../../services/usersService"; import { GraphqlService, TGraphqlTypes } from "../../../../../services/graphqlService"; import { GqlWsMessageType, GraphqlProtocols, graphqlSubProtocol, GraphqlTypes } from "../../../../../constants"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; import { Utils } from "../../../../../utils"; import { ConsoleAuthorization } from "./operation-console/ConsoleAuthorization"; import { ConsoleHeaders } from "./operation-console/ConsoleHeaders"; @@ -702,8 +700,8 @@ export const OperationConsoleGql = ({ } {selectedTab === ConsoleTab.response && (requestError - ? - : response && + ? + : response && ) } {selectedTab === ConsoleTab.wsconsole && diff --git a/src/components/operations/operation-details/react/runtime/OperationDetails.tsx b/src/components/operations/operation-details/react/runtime/OperationDetails.tsx index caa8841c6..087d9ddfe 100644 --- a/src/components/operations/operation-details/react/runtime/OperationDetails.tsx +++ b/src/components/operations/operation-details/react/runtime/OperationDetails.tsx @@ -4,19 +4,9 @@ import { ISettingsProvider } from "@paperbits/common/configuration"; import { SessionManager } from "@paperbits/common/persistence/sessionManager"; import { HttpClient } from "@paperbits/common/http/httpClient"; import { Stack } from "@fluentui/react"; -import { - Badge, - Button, - Spinner, - Table, - TableBody, - TableCell, - TableHeader, - TableHeaderCell, - TableRow, - Tooltip, -} from "@fluentui/react-components"; +import { Badge, Button, Spinner, TableCell, TableRow, Tooltip } from "@fluentui/react-components"; import { Copy16Regular } from "@fluentui/react-icons"; +import { InfoPanel, InfoTable, MarkdownRenderer } from "@microsoft/api-docs-ui"; import { RouteHelper } from "../../../../../routing/routeHelper"; import { ApiService } from "../../../../../services/apiService"; import { UsersService } from "../../../../../services/usersService"; @@ -36,8 +26,6 @@ import { TypeDefinitionPropertyTypePrimitive, TypeDefinitionPropertyTypeReference, } from "../../../../../models/typeDefinition"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; import { OperationDetailsRuntimeProps } from "./OperationDetailsRuntime"; import { OperationRepresentation, @@ -346,11 +334,7 @@ export const OperationDetails = ({ {operation.displayName} {operation.description && ( -
- -
+
)}
-
-
- Endpoint: - {tags.length > 0 && ( + 0 && ( ))} - )} -
-
-
- + ) + } + children={ +
+ {operation.method} @@ -421,8 +402,8 @@ export const OperationDetails = ({ />
-
-
+ } + /> {enableConsole && (
+ + + ))} + /> ) : ( - )}
@@ -499,56 +458,35 @@ export const OperationDetailsGql = ({

Types

- - - + ( - - - Name - - - - - Description - - + + {getGraphType(reference)} + + +
+ +
+
-
- - {references.map((reference) => ( - - - {getGraphType(reference)} - - -
- -
-
-
- ))} -
-
-
+ )) + } + /> {references.map((reference) => (
No operation selected. :
+

+ {operation.displayName} +

+ {operation.description && ( +
+ )} -
-
-
{operation.displayName}
- {operation.description && -
- -
- } - {tags.length > 0 && + 0 && Tags: {tags.map(tag => {tag.name})} - } -
-
-
- Socket URL - {requestUrl} - -
- {api.protocols && + } + children={ + <>
- Protocol - {api.protocols.join(", ")} + Socket URL + {requestUrl} + +
- } -
-
+ {api.protocols && +
+ Protocol + {api.protocols.join(", ")} +
+ } + + } + /> {enableConsole && }
} diff --git a/src/components/operations/operation-details/react/runtime/OperationRepresentation.tsx b/src/components/operations/operation-details/react/runtime/OperationRepresentation.tsx index 80d1cbac4..56b866743 100644 --- a/src/components/operations/operation-details/react/runtime/OperationRepresentation.tsx +++ b/src/components/operations/operation-details/react/runtime/OperationRepresentation.tsx @@ -2,13 +2,13 @@ import * as React from "react"; import { useEffect, useState } from "react"; import { Stack } from "@fluentui/react"; import { Dropdown, Option, Tab, TabList } from "@fluentui/react-components"; +import { RawSchema } from "@microsoft/api-docs-ui"; import { KnownMimeTypes } from "../../../../../models/knownMimeTypes"; import { Representation } from "../../../../../models/representation"; import { TypeDefinition } from "../../../../../models/typeDefinition"; import { RepresentationExample } from "../../../../../models/representationExample"; import { Utils } from "../../../../../utils"; import { OperationDetailsTable } from "./utils"; -import { CodeSnippet } from "../../../../utils/react/CodeSnippet"; import { TypeDefinitionForRepresentation } from "./TypeDefinitions"; type OperationRepresentationProps = { @@ -67,7 +67,7 @@ export const OperationRepresentation = ({ definitions, representations, showExam selectedOptions={[selectedRepresentation.contentType]} size="small" className={"operation-content-type-dropdown"} - onOptionSelect={(e, data) => { + onOptionSelect={(_, data) => { const newSelectedRepresentation = representations.find(x => x.contentType === data.optionValue); setSelectedRepresentation(newSelectedRepresentation); newSelectedRepresentation.contentType === KnownMimeTypes.FormData && setSchemaView(TSchemaView.table); @@ -88,10 +88,10 @@ export const OperationRepresentation = ({ definitions, representations, showExam /> : selectedRepresentationDefinition && (schemaView === TSchemaView.schema - ? : + onTabSelect={(_, data: { value: string }) => setSelectedRepresentationExample(selectedRepresentation.examples.find(x => x.title === data.value)) }> {selectedRepresentation.examples.map(example => ( @@ -113,7 +113,11 @@ export const OperationRepresentation = ({ definitions, representations, showExam ))} - + } diff --git a/src/components/operations/operation-details/react/runtime/TypeDefinitions.tsx b/src/components/operations/operation-details/react/runtime/TypeDefinitions.tsx index b72d22302..2b9b76cf6 100644 --- a/src/components/operations/operation-details/react/runtime/TypeDefinitions.tsx +++ b/src/components/operations/operation-details/react/runtime/TypeDefinitions.tsx @@ -1,11 +1,9 @@ import * as React from "react"; import { useState } from "react"; import { Stack } from "@fluentui/react"; -import { Tab, TabList, Table, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow } from "@fluentui/react-components"; +import { Tab, TabList, TableCell, TableRow } from "@fluentui/react-components"; +import { InfoTable, MarkdownRenderer, RawSchema, TypeBadge } from "@microsoft/api-docs-ui"; import { TypeDefinition, TypeDefinitionPropertyTypeCombination } from "../../../../../models/typeDefinition"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; -import { CodeSnippet } from "../../../../utils/react/CodeSnippet"; import { TSchemaView } from "./OperationRepresentation"; type TypeDefinitionProps = { @@ -46,11 +44,11 @@ export const TypeDefinitionInList = ({ definition, showExamples, getReferenceUrl {schemaView === TSchemaView.schema - ? + ? :
{definition.name}
- {definition.description && } + {definition.description && } {kind === TDefinitionKind.combination ? : kind === TDefinitionKind.enum @@ -108,22 +106,16 @@ const TypeDefinitionEnum = ({ definition }: TypeDefinitionProps) => { const enumValues = definition.enum.join(", "); return ( - - - - - Type - Values - - - - - {definition.type["name"]} - {enumValues} - - -
-
+ + + {enumValues} + + } + /> ); } @@ -131,67 +123,60 @@ const TypeDefinitionEnum = ({ definition }: TypeDefinitionProps) => { const TypeDefinitionObject = ({ definition, showExamples, getReferenceUrl }: TypeDefinitionProps) => { if (!definition.properties || definition.properties.length === 0) return; + /** This is needed to ensure the right order of columns */ + const columnLabels = ["Name", "Required", "Type", "Description"]; + if (definition.readOnly) columnLabels.splice(2, 0, "Read-only"); + if (showExamples) columnLabels.push("Example"); + return ( - - - - - Name - Required - {definition.readOnly && Read-only} - Type - Description - {showExamples && Example} - - - - {definition.properties.map(property => { - let type: JSX.Element; - const typeName = property.type["name"]; - - if (property.type.displayAs === TPropertyDisplayAs.combination) { - let children = [
{property.type["combinationType"]}:
]; - - property.type["combination"].map(combinationProperty => { - const combinationName = combinationProperty["name"]; - - if (combinationProperty["displayAs"] === TPropertyDisplayAs.reference) { - children.push( - - ); - } else { - children.push(
{combinationName}
); - } - }); - - type = <>{children}; - } else if (property.type.displayAs === TPropertyDisplayAs.reference || property.type.displayAs === TPropertyDisplayAs.arrayOfReference) { - type = {typeName + (property.type.displayAs === TPropertyDisplayAs.arrayOfReference ? "[]" : "")}; + { + let type: JSX.Element; + const typeName = property.type["name"]; + + if (property.type.displayAs === TPropertyDisplayAs.combination) { + let children = [
{property.type["combinationType"]}:
]; + + property.type["combination"].map(combinationProperty => { + const combinationName = combinationProperty["name"]; + + if (combinationProperty["displayAs"] === TPropertyDisplayAs.reference) { + children.push( + + ); } else { - type = {typeName + (property.type.displayAs === TPropertyDisplayAs.arrayOfPrimitive ? "[]" : "")}; + children.push(
{combinationName}
); + } + }); + + type = <>{children}; + } else if (property.type.displayAs === TPropertyDisplayAs.reference || property.type.displayAs === TPropertyDisplayAs.arrayOfReference) { + type = {typeName + (property.type.displayAs === TPropertyDisplayAs.arrayOfReference ? "[]" : "")}; + } else { + type = {typeName + (property.type.displayAs === TPropertyDisplayAs.arrayOfPrimitive ? "[]" : "")}; + } + + return ( + + {property.name} + + {definition.readOnly && {property.readOnly}} + +
+ +
+ {showExamples && + + {!!property.example && {property.example}} + } - - return ( - - {property.name} - {property.required ? "true" : "false"} - {definition.readOnly && {property.readOnly}} - {type} -
- -
- {showExamples && - - {!!property.example && {property.example}} - - } -
- ); - })} -
-
-
+ + ); + })} + /> ); } diff --git a/src/components/operations/operation-details/react/runtime/TypeDefinitionsGql.tsx b/src/components/operations/operation-details/react/runtime/TypeDefinitionsGql.tsx index d91240d49..6e51acd84 100644 --- a/src/components/operations/operation-details/react/runtime/TypeDefinitionsGql.tsx +++ b/src/components/operations/operation-details/react/runtime/TypeDefinitionsGql.tsx @@ -2,10 +2,8 @@ import * as React from "react"; import { useState } from "react"; import { GraphQLCompositeType, GraphQLEnumValue, GraphQLField, GraphQLInputType, GraphQLObjectType, GraphQLOutputType, isEnumType, isUnionType } from "graphql"; import { Stack } from "@fluentui/react"; -import { Tab, TabList, Table, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow } from "@fluentui/react-components"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; -import { CodeSnippet } from "../../../../utils/react/CodeSnippet"; +import { Tab, TabList, TableCell, TableRow } from "@fluentui/react-components"; +import { InfoTable, MarkdownRenderer, RawSchema } from "@microsoft/api-docs-ui"; import { GraphqlFieldTypes } from "../../../../../constants"; import { TSchemaView } from "./OperationRepresentation"; @@ -37,10 +35,10 @@ export const TypeDefinitionGql = ({ {schemaView === TSchemaView.schema - ? : (
- +
) -const GQLTypeDefinitionForRepresentation = ({ graph, getGraphType }: GQLTypeDefinitionProps) => ( - <> -
{graph.name}
- {graph.description && } - - - - - {isEnumType(graph) - ? Value - : isUnionType(graph) - ? Possible types - : <> - Fields - Type - - } - Description - - - - {isEnumType(graph) - ? graph[GraphqlFieldTypes.values].map((value: GraphQLEnumValue) => ( - - {value.name} - {renderDescription(value.description)} +const GQLTypeDefinitionForRepresentation = ({ graph, getGraphType }: GQLTypeDefinitionProps) => { + const columnLabels = isEnumType(graph) ? ["Value", "Description"] : isUnionType(graph) ? ["Possible types", "Description"] : ["Fields", "Type", "Description"]; + return ( + <> +
{graph.name}
+ {graph.description && } + ( + + {value.name} + {renderDescription(value.description)} + + )) + : isUnionType(graph) + ? graph[GraphqlFieldTypes.types].map((type: GraphQLObjectType) => ( + + {getGraphType(type)} + {renderDescription(type.description)} + + )) + : Object.values(graph[GraphqlFieldTypes.fields]).map((field: GraphQLField) => ( + + {field.name} + {getGraphType(field.type)} + {renderDescription(field.description)} - )) - : isUnionType(graph) - ? graph[GraphqlFieldTypes.types].map((type: GraphQLObjectType) => ( - - {getGraphType(type)} - {renderDescription(type.description)} - - )) - : Object.values(graph[GraphqlFieldTypes.fields]).map((field: GraphQLField) => ( - - {field.name} - {getGraphType(field.type)} - {renderDescription(field.description)} - - )) - } -
-
-
- -); + ))} + /> + + ); +} diff --git a/src/components/operations/operation-details/react/runtime/operation-console/ConsoleRequestResponse.tsx b/src/components/operations/operation-details/react/runtime/operation-console/ConsoleRequestResponse.tsx index be6d6576f..0374404f7 100644 --- a/src/components/operations/operation-details/react/runtime/operation-console/ConsoleRequestResponse.tsx +++ b/src/components/operations/operation-details/react/runtime/operation-console/ConsoleRequestResponse.tsx @@ -3,8 +3,6 @@ import * as ko from "knockout"; import { useEffect, useState } from "react"; import { saveAs } from "file-saver"; import { getExtension } from "mime"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { a11yLight } from "react-syntax-highlighter/dist/esm/styles/hljs"; import { HttpClient, HttpHeader, HttpMethod, HttpRequest } from "@paperbits/common/http"; import { Stack } from "@fluentui/react"; import { @@ -16,16 +14,11 @@ import { Option, Radio, RadioGroup, - Table, - TableBody, - TableCell, - TableHeader, - TableHeaderCell, - TableRow, Textarea, Tooltip } from "@fluentui/react-components"; -import { ArrowDownFilled, ArrowUpFilled, ChevronUp20Regular, Copy16Regular, EyeOffRegular, EyeRegular } from "@fluentui/react-icons"; +import { ChevronUp20Regular, Copy16Regular } from "@fluentui/react-icons"; +import { MarkdownRenderer, SyntaxHighlighter } from "@microsoft/api-docs-ui"; import { Api } from "../../../../../../models/api"; import { KnownMimeTypes } from "../../../../../../models/knownMimeTypes"; import { KnownHttpHeaders } from "../../../../../../models/knownHttpHeaders"; @@ -36,13 +29,12 @@ import { RequestError } from "../../../../../../errors/requestError"; import { HttpResponse } from "../../../../../../contracts/httpResponse"; import { TemplatingService } from "../../../../../../services/templatingService"; import { Utils } from "../../../../../../utils"; -import { MarkdownProcessor } from "../../../../../utils/react/MarkdownProcessor"; -import { ScrollableTableContainer } from "../../../../../utils/react/ScrollableTableContainer"; import { RequestBodyType, TypeOfApi, downloadableTypes } from "../../../../../../constants"; import { LogItem, WebsocketClient } from "./ws-utilities/websocketClient"; import { templates } from "./templates/templates"; import { BinaryField } from "./BinaryField"; import { RevealSecretButton } from "./consoleUtils"; +import { ConsoleWsLogItems } from "./ConsoleWsLogItems"; type ConsoleRequestResponseProps = { api: Api; @@ -465,7 +457,7 @@ ${responseBodyFormatted}`; setIsSecretsRevealed(!isSecretsRevealed)} > - + {api.type === TypeOfApi.webSocket && <> {isWsConnected && @@ -511,30 +503,7 @@ ${responseBodyFormatted}`; Output {wsLogItems.length === 0 ? Sent and received messages will appear here. Send a payload to begin. - : - - - - Time - - Data - - - - {wsLogItems.map((item, index) => ( - - {item.logTime} - { - item.logType === "SendData" - ? - : item.logType === "GetData" && - } - {item.logData} - - ))} - -
-
+ : }
diff --git a/src/components/operations/operation-details/react/runtime/operation-console/ConsoleWsLogItems.tsx b/src/components/operations/operation-details/react/runtime/operation-console/ConsoleWsLogItems.tsx index c025a9088..9e08e83bd 100644 --- a/src/components/operations/operation-details/react/runtime/operation-console/ConsoleWsLogItems.tsx +++ b/src/components/operations/operation-details/react/runtime/operation-console/ConsoleWsLogItems.tsx @@ -1,54 +1,34 @@ import * as React from "react"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { a11yLight } from "react-syntax-highlighter/dist/esm/styles/hljs"; -import { - Body1, - Body1Strong, - Table, - TableBody, - TableCell, - TableHeader, - TableHeaderCell, - TableRow, -} from "@fluentui/react-components"; +import { Body1, TableCell, TableRow } from "@fluentui/react-components"; import { ArrowDownFilled, ArrowUpFilled } from "@fluentui/react-icons"; -import { ScrollableTableContainer } from "../../../../../utils/react/ScrollableTableContainer"; +import { InfoTable, SyntaxHighlighter } from "@microsoft/api-docs-ui"; import { LogItem } from "./ws-utilities/websocketClient"; export const ConsoleWsLogItems = ({ wsLogItems }: { wsLogItems: LogItem[] }) => ( <> {wsLogItems.length === 0 ? Sent and received messages will appear here. Send a payload to begin. - : - - - - Time - - Data - - - - {wsLogItems.map((item, index) => ( - - {item.logTime} - { - item.logType === "SendData" - ? - : item.logType === "GetData" && - } - { - item.logType === "SendData" || item.logType === "GetData" - ? - {item.logData} - - : item.logData - } - - ))} - -
-
+ : ( + + {item.logTime} + { + item.logType === "SendData" + ? + : item.logType === "GetData" && + } + { + item.logType === "SendData" || item.logType === "GetData" + ? + : item.logData + } + + ))} + /> } ); \ No newline at end of file diff --git a/src/components/operations/operation-details/react/runtime/utils.tsx b/src/components/operations/operation-details/react/runtime/utils.tsx index a59045bed..075aafacb 100644 --- a/src/components/operations/operation-details/react/runtime/utils.tsx +++ b/src/components/operations/operation-details/react/runtime/utils.tsx @@ -1,11 +1,9 @@ import * as React from "react"; -import { Table, TableBody, TableCell, TableHeader, TableHeaderCell, TableRow } from "@fluentui/react-components"; +import { ParametersTable } from "@microsoft/api-docs-ui"; import { Api } from "../../../../../models/api"; import { Operation } from "../../../../../models/operation"; import { TypeOfApi } from "../../../../../constants"; import { Utils } from "../../../../../utils"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; export const scrollToOperation = (): void => { const headerElement = document.getElementById("operation"); @@ -40,60 +38,16 @@ export const getRequestUrl = (api: Api, operation: Operation, hostname: string): return requestUrl; } -const displayExamples = (examples, isHeaders: boolean): JSX.Element => { - if (examples.length === 0) return ; - - if (isHeaders) { - return ( -
- {examples.map((example, index) => ( - - {example.title}:{example.value} -
{example.description}
-
- ))} -
- ) - } +export const OperationDetailsTable = ({tableName, tableContent, showExamples, showIn}) => { + const hiddenColumns: string[] = ["readOnly"]; + !showIn && hiddenColumns.push("in"); + !showExamples && hiddenColumns.push("examples"); return ( -
- {examples.map((example, index) => ( - - {example.title !== "default" && {example.title}:} - {example.value} -
{example.description}
-
- ))} -
- ) -} - -export const OperationDetailsTable = ({tableName, tableContent, showExamples, showIn, isHeaders = false}) => ( - - - - - Name - {showIn && In} - Required - Type - Description - {showExamples && Example}{/** TODO */} - - - - {tableContent.map(parameter => ( - - {parameter.name} - {showIn && {parameter.in}} - {parameter.required ? "true" : "false"} - {parameter.type} -
- {showExamples && {parameter.examples && displayExamples(parameter.examples, isHeaders)}} -
- ))} -
-
-
-) \ No newline at end of file + + ); +} \ No newline at end of file diff --git a/src/components/operations/operation-list/react/runtime/OperationList.tsx b/src/components/operations/operation-list/react/runtime/OperationList.tsx index c0c2202e9..93e0eba67 100644 --- a/src/components/operations/operation-list/react/runtime/OperationList.tsx +++ b/src/components/operations/operation-list/react/runtime/OperationList.tsx @@ -3,10 +3,6 @@ import { useEffect, useState } from "react"; import { Router } from "@paperbits/common/routing"; import { Stack } from "@fluentui/react"; import { - Accordion, - AccordionHeader, - AccordionItem, - AccordionPanel, Button, Menu, MenuButton, @@ -16,10 +12,10 @@ import { MenuList, MenuPopover, MenuTrigger, - SearchBox, Spinner } from "@fluentui/react-components"; import { ChevronUpRegular, FilterRegular, MoreHorizontalRegular, SearchRegular } from "@fluentui/react-icons"; +import { ApiOperationsList } from "@microsoft/api-docs-ui"; import { defaultPageSize } from "../../../../../constants"; import { SearchQuery } from "../../../../../contracts/searchQuery"; import { Tag } from "../../../../../models/tag"; @@ -190,36 +186,6 @@ export const OperationList = ({ router.navigateTo(operationUrl); } - const renderOperation = (operation: Operation): JSX.Element => ( - selectOperation(operation)} - onKeyDown={e => e.key === "Enter" && selectOperation(operation)} - tabIndex={0} - > - {operation.name === selectedOperationName - ? <> - - {operation.method} - - - {showUrlPath ? operation.urlTemplate : operation.displayName} - - - : <> - - {operation.method} - - - {showUrlPath ? operation.urlTemplate : operation.displayName} - - - } - - ) - return (
@@ -329,37 +295,14 @@ export const OperationList = ({ {working ? : <> - {groupByTag - ? <> - {(!operationsByTags || operationsByTags.length === 0) - ? No operations found. - : - {operationsByTags.map((tag, index) => ( - - {tag.tag} - - {tag.items.map(operation => - renderOperation(operation) - )} - - - ))} - - } - - : <> - {(!operations || operations.length <= 0) - ? No operations found. - : operations.map(operation => - renderOperation(operation) - ) - } - - } + {hasNextPage && setPageNumber(prev => prev + 1)}>Show more} } diff --git a/src/components/products/product-details/react/runtime/ProductDetailsRuntime.tsx b/src/components/products/product-details/react/runtime/ProductDetailsRuntime.tsx index 451ea2c0e..df7a295ff 100644 --- a/src/components/products/product-details/react/runtime/ProductDetailsRuntime.tsx +++ b/src/components/products/product-details/react/runtime/ProductDetailsRuntime.tsx @@ -1,16 +1,16 @@ import * as React from "react"; import { useEffect, useState } from "react"; +import { Resolve } from "@paperbits/react/decorators"; +import { Router } from "@paperbits/common/routing"; import { Stack } from "@fluentui/react"; import { FluentProvider, Spinner } from "@fluentui/react-components"; import { CircleSmallFilled } from "@fluentui/react-icons"; -import { Resolve } from "@paperbits/react/decorators"; -import { Router } from "@paperbits/common/routing"; +import { MarkdownRenderer } from "@microsoft/api-docs-ui"; import { Product } from "../../../../../models/product"; import { ProductService } from "../../../../../services/productService"; import { UsersService } from "../../../../../services/usersService"; import { ProductState } from "../../../../../contracts/product"; import { RouteHelper } from "../../../../../routing/routeHelper"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; import { fuiTheme } from "../../../../../constants"; type ProductSubscribeRuntimeProps = {} @@ -71,7 +71,7 @@ const ProductDetailsRuntimeFC = ({ usersService, productService, productName }: Product {!!product.state && <> {productStateToLabel(product.state)}} {product.description && - + } ); diff --git a/src/components/products/product-list/react/runtime/ProductsCards.tsx b/src/components/products/product-list/react/runtime/ProductsCards.tsx index 571e9d823..6e61113c2 100644 --- a/src/components/products/product-list/react/runtime/ProductsCards.tsx +++ b/src/components/products/product-list/react/runtime/ProductsCards.tsx @@ -1,8 +1,8 @@ import * as React from "react"; import { Stack } from "@fluentui/react"; +import { MarkdownRenderer } from "@microsoft/api-docs-ui"; import { Product } from "../../../../../models/product"; import { markdownMaxCharsMap } from "../../../../../constants"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; type Props = { getReferenceUrl: (productName: string) => string; @@ -14,7 +14,7 @@ const ProductCard = ({ product, getReferenceUrl }: Props & { product: Product })

{product.displayName}

- +
diff --git a/src/components/products/product-list/react/runtime/ProductsTable.tsx b/src/components/products/product-list/react/runtime/ProductsTable.tsx index ffff7015f..a67dcb5e1 100644 --- a/src/components/products/product-list/react/runtime/ProductsTable.tsx +++ b/src/components/products/product-list/react/runtime/ProductsTable.tsx @@ -1,15 +1,7 @@ import * as React from "react"; -import { - Table, - TableBody, - TableCell, - TableHeader, - TableHeaderCell, - TableRow, -} from "@fluentui/react-components"; +import { TableCell, TableRow } from "@fluentui/react-components"; +import { InfoTable, MarkdownRenderer } from "@microsoft/api-docs-ui"; import { Product } from "../../../../../models/product"; -import { MarkdownProcessor } from "../../../../utils/react/MarkdownProcessor"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; import { NoRecordsRow } from "../../../../utils/react/NoRecordsRow"; import { markdownMaxCharsMap } from "../../../../../constants"; @@ -29,7 +21,7 @@ const TableBodyProducts = ({ products, getReferenceUrl }: Props) => ( - + )) @@ -39,25 +31,14 @@ const TableBodyProducts = ({ products, getReferenceUrl }: Props) => ( ); export const ProductsTable = ({ products, getReferenceUrl }: Props) => ( - - - - - - Name - - - Description - - - - - - - -
-
+ + } + /> ); diff --git a/src/components/products/product-subscriptions/react/runtime/ProductSubscriptionsTable.tsx b/src/components/products/product-subscriptions/react/runtime/ProductSubscriptionsTable.tsx index 23e3f7478..0bd85ca57 100644 --- a/src/components/products/product-subscriptions/react/runtime/ProductSubscriptionsTable.tsx +++ b/src/components/products/product-subscriptions/react/runtime/ProductSubscriptionsTable.tsx @@ -1,15 +1,7 @@ import * as React from "react"; -import { - Spinner, - Table, - TableBody, - TableCell, - TableHeader, - TableHeaderCell, - TableRow, -} from "@fluentui/react-components"; +import { Spinner, TableCell, TableRow } from "@fluentui/react-components"; +import { InfoTable } from "@microsoft/api-docs-ui"; import { Subscription } from "../../../../../models/subscription"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; export const ProductSubscriptionsTable = ({ subscriptions, @@ -27,27 +19,16 @@ export const ProductSubscriptionsTable = ({ ) : !subscriptions || subscriptions.length === 0 ? ( You don't have subscriptions yet. ) : ( - - - - - - Name - - - Status - + ( + + {sub.name} + {sub.state} - - - - {subscriptions?.map((sub) => ( - - {sub.name} - {sub.state} - - ))} - -
-
+ )) + } + /> ); diff --git a/src/components/users/profile/react/runtime/ProfileTable.tsx b/src/components/users/profile/react/runtime/ProfileTable.tsx index ac89cb2bf..efa27c6bf 100644 --- a/src/components/users/profile/react/runtime/ProfileTable.tsx +++ b/src/components/users/profile/react/runtime/ProfileTable.tsx @@ -8,11 +8,7 @@ import { MenuList, MenuPopover, MenuTrigger, - Table, - TableBody, TableCell, - TableHeader, - TableHeaderCell, TableRow, } from "@fluentui/react-components"; import { @@ -21,11 +17,11 @@ import { MoreHorizontalRegular, SettingsRegular, } from "@fluentui/react-icons"; +import { InfoTable } from "@microsoft/api-docs-ui"; import { User } from "../../../../../models/user"; import { formatDate } from "../../../../utils"; import { BtnSpinner } from "../../../../utils/react/BtnSpinner"; import { ValueOrField } from "../../../../utils/react/ValueOrField"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; export const ProfileTable = ({ user, save, changePassword, deleteAccount, delegationEdit }: { user: User @@ -46,115 +42,87 @@ export const ProfileTable = ({ user, save, changePassword, deleteAccount, delega } return ( - - - - - - Email - + + {user.email} + + + {user.firstName} + + + + + {user.lastName} + + + + {formatDate(user.registrationDate)} + + + {isEdit ? ( + + save(firstName, lastName).then(() => setIsEdit(false))} + > + Save + + + + ) : ( + + + - - ) : ( - - - - )} - - - -
-
+ + + } + > + Edit + + } + > + Change password + + } + style={{ color: "red" }} + > + Delete account + + + + + )} + + + } + /> ); }; diff --git a/src/components/users/subscriptions/react/runtime/SubscriptionsTable.tsx b/src/components/users/subscriptions/react/runtime/SubscriptionsTable.tsx index 14163f245..88c045957 100644 --- a/src/components/users/subscriptions/react/runtime/SubscriptionsTable.tsx +++ b/src/components/users/subscriptions/react/runtime/SubscriptionsTable.tsx @@ -6,14 +6,10 @@ import { MenuItem, MenuList, MenuPopover, - MenuTrigger, Spinner, - Table, - TableBody, + MenuTrigger, + Spinner, TableCell, TableCellActions, - TableCellLayout, - TableHeader, - TableHeaderCell, TableRow, } from "@fluentui/react-components"; import { @@ -23,11 +19,10 @@ import { MoreHorizontalRegular, ProhibitedFilled, } from "@fluentui/react-icons"; +import { InfoTable } from "@microsoft/api-docs-ui"; import { Subscription } from "../../../../../models/subscription"; import { formatDate } from "../../../../utils"; import { ValueOrFieldWBtn } from "../../../../utils/react/ValueOrField"; -import { NoRecordsRow } from "../../../../utils/react/NoRecordsRow"; -import { ScrollableTableContainer } from "../../../../utils/react/ScrollableTableContainer"; const hiddenKey = "XXXXXXXXXXXXXXXXXXXXXXXXXX"; @@ -185,61 +180,23 @@ const SubscriptionRow = ({ sub, saveName, cancelSubscription, regeneratePKey, re export const SubscriptionsTable = ({ subscriptions, saveName, cancelSubscription, regeneratePKey, regenerateSKey }: TPropsCommon & { subscriptions: Subscription[] }) => { return ( - - - - - - Name - - - - Product - - - - State - - - - Primary key - - - - Secondary key - - - - Date created - - - - - - - - - - {subscriptions.length > 0 - ? subscriptions.map((sub) => ( - - )) - : - } - -
-
+ 0 && + subscriptions.map((sub) => ( + + )) + } + noDataMessage="No subscriptions to display" + className={"profile-subscriptions-table"} + /> ); }; diff --git a/src/components/utils/react/CodeSnippet.tsx b/src/components/utils/react/CodeSnippet.tsx deleted file mode 100644 index 8eb05617e..000000000 --- a/src/components/utils/react/CodeSnippet.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import * as React from "react"; -import { useState } from "react"; -import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; -import { a11yLight } from "react-syntax-highlighter/dist/esm/styles/hljs"; -import { Stack } from "@fluentui/react"; -import { Body1, Body1Strong, Button, Tooltip } from "@fluentui/react-components"; -import { Copy16Regular } from "@fluentui/react-icons"; -import { RepresentationExample } from "../../../models/representationExample"; -import { MarkdownProcessor } from "./MarkdownProcessor"; - -type TCodeSnippetProps = { - example?: RepresentationExample; - name?: string; - content?: string; - format?: string; -} - -export const CodeSnippet = ({ example, name, content, format }: TCodeSnippetProps) => { - const [isCopied, setIsCopied] = useState(false); - const code = example?.value || content; - const language = example?.format || format || "json"; - const title = (example?.title || name || "Sample value") + ` (${language})`; - - return ( -
-
- - {title} - -
-
-
- -
-
-
- ) -} \ No newline at end of file diff --git a/src/components/utils/react/MarkdownProcessor.tsx b/src/components/utils/react/MarkdownProcessor.tsx deleted file mode 100644 index 562cb602f..000000000 --- a/src/components/utils/react/MarkdownProcessor.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as React from "react"; -import remarkGfm from "remark-gfm"; -import rehypeRaw from "rehype-raw"; -import rehypeTruncate from "rehype-truncate"; -import ReactMarkdown from "react-markdown"; // TODO: upgrade this package and all related ones when https://github.com/hashicorp/next-mdx-remote/issues/403 fixed - -type TMarkdownProcessorProps = { - markdownToDisplay: string; - maxChars?: number; - truncate?: boolean; -} - -export const MarkdownProcessor = ({ markdownToDisplay, maxChars, truncate = false }: TMarkdownProcessorProps) => ( - - {markdownToDisplay} - -); diff --git a/src/themes/website/styles/widgets/fui/apis-products-lists.scss b/src/themes/website/styles/widgets/fui/apis-products-lists.scss index 3a090660b..f290219a8 100644 --- a/src/themes/website/styles/widgets/fui/apis-products-lists.scss +++ b/src/themes/website/styles/widgets/fui/apis-products-lists.scss @@ -17,7 +17,6 @@ .fui-list-cards-container { display: grid; - width: 1100px; /* TODO */ grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; diff --git a/src/themes/website/styles/widgets/fui/fluentui.scss b/src/themes/website/styles/widgets/fui/fluentui.scss index 801569a43..0a16c0c00 100644 --- a/src/themes/website/styles/widgets/fui/fluentui.scss +++ b/src/themes/website/styles/widgets/fui/fluentui.scss @@ -71,6 +71,11 @@ width: 100%; } +fui-subscriptions-runtime .profile-subscriptions-table { + table-layout: auto; + width: 100%; +} + fui-api-list-runtime, // TMP solution while KO is not fully migrated to React/FUI fui-product-list-runtime, fui-product-apis-runtime, diff --git a/src/themes/website/styles/widgets/fui/operation-details.scss b/src/themes/website/styles/widgets/fui/operation-details.scss index 68c54aef6..e0c06b612 100644 --- a/src/themes/website/styles/widgets/fui/operation-details.scss +++ b/src/themes/website/styles/widgets/fui/operation-details.scss @@ -10,6 +10,16 @@ fui-operation-details { .operation-details-content { max-width: 800px; + + .ws-info-panel { + > div { + padding: 0; + } + + .operation-table-body-row { + padding: 1rem; + } + } } .operation-description { @@ -21,7 +31,7 @@ fui-operation-details { } .operation-tags { - padding-top: 1rem; + padding: 1rem 0; > * { margin-right: .5rem; @@ -119,8 +129,7 @@ fui-operation-details { } } -.operation-table-body-row { - padding: 1rem; +.operation-table-body-row { display: flex; align-items: center; diff --git a/src/themes/website/styles/widgets/widgets.scss b/src/themes/website/styles/widgets/widgets.scss index 301ff28b5..0ce1c499a 100644 --- a/src/themes/website/styles/widgets/widgets.scss +++ b/src/themes/website/styles/widgets/widgets.scss @@ -18,3 +18,5 @@ @import "fui/operation-details.scss"; @import "fui/apis-products-lists.scss"; @import "fui/reports.scss"; + +@import '@microsoft/api-docs-ui/dist/index.css'; \ No newline at end of file