mirror of
https://github.com/getredash/redash.git
synced 2026-03-23 04:00:09 -04:00
* Start Parameters Migration * Add dirtyCount * Use workaround with setState * Apply Changes * Add EditSettingsDialog * Add Cmd/Ctrl + Enter behavior * Remove isApplying * Delete Angular version of parameters * Update tests * Remove angular stuff * Update jest * Drag placeholder * Update events * Use old button styling and move css * Reviewing code * Add parameter rearrange test * Add Parameter Settings title change test * Update Parameter Settings button styling * Move parameter url logic back to Parameters * Disable url update when query is new * Styling changes (#4019) * Ran's title width styling * Update drag test * Improve sizing for Number inputs Co-Authored-By: Ran Byron <ranbena@gmail.com> * Fix issue with dragged parameter wrapping Co-Authored-By: Ran Byron <ranbena@gmail.com> * Don't reevaluate dirtyParamCount * Allow multiple values :) * Fix parameter alignments * Fix Select width on search * Update client/app/components/Parameters.less Co-Authored-By: Ran Byron <ranbena@gmail.com> * Humanize param.name * Make sure angular updates Execute disabled status
33 lines
1009 B
JavaScript
33 lines
1009 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
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 }) {
|
|
// show spinner when count is empty so the fade out is consistent
|
|
const icon = !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,
|
|
};
|
|
|
|
export default ParameterApplyButton;
|