Skip to content

Commit

Permalink
Merge pull request #651 from alonho/datasource_defaults
Browse files Browse the repository at this point in the history
Support default values in data source creation forms
  • Loading branch information
arikfr committed Nov 15, 2015
2 parents d14b74b + a87179b commit 346ea66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rd_ui/app/views/data_sources/form.html
Expand Up @@ -10,7 +10,7 @@
<div class="form-group" ng-class='{"has-error": !inner.input.$valid}' ng-form="inner" ng-repeat="(name, input) in type.configuration_schema.properties">
<label>{{input.title || name | capitalize}}</label>
<input name="input" type="{{input.type}}" class="form-control" ng-model="dataSource.options[name]" ng-required="input.required"
ng-if="input.type !== 'file'" accesskey="tab">
ng-if="input.type !== 'file'" accesskey="tab" placeholder="{{input.default}}">

<input name="input" type="file" class="form-control" ng-model="files[name]" ng-required="input.required && !dataSource.options[name]"
base-sixty-four-input
Expand Down
6 changes: 4 additions & 2 deletions redash/query_runner/mysql.py
Expand Up @@ -33,7 +33,8 @@ def configuration_schema(cls):
'type': 'object',
'properties': {
'host': {
'type': 'string'
'type': 'string',
'default': '127.0.0.1'
},
'user': {
'type': 'string'
Expand All @@ -47,7 +48,8 @@ def configuration_schema(cls):
'title': 'Database name'
},
'port': {
'type': 'number'
'type': 'number',
'default': 3306,
},
'use_ssl': {
'type': 'boolean',
Expand Down
6 changes: 4 additions & 2 deletions redash/query_runner/pg.py
Expand Up @@ -57,10 +57,12 @@ def configuration_schema(cls):
"type": "string"
},
"host": {
"type": "string"
"type": "string",
"default": "127.0.0.1"
},
"port": {
"type": "number"
"type": "number",
"default": 5432
},
"dbname": {
"type": "string",
Expand Down

0 comments on commit 346ea66

Please sign in to comment.