diff --git a/locales/en.json b/locales/en.json index 08133508e..b0c7286c0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -162,6 +162,7 @@ "yamlTag": "YAML", "includeSharedDirs": "Include Shared Directories", "manageSharedDirs": "Manage Shared Directories in Desktop Settings", + "manageShort": "Manage", "refreshCustomPaths": "Refresh status", "extraModelPathsModalTitle": "Custom model paths", "extraModelPathsModalNote": "Read-only — ComfyUI searches these directories, but the launcher does not manage them. Edit extra_model_paths.yaml to change them.", @@ -261,6 +262,7 @@ "makePrimary": "Use for Model Downloads", "openDir": "Open folder", "instanceOnly": "Build", + "sharedTag": "Shared", "lockedDir": "This directory is always used and cannot be removed.", "removeInstanceDirTitle": "Remove model directory?", "removeInstanceDirConfirm": "This won't delete any files. You can re-add the directory later from this list.", @@ -643,6 +645,7 @@ "community": "Community", "storageTab": "Storage", "sharedDirectories": "Shared Directories", + "storageSharedHint": "These folders are shared by every build. Each build chooses in its own Storage tab whether to use them.", "installLocation": "Default Install Location", "updatesTab": "Updates", "diagnostics": "Diagnostics", diff --git a/locales/zh.json b/locales/zh.json index 941523c9c..789abc022 100644 --- a/locales/zh.json +++ b/locales/zh.json @@ -162,6 +162,7 @@ "yamlTag": "YAML", "includeSharedDirs": "包含共享目录", "manageSharedDirs": "在桌面设置中管理共享目录", + "manageShort": "管理", "refreshCustomPaths": "刷新状态", "extraModelPathsModalTitle": "自定义模型路径", "extraModelPathsModalNote": "只读 —— ComfyUI 会搜索这些目录,但启动器不会管理它们。请编辑 extra_model_paths.yaml 以更改它们。", @@ -261,6 +262,7 @@ "makePrimary": "用于模型下载", "openDir": "打开文件夹", "instanceOnly": "构建", + "sharedTag": "共享", "lockedDir": "此目录始终会被使用,无法移除。", "removeInstanceDirTitle": "要移除模型目录吗?", "removeInstanceDirConfirm": "这不会删除任何文件。你之后可以从此列表重新添加该目录。", @@ -643,6 +645,7 @@ "community": "社区", "storageTab": "存储", "sharedDirectories": "共享目录", + "storageSharedHint": "这些文件夹由所有构建共享。每个构建可在自己的“存储”标签页中选择是否使用。", "installLocation": "默认安装位置", "updatesTab": "更新", "diagnostics": "诊断", diff --git a/src/renderer/src/comfyTitlePopup/GlobalSettingsView.test.ts b/src/renderer/src/comfyTitlePopup/GlobalSettingsView.test.ts index 7820bc443..737e9adfa 100644 --- a/src/renderer/src/comfyTitlePopup/GlobalSettingsView.test.ts +++ b/src/renderer/src/comfyTitlePopup/GlobalSettingsView.test.ts @@ -542,6 +542,27 @@ describe('GlobalSettingsView', () => { expect(dirRows.every((r) => r.find('.storage-item-icon.is-shared').exists())).toBe(true) }) + it('Storage tab explains the folders are shared and drops the redundant Shared tag', async () => { + installMockBridge() + const snapshot = makeSnapshot({ + sharedDirectoriesFields: [ + { id: 'inputDir', label: 'Input Directory', value: '/shared/in', type: 'path' }, + { id: 'outputDir', label: 'Output Directory', value: '/shared/out', type: 'path' } + ] + }) + const wrapper = mountView(snapshot) + await wrapper + .findAll('.gs-tab') + .find((t) => t.text() === 'Storage')! + .trigger('keydown', { key: 'Enter' }) + await nextTick() + expect(wrapper.find('.gs-storage-hint').text()).toContain('shared by every build') + expect(wrapper.find('.tag-shared').exists()).toBe(false) + expect(wrapper.find('.storage-dir-shared-tag').exists()).toBe(false) + const dirTags = wrapper.findAll('.gs-shared-dirs .storage-dir-tag').map((el) => el.text()) + expect(dirTags).toEqual(['Input Directory', 'Output Directory']) + }) + it('Storage tab section tooltips state the global-vs-instance scope', async () => { installMockBridge() const snapshot = makeSnapshot({ diff --git a/src/renderer/src/comfyTitlePopup/globalSettings/GlobalStorageSections.vue b/src/renderer/src/comfyTitlePopup/globalSettings/GlobalStorageSections.vue index 51e7ddc80..bc5856f00 100644 --- a/src/renderer/src/comfyTitlePopup/globalSettings/GlobalStorageSections.vue +++ b/src/renderer/src/comfyTitlePopup/globalSettings/GlobalStorageSections.vue @@ -138,9 +138,13 @@ async function handleChangeModelsDir(index: number): Promise { diff --git a/src/renderer/src/comfyTitlePopup/globalSettings/ModelsDirList.vue b/src/renderer/src/comfyTitlePopup/globalSettings/ModelsDirList.vue index fbdd5ef75..a4b2a62ef 100644 --- a/src/renderer/src/comfyTitlePopup/globalSettings/ModelsDirList.vue +++ b/src/renderer/src/comfyTitlePopup/globalSettings/ModelsDirList.vue @@ -15,6 +15,7 @@ import { } from 'lucide-vue-next' import InfoTooltip from '../../components/InfoTooltip.vue' import StorageItemIcon from '../../components/StorageItemIcon.vue' +import StorageTag from '../../components/StorageTag.vue' interface ModelsDir { path: string @@ -29,6 +30,7 @@ interface ModelsDir { interface Props { dirs: ModelsDir[] addLabel?: string + hideSharedTag?: boolean } const props = defineProps() @@ -44,6 +46,8 @@ const emit = defineEmits<{ const { t } = useI18n() const actionClass = 'models-dir-action shrink-0' +const nameClass = + 'models-dir-name static block min-w-0 max-w-full truncate gap-0 rounded-none border-none bg-transparent p-0 text-left font-mono text-[12.5px] leading-[18px] font-normal text-neutral-100 appearance-auto hover:bg-transparent hover:underline focus-visible:bg-transparent focus-visible:underline focus-visible:outline-none focus-visible:ring-0' const openMenuIndex = ref(null) function canPromote(dir: ModelsDir): boolean { @@ -117,14 +121,11 @@ const rows = computed(() => diff --git a/src/renderer/src/components/StorageTag.vue b/src/renderer/src/components/StorageTag.vue new file mode 100644 index 000000000..bba0b8ad4 --- /dev/null +++ b/src/renderer/src/components/StorageTag.vue @@ -0,0 +1,7 @@ + diff --git a/src/renderer/src/views/comfyUISettings/BuildSettingsSection.vue b/src/renderer/src/views/comfyUISettings/BuildSettingsSection.vue new file mode 100644 index 000000000..b6e7138dc --- /dev/null +++ b/src/renderer/src/views/comfyUISettings/BuildSettingsSection.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/renderer/src/views/comfyUISettings/PathField.vue b/src/renderer/src/views/comfyUISettings/PathField.vue index d33d77265..294cad061 100644 --- a/src/renderer/src/views/comfyUISettings/PathField.vue +++ b/src/renderer/src/views/comfyUISettings/PathField.vue @@ -41,6 +41,7 @@ function handleOpen(): void { diff --git a/src/renderer/src/views/comfyUISettings/StorageDirRow.vue b/src/renderer/src/views/comfyUISettings/StorageDirRow.vue index d3d059a14..ee85c9f25 100644 --- a/src/renderer/src/views/comfyUISettings/StorageDirRow.vue +++ b/src/renderer/src/views/comfyUISettings/StorageDirRow.vue @@ -1,26 +1,31 @@ diff --git a/src/renderer/src/views/comfyUISettings/StoragePane.test.ts b/src/renderer/src/views/comfyUISettings/StoragePane.test.ts index 4aad93017..27c46c0c8 100644 --- a/src/renderer/src/views/comfyUISettings/StoragePane.test.ts +++ b/src/renderer/src/views/comfyUISettings/StoragePane.test.ts @@ -247,6 +247,30 @@ describe('StoragePane', () => { expect(api.openGlobalSettingsCalls).toEqual(['storage']) }) + it('puts the manage-shared link in the Models panel footer next to Add Directory', async () => { + installMockApi() + const wrapper = mountPane() + await nextTick() + const foot = wrapper.find('.models-dir-list .models-dir-foot') + expect(foot.find('.models-dir-add').exists()).toBe(true) + expect(foot.find('.storage-manage-link').text()).toBe( + 'Manage Shared Directories in Desktop Settings' + ) + }) + + it('tags shared model dirs as Shared and leaves build-only dirs untagged', async () => { + installMockApi() + const wrapper = mountPaneWithSections(makeStorageSections(['/b/models'], { sharedOn: true })) + await nextTick() + const rows = wrapper.findAll('.models-dir-row') + const sharedRows = rows.filter((r) => r.find('.storage-item-icon.is-shared').exists()) + const ownRows = rows.filter((r) => !r.find('.storage-item-icon.is-shared').exists()) + expect(sharedRows.length).toBeGreaterThan(0) + expect(ownRows.length).toBeGreaterThan(0) + expect(sharedRows.every((r) => r.find('.tag-shared').text() === 'Shared')).toBe(true) + expect(ownRows.every((r) => !r.find('.tag-shared').exists())).toBe(true) + }) + it('hides the manage-shared link while shared models is off', async () => { installMockApi() const wrapper = mountPaneWithSections(makeStorageSections([])) @@ -820,6 +844,22 @@ describe('StoragePane', () => { expect(wrapper.emitted('update-field')).toBeUndefined() }) + it('tags shared input and output rows as Shared with a text Manage action', async () => { + installMockApi() + const wrapper = mountPaneWithSections( + makeIoSections({ sharedInput: true, sharedOutput: false }), + makeSharedIoSnapshot() + ) + await nextTick() + const [sharedRow, ownRow] = wrapper.findAll('.storage-dir-row') + expect(sharedRow!.find('.storage-dir-shared-tag').text()).toBe('Shared') + expect( + sharedRow!.find('.storage-dir-action[aria-label^="Manage Shared Directories"]').text() + ).toBe('Manage') + expect(ownRow!.find('.storage-dir-shared-tag').exists()).toBe(false) + expect(ownRow!.find('.storage-dir-tag').text()).toBe('default') + }) + it('browsing a per-instance output updates only the install outputDir field', async () => { const api = installMockApi() api.browseFolderReturn = '/ext/out' diff --git a/src/renderer/src/views/comfyUISettings/StoragePane.vue b/src/renderer/src/views/comfyUISettings/StoragePane.vue index 96db062ed..de877e9fa 100644 --- a/src/renderer/src/views/comfyUISettings/StoragePane.vue +++ b/src/renderer/src/views/comfyUISettings/StoragePane.vue @@ -4,9 +4,9 @@ import { useI18n } from 'vue-i18n' import Button from '@comfyorg/design-system/button/Button' import { AlertTriangle } from 'lucide-vue-next' import { useModal } from '../../composables/useModal' -import GlobalSettingsMicroSection from '../../comfyTitlePopup/globalSettings/GlobalSettingsMicroSection.vue' import ModelsDirList from '../../comfyTitlePopup/globalSettings/ModelsDirList.vue' import StorageDirRow from './StorageDirRow.vue' +import BuildSettingsSection from './BuildSettingsSection.vue' import BooleanToggle from './BooleanToggle.vue' import ExtraModelPathsModal, { type ExtraModelPathSection } from './ExtraModelPathsModal.vue' import InfoTooltip from '../../components/InfoTooltip.vue' @@ -330,29 +330,26 @@ function handleRevealPath(path: string): void {