22
22
height : 100vh ;
23
23
overflow : hidden;
24
24
}
25
+
25
26
# voyager {
26
27
height : 100% ;
27
28
position : relative;
28
29
}
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 */
29
52
</ style >
30
53
</ head >
31
54
< 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 -->
32
66
< div id ="voyager ">
33
67
< div class ="graphql-voyager ">
34
68
< div class ="doc-panel ">
@@ -54,7 +88,13 @@ <h1> Transmitting... </h1>
54
88
method : 'post' ,
55
89
headers : {
56
90
'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 */
58
98
} ,
59
99
body : JSON . stringify ( { query : introspectionQuery } ) ,
60
100
credentials : 'include'
@@ -70,12 +110,38 @@ <h1> Transmitting... </h1>
70
110
}
71
111
72
112
// 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 */
79
145
</ script >
80
146
</ body >
81
147
</ html >
0 commit comments