diff --git a/src/App.tsx b/src/App.tsx index d4c3881..70ba274 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -144,7 +144,7 @@ const App = ({ ui, navigation }: { ui: UIState, navigation: NavigationState }) = - + diff --git a/src/components/CommandPalette.tsx b/src/components/CommandPalette.tsx index b03f9c7..4ca838f 100644 --- a/src/components/CommandPalette.tsx +++ b/src/components/CommandPalette.tsx @@ -27,8 +27,14 @@ import { LoginOutlined, UserAddOutlined, LogoutOutlined, + InfoCircleOutlined, + FundOutlined, + SettingOutlined, } from '@ant-design/icons'; -import { useHistory } from 'react-router'; +import { + useHistory, + generatePath, +} from 'react-router'; import { Config as ConfigType, Tune as TuneType, @@ -56,6 +62,23 @@ import Icon from './SideBar/Icon'; enum Sections { NAVIGATION = 'Navigation', AUTH = 'Authentication', + TUNE = 'Tune', + LOG = 'Log', + DIAGNOSE = 'Diagnose', +}; + +const mapStateToProps = (state: AppState) => ({ + config: state.config, + tune: state.tune, + ui: state.ui, + navigation: state.navigation, +}); + +interface CommandPaletteProps { + config: ConfigType; + tune: TuneType; + navigation: NavigationState; + children?: ReactNode; }; const searchStyle = { @@ -202,19 +225,7 @@ const RenderResults = () => { ); }; -const mapStateToProps = (state: AppState) => ({ - config: state.config, - tune: state.tune, - ui: state.ui, - navigation: state.navigation, -}); - -interface CommandPaletteProps { - config: ConfigType; - tune: TuneType; - navigation: NavigationState; - children?: ReactNode; -}; +const buildTuneUrl = (tuneId: string, route: string) => generatePath(route, { tuneId }); const ActionsProvider = (props: CommandPaletteProps) => { const { config, tune, navigation } = props; @@ -222,7 +233,32 @@ const ActionsProvider = (props: CommandPaletteProps) => { const history = useHistory(); const generateActions = useCallback((types: MenusType) => { - const newActions: Action[] = []; + const newActions: Action[] = [ + { + id: 'InfoAction', + section: Sections.TUNE, + name: 'Info', + subtitle: 'Basic information about this tune.', + icon: , + perform: () => history.push(buildTuneUrl(navigation.tuneId!, Routes.TUNE_ROOT)), + }, + { + id: 'LogsAction', + section: Sections.LOG, + name: 'Logs', + subtitle: 'Log viewer.', + icon: , + perform: () => history.push(buildTuneUrl(navigation.tuneId!, Routes.TUNE_LOGS)), + }, + { + id: 'DiagnoseAction', + section: Sections.DIAGNOSE, + name: 'Diagnose', + subtitle: 'Tooth and composite logs viewer.', + icon: , + perform: () => history.push(buildTuneUrl(navigation.tuneId!, Routes.TUNE_DIAGNOSE)), + }, + ]; Object.keys(types).forEach((menuName: string) => { if (SKIP_MENUS.includes(menuName)) { diff --git a/src/components/TopBar.tsx b/src/components/TopBar.tsx index 5679216..5517b5a 100644 --- a/src/components/TopBar.tsx +++ b/src/components/TopBar.tsx @@ -131,10 +131,10 @@ const TopBar = ({ tuneId }: { tuneId: string | null }) => { {sm && 'Tune'} - + - {sm && 'Log'} + {sm && 'Logs'} diff --git a/src/routes.ts b/src/routes.ts index 476cf65..d0036f6 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -6,7 +6,7 @@ export enum Routes { TUNE_TAB = '/t/:tuneId/:tab', TUNE_TUNE = '/t/:tuneId/tune', TUNE_DIALOG = '/t/:tuneId/tune/:category/:dialog', - TUNE_LOG = '/t/:tuneId/log', + TUNE_LOGS = '/t/:tuneId/logs', TUNE_DIAGNOSE = '/t/:tuneId/diagnose', LOGIN = '/auth/login',