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()}
onClick={this.gotoSlice.bind(this)}
>
{t('Create new slice')}
{t('Create new chart')}
</Button>
<br /><br />
</Panel>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -224,13 +224,13 @@ class DruidDatasourceModelView(DatasourceModelView, DeleteMixin, YamlExportMixin
base_order = ('datasource_name', 'asc')
description_columns = {
'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 '
'slices behave. '
'Also note that slices need to point to a datasource, so '
'this form will fail at saving if removing slices from a '
'datasource. If you want to change the datasource for a slice, '
"overwrite the slice from the 'explore view'"),
'charts behave. '
'Also note that charts need to point to a datasource, so '
'this form will fail at saving if removing charts from a '
'datasource. If you want to change the datasource for a chart, '
"overwrite the chart from the 'explore view'"),
'offset': _('Timezone offset (in hours) for this datasource'),
'description': Markup(
'Supports <a href="'

View File

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

View File

@ -1,8 +1,6 @@
[ignore: superset/assets/node_modules/**]
[python: superset/**.py]
[jinja2: superset/**/templates/**.html]
[javascript: superset/assets/javascripts/**.js]
[javascript: superset/assets/javascripts/**.jsx]
[javascript: superset/assets/visualizations/**.js]
[javascript: superset/assets/visualizations/**.jsx]
[javascript: superset/assets/src/**.js]
[javascript: superset/assets/src/**.jsx]
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.',
),
'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: []]]
label_columns = {
@ -1959,7 +1959,7 @@ class Superset(BaseSupersetView):
slices = session.query(models.Slice).filter_by(id=slice_id).all()
if not slices:
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:
SqlaTable = ConnectorRegistry.sources['table']
table = (

View File

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

View File

@ -56,7 +56,7 @@ class CoreTests(SupersetTestCase):
resp = self.get_resp(
'/login/',
data=dict(username='admin', password='general'))
self.assertIn('Welcome', resp)
self.assertNotIn('User confirmation needed', resp)
resp = self.get_resp('/logout/', follow_redirects=True)
self.assertIn('User confirmation needed', resp)
@ -64,14 +64,8 @@ class CoreTests(SupersetTestCase):
resp = self.get_resp(
'/login/',
data=dict(username='admin', password='wrongPassword'))
self.assertNotIn('Welcome', 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):
self.login(username='admin')
slc = self.get_slice('Girls', db.session)