Skip to content

Commit

Permalink
Merge pull request apache#17 from john-bodley/john-bodley-cherry-pick…
Browse files Browse the repository at this point in the history
…-fixes

cherry pick fixes
  • Loading branch information
john-bodley authored Mar 7, 2018
2 parents d995649 + 37a255f commit eb95017
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
38 changes: 19 additions & 19 deletions superset/assets/javascripts/welcome/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,7 @@ export default class App extends React.PureComponent {
return (
<div className="container welcome">
<Tabs defaultActiveKey={1} id="uncontrolled-tab-example">
<Tab eventKey={1} title={t('Recently Viewed')}>
<Panel>
<Row>
<Col md={8}><h2>{t('Recently Viewed')}</h2></Col>
</Row>
<hr />
<RecentActivity user={this.props.user} />
</Panel>
</Tab>
<Tab eventKey={2} title={t('Favorites')}>
<Panel>
<Row>
<Col md={8}><h2>{t('Favorites')}</h2></Col>
</Row>
<hr />
<Favorites user={this.props.user} />
</Panel>
</Tab>
<Tab eventKey={3} title={t('Dashboards')}>
<Tab eventKey={1} title={t('Dashboards')}>
<Panel>
<Row>
<Col md={8}><h2>{t('Dashboards')}</h2></Col>
Expand All @@ -62,6 +44,24 @@ export default class App extends React.PureComponent {
<DashboardTable search={this.state.search} />
</Panel>
</Tab>
<Tab eventKey={2} title={t('Recently Viewed')}>
<Panel>
<Row>
<Col md={8}><h2>{t('Recently Viewed')}</h2></Col>
</Row>
<hr />
<RecentActivity user={this.props.user} />
</Panel>
</Tab>
<Tab eventKey={3} title={t('Favorites')}>
<Panel>
<Row>
<Col md={8}><h2>{t('Favorites')}</h2></Col>
</Row>
<hr />
<Favorites user={this.props.user} />
</Panel>
</Tab>
</Tabs>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def get_payload(self, query_obj=None):

df = payload.get('df')
if self.status != utils.QueryStatus.FAILED:
if df is None or df.empty:
if df is not None and df.empty:
payload['error'] = 'No data'
else:
payload['data'] = self.get_data(df)
Expand Down Expand Up @@ -611,7 +611,7 @@ def query_obj(self):
return None

def get_df(self, query_obj=None):
return pd.DataFrame()
return None

def get_data(self, df):
markup_type = self.form_data.get('markup_type')
Expand Down
11 changes: 10 additions & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ def test_slice_payload_no_data(self):

data = self.get_json_resp(url)
self.assertEqual(data['status'], utils.QueryStatus.SUCCESS)
assert 'No data' in data['error']
self.assertEqual(data['error'], 'No data')

def test_slice_payload_invalid_query(self):
self.login(username='admin')
Expand All @@ -937,6 +937,15 @@ def test_slice_payload_invalid_query(self):
self.assertEqual(data['status'], utils.QueryStatus.FAILED)
assert 'KeyError' in data['stacktrace']

def test_slice_payload_viz_markdown(self):
self.login(username='admin')
slc = self.get_slice('Title', db.session)

url = slc.get_explore_url(base_url='/superset/explore_json')
data = self.get_json_resp(url)
self.assertEqual(data['status'], None)
self.assertEqual(data['error'], None)


if __name__ == '__main__':
unittest.main()

0 comments on commit eb95017

Please sign in to comment.