Auto-complete of tables and columns in "Query Database" section [5.3.0-B1]
In the https://in-portal.atlassian.net/browse/INP-1174 the task the CodeMirror (see https://codemirror.net/) editor was added to "Tools > Query Database" section. This allowed to have syntax highlighting and line numbering to enhance use experience.
To make user experience even better proposing to enable auto-complete of tables and their column names.
Solution
create "
adm:CodeMirrorDatabaseHintOptions", that, that will:store results in memcache for 1 hour
get database tables matching used TablePrefix
get column names of these tables
build up a JSON-encoded array from that data
return it
on the "
tools/sql_query" template add "hintOptions" to CodeMirror options, that's content would look like:{tables: <inp2:adm:CodeMirrorDatabaseHintOptions/>}
Copied from http://codemirror.net/mode/sql/ page source:
hintOptions: {
tables: {
users: {name: null, score: null, birthDate: null},
countries: {name: null, population: null, size: null}
}
}