UI Conversion: Replaced all usages of FlexRow / FlexColumn to Layout
Summary: Replaced all usages of FlexRow / FlexColumn to new Layout component Reviewed By: mweststrate Differential Revision: D28055698 fbshipit-source-id: ad50762b068c897e5c4c182ac2d575d7e3a5f166
This commit is contained in:
committed by
Facebook GitHub Bot
parent
00fb573ba2
commit
24ac075d76
@@ -8,13 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {
|
import {
|
||||||
FlexRow,
|
|
||||||
ManagedTable,
|
ManagedTable,
|
||||||
TableBodyRow,
|
TableBodyRow,
|
||||||
TableBodyColumn,
|
TableBodyColumn,
|
||||||
Value,
|
Value,
|
||||||
renderValue,
|
renderValue,
|
||||||
} from 'flipper';
|
} from 'flipper';
|
||||||
|
import {Layout} from 'flipper-plugin';
|
||||||
import React, {useMemo} from 'react';
|
import React, {useMemo} from 'react';
|
||||||
|
|
||||||
import {Structure} from './index';
|
import {Structure} from './index';
|
||||||
@@ -59,7 +59,7 @@ const DatabaseStructureManagedTable = React.memo(
|
|||||||
[columns],
|
[columns],
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<FlexRow grow={true}>
|
<Layout.Horizontal grow>
|
||||||
<ManagedTable
|
<ManagedTable
|
||||||
floating={false}
|
floating={false}
|
||||||
columnOrder={columnOrder}
|
columnOrder={columnOrder}
|
||||||
@@ -68,7 +68,7 @@ const DatabaseStructureManagedTable = React.memo(
|
|||||||
rows={renderRows}
|
rows={renderRows}
|
||||||
horizontallyScrollable={true}
|
horizontallyScrollable={true}
|
||||||
/>
|
/>
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import {
|
|||||||
produce,
|
produce,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
Select,
|
Select,
|
||||||
FlexColumn,
|
|
||||||
FlexRow,
|
|
||||||
ManagedTable,
|
ManagedTable,
|
||||||
Text,
|
Text,
|
||||||
Button,
|
Button,
|
||||||
@@ -43,7 +41,13 @@ import {
|
|||||||
} from './UpdateQueryUtil';
|
} from './UpdateQueryUtil';
|
||||||
import sqlFormatter from 'sql-formatter';
|
import sqlFormatter from 'sql-formatter';
|
||||||
import dateFormat from 'dateformat';
|
import dateFormat from 'dateformat';
|
||||||
import {createState, PluginClient, usePlugin, useValue} from 'flipper-plugin';
|
import {
|
||||||
|
createState,
|
||||||
|
PluginClient,
|
||||||
|
usePlugin,
|
||||||
|
useValue,
|
||||||
|
Layout,
|
||||||
|
} from 'flipper-plugin';
|
||||||
|
|
||||||
const PAGE_SIZE = 50;
|
const PAGE_SIZE = 50;
|
||||||
|
|
||||||
@@ -60,7 +64,7 @@ const ErrorBar = styled.div({
|
|||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
});
|
});
|
||||||
const QueryHistoryManagedTable = styled(ManagedTable)({paddingLeft: 16});
|
const QueryHistoryManagedTable = styled(ManagedTable)({paddingLeft: 16});
|
||||||
const PageInfoContainer = styled(FlexRow)({alignItems: 'center'});
|
const PageInfoContainer = styled(Layout.Horizontal)({alignItems: 'center'});
|
||||||
const TableInfoTextArea = styled(Textarea)({
|
const TableInfoTextArea = styled(Textarea)({
|
||||||
width: '98%',
|
width: '98%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@@ -171,7 +175,7 @@ const QueryHistory = React.memo(({history}: {history: Array<Query>}) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FlexRow grow={true}>
|
<Layout.Horizontal grow>
|
||||||
<QueryHistoryManagedTable
|
<QueryHistoryManagedTable
|
||||||
floating={false}
|
floating={false}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
@@ -180,7 +184,7 @@ const QueryHistory = React.memo(({history}: {history: Array<Query>}) => {
|
|||||||
rows={rows}
|
rows={rows}
|
||||||
horizontallyScrollable={true}
|
horizontallyScrollable={true}
|
||||||
/>
|
/>
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -220,7 +224,7 @@ const PageInfo = React.memo((props: PageInfoProps) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageInfoContainer grow={true}>
|
<PageInfoContainer grow>
|
||||||
<div style={{flex: 1}} />
|
<div style={{flex: 1}} />
|
||||||
<Text>
|
<Text>
|
||||||
{props.count === props.totalRows
|
{props.count === props.totalRows
|
||||||
@@ -262,7 +266,7 @@ const DataTable = React.memo(
|
|||||||
onRowEdited: (changes: {[key: string]: string | null}) => void;
|
onRowEdited: (changes: {[key: string]: string | null}) => void;
|
||||||
}) =>
|
}) =>
|
||||||
page ? (
|
page ? (
|
||||||
<FlexRow grow={true}>
|
<Layout.Horizontal grow>
|
||||||
<ManagedTable
|
<ManagedTable
|
||||||
tableKey={`databases-${page.databaseId}-${page.table}`}
|
tableKey={`databases-${page.databaseId}-${page.table}`}
|
||||||
floating={false}
|
floating={false}
|
||||||
@@ -299,7 +303,7 @@ const DataTable = React.memo(
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
) : null,
|
) : null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -323,7 +327,7 @@ const QueryTable = React.memo(
|
|||||||
const columns = table.columns;
|
const columns = table.columns;
|
||||||
const rows = table.rows;
|
const rows = table.rows;
|
||||||
return (
|
return (
|
||||||
<FlexRow grow={true} style={{paddingTop: 18}}>
|
<Layout.Horizontal grow style={{paddingTop: 18}}>
|
||||||
<ManagedTable
|
<ManagedTable
|
||||||
floating={false}
|
floating={false}
|
||||||
multiline={true}
|
multiline={true}
|
||||||
@@ -349,23 +353,23 @@ const QueryTable = React.memo(
|
|||||||
columnValues={table.rows[table.highlightedRows[0]]}
|
columnValues={table.rows[table.highlightedRows[0]]}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
);
|
);
|
||||||
} else if (query.id && query.id !== null) {
|
} else if (query.id && query.id !== null) {
|
||||||
return (
|
return (
|
||||||
<FlexRow grow={true} style={{paddingTop: 18}}>
|
<Layout.Horizontal grow style={{paddingTop: 18}}>
|
||||||
<Text style={{paddingTop: 8, paddingLeft: 8}}>
|
<Text style={{paddingTop: 8, paddingLeft: 8}}>
|
||||||
Row id: {query.id}
|
Row id: {query.id}
|
||||||
</Text>
|
</Text>
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
);
|
);
|
||||||
} else if (query.count && query.count !== null) {
|
} else if (query.count && query.count !== null) {
|
||||||
return (
|
return (
|
||||||
<FlexRow grow={true} style={{paddingTop: 18}}>
|
<Layout.Horizontal grow style={{paddingTop: 18}}>
|
||||||
<Text style={{paddingTop: 8, paddingLeft: 8}}>
|
<Text style={{paddingTop: 8, paddingLeft: 8}}>
|
||||||
Rows affected: {query.count}
|
Rows affected: {query.count}
|
||||||
</Text>
|
</Text>
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
@@ -1046,7 +1050,7 @@ export function Component() {
|
|||||||
{};
|
{};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FlexColumn style={{flex: 1}}>
|
<Layout.Container grow>
|
||||||
<Toolbar position="top" style={{paddingLeft: 16}}>
|
<Toolbar position="top" style={{paddingLeft: 16}}>
|
||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button
|
<Button
|
||||||
@@ -1192,8 +1196,8 @@ export function Component() {
|
|||||||
</Toolbar>
|
</Toolbar>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
<FlexRow grow={true}>
|
<Layout.Horizontal grow>
|
||||||
<FlexColumn grow={true}>
|
<Layout.Container grow>
|
||||||
{state.viewMode === 'data' ? (
|
{state.viewMode === 'data' ? (
|
||||||
<DataTable
|
<DataTable
|
||||||
page={state.currentPage}
|
page={state.currentPage}
|
||||||
@@ -1222,10 +1226,10 @@ export function Component() {
|
|||||||
{state.viewMode === 'queryHistory' ? (
|
{state.viewMode === 'queryHistory' ? (
|
||||||
<QueryHistory history={state.queryHistory} />
|
<QueryHistory history={state.queryHistory} />
|
||||||
) : null}
|
) : null}
|
||||||
</FlexColumn>
|
</Layout.Container>
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
<Toolbar position="bottom" style={{paddingLeft: 8}}>
|
<Toolbar position="bottom" style={{paddingLeft: 8}}>
|
||||||
<FlexRow grow={true}>
|
<Layout.Horizontal grow>
|
||||||
{state.viewMode === 'SQL' && state.executionTime !== 0 ? (
|
{state.viewMode === 'SQL' && state.executionTime !== 0 ? (
|
||||||
<Text> {state.executionTime} ms </Text>
|
<Text> {state.executionTime} ms </Text>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -1248,11 +1252,11 @@ export function Component() {
|
|||||||
onForward={onNextPageClicked}
|
onForward={onNextPageClicked}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</FlexRow>
|
</Layout.Horizontal>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
{state.error && (
|
{state.error && (
|
||||||
<ErrorBar>{getStringFromErrorLike(state.error)}</ErrorBar>
|
<ErrorBar>{getStringFromErrorLike(state.error)}</ErrorBar>
|
||||||
)}
|
)}
|
||||||
</FlexColumn>
|
</Layout.Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user