Skip to content

Commit 5038781

Browse files
committed
provide ingrations command
1 parent 07b07cb commit 5038781

10 files changed

Lines changed: 19271 additions & 8 deletions

File tree

Taskfile.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ tasks:
152152
cmds:
153153
- poetry run dec-tool update-di-reference
154154

155+
update:integrations:
156+
desc: update integrations page
157+
cmds:
158+
- poetry run dec-tool update-integrations
159+
155160
public:versions:
156161
desc: List public documentation versions
157162
deps:
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ integrations:
88
# content: |
99
# Mandatory small markdown paragraph which describes, what you can do with the service or application.
1010
# The content should have at least one link.
11+
# Possible placeholders:
12+
# - {{p.pluginID}} - markdownlink to plugin (replace all '-' with '_')
13+
# - {{p.pluginID_ref}} - relative link to plugin (replace all '-' with '_')
1114

1215
#####
1316
# Services
@@ -26,18 +29,18 @@ integrations:
2629
- name: SSH
2730
icon: ":material-ssh:"
2831
content: |
29-
Interact with SSH servers to {{p.cmem_plugin_ssh-Download}} or {{p.cmem_plugin_ssh-Execute}}.
32+
Interact with SSH servers to {{p.cmem_plugin_ssh_Download}} or {{p.cmem_plugin_ssh_Execute}}.
3033
3134
- name: Nextcloud
3235
icon: ":simple-nextcloud:"
3336
content: |
34-
Use a Nextcloud instance to {{p.cmem_plugin_nextcloud-Download}} or {{p.cmem_plugin_nextcloud-Upload}}.
37+
Use a Nextcloud instance to {{p.cmem_plugin_nextcloud_Download}} or {{p.cmem_plugin_nextcloud_Upload}}.
3538
3639
- name: Salesforce
3740
icon: ":fontawesome-brands-salesforce:"
3841
content: |
39-
Interact with your Salesforce data, such as {{p.cmem_plugin_salesforce-workflow-operations-SobjectCreate}} or
40-
execute a {{p.cmem_plugin_salesforce-SoqlQuery}}.
42+
Interact with your Salesforce data, such as {{p.cmem_plugin_salesforce_workflow_operations_SobjectCreate}} or
43+
execute a {{p.cmem_plugin_salesforce_SoqlQuery}}.
4144
4245
- name: Mattermost
4346
icon: ":simple-mattermost:"
@@ -52,7 +55,7 @@ integrations:
5255
- name: YAML
5356
icon: ":simple-yaml:"
5457
content: |
55-
Load and integrate data from YAML files with the {{p.cmem_plugin_yaml-parse}} task.
58+
Load and integrate data from YAML files with the {{p.cmem_plugin_yaml_parse}} task.
5659
5760
- name: XML
5861
icon: ":material-xml:"
@@ -64,7 +67,7 @@ integrations:
6467
icon: ":fontawesome-solid-file-csv:"
6568
content: |
6669
Comma-separated values (CSV) is a text data format which can be processed
67-
(read and write) with the {{p.csv}} dataset.
70+
(read and write) with the [CSV Dataset]({{p.csv_ref}}).
6871
6972
- name: Excel
7073
icon: ":fontawesome-solid-file-csv:"

data/plugins.json

Lines changed: 18958 additions & 0 deletions
Large diffs are not rendered by default.

docs/build/.pages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
nav:
22
- Build: index.md
3+
- Integrations: Integrations
34
- Introduction to the User Interface: introduction-to-the-user-interface
45
- Rule Operators: rule-operators
56
- Define Prefixes / Namespaces: define-prefixes-namespaces

docs/build/integrations/index.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
title: "Integrations"
3+
icon: octicons/cross-reference-24
4+
hide:
5+
- toc
6+
tags:
7+
- Build
8+
- Reference
9+
---
10+
# Integrations
11+
<!-- This file was generated - DO NOT CHANGE IT MANUALLY -->
12+
13+
The following services and applications can be easily integrated in Corporate Memory workflows:
14+
15+
<div class="grid cards" markdown>
16+
17+
- :fontawesome-solid-file-csv:{ .lg .middle } CSV
18+
19+
---
20+
21+
Comma-separated values (CSV) is a text data format which can be processed
22+
(read and write) with the [CSV Dataset](../../build/reference/dataset/csv.md).
23+
24+
25+
- :fontawesome-solid-file-csv:{ .lg .middle } Excel
26+
27+
---
28+
29+
Use the [Excel](../../build/reference/dataset/excel.md) task to read and write to Excel workbooks in the Open XML format (XLSX).
30+
31+
32+
- :material-google-drive:{ .lg .middle } Google Drive
33+
34+
---
35+
36+
Use the [Excel (Google Drive)](../../build/reference/dataset/googlespreadsheet.md) to read and write to Excel workbooks in Google Drive.
37+
38+
39+
- :material-code-json:{ .lg .middle } JSON
40+
41+
---
42+
43+
Use the [JSON](../../build/reference/dataset/json.md) dataset to read and write JSON files (JavaScript Object Notation).
44+
45+
46+
- :material-code-json:{ .lg .middle } JSON Lines
47+
48+
---
49+
50+
Use the [JSON](../../build/reference/dataset/json.md) dataset to read and write files in the [JSON Lines](https://jsonlines.org/) text file format.
51+
52+
53+
- :simple-mariadb:{ .lg .middle } MariaDB
54+
55+
---
56+
57+
MariaDB can be accessed with the [JDBC endpoint](../../build/reference/dataset/Jdbc.md) dataset and a proper JDBC driver.
58+
59+
60+
- :simple-mattermost:{ .lg .middle } Mattermost
61+
62+
---
63+
64+
Send workflow reports or any other message to user and groups in you Mattermost with
65+
the [Send Mattermost messages](../../build/reference/customtask/cmem_plugin_mattermost.md) task.
66+
67+
68+
- :material-microsoft:{ .lg .middle } Microsoft SQL
69+
70+
---
71+
72+
The Microsoft SQL Server can be accessed with the [JDBC endpoint](../../build/reference/dataset/Jdbc.md) dataset and a proper JDBC driver.
73+
74+
75+
- :simple-mysql:{ .lg .middle } MySQL
76+
77+
---
78+
79+
MySQL can be accessed with the [JDBC endpoint](../../build/reference/dataset/Jdbc.md) dataset and a proper JDBC driver.
80+
81+
82+
- :simple-neo4j:{ .lg .middle } Neo4J
83+
84+
---
85+
86+
Use the [Neo4j](../../build/reference/dataset/neo4j.md) dataset for reading and writing Neo4j graphs.
87+
88+
89+
- :simple-nextcloud:{ .lg .middle } Nextcloud
90+
91+
---
92+
93+
Use a Nextcloud instance to [Download Nextcloud files](../../build/reference/customtask/cmem_plugin_nextcloud-Download.md) or [Upload files to Nextcloud](../../build/reference/customtask/cmem_plugin_nextcloud-Upload.md).
94+
95+
96+
- :material-microsoft-office:{ .lg .middle } Office 365
97+
98+
---
99+
100+
Use the [Excel (OneDrive, Office365)](../../build/reference/dataset/office365preadsheet.md) to read and write to Excel workbooks in Office 365.
101+
102+
103+
- :simple-postgresql:{ .lg .middle } PostgreSQL
104+
105+
---
106+
107+
PostgreSQL can be accessed with the [JDBC endpoint](../../build/reference/dataset/Jdbc.md) dataset and a proper JDBC driver.
108+
109+
110+
- :fontawesome-brands-salesforce:{ .lg .middle } Salesforce
111+
112+
---
113+
114+
Interact with your Salesforce data, such as [Create/Update Salesforce Objects](../../build/reference/customtask/cmem_plugin_salesforce-workflow-operations-SobjectCreate.md) or
115+
execute a [SOQL query (Salesforce)](../../build/reference/customtask/cmem_plugin_salesforce-SoqlQuery.md).
116+
117+
118+
- :simple-sqlite:{ .lg .middle } SQLite
119+
120+
---
121+
122+
SQLite can be accessed with the [JDBC endpoint](../../build/reference/dataset/Jdbc.md) dataset and a proper JDBC driver.
123+
124+
125+
- :material-ssh:{ .lg .middle } SSH
126+
127+
---
128+
129+
Interact with SSH servers to [Download SSH files](../../build/reference/customtask/cmem_plugin_ssh-Download.md) or [Execute commands via SSH](../../build/reference/customtask/cmem_plugin_ssh-Execute.md).
130+
131+
132+
- :material-xml:{ .lg .middle } XML
133+
134+
---
135+
136+
Load and write data to XML files with the [XML](../../build/reference/dataset/xml.md) dataset as well as
137+
[Parse XML](../../build/reference/customtask/XmlParserOperator.md) from external services.
138+
139+
140+
- :simple-yaml:{ .lg .middle } YAML
141+
142+
---
143+
144+
Load and integrate data from YAML files with the [Parse YAML](../../build/reference/customtask/cmem_plugin_yaml-parse.md) task.
145+
146+
147+
- :material-code-json:{ .lg .middle } Zipped JSON
148+
149+
---
150+
151+
Use the [JSON](../../build/reference/dataset/json.md) dataset to read and write JSON files in a ZIP Archive.
152+
153+
154+
155+
156+
</div>

tools/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
from tools.update_di_reference import update_di_reference
66
from tools.update_icons import update_icons
7-
7+
from tools.update_integrations import update_integrations
88

99
@click.group()
1010
def cli():
1111
"""documentation.eccenca.com build tool"""
1212

1313
cli.add_command(update_icons)
1414
cli.add_command(update_di_reference)
15+
cli.add_command(update_integrations)

tools/templates/integration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- {{integration.icon}}{ .lg .middle } {{integration.name}}
2+
3+
---
4+
5+
{{integration.content}}
6+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: "Integrations"
3+
icon: octicons/cross-reference-24
4+
hide:
5+
- toc
6+
tags:
7+
- Build
8+
- Reference
9+
---
10+
# Integrations
11+
<!-- This file was generated - DO NOT CHANGE IT MANUALLY -->
12+
13+
The following services and applications can be easily integrated in Corporate Memory workflows:
14+
15+
<div class="grid cards" markdown>
16+
17+
{{items}}
18+
19+
</div>

tools/update_di_reference.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,18 @@ def create_umbrella_pages(plugins: dict[str, list[PluginDescription]], base_dir:
262262
def update_di_reference(output_dir):
263263
"""Update DI Reference documentation."""
264264
basedir = Path(output_dir)
265-
click.echo(f"Creating DI reference documentation in {basedir}")
266265
plugins = get_plugin_descriptions()
267266

267+
click.echo(f"Dump plugins descriptions to {(plugins_json := Path('data/plugins.json'))}")
268+
plugins_dump: dict[str, dict] = {}
269+
for category, plugins_list in plugins.items():
270+
for plugin in plugins_list:
271+
if plugin.pluginId in plugins_dump:
272+
raise Exception(f"Duplicate plugin ID: {plugin.pluginId}")
273+
plugins_dump[plugin.pluginId] = plugin.model_dump()
274+
plugins_json.write_text(json.dumps(plugins_dump, indent=2))
275+
276+
click.echo(f"Creating DI reference documentation in {basedir}")
268277
# create directory structure
269278
rmtree(basedir, ignore_errors=True)
270279
basedir.mkdir(parents=True, exist_ok=True)

tools/update_integrations.py

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
"""Update Integrations Page"""
2+
import json
3+
from pathlib import Path
4+
5+
import click
6+
import yaml
7+
from jinja2 import Environment, PackageLoader, select_autoescape, StrictUndefined
8+
from pydantic import BaseModel, ConfigDict, TypeAdapter
9+
10+
from tools.update_di_reference import PluginDescription
11+
12+
jinja_environment = Environment(
13+
loader=PackageLoader("tools"),
14+
autoescape=select_autoescape(),
15+
undefined=StrictUndefined
16+
)
17+
18+
ListOfPlugins = TypeAdapter(dict[str, PluginDescription])
19+
20+
class AttrDict(dict):
21+
"""Dict subclass that allows attribute access."""
22+
23+
def __getattr__(self, key):
24+
return self[key]
25+
26+
def __setattr__(self, key, value):
27+
self[key] = value
28+
29+
30+
def get_plugin_placeholder(plugin_file: Path) -> object:
31+
"""Get Plugin Placeholder to allow {{p.office365preadsheet}}"""
32+
placeholders = AttrDict()
33+
plugins = ListOfPlugins.validate_json(plugin_file.read_text())
34+
for pluginId, plugin in plugins.items():
35+
attribute_id = plugin.pluginId.replace("-", "_")
36+
attribute_id_ref = plugin.pluginId.replace("-", "_") + "_ref"
37+
plugin_link = f"../../build/reference/{plugin.pluginType}/{plugin.pluginId}.md"
38+
setattr(placeholders, attribute_id, f"[{plugin.title}]({plugin_link})")
39+
setattr(placeholders, attribute_id_ref, plugin_link)
40+
return placeholders
41+
42+
43+
class Integration(BaseModel):
44+
"""Integration Description"""
45+
46+
model_config = ConfigDict(extra="forbid")
47+
48+
name: str
49+
icon: str
50+
content: str
51+
52+
class IntegrationsFile(BaseModel):
53+
"""Integration File Base Model"""
54+
55+
model_config = ConfigDict(extra="forbid")
56+
57+
integrations: list[Integration]
58+
59+
def create_integrations_markdown(yaml_source: Path, markdown_output: Path, plugins_file: Path) -> None:
60+
"""Create the integration markdown file."""
61+
base_template = jinja_environment.get_template("integrations_base.md")
62+
integration_template = jinja_environment.get_template("integration.md")
63+
parsed_content = IntegrationsFile.model_validate(yaml.safe_load(yaml_source.read_text()))
64+
click.echo(f"Parsed {len(parsed_content.integrations)} integrations.")
65+
integrations = sorted(parsed_content.integrations, key=lambda i: i.name.lower())
66+
plugin_placeholder = get_plugin_placeholder(plugin_file=plugins_file)
67+
items = ""
68+
for integration in integrations:
69+
content_template = jinja_environment.from_string(integration.content)
70+
integration.content = content_template.render(p=plugin_placeholder) + "\n\n"
71+
items += integration_template.render(integration=integration)
72+
markdown = base_template.render(items=items)
73+
markdown_output.write_text(markdown)
74+
75+
76+
@click.command()
77+
@click.option(
78+
"--input-file", "-i",
79+
type=click.Path(exists=False, dir_okay=False, file_okay=True),
80+
default="data/integrations.yml",
81+
help="Where to get the integration descriptions from?",
82+
show_default=True,
83+
)
84+
@click.option(
85+
"--output-file", "-o",
86+
type=click.Path(exists=False, dir_okay=False, file_okay=True),
87+
default="docs/build/integrations/index.md",
88+
help="Where to save the markdown file?",
89+
show_default=True,
90+
)
91+
@click.option(
92+
"--plugins-file",
93+
type=click.Path(exists=False, dir_okay=False, file_okay=True),
94+
default="data/plugins.json",
95+
help="Where to load the plugin information from?",
96+
show_default=True,
97+
)
98+
def update_integrations(input_file: str, output_file: str, plugins_file: str) -> None:
99+
"""Update the integrations page by parsing the integrations.yaml"""
100+
click.echo(f"Creating Integrations Pages as {output_file}")
101+
create_integrations_markdown(
102+
yaml_source=Path(input_file),
103+
markdown_output=Path(output_file),
104+
plugins_file=Path(plugins_file)
105+
)

0 commit comments

Comments
 (0)