Skip to content

Commit

Permalink
fix(ui): Navigate to selected app in table view on Enter press (argop…
Browse files Browse the repository at this point in the history
…roj#6859)

Signed-off-by: Remington Breeze <[email protected]>
  • Loading branch information
rbreeze authored Feb 22, 2022
1 parent 52ba423 commit 13614e8
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {DataLoader, DropDownMenu, Tooltip} from 'argo-ui';
import * as React from 'react';
import {Key, KeybindingContext, useNav} from 'argo-ui/v2';
import {Cluster} from '../../../shared/components';
import {Consumer} from '../../../shared/context';
import {Consumer, Context} from '../../../shared/context';
import * as models from '../../../shared/models';
import {ApplicationURLs} from '../application-urls';
import * as AppUtils from '../utils';
Expand All @@ -19,6 +19,7 @@ export const ApplicationsTable = (props: {
deleteApplication: (appName: string) => any;
}) => {
const [selectedApp, navApp, reset] = useNav(props.applications.length);
const ctxh = React.useContext(Context);

const {useKeybinding} = React.useContext(KeybindingContext);

Expand All @@ -31,6 +32,16 @@ export const ApplicationsTable = (props: {
return selectedApp > -1 ? true : false;
}
});
useKeybinding({
keys: Key.ENTER,
action: () => {
if (selectedApp > -1) {
ctxh.navigation.goto(`/applications/${props.applications[selectedApp].metadata.name}`);
return true;
}
return false;
}
});

return (
<Consumer>
Expand Down

0 comments on commit 13614e8

Please sign in to comment.