2018-09-11 14:11:24 +03:00
{% extends "basic/layout.html" %}
2018-12-16 09:41:34 +03:00
{%- if pagename == 'index' %}
{% set is_landing_page = true %}
{%- endif %}
2018-09-11 14:11:24 +03:00
{% set css_files = css_files + ['_static/hasura-custom.css', '_static/djangosite.css'] %}
2018-12-16 09:41:34 +03:00
{%- if is_landing_page %}
{% set css_files = css_files + ['_static/landing.css'] %}
{%- endif %}
2018-09-11 14:11:24 +03:00
{%- macro secondnav() %}
{%- if prev %}
« < a href = "{{ prev.link|e }}" title = "{{ prev.title|e }}" > previous< / a >
{{ reldelim2 }}
{%- endif %}
{%- if next %}
< a href = "{{ next.link|e }}" title = "{{ next.title|e }}" > next< / a > »
{%- endif %}
{%- endmacro %}
2019-12-30 12:02:06 +03:00
{% block linktags %}
{{ super() }}
2020-02-27 13:13:07 +03:00
< link rel = "canonical" href = "https://{{ BASE_DOMAIN }}/docs/1.0/{{ pagename }}{{ file_suffix }}" / >
2018-09-11 14:11:24 +03:00
{% endblock %}
{% block document %}
2018-12-16 09:41:34 +03:00
< div id = "custom-doc" class = "{% block bodyclass %}{{ 'yui-t6' if not is_landing_page else '' }}{% endblock %}" >
2018-09-11 14:11:24 +03:00
< div class = "main_container_wrapper" >
{% include 'pages/loading.html' %}
2020-05-14 09:33:50 +03:00
< div id = "banner" class = "bannerStripWrapper hideClass" >
< div class = 'bannerInnerWrapper displayFlex' >
< a
href="https://hasura.io/events/hasura-con-2020/"
target="_blank"
rel="noreferrer noopener"
>
< div class = "bannerStrip" >
< div class = "displayFlex noPadd" >
< div class = "announceIcon" >
< img src = "{{ pathto('_images/layout/hasura-con.svg', 1) }}" alt = "Hasura Con20" / >
< / div >
< div class = "bodyTextSmall" >
< span class = "textColor" >
2020-05-22 12:55:17 +03:00
Register for Hasura Con: A free, online conference on pushing the boundaries of GraphQL
2020-05-14 09:33:50 +03:00
< / span >
< / div >
< / div >
< / div >
< / a >
< div id = "banner-close" class = "closeBanner" >
< img src = "{{ pathto('_images/layout/close.svg', 1) }}" alt = "Close" / >
< / div >
< / div >
< div class = 'bannerStripImg' >
< img src = "{{ pathto('_images/layout/stripe.png', 1) }}" alt = 'stripe' / >
< / div >
< / div >
2020-06-06 13:12:14 +03:00
< header
id="header"
class='blueBgColor boderBottom'
>
2020-06-08 11:49:19 +03:00
< div class = "navContainerWrapper noPadd" >
2020-06-06 13:12:14 +03:00
< div class = "headerWrapper" >
< div class = "navLeft" >
< div class = "brand" >
< a href = "https://hasura.io/" >
< img src = "{{ pathto('_images/layout/white-logo.svg', 1) }}" alt = "Logo" / >
< / a >
< / div >
< a href = "https://discordapp.com/invite/hasura" target = "_blank" rel = "noopener noreferrer" >
< div class = "discordBtn" >
< img src = "{{ pathto('_images/layout/discord-brands-block.svg', 1) }}" alt = "Discord" / >
< / div >
< / a >
< a href = "https://twitter.com/hasurahq" target = "_blank" rel = "noopener noreferrer" >
< div class = "twitterBtn" >
< img src = "{{ pathto('_images/layout/twitter-brands-block.svg', 1) }}" alt = "Twitter" / >
< / div >
< / a >
< / div >
< div class = "navBlueBG" >
< ul class = "navBarUL" >
< li class = 'navListActive' >
< span class = "versionTxt" >
< select value = "{{ version }}" onchange = "location = this.value;" class = "selected" aria-label = "Select Version" >
{%- if version == '1.0' %}
< option class = "option_val" value = "https://{{ BASE_DOMAIN }}/docs/1.0/graphql/manual/index.html" selected = "selected" > v1.x< / option >
{%- else -%}
< option class = "option_val" value = "https://{{ BASE_DOMAIN }}/docs/1.0/graphql/manual/index.html" > v1.x< / option >
{% endif %}
< / select >
< / span >
< a href = "/" > Docs< / a >
< / li >
< li >
< a href = 'https://hasura.io/blog/' >
Blog
< / a >
< / li >
< li >
< a href = "https://hasura.io/learn/" >
Tutorials
< / a >
< / li >
< li >
< a href = "https://hasura.io/enterprise/" >
Enterprise
< / a >
< / li >
< li >
< a href = "https://hasura.io/hasura-pro/" >
Hasura Pro
< / a >
< / li >
< li >
< a href = "https://hasura.io/pricing/" >
Pricing
< / a >
< / li >
< li >
< a href = 'https://hasura.io/docs/1.0/graphql/manual/getting-started/index.html' >
< button class = "commonBtn navBtnHome" >
Get Started
< / button >
< / a >
< / li >
< li >
< a
href='https://calendly.com/hasura/prod-expert-call'
>
< button class = "commonBtn navBtnContactHome" >
Talk to a Product Expert
< / button >
< / a >
< / li >
< / ul >
< / div >
< div class = 'navBlueBG' >
< span class = "navBarToggle"
onclick="openMenu()"
>
< span class = "iconBar" > < / span >
< span class = "iconBar" > < / span >
< span class = "iconBar" > < / span >
< / span >
< / div >
< div id = "navbar" class = "topnav" >
< div class = "visibleMobile" >
< ul class = "navBarULMobile" >
< li >
< a href = '/'
onclick="openMenu()"
>Docs< / a >
< span class = "versionTxt" >
< select value = "{{ version }}" onchange = "location = this.value;" class = "selected" aria-label = "Select Version" >
{%- if version == '1.0' %}
< option class = "option_val" value = "https://{{ BASE_DOMAIN }}/docs/1.0/graphql/manual/index.html" selected = "selected" > v1.x< / option >
{%- else -%}
< option class = "option_val" value = "https://{{ BASE_DOMAIN }}/docs/1.0/graphql/manual/index.html" > v1.x< / option >
{% endif %}
< / select >
< / span >
< / li >
< li >
< a href = 'https://hasura.io/blog/'
onclick="openMenu()"
>
Blog
< / a >
< / li >
< li >
< a href = 'https://hasura.io/learn/'
onclick="openMenu()"
>
Tutorials
< / a >
< / li >
< li >
< a href = "https://hasura.io/enterprise/"
onclick="openMenu()"
>
Enterprise
< / a >
< / li >
< li >
< a href = "https://hasura.io/hasura-pro/"
onclick="openMenu()"
>
Hasura Pro
< / a >
< / li >
< li >
< a href = "https://hasura.io/pricing/"
onclick="openMenu()"
>
Pricing
< / a >
< / li >
< li >
< a href = 'https://hasura.io/docs/1.0/graphql/manual/getting-started/index.html'
onclick="openMenu()"
>
< button class = 'commonBtn navBtnHome' >
Get Started
< / button >
< / a >
< / li >
< li >
< a href = "https://calendly.com/hasura/prod-expert-call"
onclick="openMenu()"
>
< button class = "commonBtn navBtnContactHome" >
Talk to a Product Expert
< / button >
< / a >
< / li >
< / ul >
< / div >
< / div >
< / div >
< / div >
< / header >
2018-09-11 14:11:24 +03:00
< div id = "" class = "content_wrapper" >
2018-12-16 09:41:34 +03:00
{%- if is_landing_page %}
2018-09-11 14:11:24 +03:00
{% include 'pages/landing.html' %}
{%- else %}
{% set rootpage = 'common' %}
{% set pagenameSplit = pagename.split('/') %}
2018-12-16 09:41:34 +03:00
2018-09-11 14:11:24 +03:00
{% block sidebarwrapper %}
< div class = "yui-b mobile-hide" id = "sidebar" >
2020-06-06 13:12:14 +03:00
< div id = 'sidebar-close' class = 'mobile-only closeIcon' >
< img src = "{{ pathto('_images/layout/close-icon.svg', 1) }}" alt = "Close" / >
< / div >
2018-09-11 14:11:24 +03:00
{{ sidebar() }}
< / div >
{% endblock %}
2018-12-16 09:41:34 +03:00
2018-09-11 14:11:24 +03:00
< div class = "content_inner_wrapper" >
< div role = "main" parent = {{ rootpage } } >
2018-12-16 09:41:34 +03:00
2018-12-15 08:07:47 +03:00
< div id = "docs-header" >
2020-06-06 13:12:14 +03:00
<!--
2018-12-15 08:07:47 +03:00
< div class = "mobile-only" id = "mobile-logo" >
2019-12-30 12:02:06 +03:00
< a href = "https://{{ BASE_DOMAIN }}/" target = "_blank" rel = "noopener" >
2018-09-11 14:11:24 +03:00
< div class = "img_wrapper inline-block" >
2019-12-30 12:02:06 +03:00
< img class = "responsive logo_img no-shadow" src = "{{ pathto('_images/layout/logo-dark.svg', 1) }}" alt = "Hasura Logo Dark" / >
2018-09-11 14:11:24 +03:00
< / div >
< / a >
2020-02-27 13:13:07 +03:00
< a href = "https://{{ BASE_DOMAIN }}/docs" class = "docs_label mobile-logo-docs" > DOCS v{{version}}< / a >
2018-09-11 14:11:24 +03:00
< / div >
2020-06-06 13:12:14 +03:00
-->
2018-12-15 08:07:47 +03:00
< div id = "docs-header-actions" >
< div class = "inline-block" id = "input_search_box" >
2018-09-11 14:11:24 +03:00
< span class = "fa fa-search search_icon" > < / span >
2019-01-08 20:09:05 +03:00
< input type = "text" id = "search_element" placeholder = "Search docs..." / >
2018-09-11 14:11:24 +03:00
< / div >
2020-06-06 13:12:14 +03:00
< div class = "inline-block mobile-only" id = "nav_tree_icon" >
< div class = "docs-menu" >
DOCS MENU >
< / div >
< / div >
<!--
2018-12-15 08:07:47 +03:00
< div class = "inline-block header_links" >
2018-09-26 17:12:55 +03:00
< div class = "social_icons_wrapper" >
2019-12-15 16:02:59 +03:00
< div class = "social_icons" >
2020-02-27 13:13:07 +03:00
< a href = "https://hasura.io/learn/" target = "_blank" rel = "noopener" >
2019-12-15 16:02:59 +03:00
Tutorials
< / a >
< / div >
2018-09-26 17:12:55 +03:00
< div class = "social_icons" >
2019-12-30 12:02:06 +03:00
< a href = "https://twitter.com/hasurahq/" target = "_blank" rel = "noopener" >
< img class = "responsive" src = "{{ pathto('_images/layout/Twitter.svg', 1) }}" alt = "Twitter icon" / >
2018-09-26 17:12:55 +03:00
< / a >
< / div >
< div class = "social_icons tooltip" >
2019-12-30 12:02:06 +03:00
< a href = "https://discord.gg/vBPpJkS" target = "_blank" rel = "noopener" >
< img class = "responsive" src = "{{ pathto('_images/layout/Discord.svg', 1) }}" alt = "Discord icon" / >
2018-09-26 17:12:55 +03:00
< / a >
2019-12-15 16:02:59 +03:00
< span class = "tooltip_text" > Get instant support on our discord server< / span >
2018-09-26 17:12:55 +03:00
< / div >
< / div >
2018-09-11 14:11:24 +03:00
< / div >
2020-06-06 13:12:14 +03:00
-->
2018-09-11 14:11:24 +03:00
< / div >
2018-12-15 08:07:47 +03:00
< / div >
2018-12-16 09:41:34 +03:00
2018-12-15 08:07:47 +03:00
< div id = "docs-content" >
2018-09-11 14:11:24 +03:00
< div id = "{{ pagename|replace('/', '-') }}" >
{% block body %}{% endblock %}
< / div >
< / div >
2018-12-16 09:41:34 +03:00
2018-09-11 14:11:24 +03:00
< div class = "nav" > {{ secondnav() }}< / div >
2018-12-16 09:41:34 +03:00
2018-09-11 14:11:24 +03:00
< div class = "feedback_wrapper" >
< div class = "feedback" >
Was this page helpful?
<!-- inline svgs to allow color manipulation on hover -->
< div class = "display_inl actions thumb_up" >
< svg xmlns = "http://www.w3.org/2000/svg" xmlns:xlink = "http://www.w3.org/1999/xlink" version = "1.1" id = "Capa_1" x = "0px" y = "0px" width = "21px" height = "21px" viewBox = "0 0 561 561" style = "enable-background:new 0 0 561 561;" xml:space = "preserve" >
< g >
< g id = "thumb-up" >
< path d = "M0,535.5h102v-306H0V535.5z M561,255c0-28.05-22.95-51-51-51H349.35l25.5-117.3c0-2.55,0-5.1,0-7.65 c0-10.2-5.1-20.4-10.199-28.05L336.6,25.5L168.3,193.8c-10.2,7.65-15.3,20.4-15.3,35.7v255c0,28.05,22.95,51,51,51h229.5 c20.4,0,38.25-12.75,45.9-30.6l76.5-181.051c2.55-5.1,2.55-12.75,2.55-17.85v-51H561C561,257.55,561,255,561,255z" fill = "#787878" / >
< / g >
< / g >
< / svg >
< / div >
< div class = "display_inl actions thumb_down" >
2019-12-30 12:02:06 +03:00
< svg xmlns = "http://www.w3.org/2000/svg" xmlns:xlink = "http://www.w3.org/1999/xlink" version = "1.1" id = "Capa_2" x = "0px" y = "0px" width = "21px" height = "21px" viewBox = "0 0 561 561" style = "enable-background:new 0 0 561 561;" xml:space = "preserve" >
2018-09-11 14:11:24 +03:00
< g >
< g id = "thumb-down" >
< path d = "M357,25.5H127.5c-20.4,0-38.25,12.75-45.9,30.6L5.1,237.15C2.55,242.25,0,247.35,0,255v48.45l0,0V306 c0,28.05,22.95,51,51,51h160.65l-25.5,117.3c0,2.55,0,5.101,0,7.65c0,10.2,5.1,20.399,10.2,28.05l28.05,25.5l168.3-168.3 c10.2-10.2,15.3-22.95,15.3-35.7v-255C408,48.45,385.05,25.5,357,25.5z M459,25.5v306h102v-306H459z" fill = "#787878" / >
< / g >
< / g >
< / svg >
< / div >
< / div >
< div class = "detailed_feedback hide" >
< div class = "feedback_detail_msg" > < / div >
< textarea rows = "4" cols = "75" id = "feedback_box" data-id = "0" > < / textarea >
< br / >
< button class = "feedback_btn" > Submit< / button >
< / div >
< div class = "thank_you hide" >
Thank you for your feedback!
< / div >
< / div >
2018-12-16 09:41:34 +03:00
2018-09-11 14:11:24 +03:00
< div class = "footer-hasura-custom" >
2019-12-30 12:02:06 +03:00
< img class = "responsive footer_logo" src = "{{ pathto('_images/layout/hasura_logo.svg', 1) }}" alt = "Hasura Logo Dark" / >
2019-01-23 18:06:37 +03:00
< div class = "footer_text" >
2019-01-29 18:54:56 +03:00
< div > Want to contribute or report missing content?< / div >
< div >
2019-12-30 12:02:06 +03:00
< a target = "_blank" rel = "noopener" href = "https://github.com/hasura/graphql-engine/blob/master/docs/{{ pagename }}.rst" > edit this page on github< / a >
| < a target = "_blank" rel = "noopener" href = "https://github.com/hasura/graphql-engine/blob/master/CONTRIBUTING.md" > contributing guidelines< / a >
| < a target = "_blank" rel = "noopener" href = "https://github.com/hasura/graphql-engine/issues" > report an issue< / a >
2019-01-29 18:54:56 +03:00
< / div >
< br / >
< div >
2019-12-30 12:02:06 +03:00
< a target = "_blank" rel = "noopener" href = "https://github.com/hasura/graphql-engine" > Hasura GraphQL engine< / a > is open source. < a target = "_blank" rel = "noopener" href = "https://github.com/hasura/graphql-engine/blob/master/LICENSE" > See license< / a >
2019-01-29 18:54:56 +03:00
< / div >
< div >
2019-12-30 12:02:06 +03:00
Powered by < a target = "_blank" rel = "noopener" href = "http://www.sphinx-doc.org" > Sphinx< / a > .
2020-02-27 13:13:07 +03:00
| Copyright © 2020 < a target = "_blank" rel = "noopener" href = "https://hasura.io" > Hasura< / a > .
2019-01-29 18:54:56 +03:00
< / div >
2019-01-23 18:06:37 +03:00
< / div >
2018-09-11 14:11:24 +03:00
< / div >
< / div >
< / div >
< div style = "clear: both;" > < / div >
{%- endif %}
< / div >
< / div >
< / div >
{% endblock %}
{% block sidebarrel %}
{% endblock %}
{# Empty some default blocks out #}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebar1 %}{% endblock %}
{% block sidebar2 %}{% endblock %}
{% block footer %}
2019-12-17 10:04:36 +03:00
<!-- intercom -->
< script >
window.intercomSettings = {
app_id: "rucirpb3"
};
< / script >
< script > ( f u n c t i o n ( ) { v a r w = w i n d o w ; v a r i c = w . I n t e r c o m ; i f ( t y p e o f i c = = = " f u n c t i o n " ) { i c ( ' r e a t t a c h _ a c t i v a t o r ' ) ; i c ( ' u p d a t e ' , i n t e r c o m S e t t i n g s ) ; } e l s e { v a r d = d o c u m e n t ; v a r i = f u n c t i o n ( ) { i . c ( a r g u m e n t s ) } ; i . q = [ ] ; i . c = f u n c t i o n ( a r g s ) { i . q . p u s h ( a r g s ) } ; w . I n t e r c o m = i ; f u n c t i o n l ( ) { v a r s = d . c r e a t e E l e m e n t ( ' s c r i p t ' ) ; s . t y p e = ' t e x t / j a v a s c r i p t ' ; s . a s y n c = t r u e ; s . s r c = ' h t t p s : / / w i d g e t . i n t e r c o m . i o / w i d g e t / r u c i r p b 3 ' ; v a r
x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
2018-09-11 14:11:24 +03:00
< / script >
2019-01-18 12:02:56 +03:00
<!-- support button -->
< script type = "text/javascript" >
$(document).ready( function() {
const supportBtnHandler = function() {
2019-12-17 10:04:36 +03:00
if ( window.Intercom ) {
window.Intercom('show');
2019-01-18 12:02:56 +03:00
}
};
$('.supportBtn').on('click', supportBtnHandler);
});
2018-09-11 14:11:24 +03:00
< / script >
2020-05-14 09:33:50 +03:00
<!-- Local storage -->
< script type = "text/javascript" >
$(document).ready( function() {
const bannerStripeConsent = window.localStorage.getItem("hasuraCon2020BannerStripeConsent")
if (bannerStripeConsent !== "yes") {
$('#banner').removeClass("hideClass");
}
$('#banner-close').click(function(e){
window.localStorage.setItem('hasuraCon2020BannerStripeConsent', 'yes');
$('#banner').hide();
});
});
< / script >
2020-06-06 13:12:14 +03:00
<!-- Hamburger menu -->
< script type = "text/javascript" >
function openMenu() {
var x = document.getElementById("navbar")
if (x.className === "topnav") {
x.className += " responsive"
} else {
x.className = "topnav"
}
}
< / script >
2018-09-11 14:11:24 +03:00
<!-- utils -->
< script type = "text/javascript" >
// load script file
const loadScript = function(url, callback) {
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
script.onreadystatechange = callback;
script.onload = callback;
// Fire the loading
head.appendChild(script);
};
// load css file
const loadCss = function(url, callback) {
var head = document.getElementsByTagName('head')[0];
var link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.href = url;
// Then bind the event to the callback function.
// There are several events for cross browser compatibility.
link.onreadystatechange = callback;
link.onload = callback;
// Fire the loading
head.appendChild(link);
};
// make ajax call
const promise_ajax = function(url, data, type) {
return new Promise(function(resolve, reject) {
var req = new XMLHttpRequest();
req.open(type, url, true);
req.setRequestHeader("Content-type", "application/json");
req.onload = function() {
if (req.status === 200) {
resolve(req.response);
} else {
reject(req.response);
}
};
req.onerror = function() {
reject(Error("Network Error"));
};
// Make the request
req.send(JSON.stringify(data));
});
};
// Track GA event
const trackga = function ( category, action, label, value ) {
2020-05-08 10:44:20 +03:00
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'Click Events',
category: category,
action: action,
label: label,
value: value
})
2018-09-11 14:11:24 +03:00
};
< / script >
<!-- search -->
2018-12-13 14:08:45 +03:00
< script type = "text/javascript" src = "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js" > < / script >
2018-09-11 14:11:24 +03:00
< script type = "text/javascript" >
2018-12-13 14:08:45 +03:00
docsearch({
2020-02-27 13:13:07 +03:00
appId: 'WCBB1VVLRC',
apiKey: '298d448cd9d7ed93fbab395658da19e8',
indexName: 'graphql-docs-prod',
2019-01-08 20:09:05 +03:00
inputSelector: '#search_element',
2018-12-15 08:07:47 +03:00
transformData: function(suggestions) {
2020-02-27 13:13:07 +03:00
if (window.location.origin !== 'https://hasura.io') {
2018-12-15 08:07:47 +03:00
suggestions.forEach(suggestion => {
if (window.location.origin === 'http://localhost:8000') {
2020-02-27 13:13:07 +03:00
suggestion.url = suggestion.url.replace(/https:\/\/hasura.io\/docs\/[^\/]*/, window.location.origin)
2018-12-15 08:07:47 +03:00
} else {
2020-02-27 13:13:07 +03:00
suggestion.url = suggestion.url.replace('https://hasura.io\/docs', window.location.origin);
2018-12-15 08:07:47 +03:00
}
});
}
return suggestions;
},
// algoliaOptions: {
// hitsPerPage: 10
// },
2018-12-13 14:08:45 +03:00
debug: false
2018-12-16 09:41:34 +03:00
});
< / script >
2018-09-11 14:11:24 +03:00
<!-- mobile sidebar -->
< script type = "text/javascript" >
$(document).ready( function() {
const navTreeHandler = function(e) {
const sidebar = $('#sidebar');
const background = $('.content_inner_wrapper');
const body = $('body');
if (sidebar.hasClass('mobile-hide')) {
sidebar.removeClass('mobile-hide');
background.addClass('no_scroll');
body.addClass('no_scroll');
} else {
sidebar.addClass('mobile-hide');
background.removeClass('no_scroll');
body.removeClass('no_scroll');
}
};
$('#nav_tree_icon').on('click', navTreeHandler);
2020-06-06 13:12:14 +03:00
$('#sidebar-close').on('click', navTreeHandler);
2018-09-11 14:11:24 +03:00
});
< / script >
<!-- feedback -->
< script type = "text/javascript" >
$(document).ready( function() {
var baseDomain = "{{ BASE_DOMAIN }}";
const feedbackUrl = baseDomain ? 'https://data.' + baseDomain + '/v1/query' : 'https://data.hasura-stg.hasura-app.io/v1/query';
const sendFeedback = function(feedback, feedbackDetailMsg) {
const insertQuery = {
'type': 'insert',
'args': {
'table': 'docs_feedback',
'objects': [
{
'page': window.location.pathname,
'feedback': feedback
}
],
'returning': ['id']
}
};
promise_ajax(feedbackUrl, insertQuery, 'POST')
.then( function(response) {
const data = JSON.parse(response);
$('#feedback_box').data('id', data['returning'][0]['id']);
$('.feedback_detail_msg').html(feedbackDetailMsg);
$('.feedback').addClass('hide');
$('.detailed_feedback').removeClass('hide');
})
.catch( function(err) {
alert('Error capturing feedback');
console.log(err);
});
};
const handleThumbUpClick = function(e) {
sendFeedback('positive', 'Great to hear that. Would you like to share any other feedback:');
};
$('.thumb_up').on('click', handleThumbUpClick);
const handleThumbDownClick = function(e) {
sendFeedback('negative', 'Sorry to hear that. Could you please tell us what you were looking for:');
};
$('.thumb_down').on('click', handleThumbDownClick);
const handleFeedbackBtnClick = function(e) {
const feedbackBox = $('#feedback_box');
const feedbackId = feedbackBox.data('id');
const feedbackContent = feedbackBox.val();
const updateQuery = {
'type': 'update',
'args': {
'table': 'docs_feedback',
'$set': {
'feedback_content': feedbackContent
},
'where': {'id': feedbackId}
}
};
promise_ajax(feedbackUrl, updateQuery, 'POST')
.then( function(response) {
$('.detailed_feedback').addClass('hide');
$('.thank_you').removeClass('hide');
})
.catch( function(err) {
alert('Error capturing feedback');
console.log(err);
});
};
$('.feedback_btn').on('click', handleFeedbackBtnClick);
});
< / script >
<!-- graphiql -->
< script type = "text/javascript" >
$(document).ready( function() {
// graphql query fetcher
const graphQLFetcher = function(endpoint) {
endpoint = endpoint || "{{ GRAPHIQL_DEFAULT_ENDPOINT }}";
return function(graphQLParams) {
const params = {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(graphQLParams),
credentials: 'include'
};
return fetch(endpoint, params)
.then(function (response) {
return response.text();
})
.then(function (responseBody) {
try {
return JSON.parse(responseBody);
} catch (error) {
return responseBody;
}
});
}
};
// create GraphiQL components and embed into HTML
const setupGraphiQL = function() {
if (typeof(React) === 'undefined' || typeof(ReactDOM) === 'undefined' || typeof(GraphiQL) === 'undefined') {
return;
}
const targets = document.getElementsByClassName('graphiql');
for (let i = 0; i < targets.length ; i + + ) {
const target = targets[i];
const endpoint = target.getElementsByClassName("endpoint")[0].innerHTML.trim();
const query = target.getElementsByClassName("query")[0].innerHTML.trim();
const response = target.getElementsByClassName("response")[0].innerHTML.trim();
2019-01-15 17:34:39 +03:00
const variables = target.getElementsByClassName("variables")[0].innerHTML.trim();
2018-09-11 14:11:24 +03:00
const graphiQLElement = React.createElement(GraphiQL, {
fetcher: graphQLFetcher(endpoint),
schema: null, // TODO: pass undefined if introspection supported
query: query,
2019-01-15 17:34:39 +03:00
response: response,
variables: variables
2018-09-11 14:11:24 +03:00
});
ReactDOM.render(graphiQLElement, target);
}
};
2019-01-15 17:34:39 +03:00
const resizeGraphiQLVariableEditors = function() {
const graphiQLVariableEditors = $('.graphiql .variable-editor');
for (let i = 0; i < graphiQLVariableEditors.length ; i + + ) {
graphiQLVariableEditors[i].style.height = '120px';
}
};
2018-09-11 14:11:24 +03:00
// if graphiql elements present, load react/graphiql js files and setup graphiql
if ($('.graphiql').length > 0) {
const loadingStatus = {'react': false, 'reactDom': false, 'graphiQL': false};
const checkLoading = function(loadedFile) {
return function () {
loadingStatus[loadedFile] = true;
// return if all files not yet loaded
for (var file in loadingStatus) {
if (!loadingStatus[file]) {
return;
}
}
setupGraphiQL();
2019-01-15 17:34:39 +03:00
resizeGraphiQLVariableEditors();
2018-09-11 14:11:24 +03:00
}
};
loadCss("{{ pathto('_static/graphiql/graphiql.css', 1) }}", function(){});
loadScript("{{ pathto('_static/react/react.min.js', 1) }}", checkLoading('react'));
loadScript("{{ pathto('_static/react/react-dom.min.js', 1) }}", checkLoading('reactDom'));
loadScript("{{ pathto('_static/graphiql/graphiql.min.js', 1) }}", checkLoading('graphiQL'));
}
});
< / script >
<!-- global_tabs -->
< script type = "text/javascript" >
$(document).ready( function() {
if ($('.global-tabs').length > 0) {
loadCss("{{ pathto('_static/global_tabs/global_tabs.css', 1) }}", function(){});
loadScript("{{ pathto('_static/global_tabs/global_tabs.js', 1) }}", function(){});
}
});
< / script >
<!-- replace latest release tag -->
< script type = "text/javascript" >
$(document).ready( function() {
// if latest release tag elements present, replace with latest release tag
if ($('.latest-release-tag').length > 0) {
const releaseUrl = 'https://releases.hasura.io/graphql-engine?agent=docs.hasura.io';
promise_ajax(releaseUrl, null, 'GET')
.then(function (response) {
const data = JSON.parse(response);
const latest_version = data.latest;
2020-03-09 19:56:59 +03:00
const latest_prerelease_version = data.prerelease;
2018-09-11 14:11:24 +03:00
2020-03-09 19:56:59 +03:00
const release_targets = document.getElementsByClassName('latest-release-tag');
for (let i = 0; i < release_targets.length ; i + + ) {
const release_target = release_targets[i];
2018-09-11 14:11:24 +03:00
2020-03-09 19:56:59 +03:00
release_target.innerHTML = latest_version;
}
const prerelease_targets = document.getElementsByClassName('latest-prerelease-tag');
for (let i = 0; i < prerelease_targets.length ; i + + ) {
const prerelease_target = prerelease_targets[i];
prerelease_target.innerHTML = latest_prerelease_version;
2018-09-11 14:11:24 +03:00
}
})
.catch(function (err) {
console.log(err);
});
}
});
< / script >
2019-03-13 13:04:40 +03:00
<!-- open external links in new tab -->
< script type = "text/javascript" >
$(document).ready( function() {
const externalLinks = $('a.reference.external');
for (let i = 0; i < externalLinks.length ; i + + ) {
externalLinks[i].setAttribute('target', '_blank');
}
});
< / script >
2019-01-08 20:09:05 +03:00
{%- block extrafooter %} {% endblock %}
2019-12-30 12:02:06 +03:00
{% block extrahead %}
<!-- <meta name="viewport" content="user - scalable=no"> -->
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
< link href = "https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel = "stylesheet" integrity = "sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin = "anonymous" >
< link rel = "stylesheet" href = "https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.css" / >
{% endblock %}
2018-09-11 14:11:24 +03:00
{% endblock %}