mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(ui): hide workflow thumbnail for unsaved and default workflows
This commit is contained in:
@@ -96,13 +96,17 @@ const WorkflowGeneralTab = () => {
|
||||
<FormLabel>{t('nodes.workflowName')}</FormLabel>
|
||||
<Input variant="darkFilled" value={name} onChange={handleChangeName} />
|
||||
</FormControl>
|
||||
{/* we should not show this field if default workflow or not saved to DB yet */}
|
||||
{/* {data?.meta.category !== 'default' || !data.workflow_id && ( */}
|
||||
<FormControl>
|
||||
<FormLabel>{t('workflows.workflowThumbnail')}</FormLabel>
|
||||
<WorkflowThumbnailEditor thumbnailUrl={data?.thumbnail_url || null} workflowId={id} />
|
||||
</FormControl>
|
||||
{/* )} */}
|
||||
{/*
|
||||
* Only saved and non-default workflows can have a thumbnail.
|
||||
* - Unsaved workflows have no id.
|
||||
* - Default workflows have a category of 'default'.
|
||||
*/}
|
||||
{id && data && data.workflow.meta.category !== 'default' && (
|
||||
<FormControl>
|
||||
<FormLabel>{t('workflows.workflowThumbnail')}</FormLabel>
|
||||
<WorkflowThumbnailEditor thumbnailUrl={data.thumbnail_url} workflowId={id} />
|
||||
</FormControl>
|
||||
)}
|
||||
<FormControl>
|
||||
<FormLabel>{t('nodes.workflowVersion')}</FormLabel>
|
||||
<Input variant="darkFilled" value={version} onChange={handleChangeVersion} />
|
||||
|
||||
@@ -11,8 +11,8 @@ export const WorkflowThumbnailEditor = ({
|
||||
workflowId,
|
||||
thumbnailUrl,
|
||||
}: {
|
||||
workflowId?: string;
|
||||
thumbnailUrl: string | null;
|
||||
workflowId: string;
|
||||
thumbnailUrl?: string | null;
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -28,10 +28,6 @@ export const WorkflowThumbnailEditor = ({
|
||||
}, []);
|
||||
|
||||
const handleSaveChanges = useCallback(async () => {
|
||||
if (!workflowId) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (localThumbnailUrl) {
|
||||
const blob = await convertImageUrlToBlob(localThumbnailUrl);
|
||||
|
||||
@@ -9,12 +9,12 @@ export const WorkflowThumbnailField = ({
|
||||
imageUrl,
|
||||
onChange,
|
||||
}: {
|
||||
imageUrl: string | null;
|
||||
imageUrl?: string | null;
|
||||
onChange: (localThumbnailUrl: string | null) => void;
|
||||
}) => {
|
||||
const [thumbnail, setThumbnail] = useState<File | null>(null);
|
||||
|
||||
const syncThumbnail = useCallback(async (imageUrl: string | null) => {
|
||||
const syncThumbnail = useCallback(async (imageUrl?: string | null) => {
|
||||
if (!imageUrl) {
|
||||
setThumbnail(null);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user