mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
add project as a workflow category in the front-end
This commit is contained in:
committed by
psychedelicious
parent
b4cf5496b6
commit
3dc13221d8
@ -1697,6 +1697,7 @@
|
|||||||
"workflowLibrary": "Library",
|
"workflowLibrary": "Library",
|
||||||
"userWorkflows": "My Workflows",
|
"userWorkflows": "My Workflows",
|
||||||
"defaultWorkflows": "Default Workflows",
|
"defaultWorkflows": "Default Workflows",
|
||||||
|
"projectWorkflows": "Project Workflows",
|
||||||
"openWorkflow": "Open Workflow",
|
"openWorkflow": "Open Workflow",
|
||||||
"uploadWorkflow": "Load from File",
|
"uploadWorkflow": "Load from File",
|
||||||
"deleteWorkflow": "Delete Workflow",
|
"deleteWorkflow": "Delete Workflow",
|
||||||
@ -1709,6 +1710,7 @@
|
|||||||
"workflowSaved": "Workflow Saved",
|
"workflowSaved": "Workflow Saved",
|
||||||
"noRecentWorkflows": "No Recent Workflows",
|
"noRecentWorkflows": "No Recent Workflows",
|
||||||
"noUserWorkflows": "No User Workflows",
|
"noUserWorkflows": "No User Workflows",
|
||||||
|
"noWorkflows": "No Workflows",
|
||||||
"noSystemWorkflows": "No System Workflows",
|
"noSystemWorkflows": "No System Workflows",
|
||||||
"problemLoading": "Problem Loading Workflows",
|
"problemLoading": "Problem Loading Workflows",
|
||||||
"loading": "Loading Workflows",
|
"loading": "Loading Workflows",
|
||||||
|
@ -15,7 +15,7 @@ export type XYPosition = z.infer<typeof zXYPosition>;
|
|||||||
export const zDimension = z.number().gt(0).nullish();
|
export const zDimension = z.number().gt(0).nullish();
|
||||||
export type Dimension = z.infer<typeof zDimension>;
|
export type Dimension = z.infer<typeof zDimension>;
|
||||||
|
|
||||||
export const zWorkflowCategory = z.enum(['user', 'default']);
|
export const zWorkflowCategory = z.enum(['user', 'default', 'project']);
|
||||||
export type WorkflowCategory = z.infer<typeof zWorkflowCategory>;
|
export type WorkflowCategory = z.infer<typeof zWorkflowCategory>;
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@ import {
|
|||||||
InputRightElement,
|
InputRightElement,
|
||||||
Spacer,
|
Spacer,
|
||||||
} from '@invoke-ai/ui';
|
} from '@invoke-ai/ui';
|
||||||
|
import { useStore } from '@nanostores/react';
|
||||||
|
import { $projectId } from 'app/store/nanostores/projectId';
|
||||||
import {
|
import {
|
||||||
IAINoContentFallback,
|
IAINoContentFallback,
|
||||||
IAINoContentFallbackWithSpinner,
|
IAINoContentFallbackWithSpinner,
|
||||||
@ -62,6 +64,7 @@ const WorkflowLibraryList = () => {
|
|||||||
const [order_by, setOrderBy] = useState<WorkflowRecordOrderBy>('opened_at');
|
const [order_by, setOrderBy] = useState<WorkflowRecordOrderBy>('opened_at');
|
||||||
const [direction, setDirection] = useState<SQLiteDirection>('ASC');
|
const [direction, setDirection] = useState<SQLiteDirection>('ASC');
|
||||||
const [debouncedQuery] = useDebounce(query, 500);
|
const [debouncedQuery] = useDebounce(query, 500);
|
||||||
|
const projectId = useStore($projectId);
|
||||||
|
|
||||||
const queryArg = useMemo<Parameters<typeof useListWorkflowsQuery>[0]>(() => {
|
const queryArg = useMemo<Parameters<typeof useListWorkflowsQuery>[0]>(() => {
|
||||||
if (category === 'user') {
|
if (category === 'user') {
|
||||||
@ -142,13 +145,8 @@ const WorkflowLibraryList = () => {
|
|||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleSetUserCategory = useCallback(() => {
|
const handleSetCategory = useCallback((category: WorkflowCategory) => {
|
||||||
setCategory('user');
|
setCategory(category);
|
||||||
setPage(0);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const handleSetDefaultCategory = useCallback(() => {
|
|
||||||
setCategory('default');
|
|
||||||
setPage(0);
|
setPage(0);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -158,21 +156,31 @@ const WorkflowLibraryList = () => {
|
|||||||
<ButtonGroup>
|
<ButtonGroup>
|
||||||
<Button
|
<Button
|
||||||
variant={category === 'user' ? undefined : 'ghost'}
|
variant={category === 'user' ? undefined : 'ghost'}
|
||||||
onClick={handleSetUserCategory}
|
onClick={handleSetCategory.bind(null, 'user')}
|
||||||
isChecked={category === 'user'}
|
isChecked={category === 'user'}
|
||||||
>
|
>
|
||||||
{t('workflows.userWorkflows')}
|
{t('workflows.userWorkflows')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
{projectId ? (
|
||||||
variant={category === 'default' ? undefined : 'ghost'}
|
<Button
|
||||||
onClick={handleSetDefaultCategory}
|
variant={category === 'project' ? undefined : 'ghost'}
|
||||||
isChecked={category === 'default'}
|
onClick={handleSetCategory.bind(null, 'project')}
|
||||||
>
|
isChecked={category === 'project'}
|
||||||
{t('workflows.defaultWorkflows')}
|
>
|
||||||
</Button>
|
{t('workflows.projectWorkflows')}
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<Button
|
||||||
|
variant={category === 'default' ? undefined : 'ghost'}
|
||||||
|
onClick={handleSetCategory.bind(null, 'default')}
|
||||||
|
isChecked={category === 'default'}
|
||||||
|
>
|
||||||
|
{t('workflows.defaultWorkflows')}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
{category === 'user' && (
|
{category !== 'default' && (
|
||||||
<>
|
<>
|
||||||
<FormControl isDisabled={isFetching} w={64} minW={56}>
|
<FormControl isDisabled={isFetching} w={64} minW={56}>
|
||||||
<FormLabel>{t('common.orderBy')}</FormLabel>
|
<FormLabel>{t('common.orderBy')}</FormLabel>
|
||||||
@ -228,7 +236,7 @@ const WorkflowLibraryList = () => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
</ScrollableContent>
|
</ScrollableContent>
|
||||||
) : (
|
) : (
|
||||||
<IAINoContentFallback label={t('workflows.noUserWorkflows')} />
|
<IAINoContentFallback label={t('workflows.noWorkflows')} />
|
||||||
)}
|
)}
|
||||||
<Divider />
|
<Divider />
|
||||||
{data && (
|
{data && (
|
||||||
|
@ -52,7 +52,7 @@ const WorkflowLibraryListItem = ({ workflowDTO }: Props) => {
|
|||||||
{workflowDTO.name || t('workflows.unnamedWorkflow')}
|
{workflowDTO.name || t('workflows.unnamedWorkflow')}
|
||||||
</Heading>
|
</Heading>
|
||||||
<Spacer />
|
<Spacer />
|
||||||
{workflowDTO.category === 'user' && (
|
{workflowDTO.category !== 'default' && (
|
||||||
<Text
|
<Text
|
||||||
fontSize="sm"
|
fontSize="sm"
|
||||||
variant="subtext"
|
variant="subtext"
|
||||||
@ -81,7 +81,7 @@ const WorkflowLibraryListItem = ({ workflowDTO }: Props) => {
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
<Spacer />
|
<Spacer />
|
||||||
{workflowDTO.category === 'user' && (
|
{workflowDTO.category !== 'default' && (
|
||||||
<Text
|
<Text
|
||||||
fontSize="sm"
|
fontSize="sm"
|
||||||
variant="subtext"
|
variant="subtext"
|
||||||
@ -104,7 +104,7 @@ const WorkflowLibraryListItem = ({ workflowDTO }: Props) => {
|
|||||||
>
|
>
|
||||||
{t('common.load')}
|
{t('common.load')}
|
||||||
</Button>
|
</Button>
|
||||||
{workflowDTO.category === 'user' && (
|
{workflowDTO.category !== 'default' && (
|
||||||
<Button
|
<Button
|
||||||
flexShrink={0}
|
flexShrink={0}
|
||||||
colorScheme="error"
|
colorScheme="error"
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user