Skip to content

Multiple improvements/features (pagination, etc)#8

Open
drdaeman wants to merge 7 commits into
kirs:masterfrom
drdaeman:pagination
Open

Multiple improvements/features (pagination, etc)#8
drdaeman wants to merge 7 commits into
kirs:masterfrom
drdaeman:pagination

Conversation

@drdaeman

@drdaeman drdaeman commented Mar 17, 2018

Copy link
Copy Markdown
Contributor

Hi! As I've mentioned in #7, I've did some enhancements for personal use purposes, which I'd like to share:

  • Pagination. By default, 25 queries per page are shown, but this is configurable (from UI).
  • Multiple servers support. A configuration file is now a map of servers, rather than a single one. It should be noted, old configuration files are not compatible with this and have to be updated.
  • A button to reset statistics. Unfortunately, I haven't figured out how to add CSRF protection (too much time had passed since I last wrote any Ruby code). After merging, I suggest to create an issue about this to not forget it.

If there are any changes you'd like me to make to those commits, please feel free to advise.

Thanks!

Rather than using gsub to replace apostrophes, a proper
way to sanitize is to use escape_string method (which
is essentially libpq's PQescapeStringConn)
- Implements pagination, 25 rows per page by default
- Uses sinatra-params gem for parameter passing
A quick hack to support multiple servers instead of just one.
Allows to avoid running multiple instances and having to set up
manual routing with e.g. nginx.
- If there's a single server, automatically redirect
- If there are many, show a list
- Correctly 404 if a non-existent URL is requested
Known issues: no CSRF protection, I can't figure out how to
use Rack::Csrf or Rack::Protection::AuthenticityToken or
whatever else.
@kirs

kirs commented Aug 7, 2018

Copy link
Copy Markdown
Owner

Thanks for working on this and sorry that I haven't seen the PR earlier. Please feel free to ping me by mentioning @kirs in the future.

I'm happy to accept the PR, but I think it's still possible to make the config format backward compatible to avoid breaking the tool for the rest of users. It should be a trivial condition to check if the config file is using single level or if it's nested. Is it something that you'll have time to work on?

Thanks again for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants