Skip to content

Commit

Permalink
add toggle_table_string
Browse files Browse the repository at this point in the history
addresses mozilla#130

Makes the _v of the schema browser toggle into a configurable string
per data source. It is not required and if it is not filled in the
toggle will not appear in the schema browser.

Not in postgres query_runner because then test_interactive_new fails.
  • Loading branch information
alison985 committed Jul 24, 2017
1 parent f2d9fc7 commit ba7e0ed
Show file tree
Hide file tree
Showing 31 changed files with 177 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/app/pages/queries/schema-browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

<button class="btn btn-default"
title="Toggle Versioned Tables"
ng-click="$ctrl.flipToggleVersionedTables($ctrl.versionToggle)">
ng-click="$ctrl.flipToggleVersionedTables($ctrl.versionToggle)"
ng-if="dataSource.options.toggle_table_string != ''">
<span class="fa " ng-class="{'fa-toggle-on': $ctrl.versionToggle == true, 'fa-toggle-off': !$ctrl.versionToggle}">
<input type="checkbox" id="versioned-tables-toggle" ng-model="$ctrl.versionToggle" hidden/>
</span>
Expand Down
2 changes: 1 addition & 1 deletion client/app/pages/queries/schema-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function SchemaBrowserCtrl($scope) {
this.flipToggleVersionedTables = (versionToggle) => {
if (versionToggle === false) {
this.versionToggle = true;
this.versionFilter = '_v';
this.versionFilter = $scope.dataSource.options.toggle_table_string;
} else {
this.versionToggle = false;
this.versionFilter = 'abcdefghijklmnop';
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/activedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": "https://github.com/klahnakoski/ActiveData/tree/dev/docs"
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["host_url"]
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ def configuration_schema(cls):
'type': 'string',
'title': 'Schema Name',
'default': 'default'
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['region', 's3_staging_dir'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/axibase_tsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ def configuration_schema(cls):
'trust_certificate': {
'type': 'boolean',
'title': 'Trust SSL Certificate'
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['username', 'password', 'hostname', 'protocol', 'port'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/big_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def configuration_schema(cls):
'maximumBillingTier': {
"type": "number",
"title": "Maximum Billing Tier"
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['jsonKeyFile', 'projectId'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/cass.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ def configuration_schema(cls):
'type': 'number',
'title': 'Protocol Version',
'default': 3
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['keyspace', 'host']
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def configuration_schema(cls):
"dbname": {
"type": "string",
"title": "Database Name"
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["dbname"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/dynamodb_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["access_key", "secret_key"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"secret": ["basic_auth_password"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/google_analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ def configuration_schema(cls):
'jsonKeyFile': {
"type": "string",
'title': 'JSON Key File'
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['jsonKeyFile'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/google_spreadsheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['jsonKeyFile'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/graphite.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['url'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/hive_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["host"]
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/impala_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["host"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/influx_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['url']
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/jql.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['url', 'username', 'password'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/memsql_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ def configuration_schema(cls):
},
"password": {
"type": "string"
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}

},
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['connectionString', 'dbName']
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["db"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ def configuration_schema(cls):
'port': {
'type': 'number',
'default': 3306,
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"order": ['host', 'port', 'user', 'passwd', 'db'],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["servicename", "user", "password", "host", "port"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/presto.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['host']
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
}
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/salesforce.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ def configuration_schema(cls):
},
"sandbox": {
"type": "boolean"
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["username", "password", "token"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['path']
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ def configuration_schema(cls):
},
"database": {
"type": "string"
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["user", "password", "account", "database", "warehouse"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
"required": ["dbpath"],
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/treasuredata.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['apikey','db']
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions redash/query_runner/vertica.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ def configuration_schema(cls):
"type": "string",
"title": "Documentation URL",
"default": cls.default_doc_url
},
"toggle_table_string": {
"type": "string",
"title": "Toggle Table String",
"default": "_v",
"info": "This string will be used to toggle visibility of tables in the schema browser when editing a query in order to remove non-useful tables from sight."
}
},
'required': ['database'],
Expand Down

0 comments on commit ba7e0ed

Please sign in to comment.