mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-13 20:14:16 +00:00
Show a connected account's login, not a key ending, on tool cards
GitHub connections made with a token are named after the GitHub login; the card called that login a key ending.
This commit is contained in:
1 parent
154d693116
commit
dab5aca96e
2 files changed
+39
-2
No files matched your search
@@ -458,6 +458,42 @@ describe('Tools page connections', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('names an account by its login, not as a key ending', async () => {
|
||||
getUserTools.mockImplementation(() =>
|
||||
jsonResponse({
|
||||
tools: [
|
||||
...TOOLS,
|
||||
{
|
||||
id: 'gh',
|
||||
name: 'mcp_tool',
|
||||
displayName: 'GitHub',
|
||||
customName: '',
|
||||
description: '',
|
||||
status: true,
|
||||
config: {},
|
||||
actions: [],
|
||||
connection_id: 'conn-gh',
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
reduxState.connectors.connections = [
|
||||
...reduxState.connectors.connections,
|
||||
{
|
||||
id: 'conn-gh',
|
||||
connector_key: 'github',
|
||||
name: 'GitHub',
|
||||
icon: 'github',
|
||||
status: 'connected',
|
||||
auth_kind: 'api_key',
|
||||
account_label: 'dartpain',
|
||||
},
|
||||
];
|
||||
await renderTools(root);
|
||||
const footer = card('GitHub').querySelector('[data-slot="card-footer"]')!;
|
||||
expect(footer.textContent).toBe('dartpain');
|
||||
});
|
||||
|
||||
it('says a connected tool needs signing in again, with no raw MCP reconnect', async () => {
|
||||
await renderTools(root);
|
||||
expect(card('Linear').textContent).toContain(
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
selectConnections,
|
||||
selectConnectorCatalog,
|
||||
} from '../connectors/connectorsSlice';
|
||||
import { connectorDescription } from '../connectors/i18n';
|
||||
import { connectorDescription, isKeyHint } from '../connectors/i18n';
|
||||
import type { Connection } from '../connectors/types';
|
||||
import { useSignInAgain } from '../connectors/SignInAgainNotice';
|
||||
import { toolServiceOf } from '../connectors/toolService';
|
||||
@@ -334,7 +334,8 @@ export default function Tools() {
|
||||
const accountLine = (connection: Connection) =>
|
||||
connection.account_name
|
||||
? connection.account_name
|
||||
: connection.auth_kind === 'api_key'
|
||||
: connection.auth_kind === 'api_key' &&
|
||||
isKeyHint(connection.account_label)
|
||||
? t('settings.connectors.detail.keyEnding', {
|
||||
hint: connection.account_label,
|
||||
interpolation: { escapeValue: false },
|
||||
|
||||
Reference in new issue
Block a user