mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Disable detail panel link
The link is disabled if the `monitor` flag is not true. If Weave Cloud runs without Monitor, the link is dead. The flag allows to pass Weave Cloud's Monitor state down to Scope.
This commit is contained in:
@@ -869,3 +869,10 @@ export function getImagesForService(orgId, serviceId) {
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function setMonitorState(monitor) {
|
||||
return {
|
||||
type: ActionTypes.MONITOR_STATE,
|
||||
monitor
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
unpinMetric,
|
||||
toggleHelp,
|
||||
setGraphView,
|
||||
setMonitorState,
|
||||
setTableView,
|
||||
setResourceView,
|
||||
shutdown,
|
||||
@@ -63,6 +64,8 @@ class App extends React.Component {
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
this.props.dispatch(setMonitorState(this.props.monitor));
|
||||
|
||||
this.setViewportDimensions = this.setViewportDimensions.bind(this);
|
||||
this.handleResize = debounce(this.setViewportDimensions, VIEWPORT_RESIZE_DEBOUNCE_INTERVAL);
|
||||
|
||||
@@ -257,4 +260,8 @@ function mapStateToProps(state) {
|
||||
};
|
||||
}
|
||||
|
||||
App.defaultProps = {
|
||||
monitor: false
|
||||
};
|
||||
|
||||
export default connect(mapStateToProps)(App);
|
||||
|
||||
@@ -65,12 +65,12 @@ class NodeDetailsHealthLinkItem extends React.Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
id, url, pausedAt, ...props
|
||||
id, url, monitor, pausedAt, ...props
|
||||
} = this.props;
|
||||
const metricColor = getMetricColor(id);
|
||||
const labelColor = this.state.hovered && !props.valueEmpty && darkenColor(metricColor);
|
||||
|
||||
const timedUrl = appendTime(url, pausedAt);
|
||||
const timedUrl = monitor === true ? appendTime(url, pausedAt) : '';
|
||||
|
||||
return (
|
||||
<CloudLink
|
||||
@@ -95,6 +95,7 @@ class NodeDetailsHealthLinkItem extends React.Component {
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
pausedAt: state.get('pausedAt'),
|
||||
monitor: state.get('monitor'),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ const ACTION_TYPES = [
|
||||
'JUMP_TO_TIME',
|
||||
'LEAVE_EDGE',
|
||||
'LEAVE_NODE',
|
||||
'MONITOR_STATE',
|
||||
'OPEN_WEBSOCKET',
|
||||
'PAUSE_TIME_AT_NOW',
|
||||
'PIN_METRIC',
|
||||
|
||||
@@ -768,6 +768,10 @@ export function rootReducer(state = initialState, action) {
|
||||
});
|
||||
}
|
||||
|
||||
case ActionTypes.MONITOR_STATE: {
|
||||
return state.set('monitor', action.monitor);
|
||||
}
|
||||
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user