Commit f7f124c5 by ryan

reuse deprecationWarning

parent d13eebfe
import propDeprecationWarning from '../../utils/propDeprecationWarning';
import deprecationWarning from '../../utils/deprecationWarning';
import { ColorPickerProps } from './ColorPickerPopover';
export const warnAboutColorPickerPropsDeprecation = (componentName: string, props: ColorPickerProps) => {
const { onColorChange } = props;
if (onColorChange) {
propDeprecationWarning(componentName, 'onColorChange', 'onChange');
deprecationWarning(componentName, 'onColorChange', 'onChange');
}
};
const deprecationWarning = (file: string, oldName: string, newName: string) => {
const message = `[Deprecation warning] ${file}: ${oldName} is deprecated. Use ${newName} instead`;
console.warn(message);
};
export default deprecationWarning;
......@@ -3,4 +3,5 @@ export * from './valueFormats/valueFormats';
export * from './colors';
export * from './namedColorsPalette';
export * from './string';
export * from './deprecationWarning';
export { getMappedValue } from './valueMappings';
const propDeprecationWarning = (componentName: string, propName: string, newPropName: string) => {
const message = `[Deprecation warning] ${componentName}: ${propName} is deprecated. Use ${newPropName} instead`;
console.warn(message);
};
export default propDeprecationWarning;
import _ from 'lodash';
import { getValueFormat, getValueFormatterIndex, getValueFormats, stringToJsRegex } from '@grafana/ui';
import deprecationWarning from '@grafana/ui/src/utils/deprecationWarning';
const kbn: any = {};
......@@ -230,7 +231,7 @@ kbn.slugifyForUrl = str => {
/** deprecated since 6.1, use grafana/ui */
kbn.stringToJsRegex = str => {
console.warn('Migrate stringToJsRegex to grafana/ui, ');
deprecationWarning('kbn.ts', 'kbn.stringToJsRegex()', '@grafana/ui');
return stringToJsRegex(str);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment