@@ -2,6 +2,7 @@ import { ReactElement, ReactNode } from 'react';
22import magnifier from '../../../public/images/figures/magnifier.svg?url' ;
33import { ProjectType } from '@/gql/graphql' ;
44import { cn } from '@/lib/utils' ;
5+ import { InlineCode } from '../v2/inline-code' ;
56import { Card } from './card' ;
67import { DocsLink } from './docs-note' ;
78import { Heading } from './heading' ;
@@ -48,41 +49,58 @@ export const noSchema = (
4849 />
4950) ;
5051
51- // @todo consider monolith vs distributed etc
5252export const NoSchemaVersion = ( {
53- projectType,
53+ projectType = null ,
54+ recommendedAction = 'none' ,
5455} : {
5556 projectType : ProjectType | null ;
57+ recommendedAction : 'publish' | 'check' | 'none' ;
5658} ) : ReactElement => {
57- const isDistributed =
58- projectType === ProjectType . Federation || projectType === ProjectType . Stitching ;
59+ let children : ReactElement | null = null ;
60+ if ( recommendedAction !== 'none' ) {
61+ const isDistributed =
62+ projectType === ProjectType . Federation || projectType === ProjectType . Stitching ;
63+
64+ if ( recommendedAction === 'check' ) {
65+ children = (
66+ < >
67+ < div className = "flex w-full justify-center py-2 text-xs text-gray-500" >
68+ It's recommended to check that the schema is valid and compatible with the state of the
69+ registry before publishing.
70+ </ div >
71+ < div className = "flex w-full justify-center" >
72+ < InlineCode
73+ content = { `hive schema:check ${ isDistributed ? '--service <service-name> --url <url> ' : '' } <path/schema.graphql>` }
74+ />
75+ </ div >
76+ </ >
77+ ) ;
78+ } else if ( recommendedAction === 'publish' ) {
79+ children = (
80+ < >
81+ { isDistributed && (
82+ < div className = "flex w-full justify-center py-2 text-xs text-gray-500" >
83+ For distributed systems, it's recommended to publish the schema after the service is
84+ deployed.
85+ </ div >
86+ ) }
87+ < div className = "flex w-full justify-center" >
88+ < InlineCode
89+ content = { `hive schema:publish ${ isDistributed ? '--service <service-name> --url <url> ' : '' } <path/schema.graphql>` }
90+ />
91+ </ div >
92+ </ >
93+ ) ;
94+ }
95+ }
96+
5997 return (
6098 < EmptyList
6199 title = "Hive is waiting for your first schema"
62100 description = "You can publish a schema with Hive CLI and Hive Client"
63101 docsUrl = "/features/schema-registry#publish-a-schema"
64102 >
65- < >
66- < div className = "flex w-full justify-center py-2 text-xs text-gray-500" >
67- First check that the schema is valid and compatible with the state of the registry.
68- </ div >
69- < div className = "flex w-full justify-center" >
70- < InputCopy
71- value = { `hive schema:check ${ isDistributed ? '--service <service-name> --url <url> ' : '' } <path/schema.graphql>` }
72- alignment = "center"
73- />
74- </ div >
75- < div className = "flex w-full justify-center py-2 text-xs text-gray-500" >
76- Then publish the schema. For distributed systems, it's recommended to publish the schema
77- after the service is deployed.
78- </ div >
79- < div className = "flex w-full justify-center" >
80- < InputCopy
81- value = { `hive schema:publish ${ isDistributed ? '--service <service-name> --url <url> ' : '' } <path/schema.graphql>` }
82- alignment = "center"
83- />
84- </ div >
85- </ >
103+ { children }
86104 </ EmptyList >
87105 ) ;
88106} ;
0 commit comments