From 3484f321af6fd844f37d88c06d7d65b5bb57675f Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Fri, 30 Oct 2020 04:20:00 -0700 Subject: [PATCH] Support archived devices Summary: Make sure archived are displayed as such in the UI, and normal device functions aren't available: * taking screenshots * bookmarks * metro device plugins * disabling plugins * disabled and unavailable plugins * mobile builds Also moved starting an emulator to the left rail, since it isn't a function related to the current selected thing Reviewed By: cekkaewnumchai Differential Revision: D24620247 fbshipit-source-id: f1f469e2fc5167fd90ccb35d583988873a9bc787 --- desktop/app/src/sandy-chrome/LeftRail.tsx | 19 +++ .../sandy-chrome/appinspect/AppInspect.tsx | 35 +++--- .../sandy-chrome/appinspect/PluginList.tsx | 117 ++++++++++-------- 3 files changed, 100 insertions(+), 71 deletions(-) diff --git a/desktop/app/src/sandy-chrome/LeftRail.tsx b/desktop/app/src/sandy-chrome/LeftRail.tsx index bf0606dfa..34d90d4c9 100644 --- a/desktop/app/src/sandy-chrome/LeftRail.tsx +++ b/desktop/app/src/sandy-chrome/LeftRail.tsx @@ -19,6 +19,7 @@ import { SettingOutlined, QuestionCircleOutlined, MedicineBoxOutlined, + RocketOutlined, } from '@ant-design/icons'; import {SidebarLeft, SidebarRight} from './SandyIcons'; import {useDispatch, useStore} from '../utils/useStore'; @@ -37,6 +38,8 @@ import {useValue} from 'flipper-plugin'; import {logout} from '../reducers/user'; import config from '../fb-stubs/config'; import styled from '@emotion/styled'; +import {showEmulatorLauncher} from './appinspect/LaunchEmulator'; +import {useStore as useReduxStore} from 'react-redux'; const LeftRailButtonElem = styled(Button)<{kind?: 'small'}>(({kind}) => ({ width: kind === 'small' ? 32 : 36, @@ -128,6 +131,7 @@ export function LeftRail({ /> + @@ -223,6 +227,21 @@ function DebugLogsButton({ ); } +function LaunchEmulatorButton() { + const store = useReduxStore(); + + return ( + } + title="Start Emulator / Simulator" + onClick={() => { + showEmulatorLauncher(store); + }} + small + /> + ); +} + function SetupDoctorButton() { const [visible, setVisible] = useState(false); const result = useStore( diff --git a/desktop/app/src/sandy-chrome/appinspect/AppInspect.tsx b/desktop/app/src/sandy-chrome/appinspect/AppInspect.tsx index f1c5f633a..ac01dec99 100644 --- a/desktop/app/src/sandy-chrome/appinspect/AppInspect.tsx +++ b/desktop/app/src/sandy-chrome/appinspect/AppInspect.tsx @@ -8,13 +8,11 @@ */ import React from 'react'; -import {Alert, Button, Input} from 'antd'; +import {Alert, Input} from 'antd'; import {LeftSidebar, SidebarTitle, InfoIcon} from '../LeftSidebar'; -import {SettingOutlined, RocketOutlined} from '@ant-design/icons'; +import {SettingOutlined} from '@ant-design/icons'; import {Layout, Link, styled} from '../../ui'; import {theme} from 'flipper-plugin'; -import {useStore as useReduxStore} from 'react-redux'; -import {showEmulatorLauncher} from './LaunchEmulator'; import {AppSelector} from './AppSelector'; import {useStore} from '../../utils/useStore'; import {PluginList} from './PluginList'; @@ -33,8 +31,8 @@ const appTooltip = ( ); export function AppInspect() { - const store = useReduxStore(); const selectedDevice = useStore((state) => state.connections.selectedDevice); + const isArchived = !!selectedDevice?.isArchived; return ( @@ -45,26 +43,27 @@ export function AppInspect() { - } defaultValue="mysite" /> - -