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: Track nodeView tab in URL #5300

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
no storage
Signed-off-by: Simon Behar <[email protected]>
  • Loading branch information
simster7 committed Mar 4, 2021
commit 885ab772f14faa741128deb240979f518c2369d6
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {hasWarningConditionBadge} from '../../../shared/conditions-panel';
import {Context} from '../../../shared/context';
import {historyUrl} from '../../../shared/history';
import {RetryWatch} from '../../../shared/retry-watch';
import {ScopedLocalStorage} from '../../../shared/scoped-local-storage';
import {services} from '../../../shared/services';
import {useQueryParams} from '../../../shared/use-query-params';
import * as Operations from '../../../shared/workflow-operations-map';
Expand Down Expand Up @@ -41,13 +40,12 @@ export const WorkflowDetails = ({history, location, match}: RouteComponentProps<
// boiler-plate
const {navigation, popup} = useContext(Context);
const queryParams = new URLSearchParams(location.search);
const storage = new ScopedLocalStorage('workflow-details');

const [namespace] = useState(match.params.namespace);
const [name, setName] = useState(match.params.name);
const [tab, setTab] = useState(queryParams.get('tab') || 'workflow');
const [nodeId, setNodeId] = useState(queryParams.get('nodeId'));
const [nodePanelView, setNodePanelView] = useState(queryParams.get('nodePanelView') || storage.getItem('nodePanelView', ''));
const [nodePanelView, setNodePanelView] = useState(queryParams.get('nodePanelView'));
const [sidePanel, setSidePanel] = useState(queryParams.get('sidePanel'));

useEffect(
Expand Down Expand Up @@ -260,22 +258,14 @@ export const WorkflowDetails = ({history, location, match}: RouteComponentProps<
)}
</div>
<div className='workflow-details__step-info'>
<button
className='workflow-details__step-info-close'
onClick={() => {
setNodeId(null);
setNodePanelView(null);
}}>
<button className='workflow-details__step-info-close' onClick={() => setNodeId(null)}>
<i className='argo-icon-close' />
</button>
{selectedNode && (
<WorkflowNodeInfo
node={selectedNode}
onTabSelected={selected => {
setNodePanelView(selected);
storage.setItem('nodePanelView', selected, '');
}}
selectedTabKey={nodePanelView || storage.getItem('nodePanelView', '')}
onTabSelected={setNodePanelView}
selectedTabKey={nodePanelView}
workflow={workflow}
links={links}
onShowContainerLogs={(x, container) => setSidePanel(`logs:${x}:${container}`)}
Expand Down