Skip to content

Commit

Permalink
feat: store "Group Nodes" button state in application details prefere…
Browse files Browse the repository at this point in the history
…nces (#8036)

Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
  • Loading branch information
Alexander Matyushentsev committed Jan 3, 2022
1 parent 99d1dca commit 3247090
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface ApplicationDetailsState {
revision?: string;
groupedResources?: ResourceStatus[];
slidingPanelPage?: number;
showCompactNodes?: boolean;
}

interface FilterInput {
Expand Down Expand Up @@ -68,7 +67,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{nam

constructor(props: RouteComponentProps<{name: string}>) {
super(props);
this.state = {page: 0, groupedResources: [], slidingPanelPage: 0, showCompactNodes: false};
this.state = {page: 0, groupedResources: [], slidingPanelPage: 0};
}

private get showOperationState() {
Expand Down Expand Up @@ -97,8 +96,8 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{nam
this.setState({slidingPanelPage: 0});
}

private toggleCompactView() {
this.setState({showCompactNodes: !this.state.showCompactNodes});
private toggleCompactView(pref: AppDetailsPreferences) {
services.viewPreferences.updatePreferences({appDetails: {...pref, groupNodes: !pref.groupNodes}});
}

public render() {
Expand Down Expand Up @@ -256,9 +255,9 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{nam
<Filters pref={pref} tree={tree} onSetFilter={setFilter} onClearFilter={clearFilter}>
{pref.view === 'tree' && (
<button
className={`argo-button argo-button--base${!this.state.showCompactNodes ? '-o' : ''}`}
className={`argo-button argo-button--base${!pref.groupNodes ? '-o' : ''}`}
style={{border: 'none', width: '160px'}}
onClick={() => this.toggleCompactView()}>
onClick={() => this.toggleCompactView(pref)}>
<i className={classNames('fa fa-object-group')} style={{width: '15px', marginRight: '5px'}} />
Group Nodes
</button>
Expand All @@ -272,7 +271,7 @@ export class ApplicationDetails extends React.Component<RouteComponentProps<{nam
this.getApplicationActionMenu(application, false)
)
}
showCompactNodes={this.state.showCompactNodes}
showCompactNodes={pref.groupNodes}
tree={tree}
app={application}
showOrphanedResources={pref.orphanedResources}
Expand Down
1 change: 1 addition & 0 deletions ui/src/app/shared/services/view-preferences-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface AppDetailsPreferences {
darkMode: boolean;
followLogs: boolean;
hideFilters: boolean;
groupNodes?: boolean;
}

export interface PodViewPreferences {
Expand Down

0 comments on commit 3247090

Please sign in to comment.