mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-28 10:16:10 -06:00
Fixes #19622: Allow loading graphql query from URL (#20014)
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
This commit is contained in:
parent
d222913716
commit
9df0bdcfaf
@ -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;
|
const fetchURL = window.location.href;
|
||||||
|
|
||||||
function httpUrlToWebSockeUrl(url) {
|
function httpUrlToWebSockeUrl(url) {
|
||||||
@ -123,6 +138,8 @@
|
|||||||
defaultEditorToolsVisibility: true,
|
defaultEditorToolsVisibility: true,
|
||||||
plugins: [explorerPlugin],
|
plugins: [explorerPlugin],
|
||||||
inputValueDeprecation: true,
|
inputValueDeprecation: true,
|
||||||
|
defaultQuery: EXAMPLE_QUERY,
|
||||||
|
query: sharedQuery,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user