mirror of
https://github.com/weaveworks/scope.git
synced 2026-05-05 16:59:36 +00:00
Add a confirmation dialog for deleting a pod.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { isEmpty } from 'lodash';
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { trackAnalyticsEvent } from '../../utils/tracking-utils';
|
||||
@@ -25,9 +26,11 @@ class NodeDetailsControlButton extends React.Component {
|
||||
|
||||
handleClick(ev) {
|
||||
ev.preventDefault();
|
||||
const { id, human } = this.props.control;
|
||||
const { id, human, confirmation } = this.props.control;
|
||||
trackAnalyticsEvent('scope.node.control.click', { id, title: human });
|
||||
this.props.dispatch(doControl(this.props.nodeId, this.props.control));
|
||||
if (isEmpty(confirmation) || window.confirm(confirmation)) { // eslint-disable-line no-alert
|
||||
this.props.dispatch(doControl(this.props.nodeId, this.props.control));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,14 @@ export default function NodeDetailsControls({
|
||||
</div>
|
||||
}
|
||||
<span className="node-details-controls-buttons">
|
||||
{sortBy(controls, 'rank').map(control => (<NodeDetailsControlButton
|
||||
nodeId={nodeId}
|
||||
control={control}
|
||||
pending={pending}
|
||||
key={control.id} />))}
|
||||
{sortBy(controls, 'rank').map(control => (
|
||||
<NodeDetailsControlButton
|
||||
nodeId={nodeId}
|
||||
control={control}
|
||||
pending={pending}
|
||||
key={control.id}
|
||||
/>
|
||||
))}
|
||||
</span>
|
||||
{controls && <span title="Applying..." className={spinnerClassName} />}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user