Rename "slice" to "chart" and update translations (#5008)

* Rename slice to chart and update translations

* Fix unit tests
This commit is contained in:
Beto Dealmeida 2018-05-21 17:49:02 -07:00 committed by Maxime Beauchemin
parent 459cb701fb
commit 973c661501
40 changed files with 56092 additions and 20404 deletions

View File

@ -98,7 +98,7 @@ export default class AddSliceContainer extends React.PureComponent {
disabled={this.isBtnDisabled()} disabled={this.isBtnDisabled()}
onClick={this.gotoSlice.bind(this)} onClick={this.gotoSlice.bind(this)}
> >
{t('Create new slice')} {t('Create new chart')}
</Button> </Button>
<br /><br /> <br /><br />
</Panel> </Panel>

View File

@ -182,8 +182,8 @@ class Controls extends React.PureComponent {
userId={userId} userId={userId}
triggerNode={ triggerNode={
<MenuItemContent <MenuItemContent
text={t('Add Slices')} text={t('Add Charts')}
tooltip={t('Add some slices to this dashboard')} tooltip={t('Add some charts to this dashboard')}
faIcon="plus" faIcon="plus"
/> />
} }

View File

@ -71,7 +71,7 @@ class SaveModal extends React.Component {
if (sliceParams.action === 'saveas') { if (sliceParams.action === 'saveas') {
sliceName = this.state.newSliceName; sliceName = this.state.newSliceName;
if (sliceName === '') { if (sliceName === '') {
this.setState({ alert: t('Please enter a slice name') }); this.setState({ alert: t('Please enter a chart name') });
return; return;
} }
sliceParams.slice_name = sliceName; sliceParams.slice_name = sliceName;

View File

@ -30,7 +30,7 @@ export default class URLShortLinkButton extends React.Component {
} }
renderPopover() { renderPopover() {
const emailBody = t('Check out this slice: %s', this.state.shortUrl); const emailBody = t('Check out this chart: %s', this.state.shortUrl);
return ( return (
<Popover id="shorturl-popover"> <Popover id="shorturl-popover">
<CopyToClipboard <CopyToClipboard

View File

@ -1853,9 +1853,9 @@ export const controls = {
slice_id: { slice_id: {
type: 'HiddenControl', type: 'HiddenControl',
label: t('Slice ID'), label: t('Chart ID'),
hidden: true, hidden: true,
description: t('The id of the active slice'), description: t('The id of the active chart'),
}, },
cache_timeout: { cache_timeout: {

View File

@ -30,7 +30,7 @@ class CreatedContent extends React.PureComponent {
className="table table-condensed" className="table table-condensed"
columns={['slice', 'favorited']} columns={['slice', 'favorited']}
mutator={mutator} mutator={mutator}
noDataText={t('No slices')} noDataText={t('No charts')}
sortable sortable
/> />
); );
@ -58,7 +58,7 @@ class CreatedContent extends React.PureComponent {
<h3>{t('Dashboards')}</h3> <h3>{t('Dashboards')}</h3>
{this.renderDashboardTable()} {this.renderDashboardTable()}
<hr /> <hr />
<h3>{t('Slices')}</h3> <h3>{t('Charts')}</h3>
{this.renderSliceTable()} {this.renderSliceTable()}
</div> </div>
); );

View File

@ -224,13 +224,13 @@ class DruidDatasourceModelView(DatasourceModelView, DeleteMixin, YamlExportMixin
base_order = ('datasource_name', 'asc') base_order = ('datasource_name', 'asc')
description_columns = { description_columns = {
'slices': _( 'slices': _(
'The list of slices associated with this table. By ' 'The list of charts associated with this table. By '
'altering this datasource, you may change how these associated ' 'altering this datasource, you may change how these associated '
'slices behave. ' 'charts behave. '
'Also note that slices need to point to a datasource, so ' 'Also note that charts need to point to a datasource, so '
'this form will fail at saving if removing slices from a ' 'this form will fail at saving if removing charts from a '
'datasource. If you want to change the datasource for a slice, ' 'datasource. If you want to change the datasource for a chart, '
"overwrite the slice from the 'explore view'"), "overwrite the chart from the 'explore view'"),
'offset': _('Timezone offset (in hours) for this datasource'), 'offset': _('Timezone offset (in hours) for this datasource'),
'description': Markup( 'description': Markup(
'Supports <a href="' 'Supports <a href="'

View File

@ -180,13 +180,13 @@ class TableModelView(DatasourceModelView, DeleteMixin, YamlExportMixin): # noqa
) )
description_columns = { description_columns = {
'slices': _( 'slices': _(
'The list of slices associated with this table. By ' 'The list of charts associated with this table. By '
'altering this datasource, you may change how these associated ' 'altering this datasource, you may change how these associated '
'slices behave. ' 'charts behave. '
'Also note that slices need to point to a datasource, so ' 'Also note that charts need to point to a datasource, so '
'this form will fail at saving if removing slices from a ' 'this form will fail at saving if removing charts from a '
'datasource. If you want to change the datasource for a slice, ' 'datasource. If you want to change the datasource for a chart, '
"overwrite the slice from the 'explore view'"), "overwrite the chart from the 'explore view'"),
'offset': _('Timezone offset (in hours) for this datasource'), 'offset': _('Timezone offset (in hours) for this datasource'),
'table_name': _( 'table_name': _(
'Name of the table that exists in the source database'), 'Name of the table that exists in the source database'),

View File

@ -1,8 +1,6 @@
[ignore: superset/assets/node_modules/**] [ignore: superset/assets/node_modules/**]
[python: superset/**.py] [python: superset/**.py]
[jinja2: superset/**/templates/**.html] [jinja2: superset/**/templates/**.html]
[javascript: superset/assets/javascripts/**.js] [javascript: superset/assets/src/**.js]
[javascript: superset/assets/javascripts/**.jsx] [javascript: superset/assets/src/**.jsx]
[javascript: superset/assets/visualizations/**.js]
[javascript: superset/assets/visualizations/**.jsx]
encoding = utf-8 encoding = utf-8

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -450,7 +450,7 @@ class SliceModelView(SupersetModelView, DeleteMixin): # noqa
'want to alter specific parameters.', 'want to alter specific parameters.',
), ),
'cache_timeout': _( 'cache_timeout': _(
'Duration (in seconds) of the caching timeout for this slice.'), 'Duration (in seconds) of the caching timeout for this chart.'),
} }
base_filters = [['id', SliceFilter, lambda: []]] base_filters = [['id', SliceFilter, lambda: []]]
label_columns = { label_columns = {
@ -1959,7 +1959,7 @@ class Superset(BaseSupersetView):
slices = session.query(models.Slice).filter_by(id=slice_id).all() slices = session.query(models.Slice).filter_by(id=slice_id).all()
if not slices: if not slices:
return json_error_response(__( return json_error_response(__(
'Slice %(id)s not found', id=slice_id), status=404) 'Chart %(id)s not found', id=slice_id), status=404)
elif table_name and db_name: elif table_name and db_name:
SqlaTable = ConnectorRegistry.sources['table'] SqlaTable = ConnectorRegistry.sources['table']
table = ( table = (

View File

@ -125,7 +125,7 @@ class SupersetTestCase(unittest.TestCase):
resp = self.get_resp( resp = self.get_resp(
'/login/', '/login/',
data=dict(username=username, password=password)) data=dict(username=username, password=password))
self.assertIn('Welcome', resp) self.assertNotIn('User confirmation needed', resp)
def get_slice(self, slice_name, session): def get_slice(self, slice_name, session):
slc = ( slc = (

View File

@ -56,7 +56,7 @@ class CoreTests(SupersetTestCase):
resp = self.get_resp( resp = self.get_resp(
'/login/', '/login/',
data=dict(username='admin', password='general')) data=dict(username='admin', password='general'))
self.assertIn('Welcome', resp) self.assertNotIn('User confirmation needed', resp)
resp = self.get_resp('/logout/', follow_redirects=True) resp = self.get_resp('/logout/', follow_redirects=True)
self.assertIn('User confirmation needed', resp) self.assertIn('User confirmation needed', resp)
@ -64,14 +64,8 @@ class CoreTests(SupersetTestCase):
resp = self.get_resp( resp = self.get_resp(
'/login/', '/login/',
data=dict(username='admin', password='wrongPassword')) data=dict(username='admin', password='wrongPassword'))
self.assertNotIn('Welcome', resp)
self.assertIn('User confirmation needed', resp) self.assertIn('User confirmation needed', resp)
def test_welcome(self):
self.login()
resp = self.client.get('/superset/welcome')
assert 'Welcome' in resp.data.decode('utf-8')
def test_slice_endpoint(self): def test_slice_endpoint(self):
self.login(username='admin') self.login(username='admin')
slc = self.get_slice('Girls', db.session) slc = self.get_slice('Girls', db.session)