From 03518a8da198d5ca2c19dd71fed8709c9dabf832 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 1 Dec 2023 16:18:39 +0100 Subject: [PATCH] :sparkles: Add the ability to stream events on rpc methods --- .../app/templates/api-doc-entry.tmpl | 6 ++ backend/resources/app/templates/api-doc.tmpl | 11 ++ backend/src/app/features/components_v2.clj | 12 ++- backend/src/app/http/errors.clj | 4 + backend/src/app/http/sse.clj | 86 +++++++++++++++ backend/src/app/rpc.clj | 18 ++-- backend/src/app/rpc/commands/binfile.clj | 101 +++++++++++------- backend/src/app/rpc/commands/management.clj | 65 ++++++----- backend/src/app/rpc/doc.clj | 2 + backend/test/backend_tests/helpers.clj | 32 +++++- .../backend_tests/rpc_management_test.clj | 9 +- common/deps.edn | 2 +- docker/devenv/files/nginx.conf | 2 + frontend/package.json | 1 + frontend/src/app/main/data/dashboard.cljs | 16 ++- frontend/src/app/main/repo.cljs | 32 ++++-- .../src/app/main/ui/dashboard/projects.cljs | 6 +- frontend/src/app/util/http.cljs | 27 +++-- frontend/src/app/util/sse.cljs | 54 ++++++++++ frontend/src/app/worker/import.cljs | 20 ++-- frontend/yarn.lock | 8 ++ 21 files changed, 408 insertions(+), 106 deletions(-) create mode 100644 backend/src/app/http/sse.clj create mode 100644 frontend/src/app/util/sse.cljs diff --git a/backend/resources/app/templates/api-doc-entry.tmpl b/backend/resources/app/templates/api-doc-entry.tmpl index c61157ec2..31c48deeb 100644 --- a/backend/resources/app/templates/api-doc-entry.tmpl +++ b/backend/resources/app/templates/api-doc-entry.tmpl @@ -25,6 +25,12 @@ SCHEMA {% endif %} + + {% if item.sse %} + + SSE + + {% endif %}