Skip to content

Commit

Permalink
Merge commit 'c14a06db4185b9b043116708b649b0be2ad17a1f' into superset…
Browse files Browse the repository at this point in the history
…_additions

* commit 'c14a06db4185b9b043116708b649b0be2ad17a1f':
  Revert "style: fix checkbox color (#10970)"
  feat: add "created by" to dashboard CRUD view (#11030)
  Changed `tags.py` and `helpers.py` in `models` module: removed disabled pylint rule `unused_import`, changed unused arguments to private and removed disabled rule `unused-argument. Removed redundant rules.` (#11037)
  chore: updated lint rules in models module (#11036)
  Removed disable global pytlint rule `standarderror-builtin` which isn't appearing for Python3 (#11038)
  Enabled argument-differ for bulk_delete (#11039)
  Enabled no-self-use pylint rule in security. Formatter (#11041)
  Changed variable name from capitals to lowercase and changed lint rule (#11044)
  Revert "ESLint: Re-enable rule default-props-match-prop-types (#10868)" (#11050)
  feat(saved_queries): add custom api filter for all string & text fields (#11031)
  Support jinja templates (#11008)
  • Loading branch information
rorymillersoft committed Oct 23, 2020
2 parents 4b180eb + c14a06d commit 1ac9518
Show file tree
Hide file tree
Showing 43 changed files with 368 additions and 112 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=standarderror-builtin,long-builtin,dict-view-method,intern-builtin,suppressed-message,no-absolute-import,unpacking-in-except,apply-builtin,delslice-method,indexing-exception,old-raise-syntax,print-statement,cmp-builtin,reduce-builtin,useless-suppression,coerce-method,input-builtin,cmp-method,raw_input-builtin,nonzero-method,backtick,basestring-builtin,setslice-method,reload-builtin,oct-method,map-builtin-not-iterating,execfile-builtin,old-octal-literal,zip-builtin-not-iterating,buffer-builtin,getslice-method,metaclass-assignment,xrange-builtin,long-suffix,round-builtin,range-builtin-not-iterating,next-method-called,parameter-unpacking,unicode-builtin,unichr-builtin,import-star-module-level,raising-string,filter-builtin-not-iterating,using-cmp-argument,coerce-builtin,file-builtin,old-division,hex-method,missing-docstring,too-many-lines,ungrouped-imports,import-outside-toplevel,raise-missing-from,super-with-arguments,bad-option-value
disable=long-builtin,dict-view-method,intern-builtin,suppressed-message,no-absolute-import,unpacking-in-except,apply-builtin,delslice-method,indexing-exception,old-raise-syntax,print-statement,cmp-builtin,reduce-builtin,useless-suppression,coerce-method,input-builtin,cmp-method,raw_input-builtin,nonzero-method,backtick,basestring-builtin,setslice-method,reload-builtin,oct-method,map-builtin-not-iterating,execfile-builtin,old-octal-literal,zip-builtin-not-iterating,buffer-builtin,getslice-method,metaclass-assignment,xrange-builtin,long-suffix,round-builtin,range-builtin-not-iterating,next-method-called,parameter-unpacking,unicode-builtin,unichr-builtin,import-star-module-level,raising-string,filter-builtin-not-iterating,using-cmp-argument,coerce-builtin,file-builtin,old-division,hex-method,missing-docstring,too-many-lines,ungrouped-imports,import-outside-toplevel,raise-missing-from,super-with-arguments,bad-option-value


[REPORTS]
Expand Down
2 changes: 2 additions & 0 deletions superset-frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ module.exports = {
'padded-blocks': 0,
'prefer-arrow-callback': 0,
'prefer-destructuring': ['error', { object: true, array: false }],
'react/default-props-match-prop-types': 0, // disabled temporarily
'react/destructuring-assignment': 0, // re-enable up for discussion
'react/forbid-prop-types': 0,
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
Expand Down Expand Up @@ -232,6 +233,7 @@ module.exports = {
'prefer-arrow-callback': 0,
'prefer-object-spread': 1,
'prefer-destructuring': ['error', { object: true, array: false }],
'react/default-props-match-prop-types': 0, // disabled temporarily
'react/destructuring-assignment': 0, // re-enable up for discussion
'react/forbid-prop-types': 0,
'react/jsx-filename-extension': [1, { extensions: ['.jsx', '.tsx'] }],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
import { DASHBOARD_LIST } from './dashboard_list.helper';

describe('dashboard filters', () => {
describe('dashboard filters card view', () => {
beforeEach(() => {
cy.login();
cy.server();
Expand All @@ -36,14 +36,63 @@ describe('dashboard filters', () => {
cy.get('.ant-card').should('not.exist');
});

it('should filter by created by correctly', () => {
// filter by created by
cy.get('.Select__control').eq(1).click();
cy.get('.Select__menu').contains('alpha user').click();
cy.get('.ant-card').should('not.exist');
cy.get('.Select__control').eq(1).click();
cy.get('.Select__menu').contains('gamma user').click();
cy.get('.ant-card').should('not.exist');
});

it('should filter by published correctly', () => {
// filter by published
cy.get('.Select__control').eq(1).click();
cy.get('.Select__control').eq(2).click();
cy.get('.Select__menu').contains('Published').click();
cy.get('.ant-card').should('have.length', 2);
cy.get('.ant-card').first().contains('USA Births Names').should('exist');
cy.get('.Select__control').eq(1).click();
cy.get('.Select__control').eq(1).type('unpub{enter}');
cy.get('.Select__control').eq(2).click();
cy.get('.Select__control').eq(2).type('unpub{enter}');
cy.get('.ant-card').should('have.length', 2);
});
});

describe('dashboard filters list view', () => {
beforeEach(() => {
cy.login();
cy.server();
cy.visit(DASHBOARD_LIST);
});

it('should filter by owners correctly', () => {
// filter by owners
cy.get('.Select__control').first().click();
cy.get('.Select__menu').contains('alpha user').click();
cy.get('.table-row').should('not.exist');
cy.get('.Select__control').first().click();
cy.get('.Select__menu').contains('gamma user').click();
cy.get('.table-row').should('not.exist');
});

it('should filter by created by correctly', () => {
// filter by created by
cy.get('.Select__control').eq(1).click();
cy.get('.Select__menu').contains('alpha user').click();
cy.get('.table-row').should('not.exist');
cy.get('.Select__control').eq(1).click();
cy.get('.Select__menu').contains('gamma user').click();
cy.get('.table-row').should('not.exist');
});

it('should filter by published correctly', () => {
// filter by published
cy.get('.Select__control').eq(2).click();
cy.get('.Select__menu').contains('Published').click();
cy.get('.table-row').should('have.length', 2);
cy.get('.table-row').first().contains('USA Births Names').should('exist');
cy.get('.Select__control').eq(2).click();
cy.get('.Select__control').eq(2).type('unpub{enter}');
cy.get('.table-row').should('have.length', 2);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,22 @@ describe('dashboard list view', () => {
cy.get('table[role="table"]').should('be.visible');
// check dashboard list view header
cy.get('th[role="columnheader"]:nth-child(2)').contains('Title');
cy.get('th[role="columnheader"]:nth-child(3)').contains('Owners');
cy.get('th[role="columnheader"]:nth-child(4)').contains('Modified By');
cy.get('th[role="columnheader"]:nth-child(5)').contains('Published');
cy.get('th[role="columnheader"]:nth-child(6)').contains('Modified');
cy.get('th[role="columnheader"]:nth-child(7)').contains('Actions');
cy.get('th[role="columnheader"]:nth-child(3)').contains('Modified By');
cy.get('th[role="columnheader"]:nth-child(4)').contains('Published');
cy.get('th[role="columnheader"]:nth-child(5)').contains('Modified');
cy.get('th[role="columnheader"]:nth-child(6)').contains('Created By');
cy.get('th[role="columnheader"]:nth-child(7)').contains('Owners');
cy.get('th[role="columnheader"]:nth-child(8)').contains('Actions');
cy.get('.table-row').should('have.length', 4);
});

it('should sort correctly', () => {
cy.get('th[role="columnheader"]:nth-child(2)').click();
cy.get('.table-row td:nth-child(2):eq(0)').contains('Tabbed Dashboard');
cy.get('th[role="columnheader"]:nth-child(3)').click();
cy.get('.table-row td:nth-child(2):eq(0)').contains('Tabbed Dashboard');
cy.get('th[role="columnheader"]:nth-child(5)').click();
cy.get('.table-row td:nth-child(2):eq(0)').contains("World Bank's Data");
cy.get('th[role="columnheader"]:nth-child(6)').click();
cy.get('.table-row td:nth-child(2):eq(0)').contains("World Bank's Data");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ describe('DashboardBuilder', () => {
dashboardLayout,
deleteTopLevelTabs() {},
editMode: false,
showBuilderPane() {},
setColorSchemeAndUnsavedChanges() {},
colorScheme: undefined,
handleComponentDrop() {},
setDirectPathToChild: sinon.spy(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import React from 'react';
import sinon from 'sinon';
import { shallow, mount } from 'enzyme';

import { supersetTheme, ThemeProvider } from '@superset-ui/core';

import CheckboxControl from 'src/explore/components/controls/CheckboxControl';
import ControlHeader from 'src/explore/components/ControlHeader';
import Checkbox from 'src/components/Checkbox';
Expand Down Expand Up @@ -50,10 +48,7 @@ describe('CheckboxControl', () => {
});

it('Checks the box when the label is clicked', () => {
const fullComponent = mount(<CheckboxControl {...defaultProps} />, {
wrappingComponent: ThemeProvider,
wrappingComponentProps: { theme: supersetTheme },
});
const fullComponent = mount(<CheckboxControl {...defaultProps} />);

const spy = sinon.spy(fullComponent.instance(), 'onChange');

Expand Down
3 changes: 2 additions & 1 deletion superset-frontend/src/CRUD/Field.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ const propTypes = {
compact: PropTypes.bool,
};
const defaultProps = {
controlProps: {},
onChange: () => {},
compact: false,
description: null,
desc: null,
};

export default class Field extends React.PureComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const propTypes = {
templateParams: PropTypes.string,
};

const defaultProps = {
vizRequest: {},
};

class ExploreCtasResultsButton extends React.PureComponent {
constructor(props) {
super(props);
Expand Down Expand Up @@ -109,6 +113,7 @@ class ExploreCtasResultsButton extends React.PureComponent {
}
}
ExploreCtasResultsButton.propTypes = propTypes;
ExploreCtasResultsButton.defaultProps = defaultProps;

function mapStateToProps({ sqlLab, common }) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import TableSelector from '../../components/TableSelector';

const propTypes = {
queryEditor: PropTypes.object.isRequired,
height: PropTypes.number,
height: PropTypes.number.isRequired,
tables: PropTypes.array,
actions: PropTypes.object,
database: PropTypes.object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const propTypes = {
};

const defaultProps = {
label: null,
description: null,
onChange: () => {},
code: '{}',
};
Expand Down
11 changes: 2 additions & 9 deletions superset-frontend/src/components/Checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,15 @@ interface CheckboxProps {
}

const Styles = styled.span`
cursor: pointer;
&.primary {
color: ${({ theme }) => theme.colors.primary.base};
}
&.grayscale {
color: ${({ theme }) => theme.colors.grayscale.light1};
}
svg {
&,
& svg {
vertical-align: top;
}
`;

export default function Checkbox({ checked, onChange, style }: CheckboxProps) {
return (
<Styles
className={checked ? 'primary' : 'grayscale'}
style={style}
onClick={() => {
onChange(!checked);
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/components/CheckboxIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const CheckboxChecked = () => (
>
<path
d="M16 0H2C0.89 0 0 0.9 0 2V16C0 17.1 0.89 18 2 18H16C17.11 18 18 17.1 18 16V2C18 0.9 17.11 0 16 0Z"
fill="currentColor"
fill="#00A699"
/>
<path d="M7 14L2 9L3.41 7.59L7 11.17L14.59 3.58L16 5L7 14Z" fill="white" />
</svg>
Expand All @@ -44,7 +44,7 @@ export const CheckboxHalfChecked = () => (
>
<path
d="M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z"
fill="currentColor"
fill="#999999"
/>
<path d="M14 10H4V8H14V10Z" fill="white" />
</svg>
Expand All @@ -60,7 +60,7 @@ export const CheckboxUnchecked = () => (
>
<path
d="M16 0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H16C17.1 18 18 17.1 18 16V2C18 0.9 17.1 0 16 0Z"
fill="currentColor"
fill="#CCCCCC"
/>
<path d="M16 2V16H2V2H16V2Z" fill="white" />
</svg>
Expand Down
5 changes: 5 additions & 0 deletions superset-frontend/src/components/Hotkeys.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const propTypes = {
placement: PropTypes.string,
};

const defaultProps = {
hotkeys: [],
};

export default class Hotkeys extends React.PureComponent {
componentDidMount() {
this.props.hotkeys.forEach(keyConfig => {
Expand Down Expand Up @@ -82,3 +86,4 @@ export default class Hotkeys extends React.PureComponent {
}

Hotkeys.propTypes = propTypes;
Hotkeys.defaultProps = defaultProps;
3 changes: 2 additions & 1 deletion superset-frontend/src/components/ListView/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export interface Filter {
| 'rel_m_m'
| 'rel_o_m'
| 'title_or_slug'
| 'name_or_description';
| 'name_or_description'
| 'all_text';
input?: 'text' | 'textarea' | 'select' | 'checkbox' | 'search';
unfilteredLabel?: string;
selects?: SelectOption[];
Expand Down
6 changes: 3 additions & 3 deletions superset-frontend/src/components/Select/OnPasteSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ export default class OnPasteSelect extends React.Component {
}

OnPasteSelect.propTypes = {
separator: PropTypes.array,
separator: PropTypes.array.isRequired,
selectWrap: PropTypes.elementType,
selectRef: PropTypes.func,
onChange: PropTypes.func.isRequired,
valueKey: PropTypes.string,
labelKey: PropTypes.string,
valueKey: PropTypes.string.isRequired,
labelKey: PropTypes.string.isRequired,
options: PropTypes.array,
isMulti: PropTypes.bool,
value: PropTypes.any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import { getCategoricalSchemeRegistry, t } from '@superset-ui/core';
import ColorSchemeControl from 'src/explore/components/controls/ColorSchemeControl';

const propTypes = {
onChange: PropTypes.func,
onChange: PropTypes.func.isRequired,
colorScheme: PropTypes.string,
};

const defaultProps = {
onChange: () => {},
colorScheme: undefined,
onChange: () => {},
};

class ColorSchemeControlWrapper extends React.PureComponent {
Expand Down
17 changes: 16 additions & 1 deletion superset-frontend/src/dashboard/components/DashboardBuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,19 @@ const propTypes = {
dashboardLayout: PropTypes.object.isRequired,
deleteTopLevelTabs: PropTypes.func.isRequired,
editMode: PropTypes.bool.isRequired,
showBuilderPane: PropTypes.func.isRequired,
colorScheme: PropTypes.string,
setColorSchemeAndUnsavedChanges: PropTypes.func.isRequired,
handleComponentDrop: PropTypes.func.isRequired,
directPathToChild: PropTypes.arrayOf(PropTypes.string),
setDirectPathToChild: PropTypes.func.isRequired,
setMountedTab: PropTypes.func.isRequired,
};

const defaultProps = {
showBuilderPane: false,
directPathToChild: [],
colorScheme: undefined,
};

class DashboardBuilder extends React.Component {
Expand Down Expand Up @@ -150,7 +155,14 @@ class DashboardBuilder extends React.Component {
}

render() {
const { handleComponentDrop, dashboardLayout, editMode } = this.props;
const {
handleComponentDrop,
dashboardLayout,
editMode,
showBuilderPane,
setColorSchemeAndUnsavedChanges,
colorScheme,
} = this.props;
const { tabIndex } = this.state;
const dashboardRoot = dashboardLayout[DASHBOARD_ROOT_ID];
const rootChildId = dashboardRoot.children[0];
Expand Down Expand Up @@ -260,6 +272,9 @@ class DashboardBuilder extends React.Component {
{editMode && (
<BuilderComponentPane
topOffset={HEADER_HEIGHT + (topLevelTabs ? TABS_HEIGHT : 0)}
showBuilderPane={showBuilderPane}
setColorSchemeAndUnsavedChanges={setColorSchemeAndUnsavedChanges}
colorScheme={colorScheme}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import '../stylesheets/buttons.less';

const propTypes = {
dashboardId: PropTypes.number.isRequired,
show: PropTypes.bool,
show: PropTypes.bool.isRequired,
onHide: PropTypes.func,
colorScheme: PropTypes.object,
setColorSchemeAndUnsavedChanges: PropTypes.func,
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/dashboard/components/SliceAdder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const propTypes = {
lastUpdated: PropTypes.number.isRequired,
errorMessage: PropTypes.string,
userId: PropTypes.string.isRequired,
selectedSliceIds: PropTypes.arrayOf(PropTypes.number),
selectedSliceIds: PropTypes.arrayOf(PropTypes.number).isRequired,
editMode: PropTypes.bool,
height: PropTypes.number,
};
Expand Down
1 change: 1 addition & 0 deletions superset-frontend/src/dashboard/components/SliceHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const propTypes = {
const defaultProps = {
innerRef: null,
forceRefresh: () => ({}),
removeSlice: () => ({}),
updateSliceName: () => ({}),
toggleExpandSlice: () => ({}),
exploreChart: () => ({}),
Expand Down
Loading

0 comments on commit 1ac9518

Please sign in to comment.