Skip to content

Commit

Permalink
Remove unused canExpand functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
sg00dwin committed Sep 30, 2019
1 parent 84bb7fa commit 49c243a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
13 changes: 0 additions & 13 deletions frontend/__tests__/components/factory/list-page.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,6 @@ describe(FireMan_.displayName, () => {
});
});

it('renders expand button if given `canExpand` true', () => {
wrapper.setProps({ canExpand: true });
expect(
wrapper
.find('.co-m-pane__filter-bar-group')
.not('.co-m-pane__filter-bar-group--filter')
.childAt(0)
.dive()
.find('.compaction-btn')
.exists(),
).toBe(true);
});

it('renders `TextFilter` with given props', () => {
const filterLabel = 'My filter';
wrapper.setProps({ filterLabel });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const PipelinesPage: React.FC<PipelinesPageProps> = ({ namespace }) => {
return namespace ? (
<FireMan
canCreate={false}
canExpand={false}
filterLabel="by name"
textFilter="name"
resources={resources}
Expand Down
27 changes: 1 addition & 26 deletions frontend/public/components/factory/list-page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ import {
RequireCreatePermission,
} from '../utils';

export const CompactExpandButtons = ({ expand = false, onExpandChange = _.noop }) => (
<div className="btn-group btn-group-sm" data-toggle="buttons">
<label className={classNames('btn compaction-btn', expand ? 'btn-default' : 'btn-primary')}>
<input type="radio" onClick={() => onExpandChange(false)} /> Compact
</label>
<label className={classNames('btn compaction-btn', expand ? 'btn-primary' : 'btn-default')}>
<input type="radio" onClick={() => onExpandChange(true)} /> Expand
</label>
</div>
);

/** @type {React.SFC<{disabled?: boolean, label: string, onChange: React.ChangeEventHandler<any>, defaultValue?: string, value?: string}}>} */
export const TextFilter = ({ label, onChange, defaultValue, style, className, value }) => {
const input = React.useRef();
Expand Down Expand Up @@ -132,7 +121,7 @@ ListPageWrapper_.propTypes = {
customData: PropTypes.any,
};

/** @type {React.FC<<WrappedComponent>, {canCreate?: Boolean, canExpand?: Boolean, textFilter:string, createAccessReview?: Object, createButtonText?: String, createProps?: Object, fieldSelector?: String, filterLabel?: String, resources: any, badge?: React.ReactNode}>*/
/** @type {React.FC<<WrappedComponent>, {canCreate?: Boolean, textFilter:string, createAccessReview?: Object, createButtonText?: String, createProps?: Object, fieldSelector?: String, filterLabel?: String, resources: any, badge?: React.ReactNode}>*/
export const FireMan_ = connect(
null,
{ filterList },
Expand Down Expand Up @@ -213,7 +202,6 @@ export const FireMan_ = connect(
const {
autoFocus,
canCreate,
canExpand,
createAccessReview,
createButtonText,
createProps = {},
Expand Down Expand Up @@ -287,14 +275,6 @@ export const FireMan_ = connect(
</div>
)}
{createLink && <div className="co-m-pane__filter-bar-group">{createLink}</div>}
{canExpand && (
<div className="co-m-pane__filter-bar-group">
<CompactExpandButtons
expand={this.state.expand}
onExpandChange={this.onExpandChange}
/>
</div>
)}
<div className="co-m-pane__filter-bar-group co-m-pane__filter-bar-group--filter">
<TextFilter
label={filterLabel}
Expand Down Expand Up @@ -327,7 +307,6 @@ FireMan_.defaultProps = {

FireMan_.propTypes = {
canCreate: PropTypes.bool,
canExpand: PropTypes.bool,
createAccessReview: PropTypes.object,
createButtonText: PropTypes.string,
createProps: PropTypes.object,
Expand Down Expand Up @@ -359,7 +338,6 @@ export const ListPage = withFallback((props) => {
const {
autoFocus,
canCreate,
canExpand,
createButtonText,
createHandler,
fieldSelector,
Expand Down Expand Up @@ -424,7 +402,6 @@ export const ListPage = withFallback((props) => {
<MultiListPage
autoFocus={autoFocus}
canCreate={canCreate}
canExpand={canExpand}
createAccessReview={createAccessReview}
createButtonText={createButtonText || `Create ${label}`}
createProps={createProps}
Expand Down Expand Up @@ -453,7 +430,6 @@ export const MultiListPage = (props) => {
const {
autoFocus,
canCreate,
canExpand,
createAccessReview,
createButtonText,
createProps,
Expand Down Expand Up @@ -484,7 +460,6 @@ export const MultiListPage = (props) => {
<FireMan_
autoFocus={autoFocus}
canCreate={canCreate}
canExpand={canExpand}
createAccessReview={createAccessReview}
createButtonText={createButtonText || 'Create'}
createProps={createProps}
Expand Down

0 comments on commit 49c243a

Please sign in to comment.