From eb636f5b57478be3f42f3ca9e79644c6c6b126a9 Mon Sep 17 00:00:00 2001 From: Vitalii Date: Wed, 14 Jun 2023 16:48:29 +0300 Subject: [PATCH] satellite/admin: add UI functionality to update user's or project's user agent Implemented UI functionality to allow prod owner to update user's or project's user agent. Issue: https://github.com/storj/storj-private/issues/297 Change-Id: Ibe47e735f3c7a9fdf05b70735ebcecbac5c94ce8 --- satellite/admin/ui/src/lib/api.ts | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/satellite/admin/ui/src/lib/api.ts b/satellite/admin/ui/src/lib/api.ts index 74e825b19..d5a18e2c0 100644 --- a/satellite/admin/ui/src/lib/api.ts +++ b/satellite/admin/ui/src/lib/api.ts @@ -204,6 +204,19 @@ export class Admin { }) as Promise; } }, + { + name: 'update user agent', + desc: 'Update projects user agent', + params: [ + ['Project ID', new InputText('text', true)], + ['User Agent', new InputText('text', true)] + ], + func: async (projectId: string, userAgent: string): Promise => { + return this.fetch('PATCH', `projects/${projectId}/useragent`, null, { + userAgent + }) as Promise; + } + }, { name: 'create API key', desc: 'Create a new API key for a specific project', @@ -415,6 +428,19 @@ Blank fields will not be updated.`, }) as Promise; } }, + { + name: 'update user agent', + desc: `Update user's user agent.`, + params: [ + ["current user's email", new InputText('email', true)], + ['user agent', new InputText('text', true)] + ], + func: async (currentEmail: string, userAgent: string): Promise => { + return this.fetch('PATCH', `users/${currentEmail}/useragent`, null, { + userAgent + }) as Promise; + } + }, { name: 'disable MFA', desc: "Disable user's mulifactor authentication", @@ -472,7 +498,7 @@ Blank fields will not be updated.`, } protected async fetch( - method: 'DELETE' | 'GET' | 'POST' | 'PUT', + method: 'DELETE' | 'GET' | 'POST' | 'PUT' | 'PATCH', path: string, query?: string, data?: Record