-
-
Notifications
You must be signed in to change notification settings - Fork 850
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add spotlight * [PUI] Quick commands pallet Fixes #5888 * add testing for new commands * add text input testing * only test backend if code changed * add trans files * fix testing text * always push coverage * add nav state to manage navigation state * add navigation action and test * make test faster * fix typo * use texts instead * fix tests for linux * use var to determine action key * Revert "use texts instead" This reverts commit 7771189. * add wait for input * split out keyboard based tests * split ou test * add upload * revert assert change * adjust reporting settings * ignore error code * fix reporter config * add full info suit (+tests) * make tests more accurate * license modal fixes * unify icons * add custom actions registering with removal on page refresh * only upload report data if the tests failed * Revert "add trans files" This reverts commit 28d96e0. * adjust url that iw waited for * try an await and body locator for keypresses * test registering addition actions * extend testing for actions * add doclink and test * merge tests
- Loading branch information
Showing
16 changed files
with
377 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { t } from '@lingui/macro'; | ||
import { ActionIcon } from '@mantine/core'; | ||
import { spotlight } from '@mantine/spotlight'; | ||
import { IconCommand } from '@tabler/icons-react'; | ||
|
||
/** | ||
* A button which opens the quick command modal | ||
*/ | ||
export function SpotlightButton() { | ||
return ( | ||
<ActionIcon onClick={() => spotlight.open()} title={t`Open spotlight`}> | ||
<IconCommand /> | ||
</ActionIcon> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { t } from '@lingui/macro'; | ||
import type { SpotlightAction } from '@mantine/spotlight'; | ||
import { IconHome, IconLink, IconPointer } from '@tabler/icons-react'; | ||
import { NavigateFunction } from 'react-router-dom'; | ||
|
||
import { useLocalState } from '../states/LocalState'; | ||
import { aboutInvenTree, docLinks, licenseInfo, serverInfo } from './links'; | ||
import { menuItems } from './menuItems'; | ||
|
||
export function getActions(navigate: NavigateFunction) { | ||
const setNavigationOpen = useLocalState((state) => state.setNavigationOpen); | ||
|
||
const actions: SpotlightAction[] = [ | ||
{ | ||
title: t`Home`, | ||
description: `Go to the home page`, | ||
onTrigger: () => navigate(menuItems.home.link), | ||
icon: <IconHome size="1.2rem" /> | ||
}, | ||
{ | ||
title: t`Dashboard`, | ||
description: t`Go to the InvenTree dashboard`, | ||
onTrigger: () => navigate(menuItems.dashboard.link), | ||
icon: <IconLink size="1.2rem" /> | ||
}, | ||
{ | ||
title: t`Documentation`, | ||
description: t`Visit the documentation to learn more about InvenTree`, | ||
onTrigger: () => (window.location.href = docLinks.faq), | ||
icon: <IconLink size="1.2rem" /> | ||
}, | ||
{ | ||
title: t`About InvenTree`, | ||
description: t`About the InvenTree org`, | ||
onTrigger: () => aboutInvenTree(), | ||
icon: <IconLink size="1.2rem" /> | ||
}, | ||
{ | ||
title: t`Server Information`, | ||
description: t`About this Inventree instance`, | ||
onTrigger: () => serverInfo(), | ||
icon: <IconLink size="1.2rem" /> | ||
}, | ||
{ | ||
title: t`License Information`, | ||
description: t`Licenses for dependencies of the service`, | ||
onTrigger: () => licenseInfo(), | ||
icon: <IconLink size="1.2rem" /> | ||
}, | ||
{ | ||
title: t`Open Navigation`, | ||
description: t`Open the main navigation menu`, | ||
onTrigger: () => setNavigationOpen(true), | ||
icon: <IconPointer size="1.2rem" /> | ||
} | ||
]; | ||
|
||
return actions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,75 @@ | ||
import { Trans } from '@lingui/macro'; | ||
|
||
import { MenuLinkItem } from '../components/items/MenuLinks'; | ||
import { menuItemsCollection } from '../components/items/MenuLinks'; | ||
import { IS_DEV_OR_DEMO } from '../main'; | ||
|
||
export const menuItems: MenuLinkItem[] = [ | ||
{ | ||
export const menuItems: menuItemsCollection = { | ||
home: { | ||
id: 'home', | ||
text: <Trans>Home</Trans>, | ||
link: '/', | ||
highlight: true | ||
}, | ||
{ | ||
profile: { | ||
id: 'profile', | ||
text: <Trans>Account settings</Trans>, | ||
link: '/settings/user', | ||
doctext: <Trans>User attributes and design settings.</Trans> | ||
}, | ||
{ | ||
scan: { | ||
id: 'scan', | ||
text: <Trans>Scanning</Trans>, | ||
link: '/scan', | ||
doctext: <Trans>View for interactive scanning and multiple actions.</Trans>, | ||
highlight: true | ||
}, | ||
{ | ||
dashboard: { | ||
id: 'dashboard', | ||
text: <Trans>Dashboard</Trans>, | ||
link: '/dashboard' | ||
}, | ||
{ | ||
parts: { | ||
id: 'parts', | ||
text: <Trans>Parts</Trans>, | ||
link: '/part/' | ||
}, | ||
{ | ||
stock: { | ||
id: 'stock', | ||
text: <Trans>Stock</Trans>, | ||
link: '/stock' | ||
}, | ||
{ | ||
build: { | ||
id: 'build', | ||
text: <Trans>Build</Trans>, | ||
link: '/build/' | ||
}, | ||
{ | ||
purchasing: { | ||
id: 'purchasing', | ||
text: <Trans>Purchasing</Trans>, | ||
link: '/purchasing/' | ||
}, | ||
{ | ||
sales: { | ||
id: 'sales', | ||
text: <Trans>Sales</Trans>, | ||
link: '/sales/' | ||
}, | ||
{ | ||
'settings-system': { | ||
id: 'settings-system', | ||
text: <Trans>System Settings</Trans>, | ||
link: '/settings/system' | ||
}, | ||
{ | ||
'settings-admin': { | ||
id: 'settings-admin', | ||
text: <Trans>Admin Center</Trans>, | ||
link: '/settings/admin' | ||
} | ||
]; | ||
}; | ||
|
||
if (IS_DEV_OR_DEMO) { | ||
menuItems.push({ | ||
menuItems['playground'] = { | ||
id: 'playground', | ||
text: <Trans>Playground</Trans>, | ||
link: '/playground', | ||
highlight: true | ||
}); | ||
}; | ||
} |
Oops, something went wrong.