mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 09:41:57 +00:00
Added control to reset local view state
This commit is contained in:
@@ -11,6 +11,7 @@ import { doControlRequest, getAllNodes, getNodesDelta, getNodeDetails,
|
||||
getTopologies, deletePipe } from '../utils/web-api-utils';
|
||||
import { getActiveTopologyOptions,
|
||||
getCurrentTopologyUrl } from '../utils/topology-utils';
|
||||
import { storageSet } from '../utils/storage-utils';
|
||||
|
||||
const log = debug('scope:app-actions');
|
||||
|
||||
@@ -665,3 +666,10 @@ export function route(urlState) {
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export function resetLocalViewState() {
|
||||
return (dispatch) => {
|
||||
dispatch({type: ActionTypes.RESET_LOCAL_VIEW_STATE});
|
||||
storageSet('scopeViewState', '');
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { connect } from 'react-redux';
|
||||
|
||||
import { searchableFieldsSelector } from '../selectors/chartSelectors';
|
||||
import { CANVAS_MARGINS } from '../constants/styles';
|
||||
import { hideHelp } from '../actions/app-actions';
|
||||
import { hideHelp, resetLocalViewState } from '../actions/app-actions';
|
||||
|
||||
|
||||
const GENERAL_SHORTCUTS = [
|
||||
@@ -149,7 +149,7 @@ function renderFieldsPanel(currentTopologyName, searchableFields) {
|
||||
}
|
||||
|
||||
|
||||
function HelpPanel({currentTopologyName, searchableFields, onClickClose}) {
|
||||
function HelpPanel({currentTopologyName, searchableFields, onClickClose, onClickReset}) {
|
||||
return (
|
||||
<div className="help-panel-wrapper">
|
||||
<div className="help-panel" style={{marginTop: CANVAS_MARGINS.top}}>
|
||||
@@ -161,8 +161,19 @@ function HelpPanel({currentTopologyName, searchableFields, onClickClose}) {
|
||||
{renderSearchPanel()}
|
||||
{renderFieldsPanel(currentTopologyName, searchableFields)}
|
||||
</div>
|
||||
<div className="help-panel-controls">
|
||||
<span
|
||||
title="Reset view state"
|
||||
className="fa fa-trash-o"
|
||||
onClick={onClickReset}
|
||||
/>
|
||||
</div>
|
||||
<div className="help-panel-tools">
|
||||
<span title="Close details" className="fa fa-close" onClick={onClickClose} />
|
||||
<span
|
||||
title="Close details"
|
||||
className="fa fa-close"
|
||||
onClick={onClickClose}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -178,4 +189,7 @@ function mapStateToProps(state) {
|
||||
}
|
||||
|
||||
|
||||
export default connect(mapStateToProps, { onClickClose: hideHelp })(HelpPanel);
|
||||
export default connect(mapStateToProps, {
|
||||
onClickClose: hideHelp,
|
||||
onClickReset: resetLocalViewState
|
||||
})(HelpPanel);
|
||||
|
||||
@@ -45,6 +45,7 @@ const ACTION_TYPES = [
|
||||
'RECEIVE_TOPOLOGIES',
|
||||
'RECEIVE_API_DETAILS',
|
||||
'RECEIVE_ERROR',
|
||||
'RESET_LOCAL_VIEW_STATE',
|
||||
'ROUTE_TOPOLOGY',
|
||||
'SELECT_METRIC',
|
||||
'SHOW_HELP',
|
||||
|
||||
@@ -624,11 +624,13 @@ h2 {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
&-tools {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 8px;
|
||||
|
||||
|
||||
> span {
|
||||
.btn-opacity;
|
||||
padding: 4px 5px;
|
||||
@@ -1586,6 +1588,26 @@ h2 {
|
||||
border-color: rgba(131, 131, 172, 0.6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&-controls {
|
||||
border: 1px solid #fff;
|
||||
border-radius: 10%;
|
||||
position: absolute;
|
||||
left: 100px;
|
||||
top: 95%;
|
||||
font-size: 20px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
transition: all 0.2s ease-in-out;
|
||||
line-height: 30px;
|
||||
text-align: center;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
border: 1px solid #d0d0d0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user