Schließe die Connector-Kapselung ab, damit Paperless, IMAP und weitere Quellen über dieselbe Anbindung laufen.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
75a3949f7c
commit
d6b70d8f92
75 files changed
+9477
-414
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, documentToText, downloadFile, fetchPaperless, markDirty, textToDocument } from "../api.js";
|
||||
import { api, documentToText, downloadFile, fetchExternal, markDirty, textToDocument } from "../api.js";
|
||||
import { moduleFor } from "../sources/registry-core.js";
|
||||
import { Modal } from "./Modal.jsx";
|
||||
|
||||
export function ErrorNote({ error }) {
|
||||
@@ -53,11 +54,11 @@ function Binding({ binding, context, canEdit, isOwner, onChange }) {
|
||||
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
||||
}, [previewUrl]);
|
||||
|
||||
async function viewPaperless() {
|
||||
async function viewOriginal() {
|
||||
setError("");
|
||||
setViewing(true);
|
||||
try {
|
||||
const blob = await fetchPaperless(element.id, context);
|
||||
const blob = await fetchExternal(element.id, context);
|
||||
if (previewUrl) URL.revokeObjectURL(previewUrl);
|
||||
setPreviewUrl(URL.createObjectURL(blob));
|
||||
} catch (err) {
|
||||
@@ -212,12 +213,12 @@ function Binding({ binding, context, canEdit, isOwner, onChange }) {
|
||||
{element.kind === "external_ref" && element.external ? (
|
||||
<div className="ref">
|
||||
<p>
|
||||
{element.external.source === "paperless" ? "Paperless" : element.external.source === "imap" ? "E-Mail" : "Externe Adresse"}
|
||||
{moduleFor(element.external.source)?.addLabel || moduleFor(element.external.source)?.title || "Externe Adresse"}
|
||||
{element.external.detail?.correspondent ? ` · ${element.external.detail.correspondent}` : ""}
|
||||
{element.external.detail?.message_from ? ` · ${element.external.detail.message_from}` : ""}
|
||||
</p>
|
||||
{element.external.source === "paperless" ? (
|
||||
<button type="button" onClick={viewPaperless}>Ansehen</button>
|
||||
{moduleFor(element.external.source)?.representation && moduleFor(element.external.source).representation !== "email" ? (
|
||||
<button type="button" onClick={viewOriginal}>Ansehen</button>
|
||||
) : (
|
||||
<span>Verknüpft, ohne die Quelle zu kopieren.</span>
|
||||
)}
|
||||
@@ -314,8 +315,8 @@ function kindLabel(element) {
|
||||
const kind = element.kind;
|
||||
if (kind === "note") return "Notiz";
|
||||
if (kind === "file") return "Datei";
|
||||
if (element.external?.source === "paperless") return "Paperless";
|
||||
if (element.external?.source === "imap") return "E-Mail";
|
||||
const module = moduleFor(element.external?.source);
|
||||
if (module) return module.addLabel || module.title;
|
||||
if (kind === "external_ref") return "Referenz";
|
||||
return kind;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user