Skip to content

Commit

Permalink
Merge c93191a into sapling-pr-archive-passy
Browse files Browse the repository at this point in the history
  • Loading branch information
passy authored Aug 31, 2023
2 parents f8b934f + c93191a commit 58f12db
Show file tree
Hide file tree
Showing 79 changed files with 2,160 additions and 659 deletions.
2 changes: 1 addition & 1 deletion Flipper.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

flipperkit_version = '0.212.0'
flipperkit_version = '0.213.0'
Pod::Spec.new do |spec|
spec.name = 'Flipper'
spec.cocoapods_version = '>= 1.10'
Expand Down
2 changes: 1 addition & 1 deletion FlipperKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# LICENSE file in the root directory of this source tree.

folly_compiler_flags = '-DDEBUG=1 -DFLIPPER_OSS=1 -DFB_SONARKIT_ENABLED=1 -DFOLLY_HAVE_BACKTRACE=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0'
flipperkit_version = '0.212.0'
flipperkit_version = '0.213.0'
Pod::Spec.new do |spec|
spec.name = 'FlipperKit'
spec.version = flipperkit_version
Expand Down
2 changes: 1 addition & 1 deletion desktop/app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"rootDir": "src",
"esModuleInterop": true,
"emitDeclarationOnly": true,
"lib": ["DOM", "ES2019"],
"lib": ["DOM", "ES2021"],
"types": [
"../types/flipperGlobals"
]
Expand Down
13 changes: 2 additions & 11 deletions desktop/flipper-common/src/PluginDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* @format
*/

import {DeviceType, OS} from './server-types';

export interface PluginDetails {
name: string;
specVersion: number;
Expand Down Expand Up @@ -57,17 +59,6 @@ export interface SupportedApp {
readonly type?: DeviceType;
}

export type OS =
| 'iOS'
| 'Android'
| 'Metro'
| 'Windows'
| 'MacOS'
| 'Browser'
| 'Linux';

export type DeviceType = 'emulator' | 'physical' | 'dummy';

export type PluginType = 'client' | 'device';

export type DeviceSpec = 'KaiOS';
Expand Down
21 changes: 15 additions & 6 deletions desktop/flipper-common/src/server-types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
import {FlipperDoctor} from './doctor';
import {
DeviceSpec,
DeviceType,
DownloadablePluginDetails,
InstalledPluginDetails,
MarketplacePluginDetails,
OS as PluginOS,
UpdatablePluginDetails,
} from './PluginDetails';
import {ServerAddOnStartDetails} from './ServerAddOn';
Expand All @@ -39,7 +37,7 @@ export type FlipperServerState =
| 'error'
| 'closed';

export type DeviceOS = PluginOS;
export type DeviceOS = OS;

export type DeviceDescription = {
readonly os: DeviceOS;
Expand Down Expand Up @@ -172,11 +170,22 @@ export type FlipperServerEvents = {
'server-log': LoggerInfo;
};

export type IOSDeviceParams = {
export type OS =
| 'iOS'
| 'Android'
| 'Metro'
| 'Windows'
| 'MacOS'
| 'Browser'
| 'Linux';

export type DeviceType = 'physical' | 'emulator' | 'dummy';

export type DeviceTarget = {
udid: string;
type: DeviceType;
name: string;
deviceTypeIdentifier?: string;
osVersion?: string;
state?: string;
};

Expand Down Expand Up @@ -297,7 +306,7 @@ export type FlipperServerCommands = {
'android-get-emulators': () => Promise<string[]>;
'android-launch-emulator': (name: string, coldboot: boolean) => Promise<void>;
'android-adb-kill': () => Promise<void>;
'ios-get-simulators': (bootedOnly: boolean) => Promise<IOSDeviceParams[]>;
'ios-get-simulators': (bootedOnly: boolean) => Promise<DeviceTarget[]>;
'ios-launch-simulator': (udid: string) => Promise<void>;
'ios-idb-kill': () => Promise<void>;
'persist-settings': (settings: Settings) => Promise<void>;
Expand Down
9 changes: 9 additions & 0 deletions desktop/flipper-common/src/utils/LoggerTailer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ function transformLogLevel(level: LoggerTypes, message: string) {
if (message.endsWith('Network Error')) {
return 'warn';
}

if (message.includes('Watchman was not found in PATH')) {
return 'warn';
}

// Random Electron error, not actionable.
if (message.includes('Document is not focused')) {
return 'warn';
}
}

return level;
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-common/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"lib": ["dom", "ES2019"]
"lib": ["dom", "ES2021"]
},
"references": []
}
2 changes: 1 addition & 1 deletion desktop/flipper-frontend-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"lib": ["dom", "ES2019"],
"lib": ["dom", "ES2021"],
"types": ["../types/flipperGlobals"]
},
"references": [
Expand Down
2 changes: 1 addition & 1 deletion desktop/flipper-plugin-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "lib",
"rootDir": "src",
"lib": ["dom", "ES2019"],
"lib": ["dom", "ES2021"],
"types": ["jest", "../types/jest-extensions", "react/next", "react-dom/next"]
},
"references": [
Expand Down
4 changes: 3 additions & 1 deletion desktop/flipper-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@types/react": "17.0.39",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^17.0.13",
"dayjs": "^1.11.9",
"eventemitter3": "^4.0.7",
"flipper-common": "0.0.0",
"flipper-plugin-core": "0.0.0",
Expand All @@ -24,6 +25,7 @@
"lodash": "^4.17.21",
"react-color": "^2.19.3",
"react-element-to-jsx-string": "^14.3.4",
"react-use": "^17.4.0",
"react-virtual": "^2.10.4",
"string-natural-compare": "^3.0.0"
},
Expand All @@ -34,7 +36,7 @@
"peerDependencies": {
"@ant-design/icons": "^4.2.2",
"@testing-library/dom": "^7.26.3",
"antd": "^4.23.4"
"antd": "^4.24"
},
"scripts": {
"reset": "rimraf lib *.tsbuildinfo",
Expand Down
2 changes: 2 additions & 0 deletions desktop/flipper-plugin/src/__tests__/api.node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ test('Correct top level API exposed', () => {
"MasterDetail",
"NUX",
"Panel",
"PowerSearch",
"Spinner",
"Tab",
"Tabs",
Expand Down Expand Up @@ -129,6 +130,7 @@ test('Correct top level API exposed', () => {
"NormalizedMenuEntry",
"Notification",
"PluginClient",
"PowerSearchConfig",
"RemoteServerContext",
"ServerAddOn",
"ServerAddOnPluginConnection",
Expand Down
1 change: 1 addition & 0 deletions desktop/flipper-plugin/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ export {DataTable, DataTableColumn} from './ui/data-table/DataTable';
export {DataTableManager} from './ui/data-table/DataTableManager';
export {DataList} from './ui/DataList';
export {Spinner} from './ui/Spinner';
export * from './ui/PowerSearch';

export {DataSourceVirtualizer} from './data-source/DataSourceRendererVirtual';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

import {DatePicker, DatePickerProps} from 'antd';
import React from 'react';

type PowerSearchAbsoluteTermProps = {
onCancel: () => void;
onChange: (value: Date) => void;
dateOnly?: boolean;
minValue?: Date;
maxValue?: Date;
};

export const DATE_ONLY_FORMAT = 'YYYY-MM-DD';
export const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';

export const PowerSearchAbsoluteDateTerm: React.FC<
PowerSearchAbsoluteTermProps
> = ({onCancel, onChange, dateOnly, minValue, maxValue}) => {
const disabledDate: DatePickerProps['disabledDate'] = React.useCallback(
(date) => {
if (minValue !== undefined && date < minValue) {
return true;
}
if (maxValue !== undefined && date > maxValue) {
return true;
}
return false;
},
[minValue, maxValue],
);

const format = dateOnly ? 'YYYY-MM-DD' : 'YYYY-MM-DD HH:mm:ss';

const valueRef = React.useRef<Date>();

return (
<DatePicker
autoFocus
style={{width: 100}}
placeholder="..."
format={format}
onChange={(newValue) => {
if (!newValue) {
onCancel();
return;
}

const newDate = newValue.toDate();
valueRef.current = newDate;
onChange(newDate);
}}
onKeyDown={(event) => {
if (event.key === 'Escape') {
onCancel();
}
}}
onBlur={() => {
if (!valueRef.current) {
onCancel();
}
}}
disabledDate={disabledDate}
showTime={!dateOnly}
defaultOpen
/>
);
};
59 changes: 59 additions & 0 deletions desktop/flipper-plugin/src/ui/PowerSearch/PowerSearchConfig.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

// Mostly matches https://www.internalfb.com/code/www/html/intern/js/ui/PowerSearch/PowerSearchExampleConfig.js

export type SimpleFilterValueType =
| 'NO_VALUE'
| 'INTEGER'
| 'FLOAT'
| 'STRING'
| 'STRING_SET';

export type EnumFilterValueType = 'ENUM' | 'ENUM_SET';

export type AbsoluteDateFilterValueType = 'ABSOLUTE_DATE';

export type SimpleOperatorConfig = {
valueType: SimpleFilterValueType;
key: string;
label: string;
};

export type EnumOperatorConfig = {
valueType: EnumFilterValueType;
key: string;
label: string;
enumLabels: {[key: string]: string};
};

export type AbsoluteDateOperatorConfig = {
valueType: AbsoluteDateFilterValueType;
key: string;
label: string;
dateOnly?: boolean;
minValue?: Date;
maxValue?: Date;
};

export type OperatorConfig =
| SimpleOperatorConfig
| EnumOperatorConfig
| AbsoluteDateOperatorConfig;

export type FieldConfig = {
key: string;
label: string;
operators: {[key: string]: OperatorConfig};
};

export type PowerSearchConfig = {
name: string;
fields: {[key: string]: FieldConfig};
};
31 changes: 31 additions & 0 deletions desktop/flipper-plugin/src/ui/PowerSearch/PowerSearchContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/

import * as React from 'react';
import {css} from '@emotion/css';
import {theme} from '../theme';

const containerStyle = css`
display: flex;
flex-direction: row;
border-radius: ${theme.borderRadius};
border: 1px solid ${theme.borderColor};
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
padding: 0 ${theme.space.tiny}px;
&:focus-within,
&:hover {
border-color: ${theme.primaryColor};
box-shadow: 0 0 0 2px rgba(114, 46, 209, 0.2);
}
`;

export const PowerSearchContainer: React.FC = ({children}) => {
return <div className={containerStyle}>{children}</div>;
};
Loading

0 comments on commit 58f12db

Please sign in to comment.