Remove Value/renderValue public API from "flipper"

Summary:
Moving Value/renderValue API to "database" plugin as these APIs used exclusively by this plugin.

Alternative to that could be moving this API to "flipper-plugin" instead, but I think it doesn't make sense to expose public API which is only used in one plugin.

Reviewed By: mweststrate

Differential Revision: D28110483

fbshipit-source-id: 1576444681c1e0531fe45f0c15f442d65a28f803
This commit is contained in:
Anton Nikolaev
2021-04-30 09:36:51 -07:00
committed by Facebook GitHub Bot
parent 23102b1997
commit 368dd4a5ab
11 changed files with 18 additions and 24 deletions

View File

@@ -87,11 +87,6 @@ export {
default as ManagedTable_immutable, default as ManagedTable_immutable,
ManagedTableProps_immutable, ManagedTableProps_immutable,
} from './ui/components/table/ManagedTable_immutable'; } from './ui/components/table/ManagedTable_immutable';
export {
Value,
renderValue,
valueToNullableString,
} from './ui/components/table/TypeBasedValueRenderer';
export { export {
DataValueExtractor, DataValueExtractor,
DataInspectorExpanded, DataInspectorExpanded,

View File

@@ -40,9 +40,6 @@ export {ManagedTableProps} from './components/table/ManagedTable';
export {default as ManagedTable_immutable} from './components/table/ManagedTable_immutable'; export {default as ManagedTable_immutable} from './components/table/ManagedTable_immutable';
export {ManagedTableProps_immutable} from './components/table/ManagedTable_immutable'; export {ManagedTableProps_immutable} from './components/table/ManagedTable_immutable';
export {Value} from './components/table/TypeBasedValueRenderer';
export {renderValue} from './components/table/TypeBasedValueRenderer';
export {DataValueExtractor, DataInspectorExpanded} from 'flipper-plugin'; export {DataValueExtractor, DataInspectorExpanded} from 'flipper-plugin';
export {DataInspector as ManagedDataInspector} from 'flipper-plugin'; export {DataInspector as ManagedDataInspector} from 'flipper-plugin';
export {default as SearchableDataInspector} from './components/data-inspector/SearchableDataInspector'; export {default as SearchableDataInspector} from './components/data-inspector/SearchableDataInspector';

View File

@@ -7,7 +7,7 @@
* @format * @format
*/ */
import {Value} from 'flipper'; import {Value} from './TypeBasedValueRenderer';
type DatabaseListRequest = {}; type DatabaseListRequest = {};

View File

@@ -13,14 +13,17 @@ import {
DetailSidebar, DetailSidebar,
Panel, Panel,
ManagedDataInspector, ManagedDataInspector,
Value,
valueToNullableString,
renderValue,
styled, styled,
produce, produce,
colors, colors,
} from 'flipper'; } from 'flipper';
import {
Value,
valueToNullableString,
renderValue,
} from './TypeBasedValueRenderer';
import {Button} from 'antd'; import {Button} from 'antd';
type TableRow = { type TableRow = {

View File

@@ -7,7 +7,7 @@
* @format * @format
*/ */
import {Value, renderValue} from 'flipper'; import {Value, renderValue} from './TypeBasedValueRenderer';
import {DataTable, DataTableColumn, Layout, useMemoize} from 'flipper-plugin'; import {DataTable, DataTableColumn, Layout, useMemoize} from 'flipper-plugin';
import React from 'react'; import React from 'react';
import {Structure} from './index'; import {Structure} from './index';

View File

@@ -8,10 +8,12 @@
*/ */
import {default as styled} from '@emotion/styled'; import {default as styled} from '@emotion/styled';
import {colors} from '../colors'; import {theme} from 'flipper-plugin';
import {default as Text} from '../Text'; import {Typography} from 'antd';
import React from 'react'; import React from 'react';
const {Text} = Typography;
export type Value = export type Value =
| { | {
type: 'string' | 'blob'; type: 'string' | 'blob';
@@ -52,7 +54,7 @@ const BooleanValue = styled(NonWrappingText)<{active?: boolean}>((props) => ({
width: 8, width: 8,
height: 8, height: 8,
borderRadius: 4, borderRadius: 4,
backgroundColor: props.active ? colors.green : colors.red, backgroundColor: props.active ? theme.successColor : theme.errorColor,
marginRight: 5, marginRight: 5,
marginTop: 1, marginTop: 1,
}, },
@@ -68,9 +70,7 @@ export function renderValue(val: Value, wordWrap?: boolean) {
switch (val.type) { switch (val.type) {
case 'boolean': case 'boolean':
return ( return (
<BooleanValue code={true} active={val.value}> <BooleanValue active={val.value}>{val.value.toString()}</BooleanValue>
{val.value.toString()}
</BooleanValue>
); );
case 'blob': case 'blob':
case 'string': case 'string':

View File

@@ -7,7 +7,7 @@
* @format * @format
*/ */
import {Value} from 'flipper'; import {Value} from './TypeBasedValueRenderer';
const INT_DATA_TYPE = ['INTEGER', 'LONG', 'INT', 'BIGINT']; const INT_DATA_TYPE = ['INTEGER', 'LONG', 'INT', 'BIGINT'];
const FLOAT_DATA_TYPE = ['REAL', 'DOUBLE']; const FLOAT_DATA_TYPE = ['REAL', 'DOUBLE'];

View File

@@ -15,7 +15,7 @@ import reducers, {Store} from '../../../../app/src/reducers';
import configureStore from 'redux-mock-store'; import configureStore from 'redux-mock-store';
import {Provider} from 'react-redux'; import {Provider} from 'react-redux';
import {Value} from 'flipper'; import {Value} from '../TypeBasedValueRenderer';
import DatabaseDetailSidebar from '../DatabaseDetailSidebar'; import DatabaseDetailSidebar from '../DatabaseDetailSidebar';
const labels: Array<string> = [ const labels: Array<string> = [

View File

@@ -7,7 +7,7 @@
* @format * @format
*/ */
import {Value} from 'flipper'; import {Value} from '../TypeBasedValueRenderer';
import { import {
isUpdatable, isUpdatable,
convertStringToValue, convertStringToValue,

View File

@@ -16,10 +16,9 @@ import {
TableRows, TableRows,
TableBodyRow, TableBodyRow,
TableRowSortOrder, TableRowSortOrder,
renderValue,
TableHighlightedRows, TableHighlightedRows,
Value,
} from 'flipper'; } from 'flipper';
import {Value, renderValue} from './TypeBasedValueRenderer';
import React, {KeyboardEvent, ChangeEvent, useState, useCallback} from 'react'; import React, {KeyboardEvent, ChangeEvent, useState, useCallback} from 'react';
import {Methods, Events} from './ClientProtocol'; import {Methods, Events} from './ClientProtocol';
import ButtonNavigation from './ButtonNavigation'; import ButtonNavigation from './ButtonNavigation';