diff --git a/src/Calendars/Main.tsx b/src/Calendars/Main.tsx index c902a59..66755a1 100644 --- a/src/Calendars/Main.tsx +++ b/src/Calendars/Main.tsx @@ -23,6 +23,7 @@ import PageNotFound, { PageNotFoundRoute } from "../PageNotFound"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemDelete, itemSave, defaultColor } from "../Pim/helpers"; import { historyPersistor } from "../persist-state-history"; +import ItemChangeHistory from "../Pim/ItemChangeHistory"; const PersistCalendar = historyPersistor("Calendar")(Calendar); @@ -180,9 +181,17 @@ export default function CalendarsMain() { -

Not currently implemented.

-
+ render={() => { + const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!; + if (!cachedCollection) { + return (); + } + + return ( + + ); + }} + /> >(); - const [dialog, setDialog] = React.useState(); + const history = useHistory(); const etebase = useCredentials()!; const { collection, metadata } = props.collection; @@ -74,33 +70,29 @@ export default function CollectionChangeEntries(props: PropsType) { return a - b; }); + let changelogRoute = ""; + switch (colType) { + case "etebase.vevent": { + changelogRoute = "pim.events._id.log"; + break; + } + case "etebase.vtodo": { + changelogRoute = "pim.tasks._id.log"; + break; + } + case "etebase.vcard": { + changelogRoute = "pim.contacts._id.log"; + break; + } + } + return (
- setDialog(undefined)} - > - - Raw Content - - -
Entry UID:
{dialog?.item.uid}
-
Content: -
{dialog?.content}
-
-
- - - -
+ history.push(routeResolver.getRoute(changelogRoute, { itemUid: getRawItemNavigationUid(collection.uid, item.item.uid) })) + } />
); diff --git a/src/Contacts/Main.tsx b/src/Contacts/Main.tsx index 689ceca..1f92786 100644 --- a/src/Contacts/Main.tsx +++ b/src/Contacts/Main.tsx @@ -21,6 +21,7 @@ import ContactEdit from "./ContactEdit"; import PageNotFound, { PageNotFoundRoute } from "../PageNotFound"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers"; +import ItemChangeHistory from "../Pim/ItemChangeHistory"; const colType = "etebase.vcard"; @@ -148,9 +149,17 @@ export default function ContactsMain() {
-

Not currently implemented.

-
+ render={() => { + const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!; + if (!cachedCollection) { + return (); + } + + return ( + + ); + }} + /> (); + const [dialog, setDialog] = React.useState(); + const etebase = useCredentials()!; + const { collection, metadata } = props.collection; + const items = useItems(etebase, metadata.type); + + const item = items?.get(collection.uid)?.get(props.itemUid); + + React.useEffect(() => { + if (item) { + loadRevisions(etebase, collection, item) + .then((entries) => setEntries(entries)); + } + }, [etebase, collection, item]); + + if (!entries) { + return ( + + ); + } + + return ( +
+ setDialog(undefined)} + > + + Raw Content + + +
Revision UID:
{dialog?.item.etag}
+
Content: +
{dialog?.content}
+
+
+ + + +
+ +
+ ); +} + diff --git a/src/Pim/helpers.tsx b/src/Pim/helpers.tsx index 47f432f..1ec99a0 100644 --- a/src/Pim/helpers.tsx +++ b/src/Pim/helpers.tsx @@ -21,9 +21,13 @@ export interface CachedCollection { metadata: Etebase.CollectionMetadata; } -export function getItemNavigationUid(item: PimType) { +export function getRawItemNavigationUid(collectionUid: string, itemUid: string) { // Both collectionUid and itemUid are url safe - return `${item.collectionUid}|${item.itemUid}`; + return `${collectionUid}|${itemUid}`; +} + +export function getItemNavigationUid(item: PimType) { + return getRawItemNavigationUid(item.collectionUid!, item.itemUid!); } export function getDecryptCollectionsFunction(_colType?: string) { diff --git a/src/Tasks/Main.tsx b/src/Tasks/Main.tsx index 645167f..8c76e58 100644 --- a/src/Tasks/Main.tsx +++ b/src/Tasks/Main.tsx @@ -21,6 +21,7 @@ import TaskEdit from "./TaskEdit"; import PageNotFound, { PageNotFoundRoute } from "../PageNotFound"; import { CachedCollection, getItemNavigationUid, getDecryptCollectionsFunction, getDecryptItemsFunction, PimFab, itemSave, itemDelete } from "../Pim/helpers"; +import ItemChangeHistory from "../Pim/ItemChangeHistory"; const colType = "etebase.vtodo"; @@ -150,9 +151,17 @@ export default function TasksMain() {
-

Not currently implemented.

-
+ render={() => { + const cachedCollection = cachedCollections!.find((x) => x.collection.uid === colUid)!; + if (!cachedCollection) { + return (); + } + + return ( + + ); + }} + />