mirror of
https://github.com/getredash/redash.git
synced 2026-05-09 03:03:08 -04:00
* Autocomplete toggle improvements: * Refactor to its own component. * Show state in tooltip (enabled/disabled). * Disable the toggle if autocomplete is not possible (no schema/too many tokens). * Remove unsued code. * Custom icons font (currently has only two icons). Generated with Icomoon. If we extend its use, we should probably automate this and move to its own package. * Don't disable live autocomplete for data sources without schema. It can still be useful to autocomplete from local keywords. * Differentiate between autocomplete toggle states with an icon. Also added explicit message for the disabled state. * Remember thes state of autocomplete. * Only auto register init functions.
20 lines
401 B
JavaScript
20 lines
401 B
JavaScript
const PREFIX = 'localOptions:';
|
|
|
|
function get(key, defaultValue = undefined) {
|
|
const fullKey = PREFIX + key;
|
|
if (fullKey in window.localStorage) {
|
|
return JSON.parse(window.localStorage.getItem(fullKey));
|
|
}
|
|
return defaultValue;
|
|
}
|
|
|
|
function set(key, value) {
|
|
const fullKey = PREFIX + key;
|
|
window.localStorage.setItem(fullKey, JSON.stringify(value));
|
|
}
|
|
|
|
export default {
|
|
get,
|
|
set,
|
|
};
|