Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@
"newFolder": "New Folder",
"enableAll": "Enable All",
"disableAll": "Disable All",
"enableSelected": "Enable Selected",
"disableSelected": "Disable Selected",
"disableThirdParty": "Disable Third-Party",
"core": "Core",
"custom": "Custom",
"command": "Command",
"keybinding": "Keybinding",
"upload": "Upload",
Expand Down
46 changes: 31 additions & 15 deletions src/platform/settings/components/ExtensionPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
</Message>
</template>
<div class="mb-3 flex gap-2">
<SelectButton v-model="filterType" :options="filterTypes" />
<SelectButton
v-model="filterType"
:options="filterTypes"
option-label="label"
option-value="value"
/>
</div>
<DataTable
v-model:selection="selectedExtensions"
Expand All @@ -47,9 +52,9 @@
{{ slotProps.data.name }}
<Tag
v-if="extensionStore.isCoreExtension(slotProps.data.name)"
value="Core"
:value="$t('g.core')"
/>
<Tag v-else value="Custom" severity="info" />
<Tag v-else :value="$t('g.custom')" severity="info" />
</template>
</Column>
<Column
Expand Down Expand Up @@ -90,15 +95,26 @@ import SelectButton from 'primevue/selectbutton'
import Tag from 'primevue/tag'
import ToggleSwitch from 'primevue/toggleswitch'
import { computed, onMounted, ref } from 'vue'
import { useI18n } from 'vue-i18n'

import SearchBox from '@/components/common/SearchBox.vue'
import PanelTemplate from '@/components/dialog/content/setting/PanelTemplate.vue'
import { useSettingStore } from '@/platform/settings/settingStore'
import { useExtensionStore } from '@/stores/extensionStore'
import type { ComfyExtension } from '@/types/comfy'

const { t } = useI18n()

const filterTypes = ['All', 'Core', 'Custom']
const filterType = ref('All')
const selectedExtensions = ref<Array<any>>([])
const filterTypeKeys = ['all', 'core', 'custom'] as const
type FilterTypeKey = (typeof filterTypeKeys)[number]
const filterTypes = computed(() =>
filterTypeKeys.map((key) => ({
label: t(`g.${key}`),
value: key
}))
)
const filterType = ref<FilterTypeKey>('all')
const selectedExtensions = ref<ComfyExtension[]>([])

const filters = ref({
global: { value: '', matchMode: FilterMatchMode.CONTAINS }
Expand All @@ -112,11 +128,11 @@ const editingEnabledExtensions = ref<Record<string, boolean>>({})
const filteredExtensions = computed(() => {
const extensions = extensionStore.extensions
switch (filterType.value) {
case 'Core':
case 'core':
return extensions.filter((ext) =>
extensionStore.isCoreExtension(ext.name)
)
case 'Custom':
case 'custom':
return extensions.filter(
(ext) => !extensionStore.isCoreExtension(ext.name)
)
Expand Down Expand Up @@ -190,9 +206,9 @@ const applyChanges = () => {
}

const menu = ref<InstanceType<typeof ContextMenu>>()
const contextMenuItems = [
const contextMenuItems = computed(() => [
{
label: 'Enable Selected',
label: t('g.enableSelected'),
icon: 'pi pi-check',
command: async () => {
selectedExtensions.value.forEach((ext) => {
Expand All @@ -204,7 +220,7 @@ const contextMenuItems = [
}
},
{
label: 'Disable Selected',
label: t('g.disableSelected'),
icon: 'pi pi-times',
command: async () => {
selectedExtensions.value.forEach((ext) => {
Expand All @@ -219,20 +235,20 @@ const contextMenuItems = [
separator: true
},
{
label: 'Enable All',
label: t('g.enableAll'),
icon: 'pi pi-check',
command: enableAllExtensions
},
{
label: 'Disable All',
label: t('g.disableAll'),
icon: 'pi pi-times',
command: disableAllExtensions
},
{
label: 'Disable 3rd Party',
label: t('g.disableThirdParty'),
icon: 'pi pi-times',
command: disableThirdPartyExtensions,
disabled: !extensionStore.hasThirdPartyExtensions
}
]
])
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -334,19 +334,18 @@ export const useWorkflowTemplatesStore = defineStore(
})

// 2. Basics (isEssential categories) - always second if it exists
let gettingStartedText = 'Getting Started'
const essentialCat = coreTemplates.value.find(
(cat) => cat.isEssential && cat.templates.length > 0
)
const hasEssentialCategories = Boolean(essentialCat)

if (essentialCat) {
gettingStartedText = essentialCat.title
}
if (hasEssentialCategories) {
const categoryTitle = essentialCat.title ?? 'Getting Started'
items.push({
id: 'basics',
label: gettingStartedText,
label: st(
`templateWorkflows.category.${normalizeI18nKey(categoryTitle)}`,
categoryTitle
),
icon: 'icon-[lucide--graduation-cap]'
})
}
Expand Down
Loading