From 589427078385332f66d77605fac80ced8d0e5a78 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 10 Apr 2021 13:47:34 +0200 Subject: [PATCH] config-schema: separate loading and missing schema Signed-off-by: Patrik Oldsberg --- .../ConfigSchemaPage/ConfigSchemaPage.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/plugins/config-schema/src/components/ConfigSchemaPage/ConfigSchemaPage.tsx b/plugins/config-schema/src/components/ConfigSchemaPage/ConfigSchemaPage.tsx index 4bc7cfd98c..a2082ef972 100644 --- a/plugins/config-schema/src/components/ConfigSchemaPage/ConfigSchemaPage.tsx +++ b/plugins/config-schema/src/components/ConfigSchemaPage/ConfigSchemaPage.tsx @@ -14,23 +14,35 @@ * limitations under the License. */ import React, { useMemo } from 'react'; -import { Header, Page, Content, useApi } from '@backstage/core'; +import { Header, Page, Content, useApi, Progress } from '@backstage/core'; import { useObservable } from 'react-use'; import { configSchemaApiRef } from '../../api'; import { SchemaViewer } from '../SchemaViewer'; +import { Typography } from '@material-ui/core'; export const ConfigSchemaPage = () => { const configSchemaApi = useApi(configSchemaApiRef); - const schema = useObservable( + const schemaResult = useObservable( useMemo(() => configSchemaApi.schema$(), [configSchemaApi]), - )?.schema; + ); + + let content; + if (schemaResult) { + if (schemaResult.schema) { + content = ; + } else { + content = ( + No configuration schema available + ); + } + } else { + content = ; + } return (
- - {schema ? : 'No schema available'} - + {content} ); };