Skip to content
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

Merged
merged 4 commits into from
Feb 5, 2020

Conversation

nytai
Copy link
Member

@nytai nytai commented Jan 23, 2020

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

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

Screen Shot 2020-01-22 at 6 46 42 PM

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@codecov-io
Copy link

codecov-io commented Jan 23, 2020

Codecov Report

Merging #8999 into master will increase coverage by 0.12%.
The diff coverage is 74.74%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
...t/assets/src/views/dashboardList/DashboardList.tsx 73.14% <ø> (-0.25%) ⬇️
superset/assets/src/welcome/App.jsx 0% <ø> (ø) ⬆️
superset/assets/src/views/chartList/ChartList.tsx 74.74% <74.74%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6cb4ce0...fd9b315. Read the comment docs.

@nytai nytai changed the title [charts] new, list view (react) [WIP] [charts] new, list view (react) Jan 23, 2020
@nytai nytai marked this pull request as ready for review January 27, 2020 21:30
@nytai nytai force-pushed the tai/charts-list-view branch 2 times, most recently from 9cd3c73 to 3e4f9fb Compare January 28, 2020 23:31
@nytai nytai changed the title [WIP] [charts] new, list view (react) [charts] new, list view (react) Jan 28, 2020
return false;
}

return Boolean(this.state.permissions.find((p) => p === perm));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not a link?

Copy link
Member

@suddjian suddjian Jan 30, 2020

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.

Copy link
Member Author

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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

danger


interface Props {
addDangerToast: (msg: string) => void;
addSuccessToast: (msg: string) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

success

Copy link
Member

@suddjian suddjian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonderful

},
(err: any) => {
console.error(err);
this.props.addDangerToast(t('There was an issue deleting the selected dashboards'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?')}
Copy link
Member

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</>,
Copy link
Member

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?

Copy link
Member

@rusackas rusackas left a 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! 👍

@robdiciuccio
Copy link
Member

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.

@etr2460
Copy link
Member

etr2460 commented Jan 31, 2020

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

Copy link
Member

@etr2460 etr2460 left a 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}`);
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (lastFetchDataConfig) {
this.fetchData(lastFetchDataConfig);
}
this.props.addSuccessToast(t('Deleted') + ` ${slice_name}`);
Copy link
Member

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

@nytai nytai changed the title [charts] new, list view (react) [chart] new, list view (react) Feb 4, 2020
@nytai nytai requested a review from etr2460 February 5, 2020 00:44
@craig-rueda craig-rueda merged commit e5f5eed into apache:master Feb 5, 2020
@craig-rueda craig-rueda deleted the tai/charts-list-view branch February 5, 2020 22:35
@nytai nytai mentioned this pull request Mar 10, 2020
12 tasks
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.36.0 labels Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XL 🚢 0.36.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants