simov / express-admin

MySQL, MariaDB, PostgreSQL, SQLite admin for Node.js
MIT License
1.18k stars 223 forks source link

Russian language & settings generation based on column type info #44

Closed kreopt closed 10 years ago

kreopt commented 10 years ago

Hi! Just added russian language and made settings generation slightly more user-firendly (I think defaults of control types should depend on sql types instead using text input for each entry). Some things may not work yet so it can be easily dropped. I see you are using mysql-validator for each dbms type. It will be better if this validator will extensible and depend on dbms type. For example, postgresql have some types incompatible with mysql . So, I had to temporary add try/catch block to avoid crashing.

simov commented 10 years ago

Hi, @kreopt

About setting the control types based on their db type: it's a good idea, but I don't want to support it. My focus at this point will be to have as much control types as I can and to ensure that they work good. Setting them up is a user's responsibility.

Having different input types is definitely a good idea, and I'll think about how to add it.

About the translation: thank you very much. This goes in.

About the validation: I wrote mysql-validator especially for express-admin. Later when I added support for more database providers. I hacked the admin's code a little bit just to make sure that it validates correctly in most of the cases (and I don't think I'm going to write another validator, if you find a bug let me know, or create a pull request to that module). Here https://github.com/simov/express-admin/blob/master/lib/utils/client.js#L104 I'm 'morphing' the PostgreSQL types into their MySQL counterparts (I used this chart for reference - http://en.wikibooks.org/wiki/Converting_MySQL_to_PostgreSQL#Data_Types) Also take a look at the https://github.com/simov/express-admin-examples/ repository as these are the exact schemas and the data that the admin have been tested with (more specifically this one http://simov.github.io/express-admin-site/examples/column.html)

It will be much easier for me to test/merge your changes if you split them into separate commits and/or pull requests (but still I'll try to merge at least the translation)

:beers:

kreopt commented 10 years ago

it's a good idea, but I don't want to support it.

I can support this feature. Maybe in some kind of plugin which can be enabled from config. This is essentian function for me

and I don't think I'm going to write another validator

The same thing. I can support pg validator cause type mapping is not always a good idea

It will be much easier for me to test/merge your changes if you split them into separate commits and/or pull requests (but still I'll try to merge at least the translation)

ok

simov commented 10 years ago

@kreopt you can easily parse the generated settings.json and set the options you need.

About the validator, I think the best approach will be to use the factory pattern inside the mysql-validator module and define the pg related stuff there.

simov commented 10 years ago

Your translation and the number control type were added.