@@ -8,10 +8,17 @@ import {
88 namespacesAtom ,
99 nodeSchemasAtom ,
1010 profileSchemasAtom ,
11+ templateSchemasAtom ,
1112} from "@/entities/schema/stores/schema.atom" ;
1213import { schemaKindLabelState } from "@/entities/schema/stores/schemaKindLabel.atom" ;
1314import { schemaKindNameState } from "@/entities/schema/stores/schemaKindName.atom" ;
14- import { GenericSchema , Namespace , NodeSchema , ProfileSchema } from "@/entities/schema/types" ;
15+ import {
16+ GenericSchema ,
17+ Namespace ,
18+ NodeSchema ,
19+ ProfileSchema ,
20+ TemplateSchema ,
21+ } from "@/entities/schema/types" ;
1522import { tokenSchema } from "@/entities/user-profile/ui/token-schema" ;
1623import { Branch } from "@/shared/api/graphql/generated/graphql" ;
1724import { fetchUrl } from "@/shared/api/rest/fetch" ;
@@ -41,6 +48,7 @@ export const withSchemaContext = (AppComponent: any) => (props: any) => {
4148 const setGenerics = useSetAtom ( genericSchemasAtom ) ;
4249 const setNamespaces = useSetAtom ( namespacesAtom ) ;
4350 const setProfiles = useSetAtom ( profileSchemasAtom ) ;
51+ const setTemplates = useSetAtom ( templateSchemasAtom ) ;
4452 const setState = useSetAtom ( stateAtom ) ;
4553 const branches = useAtomValue ( branchesState ) ;
4654 const [ branchInQueryString ] = useQueryParam ( QSP . BRANCH , StringParam ) ;
@@ -54,15 +62,17 @@ export const withSchemaContext = (AppComponent: any) => (props: any) => {
5462 main : string ;
5563 nodes : NodeSchema [ ] ;
5664 generics : GenericSchema [ ] ;
57- namespaces : Namespace [ ] ;
5865 profiles : ProfileSchema [ ] ;
66+ templates : TemplateSchema [ ] ;
67+ namespaces : Namespace [ ] ;
5968 } = await fetchUrl ( CONFIG . SCHEMA_URL ( branch ?. name ) ) ;
6069
6170 const hash = schemaData . main ;
6271 const schema = sortByName ( [ ...schemaData . nodes , tokenSchema ] ) ;
6372 const generics = sortByName ( schemaData . generics || [ ] ) ;
64- const namespaces = sortByName ( schemaData . namespaces || [ ] ) ;
6573 const profiles = sortByName ( schemaData . profiles || [ ] ) ;
74+ const templates = sortByName ( schemaData . templates || [ ] ) ;
75+ const namespaces = sortByName ( schemaData . namespaces || [ ] ) ;
6676
6777 schema . forEach ( ( s ) => {
6878 s . attributes = sortByOrderWeight ( s . attributes || [ ] ) ;
@@ -73,12 +83,14 @@ export const withSchemaContext = (AppComponent: any) => (props: any) => {
7383 ...schema . map ( ( s ) => s . kind ) ,
7484 ...generics . map ( ( s ) => s . kind ) ,
7585 ...profiles . map ( ( s ) => s . kind ) ,
86+ ...templates . map ( ( s ) => s . kind ) ,
7687 ] ;
7788
7889 const schemaNames = [
7990 ...schema . map ( ( s ) => s . label ) ,
8091 ...generics . map ( ( s ) => s . label ) ,
8192 ...profiles . map ( ( s ) => s . label ) ,
93+ ...templates . map ( ( s ) => s . label ) ,
8294 ] ;
8395 const schemaKindNameTuples = R . zip ( schemaKinds , schemaNames ) ;
8496 const schemaKindNameMap = {
@@ -99,6 +111,7 @@ export const withSchemaContext = (AppComponent: any) => (props: any) => {
99111 setSchemaKindLabelState ( schemaKindLabelMap ) ;
100112 setNamespaces ( namespaces ) ;
101113 setProfiles ( profiles ) ;
114+ setTemplates ( templates ) ;
102115 setState ( { isReady : true } ) ;
103116 } catch ( error ) {
104117 toast (
0 commit comments