Skip to content

Commit

Permalink
Fixing edit URL in explore view
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 14, 2017
1 parent d98db27 commit 7471588
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default class SelectField extends React.PureComponent {
<div>
{selectWrap}
{this.props.editUrl &&
<a href={`${this.props.editUrl}/${this.props.value}`}>edit</a>
<a href={this.props.editUrl}>edit</a>
}
</div>
);
Expand Down
7 changes: 1 addition & 6 deletions superset/assets/javascripts/explorev2/stores/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ export const TIME_STAMP_OPTIONS = [
['%H:%M:%S', '%H:%M:%S | 01:32:10'],
];

const MAP_DATASOURCE_TYPE_TO_EDIT_URL = {
table: '/tablemodelview/edit',
druid: '/druiddatasourcemodelview/edit',
};

export const fields = {
datasource: {
type: 'SelectField',
Expand All @@ -43,7 +38,7 @@ export const fields = {
return {
choices: datasources,
isLoading: datasources.length === 0,
editUrl: MAP_DATASOURCE_TYPE_TO_EDIT_URL[state.datasource_type],
editUrl: state.datasource ? state.datasource.edit_url : null,
};
},
description: '',
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/javascripts/syncBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function exportFile(fileLocation, content) {
function main() {
const APP_DIR = path.resolve(__dirname, './');
const dir = APP_DIR + '/../dist/';
if (!fs.existsSync(dir)){
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const blob = { fields };
Expand Down
22 changes: 11 additions & 11 deletions superset/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from __future__ import print_function
from __future__ import unicode_literals

import ast
from collections import OrderedDict
import functools
import json
Expand Down Expand Up @@ -649,7 +648,7 @@ def export_dashboards(cls, dashboard_ids):
})


class Queryable(object):
class Datasource(object):

"""A common interface to objects that are queryable (tables and datasources)"""

Expand Down Expand Up @@ -701,16 +700,17 @@ def data(self):
order_by_choices.append((json.dumps([s, False]), s + ' [desc]'))

d = {
'all_cols': utils.choicify(self.column_names),
'column_formats': self.column_formats,
'edit_url' : self.url,
'filter_select': self.filter_select_enabled,
'filterable_cols': utils.choicify(self.filterable_column_names),
'gb_cols': utils.choicify(self.groupby_column_names),
'id': self.id,
'type': self.type,
'name': self.name,
'metrics_combo': self.metrics_combo,
'name': self.name,
'order_by_choices': order_by_choices,
'gb_cols': utils.choicify(self.groupby_column_names),
'all_cols': utils.choicify(self.column_names),
'filterable_cols': utils.choicify(self.filterable_column_names),
'filter_select': self.filter_select_enabled,
'column_formats': self.column_formats,
'type': self.type,
}
if self.type == 'table':
grains = self.database.grains() or []
Expand Down Expand Up @@ -1092,7 +1092,7 @@ def lookup_obj(lookup_metric):
return import_util.import_simple_obj(db.session, i_metric, lookup_obj)


class SqlaTable(Model, Queryable, AuditMixinNullable, ImportMixin):
class SqlaTable(Model, Datasource, AuditMixinNullable, ImportMixin):

"""An ORM object for SqlAlchemy table references"""

Expand Down Expand Up @@ -1873,7 +1873,7 @@ def lookup_obj(lookup_metric):
return import_util.import_simple_obj(db.session, i_metric, lookup_obj)


class DruidDatasource(Model, AuditMixinNullable, Queryable, ImportMixin):
class DruidDatasource(Model, AuditMixinNullable, Datasource, ImportMixin):

"""ORM object referencing Druid datasources (tables)"""

Expand Down

0 comments on commit 7471588

Please sign in to comment.