-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Proposal to implement a Query History into the Servershell
Problem
While working with serveradmin i often encounter the situation where i would like to execute a query i executed previously, currently the only way to do this is to bookmark frequently used queries in the browser. However this requires active decision to bookmark it and therefore only works for queries that are used really frequently. I personally would love to have a bash_history like history in servershell, to quickly switch between queries i used in this session or the day before.
I poured some thought into it and this would be my idea to implment this.
Proposed solution
Storing query history
I think it would be enough to store queries into the local storage in the browser, as i think most of us work only on one device.
And therefore storing it back end side would unnecessarily complicate things.
Only successful queries are stored, queries that ended with syntax errors for example will be discarded.
To enhance this further we could even store the restrict along side the query, so when a query from the history is selected the attributes of the object is also correctly shown in the table.
If the same query is made again, its original entry will be removed from the history and it will be put back on top.
Queries with identical search strings are treated as duplicates regardless of restrict values executing such a query moves it to the top of the history.
When the history reaches max size, entries will be replaced in a Fifo fashion. I would say a sensible default size is 20
Settings
We could add some options to the settings screen that control, history size, and a button is able to wipe the history.
Interacting with the history
We could introduce a new autocomplete to the Search field, that only gets triggered when the history is opened.
Either while clicking a button or clicking the shortcut SHIFT + R (To not collide with CTRL + R)
On clicking the button or the shortcut focus will move to the search field and the autocomplete will open.
It will show X last successful queries, on key enter into the search field query history is filtered to matching queries.
Auto complete navigation would work the same as with the normal autocomplete.
(The autocomplete does not show the Query object from the understood section but the query/search string the user typed into the search box at query time)
Selecting a query from the auto complete will put it into the search filed and the auto complete will close, optionally setting restricts accordingly.
Conclusion
Of course i can only speak from my own perspective but i think having something like this is a nice qol feature for the servershell. Let me know what you think :D
If this sounds useful to you i would also be happy to help or do the implementation 🚀