From e63f352062408d44913b143a7fec40476cbbe5a3 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Thu, 9 Oct 2025 13:54:27 +0200 Subject: [PATCH 1/8] update tags --- plugin.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index 15a27ed..8cddfd7 100644 --- a/plugin.json +++ b/plugin.json @@ -8,7 +8,8 @@ "icon": "icon-cloud-upload", "licenseInfo": "Apache Software License", "url": "https://www.dataiku.com/product/plugins/confluence/", - "tags": ["Governance", "Cloud", "Productivity"], + "category": "Connect", + "tags": ["Export"], "supportLevel": "NOT_SUPPORTED" } } From d4e26a7ae20db1651449146c3b78d60c6c659dee Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Mon, 24 Nov 2025 14:35:48 +0100 Subject: [PATCH 2/8] add files upload and linking --- python-lib/md2conf.py | 15 ++++++-- python-lib/wikitransfer.py | 71 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 82 insertions(+), 4 deletions(-) diff --git a/python-lib/md2conf.py b/python-lib/md2conf.py index 7301eb2..78358f6 100644 --- a/python-lib/md2conf.py +++ b/python-lib/md2conf.py @@ -318,8 +318,19 @@ def upload_attachment(page_id, file, comment, confluence_api_url, username, pass session.headers.update({'X-Atlassian-Token': 'no-check'}) res = session.post(url, files=file_to_upload) - - return True + link = None + try: + json_response = res.json() + url_base = json_response.get("_links", {}).get("base", "") + if "results" in json_response: + json_response = json_response.get("results")[0] + link = "{}{}".format( + url_base, + json_response.get("_links", {}).get("download", ""), + ) + except Exception as error: + print("Error {}".format(error)) + return link def urlEncodeNonAscii(b): return re.sub('[\x80-\xFF]', lambda c: '%%%02x' % ord(c.group(0)), b) diff --git a/python-lib/wikitransfer.py b/python-lib/wikitransfer.py index 23d78b2..de0bb1e 100644 --- a/python-lib/wikitransfer.py +++ b/python-lib/wikitransfer.py @@ -38,6 +38,7 @@ def recurse_taxonomy(self, taxonomy, ancestor=None): def transfer_article(self, article_id, parent_id=None): self.attachment_table.reset() self.transfered_attachments = [] + self.transfered_links = [] article_data = self.wiki.get_article(article_id).get_data() dss_page_name = article_data.get_name() dss_page_body = article_data.get_body() @@ -90,6 +91,9 @@ def convert(self, md_input, article_id, new_id, article_data): md = md + u'\n' + self.attachment_table.to_md() md = self.convert_math_blocks(md) md = self.develop_dss_links(md) + md = self.develop_image_md_links(md) + md = self.develop_dss_md_links(md) + md = self.develop_md_links(md) html = markdown.markdown(md, extensions=['markdown.extensions.tables', 'markdown.extensions.fenced_code', 'markdown.extensions.nl2br', @@ -164,6 +168,67 @@ def develop_dss_links(self, md): md = re.sub(object_type + r':' + initial_id, self.build_dss_url(object_type, object_path), md, flags=re.IGNORECASE) return md + def develop_md_links(self, md): + # Processing all [name](link) links + links = self.find_md_links(md) + for link in links: + link_name = link[0] + link_target = link[1] + if link_name in self.transfered_attachments: + target_link = self.transfered_links[self.transfered_attachments.index(link_name)] + replacement = '{}'.format(target_link, link_name) + md = md.replace( + "[{}]({})".format(link_name, link_target), + replacement + ) + return md + + def develop_image_md_links(self, md): + # Processing all ![name](link) links + links = self.find_image_md_links(md) + for link in links: + link_name = link[0] + link_target = link[1] + if link_name in self.transfered_attachments: + target_link = self.transfered_links[self.transfered_attachments.index(link_name)] + replacement = '{}'.format(target_link, link_name) + md = md.replace( + "![{}]({})".format(link_name, link_target), + replacement + ) + return md + + def develop_dss_md_links(self, md): + # Processing all [name]{name}(link) links + links = self.find_dss_md_links(md) + for link in links: + link_name = link[0] + link_target = link[1] + link_target_2 = link[2] + if link_name in self.transfered_attachments: + target_link = self.transfered_links[self.transfered_attachments.index(link_name)] + replacement = '{}'.format(target_link, link_name) + md = md.replace( + "[{}]{{{}}}({})".format(link_name, link_target, link_target_2), + replacement + ) + return md + + def find_dss_md_links(self, md): + pattern = r'\[([^\]]+)\]\{([^)]+)\}\(([^)]+)\)' + matches = re.findall(pattern, md) + return matches + + def find_md_links(self, md): + pattern = r'\[([^\]]+)\]\(([^)]+)\)' + matches = re.findall(pattern, md) + return matches + + def find_image_md_links(self, md): + pattern = r'\!\[([^\]]+)\]\(([^)]+)\)' + matches = re.findall(pattern, md) + return matches + def article_title(self, project_key, article_id): name = "" try: @@ -218,8 +283,9 @@ def process_linked_items(self, md, article_id, new_id): try: attachment = self.get_uploaded_file(article, project_id, upload_id) if file_name not in self.transfered_attachments: - upload_attachment(new_id, file_name, "", self.confluence_url, self.confluence_username, self.confluence_password, raw=attachment) + url = upload_attachment(new_id, file_name, "", self.confluence_url, self.confluence_username, self.confluence_password, raw=attachment) self.transfered_attachments.append(file_name) + self.transfered_links.append(url) md = self.replace_md_links_with_confluence_links(md, project_id, upload_id, file_name) except Exception as err: md = self.replace_md_links_with_confluence_links(md, project_id, upload_id, file_name, error_message='*Item could not be transfered*') @@ -290,8 +356,9 @@ def process_attachments(self, article_id, article): article = self.wiki.get_article(article.article_id) try: file = article.get_uploaded_file(attachment['smartId']) - upload_attachment(article_id, attachment_name, "", self.confluence_url, self.confluence_username, self.confluence_password, raw=file) + url = upload_attachment(article_id, attachment_name, "", self.confluence_url, self.confluence_username, self.confluence_password, raw=file) self.transfered_attachments.append(attachment_name) + self.transfered_links.append(url) except Exception as err: # get_uploaded_file not implemented yet on backend, older version of DSS logger.info("Attachement could not be uploaded because of older DSS backend:{}".format(err)) From 47b5480b19332f5afc5fe2c6b88b17bde83ae112 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Tue, 2 Dec 2025 10:16:53 +0100 Subject: [PATCH 3/8] replacing organization with subdomain for clearer presets --- parameter-sets/confluence-login/parameter-set.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parameter-sets/confluence-login/parameter-set.json b/parameter-sets/confluence-login/parameter-set.json index 6def833..7bd5bbc 100644 --- a/parameter-sets/confluence-login/parameter-set.json +++ b/parameter-sets/confluence-login/parameter-set.json @@ -27,9 +27,9 @@ }, { "name": "orgname", - "label": "Organization name", + "label": "Subdomain", "type": "STRING", - "description": "", + "description": "First part of your URL: https://.atlassian.net", "visibilityCondition": "model.server_type == 'remote'", "mandatory": false }, From bda1c48150a6b528d0e3688ec30e21b4ed218f03 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Tue, 2 Dec 2025 10:20:28 +0100 Subject: [PATCH 4/8] update tags and category --- plugin.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin.json b/plugin.json index da7c3fe..1640be8 100644 --- a/plugin.json +++ b/plugin.json @@ -8,8 +8,7 @@ "icon": "icon-cloud-upload", "licenseInfo": "Apache Software License", "url": "https://www.dataiku.com/product/plugins/confluence/", - "category": "Connect", - "tags": ["Export"], + "tags": ["Business Applications", "Productivity", "Export", "Governance"], "supportLevel": "NOT_SUPPORTED" } } From c6cc3a5b65653dd2dca8f76e027f28d119e2dbc5 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Dec 2025 13:50:10 +0100 Subject: [PATCH 5/8] adding logs --- python-lib/wikitransfer.py | 6 ++++-- python-runnables/export-wiki/runnable.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/python-lib/wikitransfer.py b/python-lib/wikitransfer.py index de0bb1e..4c870e4 100644 --- a/python-lib/wikitransfer.py +++ b/python-lib/wikitransfer.py @@ -31,9 +31,9 @@ def recurse_taxonomy(self, taxonomy, ancestor=None): for article in taxonomy: if len(article['children']) > 0: confluence_id = self.transfer_article(article['id'], ancestor) - self.recurse_taxonomy(article['children'], confluence_id) + self.recurse_taxonomy(article['children'], ancestor=confluence_id) else: - self.transfer_article(article['id'], ancestor) + self.transfer_article(article['id'], parent_id=ancestor) def transfer_article(self, article_id, parent_id=None): self.attachment_table.reset() @@ -353,12 +353,14 @@ def process_attachments(self, article_id, article): for attachment in article.article_data['article']['attachments']: if attachment[u'attachmentType'] == 'FILE' and attachment[u'attachmentType'] not in self.transfered_attachments: attachment_name = attachment['details']['objectDisplayName'] + logger.info("Uploading attachement {} / id: {}".format(attachment_name, attachment['smartId'])) article = self.wiki.get_article(article.article_id) try: file = article.get_uploaded_file(attachment['smartId']) url = upload_attachment(article_id, attachment_name, "", self.confluence_url, self.confluence_username, self.confluence_password, raw=file) self.transfered_attachments.append(attachment_name) self.transfered_links.append(url) + logger.info("Adding {}, {}, {}".format(file, attachment_name, url)) except Exception as err: # get_uploaded_file not implemented yet on backend, older version of DSS logger.info("Attachement could not be uploaded because of older DSS backend:{}".format(err)) diff --git a/python-runnables/export-wiki/runnable.py b/python-runnables/export-wiki/runnable.py index 3a3a8b6..d570a50 100644 --- a/python-runnables/export-wiki/runnable.py +++ b/python-runnables/export-wiki/runnable.py @@ -97,7 +97,7 @@ def run(self, progress_callback): else: self.space_homepage_id = None - self.recurse_taxonomy(self.taxonomy, self.space_homepage_id) + self.recurse_taxonomy(self.taxonomy, ancestor=self.space_homepage_id) if self.space_homepage_id is not None: self.update_landing_page(self.space_homepage_id) From 5f502b17a37759916a005fde3eb7829f8691266d Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Dec 2025 13:54:23 +0100 Subject: [PATCH 6/8] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cf20db..c03e8e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## [Version 1.1.1](https://github.com/dataiku/dss-plugin-confluence/releases/tag/v1.1.1) - Feature release - 2025-06-28 - Fix following API change -- Add support for links to flow_zone, scenario, dashboard, recipe, managed_folder, statistics_worksheet, lambda_service +- Add support for links to flow_zone, scenario, dashboard, recipe, managed_folder, statistics_worksheet, lambda_service and analysis ## [Version 1.1.0](https://github.com/dataiku/dss-plugin-confluence/releases/tag/v1.1.0) - Feature release - 2024-06-14 From b0b5e0e15b1de1670c4150177afe9385cc99263b Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Dec 2025 14:04:01 +0100 Subject: [PATCH 7/8] v1.1.2 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index 1640be8..6afa366 100644 --- a/plugin.json +++ b/plugin.json @@ -1,6 +1,6 @@ { "id": "confluence", - "version": "1.1.1", + "version": "1.1.2", "meta": { "label": "Confluence wiki", "description": "Export a DSS wiki to a Confluence space", From 3a5c7ebee57d50abae78d4cc78a97ff3d0d06cc1 Mon Sep 17 00:00:00 2001 From: Alex Bourret Date: Fri, 5 Dec 2025 14:04:26 +0100 Subject: [PATCH 8/8] update changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c03e8e5..9b84fce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,12 @@ # Changelog +## [Version 1.1.2](https://github.com/dataiku/dss-plugin-confluence/releases/tag/v1.1.2) - Feature release - 2025-12-05 + +- Add support for links to flow_zone, scenario, dashboard, recipe, managed_folder, statistics_worksheet, lambda_service and analysis + ## [Version 1.1.1](https://github.com/dataiku/dss-plugin-confluence/releases/tag/v1.1.1) - Feature release - 2025-06-28 - Fix following API change -- Add support for links to flow_zone, scenario, dashboard, recipe, managed_folder, statistics_worksheet, lambda_service and analysis ## [Version 1.1.0](https://github.com/dataiku/dss-plugin-confluence/releases/tag/v1.1.0) - Feature release - 2024-06-14