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

feat: store "Group Nodes" button state in application details preferences #8036

Merged
merged 1 commit into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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