Skip to content

Commit

Permalink
feat: Add links to updated pages on Completed Dialog
Browse files Browse the repository at this point in the history
Fixes: #224
  • Loading branch information
andymac4182 committed Apr 28, 2023
1 parent 92b9d2d commit 65c1a42
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/lib/src/Publisher.ts
Expand Up @@ -68,6 +68,7 @@ export interface ConfluenceAdfFile {

pageId: string;
spaceKey: string;
pageUrl: string;

contentType: PageContentType;
blogPostDate?: string;
Expand Down
7 changes: 6 additions & 1 deletion packages/lib/src/TreeConfluence.ts
Expand Up @@ -49,6 +49,7 @@ export async function ensureAllFilesExistInConfluence(
settings: ConfluenceSettings
): Promise<ConfluenceNode[]> {
const confluenceNode = await createFileStructureInConfluence(
settings,
confluenceClient,
adaptor,
node,
Expand All @@ -66,6 +67,7 @@ export async function ensureAllFilesExistInConfluence(
}

async function createFileStructureInConfluence(
settings: ConfluenceSettings,
confluenceClient: RequiredConfluenceClient,
adaptor: LoaderAdaptor,
node: LocalAdfFileTreeNode,
Expand All @@ -85,6 +87,7 @@ async function createFileStructureInConfluence(
...node.file,
pageId: parentPageId,
spaceKey,
pageUrl: "",
};

if (createPage) {
Expand All @@ -110,6 +113,7 @@ async function createFileStructureInConfluence(

const childDetailsTasks = node.children.map((childNode) => {
return createFileStructureInConfluence(
settings,
confluenceClient,
adaptor,
childNode,
Expand All @@ -122,8 +126,9 @@ async function createFileStructureInConfluence(

const childDetails = await Promise.all(childDetailsTasks);

const pageUrl = `${settings.confluenceBaseUrl}/wiki/spaces/${spaceKey}/pages/${file.pageId}/`;
return {
file: file,
file: { ...file, pageUrl },
version,
lastUpdatedBy: lastUpdatedBy ?? "",
existingAdf,
Expand Down
2 changes: 1 addition & 1 deletion packages/obsidian/src/CompletedModal.tsx
Expand Up @@ -38,7 +38,7 @@ const CompletedView: React.FC<UploadResultsProps> = ({ uploadResults }) => {
return filesUploadResult
.filter((result) => result[`${type}Result`] === "updated")
.map((result, index) => (
<li key={index}>{result.adfFile.absoluteFilePath}</li>
<li key={index}><a href={result.adfFile.pageUrl}>{result.adfFile.absoluteFilePath}</a></li>
));
};

Expand Down

0 comments on commit 65c1a42

Please sign in to comment.