-
Notifications
You must be signed in to change notification settings - Fork 903
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core/delivery): Convert execution filters to React (#4197)
- Loading branch information
1 parent
ba3bc8f
commit e3384e3
Showing
14 changed files
with
377 additions
and
339 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
app/scripts/modules/core/src/cluster/filter/FilterSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as React from 'react'; | ||
import { BindAll } from 'lodash-decorators'; | ||
|
||
import { HelpField } from 'core/help/HelpField'; | ||
|
||
export interface IFilterSectionProps { | ||
heading: string; | ||
expanded?: boolean; | ||
helpKey?: string; | ||
} | ||
|
||
export interface IFilterSectionState { | ||
expanded: boolean; | ||
} | ||
|
||
@BindAll() | ||
export class FilterSection extends React.Component<IFilterSectionProps, IFilterSectionState> { | ||
constructor(props: IFilterSectionProps) { | ||
super(props); | ||
this.state = { expanded: props.expanded }; | ||
} | ||
|
||
public getIcon() { | ||
return this.state.expanded ? 'down' : 'right'; | ||
} | ||
|
||
public toggle() { | ||
this.setState({ expanded: !this.state.expanded }); | ||
} | ||
|
||
public render() { | ||
return ( | ||
<div className="collapsible-filter-section"> | ||
<div className="section-heading clickable" onClick={this.toggle}> | ||
<h4> | ||
<span className={`glyphicon glyphicon-chevron-${this.getIcon()}`}/> | ||
{` ${this.props.heading}`} | ||
{this.props.helpKey && (<span> <HelpField id={this.props.helpKey} placement="right"/></span>)} | ||
</h4> | ||
</div> | ||
{ this.state.expanded && ( | ||
<div className="content-body"> | ||
{this.props.children} | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} | ||
} |
11 changes: 6 additions & 5 deletions
11
app/scripts/modules/core/src/cluster/filter/clusterFilter.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.