Skip to content

Commit 9b25a5e

Browse files
committed
Alpha3 Release 1.15.0
1 parent 04ca6fb commit 9b25a5e

File tree

14 files changed

+84942
-37
lines changed

14 files changed

+84942
-37
lines changed

src/.DS_Store

6 KB
Binary file not shown.

src/assets/javascripts/components/interactive.js

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ function isStoplight(value) {
148148
return value === "product_doc_stoplight_spec";
149149
}
150150

151+
function isGraphql(value){
152+
return value === "product_doc_graphql_playground";
153+
}
154+
151155
function isAsyncApi(value) {
152156
return value === "product_doc_asyncapi";
153157
}
@@ -177,14 +181,20 @@ export function HandleApiSpecSelect({
177181
let oasTemplate =
178182
selector?.options[selector.selectedIndex]?.getAttribute("data-template");
179183
let path = downloadSelector?.getAttribute("data-path");
180-
let [, ...docURL] =
184+
let [apiID, ...docURL] =
181185
selector && selector.value ? selector.value.split("-") : [];
182186
let tmplIsRedoc = isRedoc(oasTemplate);
183187
let tmplIsAsyncApi = isAsyncApi(oasTemplate);
184188
let tmplIsStoplight = isStoplight(oasTemplate);
189+
let tmplIsGraphql = isGraphql(oasTemplate);
190+
191+
185192
let url = getURLValue(docURL);
186193

187-
if (selector && isOAS(url)) {
194+
if (tmplIsGraphql){
195+
let serverEndpoint = selector?.options[selector.selectedIndex]?.getAttribute("data-graphqlendpoint")
196+
initGraphQL(apiID, serverEndpoint);
197+
}else if (selector && isOAS(url)) {
188198
if (tmplIsRedoc) {
189199
initRedoc(url);
190200
} else if (tmplIsAsyncApi) {
@@ -200,19 +210,22 @@ export function HandleApiSpecSelect({
200210
let tmplIsRedoc = isRedoc(oasTemplate);
201211
let tmplIsAsyncApi = isAsyncApi(oasTemplate);
202212
let tmplIsStoplight = isStoplight(oasTemplate);
213+
let tmplIsGraphql = isGraphql(oasTemplate);
203214

204215
let [apiID, ...docURL] = e.target.value.split("-");
205216
let url = getURLValue(docURL);
206217
downloadSelector.action = `${path}/${apiID}/docs/download`;
207-
208-
if (!isOAS(url)) return;
209-
210-
if (tmplIsRedoc) {
211-
initRedoc(url);
212-
} else if (tmplIsAsyncApi) {
213-
initAsyncApi(url);
214-
} else if (tmplIsStoplight) {
215-
initStoplight(url);
218+
if (tmplIsGraphql){
219+
let serverEndpoint = selector?.options[selector.selectedIndex]?.getAttribute("data-graphqlendpoint")
220+
initGraphQL(apiID, serverEndpoint);
221+
} else {
222+
if (tmplIsRedoc) {
223+
initRedoc(url);
224+
} else if (tmplIsAsyncApi) {
225+
initAsyncApi(url);
226+
} else if (tmplIsStoplight) {
227+
initStoplight(url);
228+
}
216229
}
217230
});
218231
}
@@ -241,6 +254,26 @@ function getOrCreateWrapper(apiDocWrapper, wrapperId) {
241254
return wrapper;
242255
}
243256

257+
function initGraphQL(apiID, _endpointUrl) {
258+
let apiDocWrapper = document.getElementById("api_doc_wrapper");
259+
260+
hideAllElements(apiDocWrapper);
261+
262+
let wrapper = getOrCreateWrapper(apiDocWrapper, "graphql-playground-wrapper");
263+
264+
// Reuse the same base path used for downloads to build the iframe src
265+
let downloadSelector = document.getElementById("display-download-button");
266+
let path = downloadSelector?.getAttribute("data-path") || "";
267+
268+
let iframe = document.createElement("iframe");
269+
iframe.setAttribute("src", `${path}/${apiID}/docs?embed=1`);
270+
iframe.setAttribute("width", "100%");
271+
iframe.setAttribute("height", "600");
272+
iframe.setAttribute("frameborder", "0");
273+
274+
handleContent(wrapper, iframe);
275+
}
276+
244277
function initRedoc(url) {
245278
let apiDocWrapper = document.getElementById("api_doc_wrapper");
246279

@@ -305,6 +338,7 @@ function initAsyncApi(url) {
305338
}
306339

307340
function initStoplight(url) {
341+
console.log("initializing spotlight")
308342
let apiDocWrapper = document.getElementById("api_doc_wrapper");
309343

310344
hideAllElements(apiDocWrapper);

src/assets/stylesheets/common/navigation.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ footer .footer-menu__link {
128128
padding: 0;
129129
right: auto;
130130
min-height: 100%;
131-
overflow-y: auto;
132131
white-space: nowrap;
133132
height: 100%;
134133
display: flex;

src/assets/stylesheets/main.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ body {
133133
min-height: 100%;
134134
display: flex;
135135
flex-direction: column;
136-
overflow: hidden;
136+
overflow-x: hidden;
137+
overflow-y: visible;
137138
}
138139

139140
/* Gradient backgrounds */

src/assets/stylesheets/pages/api-product.css

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,26 @@
128128
min-width: 274px;
129129
min-height: 166px;
130130
max-width: 274px;
131-
max-height: 166px;
131+
max-height: 200px;
132132
cursor: pointer;
133133
}
134134
.labeled-card:hover {
135135
background: var(--tdp-light-gray);
136136
border: 1px solid var(--tdp-secondary);
137137
}
138138

139+
.product-api-details .pill {
140+
background-color: #fff7cc;
141+
border: none;
142+
padding: 5px 10px;
143+
color: #505071;
144+
margin-bottom: 10px;
145+
}
146+
147+
.badge-yellow{
148+
background-color: #fff7cc;
149+
}
150+
139151
.labeled-card-plan {
140152
border: var(--tdp-light-border);
141153
border-radius: 10px;
@@ -389,7 +401,6 @@
389401
width: 181px;
390402
right: auto;
391403
min-height: 100%;
392-
overflow-y: auto;
393404
white-space: nowrap;
394405
height: 100%;
395406
display: flex;

src/assets/vendor/graphiql/graphiql.min.css

Lines changed: 641 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)