feat: add admin + deploy
ci-front / build (push) Successful in 2m28s

This commit is contained in:
2026-04-04 05:39:00 +03:00
parent 43e16b1360
commit 11cef95929
7 changed files with 1335 additions and 273 deletions
@@ -7,6 +7,12 @@ import type {
LogFilters,
InsertLogRequest,
InsertLogsRequest,
TokenUpdate,
TokenUpdatePermissions,
TokenPasswordReset,
RegistrationRequest,
DeployAgentsRequest,
DeployResponse,
} from "../types/agent.types";
class AgentApiService {
@@ -20,7 +26,9 @@ class AgentApiService {
}
async getUsers(): Promise<TokenUser[]> {
const response = await apiClient.get<TokenUser[]>(`${this.authBasePath}/tokens`);
const response = await apiClient.get<TokenUser[]>(
`${this.authBasePath}/tokens`,
);
return response.data;
}
@@ -60,17 +68,85 @@ class AgentApiService {
}
async getDistinctAgents(): Promise<string[]> {
const response = await apiClient.get<string[]>(`${this.logsBasePath}/agents`);
const response = await apiClient.get<string[]>(
`${this.logsBasePath}/agents`,
);
return response.data;
}
async getDistinctLevels(): Promise<string[]> {
const response = await apiClient.get<string[]>(`${this.logsBasePath}/levels`);
const response = await apiClient.get<string[]>(
`${this.logsBasePath}/levels`,
);
return response.data;
}
async getDistinctServices(): Promise<string[]> {
const response = await apiClient.get<string[]>(`${this.logsBasePath}/services`);
const response = await apiClient.get<string[]>(
`${this.logsBasePath}/services`,
);
return response.data;
}
// User management methods
async getUserByLogin(login: string): Promise<TokenUser> {
const response = await apiClient.get<TokenUser>(
`${this.authBasePath}/users/${login}`,
);
return response.data;
}
async getInactiveUsers(): Promise<TokenUser[]> {
const response = await apiClient.get<TokenUser[]>(
`${this.authBasePath}/users/inactive`,
);
return response.data;
}
async updateUser(login: string, data: TokenUpdate): Promise<void> {
await apiClient.put(`${this.authBasePath}/users/${login}`, data);
}
async updateUserPermissions(
login: string,
data: TokenUpdatePermissions,
): Promise<void> {
await apiClient.put(
`${this.authBasePath}/users/${login}/permissions`,
data,
);
}
async resetUserPassword(
login: string,
data: TokenPasswordReset,
): Promise<void> {
await apiClient.put(`${this.authBasePath}/users/${login}/password`, data);
}
async activateUser(login: string): Promise<void> {
await apiClient.post(`${this.authBasePath}/users/${login}/activate`);
}
async deactivateUser(login: string): Promise<void> {
await apiClient.post(`${this.authBasePath}/users/${login}/deactivate`);
}
async createRegistrationToken(
data: RegistrationRequest,
): Promise<Record<string, string>> {
const response = await apiClient.post<Record<string, string>>(
`${this.basePath}/register-token`,
data,
);
return response.data;
}
async deployAgents(data: DeployAgentsRequest): Promise<DeployResponse> {
const response = await apiClient.post<DeployResponse>(
`${this.basePath}/deploy`,
data,
);
return response.data;
}
}