From 703e5b04e7375ba3fe1168f735b83d5be2089075 Mon Sep 17 00:00:00 2001 From: Samuel Bodin <1637651+bodinsamuel@users.noreply.github.com> Date: Mon, 6 Jan 2025 18:46:25 +0100 Subject: [PATCH] fix: sync API clarify response, remove operation name in UI (#3247) ## Changes Various small changes - Return an actual JSON for /sync/start,pause,trigger - Remove the operation name in the log UI --- docs-v2/spec.yaml | 29 ++++++++++++++++++- .../server/lib/controllers/sync.controller.ts | 6 ++-- .../pages/Logs/components/OperationTag.tsx | 8 +---- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/docs-v2/spec.yaml b/docs-v2/spec.yaml index a4c9ac21d5a..be6c36ebb75 100644 --- a/docs-v2/spec.yaml +++ b/docs-v2/spec.yaml @@ -1141,11 +1141,20 @@ paths: type: string full_resync: type: boolean - description: Clear the records and reset the "lastSyncDate" associated with the sync before triggering a new sync job. + description: Reset the "lastSyncDate" associated with the sync before triggering a new sync job. responses: '200': description: Successfully triggered the sync + content: + application/json: + schema: + type: object + required: + - success + properties: + success: + type: boolean '400': description: Invalid request content: @@ -1182,6 +1191,15 @@ paths: responses: '200': description: Successfully started the sync + content: + application/json: + schema: + type: object + required: + - success + properties: + success: + type: boolean '400': description: Invalid request content: @@ -1217,6 +1235,15 @@ paths: responses: '200': description: Successfully paused the sync + content: + application/json: + schema: + type: object + required: + - success + properties: + success: + type: boolean '400': description: Invalid request content: diff --git a/packages/server/lib/controllers/sync.controller.ts b/packages/server/lib/controllers/sync.controller.ts index b4eea5ef707..8288afe9902 100644 --- a/packages/server/lib/controllers/sync.controller.ts +++ b/packages/server/lib/controllers/sync.controller.ts @@ -201,7 +201,7 @@ class SyncController { return; } - res.sendStatus(200); + res.status(200).send({ success: true }); } catch (err) { next(err); } @@ -422,7 +422,7 @@ class SyncController { initiator: 'API call' }); - res.sendStatus(200); + res.status(200).send({ success: true }); } catch (err) { next(err); } @@ -464,7 +464,7 @@ class SyncController { initiator: 'API call' }); - res.sendStatus(200); + res.status(200).send({ success: true }); } catch (err) { next(err); } diff --git a/packages/webapp/src/pages/Logs/components/OperationTag.tsx b/packages/webapp/src/pages/Logs/components/OperationTag.tsx index a6af525a3fc..6b7292f4abd 100644 --- a/packages/webapp/src/pages/Logs/components/OperationTag.tsx +++ b/packages/webapp/src/pages/Logs/components/OperationTag.tsx @@ -41,13 +41,7 @@ export const OperationTag: React.FC<{ message: string; operation: Exclude -

- {message}{' '} - - ({operation.type} - {'action' in operation && <>:{operation.action}}) - -

+

{message}

);