-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[chart] new, list view (react) #8999
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8999 +/- ##
==========================================
+ Coverage 59.15% 59.28% +0.12%
==========================================
Files 370 371 +1
Lines 11818 11916 +98
Branches 2900 2916 +16
==========================================
+ Hits 6991 7064 +73
- Misses 4648 4673 +25
Partials 179 179
Continue to review full report at Codecov.
|
82fa496
to
c8a5513
Compare
9cd3c73
to
3e4f9fb
Compare
return false; | ||
} | ||
|
||
return Boolean(this.state.permissions.find((p) => p === perm)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Boolean(this.state.permissions.find((p) => p === perm)); | |
return this.state.permissions.some((p) => p === perm); |
<span | ||
role='button' | ||
className='action-button' | ||
onClick={handleEdit} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not a link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose we could bring in the edit modal from #9051 later and trigger a modal instead of following the url.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my thinking. It's a link now, but will probably fire an action in the near future
const PAGE_SIZE = 25; | ||
|
||
interface Props { | ||
addDangerToast: (msg: string) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
interface Props { | ||
addDangerToast: (msg: string) => void; | ||
addSuccessToast: (msg: string) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, | ||
(err: any) => { | ||
console.error(err); | ||
this.props.addDangerToast(t('There was an issue deleting the selected dashboards')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.props.addDangerToast(t('There was an issue deleting the selected dashboards')); | |
this.props.addDangerToast(t(`There was an issue deleting the selected ${charts.length > 1 ? 'dashboards' : 'dashboard'}`)); |
^ This is probably not the right way to do it with translation factored in, but it's possible to select 1 item with bulk actions, so we may want to get the pluralization right.
|
||
<ConfirmStatusChange | ||
title={t('Please confirm')} | ||
description={t('Are you sure you want to delete the selected charts?')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Could address pluralization here too.
if (this.canDelete) { | ||
bulkActions.push({ | ||
key: 'delete', | ||
name: <><i className='fa fa-trash' /> Delete</>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we instead pass aname
and (optional) icon
and handle rendering tags on the other side?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nits/questions inline, but in general, LGTM! 👍
A little off-topic, but I'm not seeing any guidelines or SIPs related to TypeScript usage in Superset. Have there been any discussions about Typescript vs vanilla JS? The recent React CRUD view PRs have started introducing .tsx, but previous TypeScript usage was pretty incidental. Would love to get some consensus around this before pushing full steam ahead on TypeScript. |
Typescript was originally added to Superset as part of SIP-9 (#6120). In general, I think new code should strive to use typescript for the safety and readability that it provides, and if someone started converting old files to .ts or .tsx, I'd personally be quite happy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple comments
this.props.addSuccessToast(t('Deleted') + ` ${slice_name}`); | ||
}, | ||
(err: any) => { | ||
this.props.addDangerToast(t('There was an issue deleting') + `${slice_name}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is missing a space before slice_name. Although I don't think this translation will actually work anyway. i believe there's a way to put %s
or something in the translation string so that the full sentence gets parsed for translation. You could look in the code to find it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like there's docs around this: https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-translation
Seems simple enough
if (lastFetchDataConfig) { | ||
this.fetchData(lastFetchDataConfig); | ||
} | ||
this.props.addSuccessToast(t('Deleted') + ` ${slice_name}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as below about fixing the translation
3e4f9fb
to
aac36ca
Compare
aac36ca
to
c543a7b
Compare
CATEGORY
Choose one
SUMMARY
Similar to #8845 this swaps out the chart list view rendered by FAB with one rendered client side in react, consuming the charts api at
api/v1/chart/
Bulk actions are dependent on: #8979
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION
REVIEWERS