mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-10-12 14:01:29 +08:00
feat: rename access tokens to api keys (#6687)
* feat: rename access tokens to api keys * feat: update test cases * feat: update delete token to delete key
This commit is contained in:
parent
04778b9641
commit
2f62a9d36d
@ -3,7 +3,7 @@
|
|||||||
"alert_channels": "Alert Channels",
|
"alert_channels": "Alert Channels",
|
||||||
"organization_settings": "Organization Settings",
|
"organization_settings": "Organization Settings",
|
||||||
"ingestion_settings": "Ingestion Settings",
|
"ingestion_settings": "Ingestion Settings",
|
||||||
"api_keys": "Access Tokens",
|
"api_keys": "API Keys",
|
||||||
"my_settings": "My Settings",
|
"my_settings": "My Settings",
|
||||||
"overview_metrics": "Overview Metrics",
|
"overview_metrics": "Overview Metrics",
|
||||||
"dbcall_metrics": "Database Calls",
|
"dbcall_metrics": "Database Calls",
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"MY_SETTINGS": "SigNoz | My Settings",
|
"MY_SETTINGS": "SigNoz | My Settings",
|
||||||
"ORG_SETTINGS": "SigNoz | Organization Settings",
|
"ORG_SETTINGS": "SigNoz | Organization Settings",
|
||||||
"INGESTION_SETTINGS": "SigNoz | Ingestion Settings",
|
"INGESTION_SETTINGS": "SigNoz | Ingestion Settings",
|
||||||
"API_KEYS": "SigNoz | Access Tokens",
|
"API_KEYS": "SigNoz | API Keys",
|
||||||
"SOMETHING_WENT_WRONG": "SigNoz | Something Went Wrong",
|
"SOMETHING_WENT_WRONG": "SigNoz | Something Went Wrong",
|
||||||
"UN_AUTHORIZED": "SigNoz | Unauthorized",
|
"UN_AUTHORIZED": "SigNoz | Unauthorized",
|
||||||
"NOT_FOUND": "SigNoz | Page Not Found",
|
"NOT_FOUND": "SigNoz | Page Not Found",
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"delete_confirm_message": "Are you sure you want to delete {{keyName}} token? Deleting a token is irreversible and cannot be undone."
|
"delete_confirm_message": "Are you sure you want to delete {{keyName}} key? Deleting a key is irreversible and cannot be undone."
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"alert_channels": "Alert Channels",
|
"alert_channels": "Alert Channels",
|
||||||
"organization_settings": "Organization Settings",
|
"organization_settings": "Organization Settings",
|
||||||
"ingestion_settings": "Ingestion Settings",
|
"ingestion_settings": "Ingestion Settings",
|
||||||
"api_keys": "Access Tokens",
|
"api_keys": "API Keys",
|
||||||
"my_settings": "My Settings",
|
"my_settings": "My Settings",
|
||||||
"overview_metrics": "Overview Metrics",
|
"overview_metrics": "Overview Metrics",
|
||||||
"dbcall_metrics": "Database Calls",
|
"dbcall_metrics": "Database Calls",
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
"MY_SETTINGS": "SigNoz | My Settings",
|
"MY_SETTINGS": "SigNoz | My Settings",
|
||||||
"ORG_SETTINGS": "SigNoz | Organization Settings",
|
"ORG_SETTINGS": "SigNoz | Organization Settings",
|
||||||
"INGESTION_SETTINGS": "SigNoz | Ingestion Settings",
|
"INGESTION_SETTINGS": "SigNoz | Ingestion Settings",
|
||||||
"API_KEYS": "SigNoz | Access Tokens",
|
"API_KEYS": "SigNoz | API Keys",
|
||||||
"SOMETHING_WENT_WRONG": "SigNoz | Something Went Wrong",
|
"SOMETHING_WENT_WRONG": "SigNoz | Something Went Wrong",
|
||||||
"UN_AUTHORIZED": "SigNoz | Unauthorized",
|
"UN_AUTHORIZED": "SigNoz | Unauthorized",
|
||||||
"NOT_FOUND": "SigNoz | Page Not Found",
|
"NOT_FOUND": "SigNoz | Page Not Found",
|
||||||
|
@ -432,7 +432,7 @@ export const oldRoutes = [
|
|||||||
'/logs-explorer/live',
|
'/logs-explorer/live',
|
||||||
'/logs-save-views',
|
'/logs-save-views',
|
||||||
'/traces-save-views',
|
'/traces-save-views',
|
||||||
'/settings/api-keys',
|
'/settings/access-tokens',
|
||||||
];
|
];
|
||||||
|
|
||||||
export const oldNewRoutesMapping: Record<string, string> = {
|
export const oldNewRoutesMapping: Record<string, string> = {
|
||||||
@ -442,7 +442,7 @@ export const oldNewRoutesMapping: Record<string, string> = {
|
|||||||
'/logs-explorer/live': '/logs/logs-explorer/live',
|
'/logs-explorer/live': '/logs/logs-explorer/live',
|
||||||
'/logs-save-views': '/logs/saved-views',
|
'/logs-save-views': '/logs/saved-views',
|
||||||
'/traces-save-views': '/traces/saved-views',
|
'/traces-save-views': '/traces/saved-views',
|
||||||
'/settings/api-keys': '/settings/access-tokens',
|
'/settings/access-tokens': '/settings/api-keys',
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface AppRoutes {
|
export interface AppRoutes {
|
||||||
|
@ -34,7 +34,7 @@ const ROUTES = {
|
|||||||
MY_SETTINGS: '/my-settings',
|
MY_SETTINGS: '/my-settings',
|
||||||
SETTINGS: '/settings',
|
SETTINGS: '/settings',
|
||||||
ORG_SETTINGS: '/settings/org-settings',
|
ORG_SETTINGS: '/settings/org-settings',
|
||||||
API_KEYS: '/settings/access-tokens',
|
API_KEYS: '/settings/api-keys',
|
||||||
INGESTION_SETTINGS: '/settings/ingestion-settings',
|
INGESTION_SETTINGS: '/settings/ingestion-settings',
|
||||||
SOMETHING_WENT_WRONG: '/something-went-wrong',
|
SOMETHING_WENT_WRONG: '/something-went-wrong',
|
||||||
UN_AUTHORIZED: '/un-authorized',
|
UN_AUTHORIZED: '/un-authorized',
|
||||||
|
@ -26,9 +26,9 @@ describe('APIKeys component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders APIKeys component without crashing', () => {
|
it('renders APIKeys component without crashing', () => {
|
||||||
expect(screen.getByText('Access Tokens')).toBeInTheDocument();
|
expect(screen.getByText('API Keys')).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
screen.getByText('Create and manage access tokens for the SigNoz API'),
|
screen.getByText('Create and manage API keys for the SigNoz API'),
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -40,16 +40,16 @@ describe('APIKeys component', () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByText('No Expiry Token')).toBeInTheDocument();
|
expect(screen.getByText('No Expiry Key')).toBeInTheDocument();
|
||||||
expect(screen.getByText('1-5 of 18 tokens')).toBeInTheDocument();
|
expect(screen.getByText('1-5 of 18 keys')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('opens add new key modal on button click', async () => {
|
it('opens add new key modal on button click', async () => {
|
||||||
fireEvent.click(screen.getByText('New Token'));
|
fireEvent.click(screen.getByText('New Key'));
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
const createNewKeyBtn = screen.getByRole('button', {
|
const createNewKeyBtn = screen.getByRole('button', {
|
||||||
name: /Create new token/i,
|
name: /Create new key/i,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(createNewKeyBtn).toBeInTheDocument();
|
expect(createNewKeyBtn).toBeInTheDocument();
|
||||||
@ -57,10 +57,10 @@ describe('APIKeys component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('closes add new key modal on cancel button click', async () => {
|
it('closes add new key modal on cancel button click', async () => {
|
||||||
fireEvent.click(screen.getByText('New Token'));
|
fireEvent.click(screen.getByText('New Key'));
|
||||||
|
|
||||||
const createNewKeyBtn = screen.getByRole('button', {
|
const createNewKeyBtn = screen.getByRole('button', {
|
||||||
name: /Create new token/i,
|
name: /Create new key/i,
|
||||||
});
|
});
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -79,10 +79,10 @@ describe('APIKeys component', () => {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
fireEvent.click(screen.getByText('New Token'));
|
fireEvent.click(screen.getByText('New Key'));
|
||||||
|
|
||||||
const createNewKeyBtn = screen.getByRole('button', {
|
const createNewKeyBtn = screen.getByRole('button', {
|
||||||
name: /Create new token/i,
|
name: /Create new key/i,
|
||||||
});
|
});
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@ -90,7 +90,7 @@ describe('APIKeys component', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
act(() => {
|
act(() => {
|
||||||
const inputElement = screen.getByPlaceholderText('Enter Token Name');
|
const inputElement = screen.getByPlaceholderText('Enter Key Name');
|
||||||
fireEvent.change(inputElement, { target: { value: 'Top Secret' } });
|
fireEvent.change(inputElement, { target: { value: 'Top Secret' } });
|
||||||
fireEvent.click(screen.getByTestId('create-form-admin-role-btn'));
|
fireEvent.click(screen.getByTestId('create-form-admin-role-btn'));
|
||||||
fireEvent.click(createNewKeyBtn);
|
fireEvent.click(createNewKeyBtn);
|
||||||
|
@ -512,15 +512,15 @@ function APIKeys(): JSX.Element {
|
|||||||
<div className="api-key-container">
|
<div className="api-key-container">
|
||||||
<div className="api-key-content">
|
<div className="api-key-content">
|
||||||
<header>
|
<header>
|
||||||
<Typography.Title className="title">Access Tokens </Typography.Title>
|
<Typography.Title className="title">API Keys</Typography.Title>
|
||||||
<Typography.Text className="subtitle">
|
<Typography.Text className="subtitle">
|
||||||
Create and manage access tokens for the SigNoz API
|
Create and manage API keys for the SigNoz API
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div className="api-keys-search-add-new">
|
<div className="api-keys-search-add-new">
|
||||||
<Input
|
<Input
|
||||||
placeholder="Search for token..."
|
placeholder="Search for keys..."
|
||||||
prefix={<Search size={12} color={Color.BG_VANILLA_400} />}
|
prefix={<Search size={12} color={Color.BG_VANILLA_400} />}
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
onChange={handleSearch}
|
onChange={handleSearch}
|
||||||
@ -531,7 +531,7 @@ function APIKeys(): JSX.Element {
|
|||||||
type="primary"
|
type="primary"
|
||||||
onClick={showAddModal}
|
onClick={showAddModal}
|
||||||
>
|
>
|
||||||
<Plus size={14} /> New Token
|
<Plus size={14} /> New Key
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ function APIKeys(): JSX.Element {
|
|||||||
pageSize: 5,
|
pageSize: 5,
|
||||||
hideOnSinglePage: true,
|
hideOnSinglePage: true,
|
||||||
showTotal: (total: number, range: number[]): string =>
|
showTotal: (total: number, range: number[]): string =>
|
||||||
`${range[0]}-${range[1]} of ${total} tokens`,
|
`${range[0]}-${range[1]} of ${total} keys`,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@ -552,7 +552,7 @@ function APIKeys(): JSX.Element {
|
|||||||
{/* Delete Key Modal */}
|
{/* Delete Key Modal */}
|
||||||
<Modal
|
<Modal
|
||||||
className="delete-api-key-modal"
|
className="delete-api-key-modal"
|
||||||
title={<span className="title">Delete Token</span>}
|
title={<span className="title">Delete Key</span>}
|
||||||
open={isDeleteModalOpen}
|
open={isDeleteModalOpen}
|
||||||
closable
|
closable
|
||||||
afterClose={handleModalClose}
|
afterClose={handleModalClose}
|
||||||
@ -574,7 +574,7 @@ function APIKeys(): JSX.Element {
|
|||||||
onClick={onDeleteHandler}
|
onClick={onDeleteHandler}
|
||||||
className="delete-btn"
|
className="delete-btn"
|
||||||
>
|
>
|
||||||
Delete Token
|
Delete key
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@ -588,7 +588,7 @@ function APIKeys(): JSX.Element {
|
|||||||
{/* Edit Key Modal */}
|
{/* Edit Key Modal */}
|
||||||
<Modal
|
<Modal
|
||||||
className="api-key-modal"
|
className="api-key-modal"
|
||||||
title="Edit token"
|
title="Edit key"
|
||||||
open={isEditModalOpen}
|
open={isEditModalOpen}
|
||||||
key="edit-api-key-modal"
|
key="edit-api-key-modal"
|
||||||
afterClose={handleModalClose}
|
afterClose={handleModalClose}
|
||||||
@ -612,7 +612,7 @@ function APIKeys(): JSX.Element {
|
|||||||
icon={<Check size={14} />}
|
icon={<Check size={14} />}
|
||||||
onClick={onUpdateApiKey}
|
onClick={onUpdateApiKey}
|
||||||
>
|
>
|
||||||
Update Token
|
Update key
|
||||||
</Button>,
|
</Button>,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
@ -632,7 +632,7 @@ function APIKeys(): JSX.Element {
|
|||||||
label="Name"
|
label="Name"
|
||||||
rules={[{ required: true }, { type: 'string', min: 6 }]}
|
rules={[{ required: true }, { type: 'string', min: 6 }]}
|
||||||
>
|
>
|
||||||
<Input placeholder="Enter Token Name" autoFocus />
|
<Input placeholder="Enter Key Name" autoFocus />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="role" label="Role">
|
<Form.Item name="role" label="Role">
|
||||||
@ -666,7 +666,7 @@ function APIKeys(): JSX.Element {
|
|||||||
{/* Create New Key Modal */}
|
{/* Create New Key Modal */}
|
||||||
<Modal
|
<Modal
|
||||||
className="api-key-modal"
|
className="api-key-modal"
|
||||||
title="Create new token"
|
title="Create new key"
|
||||||
open={isAddModalOpen}
|
open={isAddModalOpen}
|
||||||
key="create-api-key-modal"
|
key="create-api-key-modal"
|
||||||
closable
|
closable
|
||||||
@ -683,7 +683,7 @@ function APIKeys(): JSX.Element {
|
|||||||
onClick={handleCopyClose}
|
onClick={handleCopyClose}
|
||||||
icon={<Check size={12} />}
|
icon={<Check size={12} />}
|
||||||
>
|
>
|
||||||
Copy token and close
|
Copy key and close
|
||||||
</Button>,
|
</Button>,
|
||||||
]
|
]
|
||||||
: [
|
: [
|
||||||
@ -704,7 +704,7 @@ function APIKeys(): JSX.Element {
|
|||||||
loading={isLoadingCreateAPIKey}
|
loading={isLoadingCreateAPIKey}
|
||||||
onClick={onCreateAPIKey}
|
onClick={onCreateAPIKey}
|
||||||
>
|
>
|
||||||
Create new token
|
Create new key
|
||||||
</Button>,
|
</Button>,
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ function APIKeys(): JSX.Element {
|
|||||||
rules={[{ required: true }, { type: 'string', min: 6 }]}
|
rules={[{ required: true }, { type: 'string', min: 6 }]}
|
||||||
validateTrigger="onFinish"
|
validateTrigger="onFinish"
|
||||||
>
|
>
|
||||||
<Input placeholder="Enter Token Name" autoFocus />
|
<Input placeholder="Enter Key Name" autoFocus />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item name="role" label="Role">
|
<Form.Item name="role" label="Role">
|
||||||
@ -769,7 +769,7 @@ function APIKeys(): JSX.Element {
|
|||||||
{showNewAPIKeyDetails && (
|
{showNewAPIKeyDetails && (
|
||||||
<div className="api-key-info-container">
|
<div className="api-key-info-container">
|
||||||
<Row>
|
<Row>
|
||||||
<Col span={8}>Token</Col>
|
<Col span={8}>Key</Col>
|
||||||
<Col span={16}>
|
<Col span={16}>
|
||||||
<span className="copyable-text">
|
<span className="copyable-text">
|
||||||
<Typography.Text>
|
<Typography.Text>
|
||||||
|
@ -82,7 +82,7 @@ export const getAPIKeysResponse = {
|
|||||||
},
|
},
|
||||||
token: '1udrUFmRI6gdb8r/hLabS7zRlgfMQlUw/tz9sac82pE=',
|
token: '1udrUFmRI6gdb8r/hLabS7zRlgfMQlUw/tz9sac82pE=',
|
||||||
role: 'ADMIN',
|
role: 'ADMIN',
|
||||||
name: 'No Expiry Token',
|
name: 'No Expiry Key',
|
||||||
createdAt: 1708008178,
|
createdAt: 1708008178,
|
||||||
expiresAt: 0,
|
expiresAt: 0,
|
||||||
updatedAt: 1708008190,
|
updatedAt: 1708008190,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user