JQL Editor Autocomplete REST
This package wraps the callbacks needed to fetch autocomplete data for the JQL editor, and provides simple hooks to delegate to Jira Cloud REST API's.
We require these configurable hooks to allow consumers to define their own fetch library given their app environment, e.g. Jira, Connect, Forge etc.
Usage
A minimal configuration of the autocomplete provider is as follows:
import { useAutocompleteProvider } from '@atlassianlabs/jql-editor-autocomplete-rest';
const getInitialData = async (url: string) => {
const response = await fetch(url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ includeCollapsedFields: true })
});
const data = response.json();
return {
jqlFields: data.visibleFieldNames,
jqlFunctions: data.visibleFunctionNames,
};
};
const getSuggestions = async (url: string) => {
const response = await fetch(url);
return response.json();
};
const useMyAutocompleteProvider = () => {
return useAutocompleteProvider('my-app', getInitialData, getSuggestions);
};
Installation
yarn add @atlassianlabs/jql-editor-autocomplete-rest
Support
For developers outside of Atlassian looking for help, or to report issues, please make a post on the community forum. We will monitor the forums and redirect topics to the appropriate maintainers.
License
Copyright (c) 2021 - 2022 Atlassian and others. Apache 2.0 licensed, see LICENSE file.