collection plugin actions

This commit is contained in:
Chris Turchin
2025-12-16 00:47:12 +01:00
parent cfbfd66eef
commit e17aae246b
11 changed files with 380 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ import { getCreateDropdownItems } from '../hooks/useCreateDropdownItems';
import { getGrpcRequestActions } from '../hooks/useGrpcRequestActions';
import { useHotKey } from '../hooks/useHotKey';
import { getHttpRequestActions } from '../hooks/useHttpRequestActions';
import { getHttpCollectionActions } from '../hooks/useHttpCollectionActions';
import { useListenToTauriEvent } from '../hooks/useListenToTauriEvent';
import { getModelAncestors } from '../hooks/useModelAncestors';
import { sendAnyHttpRequest } from '../hooks/useSendAnyHttpRequest';
@@ -374,6 +375,17 @@ function Sidebar({ className }: { className?: string }) {
if (request != null) await a.call(request);
},
})),
...(items.length === 1 && (child.model === 'folder' || child.model === 'workspace')
? await getHttpCollectionActions()
: []
).map((a) => ({
label: a.label,
leftSlot: <Icon icon={a.icon ?? 'empty'} />,
onSelect: async () => {
const model = getModel(child.model, child.id);
if (model != null) await a.call(model as any);
},
})),
];
const modelCreationItems: DropdownItem[] =
items.length === 1 && child.model === 'folder'