2222 height : 100vh ;
2323 overflow : hidden;
2424 }
25+
2526 # voyager {
2627 height : 100% ;
2728 position : relative;
2829 }
30+
31+ /* START: GraphQL Java Kickstart Enhancements to support Authorization tokens */
32+ # voyager {
33+ height : 90vh ;
34+ }
35+
36+ .authorization {
37+ width : 319px ;
38+ min-width : 319px ;
39+ border-right : 1px solid rgba (0 , 0 , 0 , .1 );
40+ }
41+
42+ .authorization > .contents {
43+ padding-left : 15px ;
44+ }
45+
46+ .contents > .header {
47+ font : 14px 'helvetica neue' , helvetica, arial, sans-serif;
48+ font-weight : bold;
49+ color : # 666 ;
50+ }
51+ /* END: GraphQL Java Kickstart Enhancements to support Authorization tokens */
2952 </ style >
3053 </ head >
3154 < body >
55+ <!-- START: GraphQL Java Kickstart Enhancements -->
56+
57+ < div class ="authorization ">
58+ < div class ="contents ">
59+ < div class ="header "> Authorization (Access Token)</ div >
60+ < div > < input id ="access-token " style ="width: 90%; padding: 6px 0 7px " /> </ div >
61+ < div > < button id ="load-token " onclick ="loadVoyager() "> Load!</ button > < button id ="reset-token " style ="display: none " onclick ="resetVoyager() "> Reset</ button > </ div >
62+ </ div >
63+ </ div >
64+
65+ <!-- END: GraphQL Java Kickstart Enhancements -->
3266 < div id ="voyager ">
3367 < div class ="graphql-voyager ">
3468 < div class ="doc-panel ">
@@ -54,7 +88,13 @@ <h1> Transmitting... </h1>
5488 method : 'post' ,
5589 headers : {
5690 'Accept' : 'application/json' ,
57- 'Content-Type' : 'application/json'
91+ 'Content-Type' : 'application/json' ,
92+
93+ /* START: GraphQL Java Kickstart Enhancements */
94+
95+ 'Authorization' : 'Bearer ' + authorizationToken
96+
97+ /* END: GraphQL Java Kickstart Enhancements */
5898 } ,
5999 body : JSON . stringify ( { query : introspectionQuery } ) ,
60100 credentials : 'include'
@@ -70,12 +110,38 @@ <h1> Transmitting... </h1>
70110 }
71111
72112 // Render <Voyager /> into the body.
73- GraphQLVoyager . init ( document . getElementById ( 'voyager' ) , {
74- introspection : introspectionProvider ,
75- displayOptions : {
76- sortByAlphabet : true ,
77- }
78- } )
113+ < ! -- GraphQLVoyager . init ( document . getElementById ( 'voyager' ) , { -->
114+ <!-- introspection: introspectionProvider,-->
115+ <!-- displayOptions: {-->
116+ <!-- sortByAlphabet: true,-->
117+ <!-- }-->
118+ <!-- })-->
119+
120+ // Render <Voyager /> into the body.
121+ function loadVoyager ( ) {
122+ document . getElementsByClassName ( "loading-box" ) [ 0 ] . style . display = "none" ;
123+
124+ GraphQLVoyager . init ( document . getElementById ( 'voyager' ) , {
125+ introspection : introspectionProvider ,
126+ displayOptions : {
127+ sortByAlphabet : true ,
128+ }
129+ } ) ;
130+
131+ document . getElementById ( "load-token" ) . style . display = "none" ;
132+ document . getElementById ( "reset-token" ) . style . display = "block" ;
133+ }
134+
135+ /* START: START: GraphQL Java Kickstart Enhancements */
136+
137+ // Reset Voyager
138+ function resetVoyager ( ) {
139+ document . getElementById ( 'access-token' ) . value = '' ;
140+
141+ location . reload ( ) ;
142+ }
143+
144+ /* END: START: GraphQL Java Kickstart Enhancements */
79145 </ script >
80146 </ body >
81147</ html >
0 commit comments