Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions netbox/templates/graphql/graphiql.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@
#
`;

let sharedQuery;
const hashArgs = new URLSearchParams(window.location.hash.substring(1));
if (hashArgs.has('query')) {
sharedQuery = hashArgs.get('query');
// reset url to not motivate copying of stale URL
hashArgs.delete('query');
let remainingHash = "";
if (hashArgs.size !== 0) {
remainingHash = `#${hashArgs.toString()}`;
}
history.pushState("", document.title,
window.location.pathname + window.location.search + remainingHash
);
}

const fetchURL = window.location.href;

function httpUrlToWebSockeUrl(url) {
Expand Down Expand Up @@ -123,6 +138,8 @@
defaultEditorToolsVisibility: true,
plugins: [explorerPlugin],
inputValueDeprecation: true,
defaultQuery: EXAMPLE_QUERY,
query: sharedQuery,
}),
);
</script>
Expand Down