diff --git a/backend/resources/templates/debug.tmpl b/backend/resources/templates/debug.tmpl index 56093e708d..7479dd9827 100644 --- a/backend/resources/templates/debug.tmpl +++ b/backend/resources/templates/debug.tmpl @@ -50,8 +50,11 @@ Debug Main Page file.
-
- +
+ + + +
diff --git a/backend/resources/templates/styles.css b/backend/resources/templates/styles.css index 74b19390a3..32fcea8883 100644 --- a/backend/resources/templates/styles.css +++ b/backend/resources/templates/styles.css @@ -168,3 +168,12 @@ form .row { padding: 5px 0; } +.set-of-inputs { + flex-direction: column; + display: flex; +} + +.set-of-inputs input:not(:last-child) { + margin-bottom: 3px; +} + diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index 4753d08937..1e04be78fc 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -265,17 +265,20 @@ (defn export-handler [{:keys [pool] :as cfg} {:keys [params profile-id] :as request}] - (let [file-id (some-> params :file-id parse-uuid) - libs? (contains? params :includelibs) - clone? (contains? params :clone) - embed? (contains? params :embedassets)] - (when-not file-id + (let [file-ids (->> (:file-ids params) + (remove empty?) + (map parse-uuid)) + libs? (contains? params :includelibs) + clone? (contains? params :clone) + embed? (contains? params :embedassets)] + + (when-not (seq file-ids) (ex/raise :type :validation :code :missing-arguments)) (let [path (-> cfg - (assoc ::binf/file-id file-id) + (assoc ::binf/file-ids file-ids) (assoc ::binf/embed-assets? embed?) (assoc ::binf/include-libraries? libs?) (binf/export!))] @@ -297,7 +300,7 @@ (yrs/response :status 200 :headers {"content-type" "application/octet-stream" - "content-disposition" (str "attachmen; filename=" file-id ".penpot")} + "content-disposition" (str "attachmen; filename=" (first file-ids) ".penpot")} :body (io/input-stream path)))))) diff --git a/backend/src/app/rpc/commands/binfile.clj b/backend/src/app/rpc/commands/binfile.clj index abdb440818..6a2fe91457 100644 --- a/backend/src/app/rpc/commands/binfile.clj +++ b/backend/src/app/rpc/commands/binfile.clj @@ -306,7 +306,7 @@ SELECT fl.id, fl.deleted_at FROM file AS fl JOIN file_library_rel AS flr ON (flr.library_file_id = fl.id) - WHERE flr.file_id = ?::uuid + WHERE flr.file_id = ANY(?) UNION SELECT fl.id, fl.deleted_at FROM file AS fl @@ -318,8 +318,10 @@ WHERE l.deleted_at IS NULL OR l.deleted_at > now();") (defn- retrieve-libraries - [pool file-id] - (map :id (db/exec! pool [sql:file-libraries file-id]))) + [pool ids] + (with-open [^AutoCloseable conn (db/open pool)] + (let [ids (db/create-array conn "uuid" ids)] + (map :id (db/exec! pool [sql:file-libraries ids]))))) (def ^:private sql:file-library-rels "SELECT * FROM file_library_rel @@ -394,14 +396,14 @@ same file library all assets used from external libraries. " - [{:keys [pool storage ::output ::file-id ::include-libraries? ::embed-assets?] :as options}] + [{:keys [pool storage ::output ::file-ids ::include-libraries? ::embed-assets?] :as options}] (us/assert! :spec ::db/pool :val pool) (us/assert! :spec ::sto/storage :val storage) (us/assert! - :expr (uuid? file-id) - :hint "`file-id` should be an uuid") + :expr (every? uuid? file-ids) + :hint "`files` should be a vector of uuid") (us/assert! :expr (bs/data-output-stream? output) @@ -420,9 +422,9 @@ :expr (not (and include-libraries? embed-assets?)) :hint "the `include-libraries?` and `embed-assets?` are mutally excluding options") - (let [libs (when include-libraries? (retrieve-libraries pool file-id)) - rels (when include-libraries? (retrieve-library-relations pool (cons file-id libs))) - files (into [file-id] libs) + (let [libs (when include-libraries? (retrieve-libraries pool file-ids)) + files (into file-ids libs) + rels (when include-libraries? (retrieve-library-relations pool file-ids)) sids (volatile! #{})] ;; Write header with metadata