feat: edit API keys (name, rights); quick dump text above its buttons; inline note badges
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m33s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 2m33s
- PATCH /keys/{id} renames a key or changes its scopes; the secret stays. Settings → API gets an
edit button per key with the same switches as for a new key.
- Quick dump: a multiline text gets the full width, the buttons move to their own row below; the
bar only goes back to one line once the text is clearly shorter (no flip-flopping).
- Notes: the "Erweitert"/"Unteraufgabe" badges sit right after the checkbox text.
v0.38.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f2eb08489
commit
1e3ac9786f
14 files changed
+266
-76
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
||||
import { render, screen, fireEvent, act } from '@testing-library/react';
|
||||
import { render, screen, fireEvent, act, within } from '@testing-library/react';
|
||||
|
||||
const createAPIKey = vi.fn(async () => ({ id: 'k1', userId: 'u', name: 'HA', keyPrefix: 'mindsift_sec_ab', scopes: 'webhook:triage,webhook:list', createdAt: '' }));
|
||||
const updateAPIKey = vi.fn(async () => ({}));
|
||||
vi.mock('../../../lib/api', () => ({
|
||||
api: {
|
||||
getAPIKeys: vi.fn(async () => [
|
||||
@@ -11,6 +12,7 @@ vi.mock('../../../lib/api', () => ({
|
||||
getTaskLists: vi.fn(async () => []),
|
||||
createAPIKey: (...args: unknown[]) => createAPIKey(...(args as [])),
|
||||
deleteAPIKey: vi.fn(),
|
||||
updateAPIKey: (...args: unknown[]) => updateAPIKey(...(args as [])),
|
||||
testWebhookIngest: vi.fn(),
|
||||
},
|
||||
triggerHaptic: vi.fn(),
|
||||
@@ -51,4 +53,19 @@ describe('ApiKeysPanel', () => {
|
||||
fireEvent.click(screen.getByRole('radio', { name: 'OpenAI Codex' }));
|
||||
expect(screen.getByText(/\[mcp_servers\.mindsift\]/)).toBeTruthy();
|
||||
});
|
||||
|
||||
it('renames a key and changes its rights', async () => {
|
||||
render(<ApiKeysPanel />);
|
||||
fireEvent.click(await screen.findByRole('button', { name: 'API-Key Rauchmelder bearbeiten' }));
|
||||
fireEvent.change(screen.getByLabelText('Name des Schlüssels'), { target: { value: 'Rauchmelder Flur' } });
|
||||
const group = screen.getByRole('group', { name: 'Berechtigungen von Rauchmelder' });
|
||||
fireEvent.click(within(group).getByRole('switch', { name: 'Aufgaben lesen' }));
|
||||
await act(async () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: 'Speichern' }));
|
||||
});
|
||||
expect(updateAPIKey).toHaveBeenCalledWith('k0', {
|
||||
name: 'Rauchmelder Flur',
|
||||
scopes: ['webhook:triage', 'webhook:task', 'tasks:read'],
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user