mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 19:00:09 -04:00
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { react2angular } from 'react2angular';
|
|
import Button from 'antd/lib/button';
|
|
import Badge from 'antd/lib/badge';
|
|
import Tooltip from 'antd/lib/tooltip';
|
|
import { KeyboardShortcuts } from '@/services/keyboard-shortcuts';
|
|
|
|
function ParameterApplyButton({ paramCount, onClick, isApplying }) {
|
|
// show spinner when applying (also when count is empty so the fade out is consistent)
|
|
const icon = isApplying || !paramCount ? 'spinner fa-pulse' : 'check';
|
|
|
|
return (
|
|
<div className="parameter-apply-button" data-show={!!paramCount} data-test="ParameterApplyButton">
|
|
<Badge count={paramCount}>
|
|
<Tooltip title={`${KeyboardShortcuts.modKey} + Enter`}>
|
|
<span>
|
|
<Button onClick={onClick}>
|
|
<i className={`fa fa-${icon}`} /> Apply Changes
|
|
</Button>
|
|
</span>
|
|
</Tooltip>
|
|
</Badge>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
ParameterApplyButton.propTypes = {
|
|
onClick: PropTypes.func.isRequired,
|
|
paramCount: PropTypes.number.isRequired,
|
|
isApplying: PropTypes.bool.isRequired,
|
|
};
|
|
|
|
export default function init(ngModule) {
|
|
ngModule.component('parameterApplyButton', react2angular(ParameterApplyButton));
|
|
}
|
|
|
|
init.init = true;
|