Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
3e510f3
Custom lint
dbreseman Apr 30, 2024
0cc2de7
Create scan-dates.yml
dbreseman Apr 30, 2024
d9f844d
Modularize
dbreseman Apr 30, 2024
a96f2cd
Create scanDates.js
dbreseman Apr 30, 2024
544bf38
Fix path
dbreseman Apr 30, 2024
082dfb1
Troubleshoot output
dbreseman Apr 30, 2024
29aac43
Concatenate results
dbreseman Apr 30, 2024
e899e16
Check against current date
dbreseman Apr 30, 2024
c80d8cc
Remove date-fns dependency
dbreseman Apr 30, 2024
515efcc
Remove deprecated set-output
dbreseman Apr 30, 2024
89b806d
Update to read environment file
dbreseman Apr 30, 2024
3605035
Resolve error
dbreseman Apr 30, 2024
a16f590
Add date to find
dbreseman Apr 30, 2024
7040ae6
Remove set-env
dbreseman Apr 30, 2024
571dfef
Update output
dbreseman Apr 30, 2024
d96de83
Switch to shell script
dbreseman Apr 30, 2024
6c28587
Run with bash
dbreseman Apr 30, 2024
c4a1fb6
Try awk
dbreseman Apr 30, 2024
3eb9af2
New approach
dbreseman Apr 30, 2024
ba07a90
Update
dbreseman Apr 30, 2024
641358c
Add file content
dbreseman Apr 30, 2024
6f000af
Update repo path
dbreseman Apr 30, 2024
8c7b801
Specify branch
dbreseman Apr 30, 2024
a8f87d2
New approach
dbreseman Apr 30, 2024
890a6aa
Update
dbreseman Apr 30, 2024
991e22e
Update flag
dbreseman Apr 30, 2024
d0c960c
Adjust regex
dbreseman Apr 30, 2024
a9b1b5d
Add debug output
dbreseman Apr 30, 2024
cd11acf
Correct typo
dbreseman Apr 30, 2024
58eb283
Update
dbreseman Apr 30, 2024
f539137
Correct typo
dbreseman Apr 30, 2024
35fba52
More debug
dbreseman Apr 30, 2024
9d445bf
New update
dbreseman Apr 30, 2024
2be7d65
add date
dbreseman Apr 30, 2024
17412d7
Adjust concat
dbreseman Apr 30, 2024
f9a0f98
update
dbreseman Apr 30, 2024
b4033da
Update
dbreseman Apr 30, 2024
7bea248
Update
dbreseman Apr 30, 2024
426d608
Number steps
dbreseman Apr 30, 2024
7cff0cb
Update
dbreseman Apr 30, 2024
1895aae
Update
dbreseman Apr 30, 2024
bde48ed
Debug
dbreseman Apr 30, 2024
364df82
Extra debug line
dbreseman Apr 30, 2024
8c81c08
Try environment varibales
dbreseman Apr 30, 2024
623df21
Next try
dbreseman Apr 30, 2024
5331fdf
Update
dbreseman Apr 30, 2024
8de0ecf
Update
dbreseman Apr 30, 2024
630c213
Troubleshoot
dbreseman Apr 30, 2024
8a6a068
Update
dbreseman Apr 30, 2024
cfcfd15
Update
dbreseman Apr 30, 2024
e1f7d18
Fix syntax error
dbreseman Apr 30, 2024
9ff64eb
Update
dbreseman Apr 30, 2024
2ebb793
Update
dbreseman Apr 30, 2024
c39c03f
Update
dbreseman Apr 30, 2024
2103330
Update
dbreseman Apr 30, 2024
da495aa
Try reading to a file
dbreseman May 1, 2024
146b8c0
Read all Md files
dbreseman May 1, 2024
893258c
Add regex steps
dbreseman May 1, 2024
966cd81
Correct syntax errors
dbreseman May 1, 2024
02623df
Update date
dbreseman May 1, 2024
c2cbb3b
Try text string
dbreseman May 1, 2024
68206e1
Merge remote-tracking branch 'origin/development'
dbreseman Jul 15, 2024
73bd0e2
Merge branch 'development'
dbreseman Jul 29, 2024
b6c03af
Run markdownlint-cli2 on docs to find (and correct) linting errors.
dbreseman Oct 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .github/workflows/lint-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ on:
jobs:
# This workflow contains a single job called "lint-pr"
lint-pr:
# Check if the event is not triggered by a fork
if: github.repository_owner == 'mendix'
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
Expand Down Expand Up @@ -53,9 +51,8 @@ jobs:
body: |
${{ env.VER }}
branch: lint-docs
committer: MarkvanMents <Mark.van.Ments@mendix.com>
assignees: MarkvanMents
reviewers: MarkvanMents
labels: Internal WIP
committer: dbreseman <dana.breseman@mendix.com>
assignees: dbreseman
reviewers: dbreseman
add-paths: |
content/en/docs/**/*.md
51 changes: 51 additions & 0 deletions .github/workflows/scan-dates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Upcoming Date Alert

# Run action at midnight on the 25th of each month and allow manual runs
on:
schedule:
- cron: '0 0 25 * *'
workflow_dispatch:

jobs:
check-dates:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout code (version 4)
- name: Step 1 - Checkout code
uses: actions/checkout@v4

# Step 2: Read content of Markdown files and write to a file
- name: Step 2 - Read Markdown files and write to a file
run: |
find content/en/docs -name '*.md' -exec cat {} + > files_content.txt

# Step 3: Confirm the file is created and contains the content
- name: Step 3 - Confirm file is created and contains content
run: |
cat files_content.txt

# Step 4: Debug - Print upcoming dates to search for
- name: Step 4 - Debug - Print upcoming dates to search for
run: |
echo "Upcoming dates to search for:"
echo "------------------------------"
echo "Current date: $(date '+%B %d, %Y')"
echo "First day of upcoming month: $(date -d 'next month' '+%B 1, %Y')"
echo "Last day of upcoming month: $(date -d "$(date -d 'next month' '+%Y-%m-01') +1 month -1 day" '+%B %d, %Y')"
echo "------------------------------"

# Step 5: Perform regex match to find upcoming dates in Markdown files
- name: Step 5 - Perform regex match
id: regex-match
uses: kaisugi/action-regex-match@v1.0.1
with:
text: June 17, 2024
regex: '(January|February|March|April|May|June|July|August|September|October|November|December)\s+[0-9]{1,2},\s+[0-9]{4}'
flags: gm

# Step 6: Debug - Print matched dates
- name: Step 6 - Debug - Print matched dates
if: ${{ steps.regex-match.outputs.matches != '' }} # Check if there are matches
run: |
echo "Matched dates found in Markdown files:"
echo "${{ steps.regex-match.outputs.matches }}"
77 changes: 77 additions & 0 deletions _scripts/scanDates.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
const fs = require('fs');
const path = require('path');

// Define regex pattern to match dates in different formats
const datePattern = /\b(?:\d{1,2}(?:st|nd|rd|th)?,?\s+)?(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)(?:\s+\d{4})?\b/;

// Define date formats to try parsing
const dateFormats = [
'MMMM do, yyyy', // January 1st, 2023
'MMMM dd, yyyy', // January 01, 2023
'MMMM d, yyyy', // January 2, 2023
'MMMM yyyy', // January 2023
'do MMMM, yyyy', // 1st January, 2023
'dd MMMM, yyyy', // 01 January, 2023
'd MMMM, yyyy', // 2 January, 2023
'd MMM yyyy', // 2 Jan 2023
'd MMMM yyyy', // 2 January 2023
];

// Get the start date and end date for the upcoming month
const today = new Date();
const startDate = new Date(today.getFullYear(), today.getMonth() + 1, 1);
const endDate = new Date(today.getFullYear(), today.getMonth() + 2, 0);

// Function to recursively search for dates in Markdown files
const scanFilesForDates = (directory) => {
const dateLines = [];

// Recursive function to search for dates
const searchForDates = (directory) => {
const files = fs.readdirSync(directory);

for (const file of files) {
const filePath = path.join(directory, file);
const stats = fs.statSync(filePath);

if (stats.isDirectory()) {
searchForDates(filePath); // Recursive call for subdirectories
} else if (file.endsWith('.md')) {
const content = fs.readFileSync(filePath, 'utf-8');
const lines = content.split('\n');
lines.forEach((line, lineNumber) => {
const datesInLine = line.match(datePattern);
if (datesInLine) {
datesInLine.forEach(dateStr => {
const date = parseDate(dateStr);
if (date && date >= startDate && date <= endDate) {
dateLines.push(`${filePath}:${lineNumber + 1}:${line.trim()}`);
}
});
}
});
}
}
};

searchForDates(directory);
return dateLines;
};

// Parse date string using multiple formats
const parseDate = (dateStr) => {
// Replace suffixes like 'st', 'nd', 'rd', 'th' with ''
dateStr = dateStr.replace(/st|nd|rd|th/g, '');
const parsedDate = new Date(dateStr);
return isNaN(parsedDate.getTime()) ? null : parsedDate;
};

// Scan files for dates in the specified directory
const dateLines = scanFilesForDates('content/en/docs');

// Write results to a file
const outputFile = 'dateLines.txt';
fs.writeFileSync(outputFile, dateLines.join('\n'));

// Write file path to standard output
console.log(outputFile);
37 changes: 37 additions & 0 deletions _scripts/scanDates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# Define regex pattern to match dates in the format "Month Day, Year"
DATE_PATTERN="\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+[0-9]{1,2},\s+[0-9]{4}\b"

# Get the start date and end date for the upcoming month
START_DATE=$(date -d "next month" +%Y%m01)
END_DATE=$(date -d "next month +1 month -1 day" +%Y%m%d)

# Function to recursively search for dates in Markdown files
scan_files_for_dates() {
local DIRECTORY="$1"
local DATE_LINES=()

# Recursive function to search for dates
search_for_dates() {
local DIRECTORY="$1"
local FILES=$(find "$DIRECTORY" -type f -name "*.md")

for FILE in $FILES; do
while IFS= read -r LINE; do
if [[ $LINE =~ $DATE_PATTERN ]]; then
DATE=$(awk -v date="${BASH_REMATCH[0]}" 'BEGIN { print mktime(date); }')
if [[ $DATE -ge $START_DATE && $DATE -le $END_DATE ]]; then
DATE_LINES+=("$FILE:$LINE")
fi
fi
done < "$FILE"
done
}

search_for_dates "$DIRECTORY"
printf '%s\n' "${DATE_LINES[@]}"
}

# Scan files for dates in the specified directory
scan_files_for_dates "content/en/docs"
4 changes: 3 additions & 1 deletion content/en/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ cascade:
# Main layout template for landing page: docs/layouts/landingpage/landingpage.html
# Other parts are in partials/landingpage
# Root index.html file calls docs/content/en/docs/_index.md content
---
---

June 17, 2024 is a date mentioned here.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can download the example in this how-to in [this GitHub repository](https://

1. Open the project that you previously created when you [created the menu extension](/apidocs-mxsdk/apidocs/extensibility-api/create-menu-extension/).
2. Add a new class to the project and name it `MyMenuExtension.cs`.
3. Replace the code in the file with the following code:
3. Replace the code in the file with the following code:

```csharp
using Mendix.StudioPro.ExtensionsAPI.UI.Menu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ In order for your extension to be loaded correctly as an extension in Studio Pro
{{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensibility-api-howtos/build-todo-example-extension/step-one.png" >}}

3. Name the project *Mendix.ToDoExtension*.
4. Choose a location to store your extension, and click **Next**.
4. Choose a location to store your extension, and click **Next**.

{{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensibility-api-howtos/build-todo-example-extension/step-two.png" >}}

5. Set **Framework** to *.NET 8.0 (Long Term Support)* and click **Create**.
5. Set **Framework** to *.NET 8.0 (Long Term Support)* and click **Create**.

{{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensibility-api-howtos/build-todo-example-extension/step-three.png" max-width=80% >}}

Expand All @@ -56,15 +56,15 @@ The details of each step are described below.

#### 3.2.1 Referencing the Extensibility API NuGet Package

1. In Visual Studio, go to **Tools** > **NuGet Package Manager** > **Manage NuGet Packages for Solution**.
1. In Visual Studio, go to **Tools** > **NuGet Package Manager** > **Manage NuGet Packages for Solution**.

{{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensibility-api-howtos/build-todo-example-extension/step-four.png" >}}

2. On the **Browse** tab, search for **Mendix ExtensionsAPI**.
2. On the **Browse** tab, search for **Mendix ExtensionsAPI**.

{{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensibility-api-howtos/build-todo-example-extension/step-five.png" max-width=50% >}}

3. Select the NuGet package and click **Install**.
3. Select the NuGet package and click **Install**.

{{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensibility-api-howtos/build-todo-example-extension/step-six.png" max-width=50% >}}

Expand All @@ -76,7 +76,7 @@ You now have a class library that can be loaded as an extension by Studio Pro. H
2. Right-click in the Solution Explorer and add a new file called *manifest.json*.
3. Right-click in the Solution Explorer and select **Properties**.
4. Ensure that you set the **Copy to Output Directory** property to **Copy always** to ensure that this file is included in your extensions output files.
5. Replace the contents of your manifest.json file with the following code:
5. Replace the contents of your manifest.json file with the following code:

```json
{
Expand All @@ -98,7 +98,7 @@ You now have a class library that can be loaded as an extension by Studio Pro. H
In this section, you will host a dockable pane within Studio Pro. This will provide you with a window where you can render the User Interface of the extension.

1. Add a new file to the solution called `ToDoListDockablePaneExtension.cs`.
2. Replace the contents of the file with the following code:
2. Replace the contents of the file with the following code:

```csharp
using System.ComponentModel.Composition;
Expand Down Expand Up @@ -399,7 +399,7 @@ Now, create the methods responsible for performing the logic:
In order to store the information to disk, add some model classes that will be able to store the Todo information.

1. Add a new class that will host the To do information itself. Call the file `ToDoModel.cs`
2. Replace the contents of the file with the following code:
2. Replace the contents of the file with the following code:

```csharp
using System.Text.Json.Serialization;
Expand Down Expand Up @@ -430,7 +430,7 @@ In order to store the information to disk, add some model classes that will be a
You will also need a model class that will store a list of all the todos that you have available.

3. Add another class and name it `ToDoListModel.cs`.
4. Replace the contents of this file with the following code:
4. Replace the contents of this file with the following code:

```csharp
using System.Text.Json.Serialization;
Expand All @@ -454,7 +454,7 @@ In order to store the information to disk, add some model classes that will be a
With the models created, you can now create a storage handler that will manage storing these models to disk.

1. Add a new class file and call it `ToDoStorage.cs`.
2. Replace the contents of the file with the following code:
2. Replace the contents of the file with the following code:

```csharp
using System.Text;
Expand Down Expand Up @@ -553,10 +553,11 @@ In this section, you will add a menu item to the toolbar that will allow you to

1. Create a `MenuExtension`.
2. Add another class and call it `ToDoListMenuExtension.cs`.
3. Replace the contents of the file with the following code:
3. Replace the contents of the file with the following code:

```csharp
using System.Collections.Generic;

using System.ComponentModel.Composition;
using Mendix.StudioPro.ExtensionsAPI.UI.DockablePane;
using Mendix.StudioPro.ExtensionsAPI.UI.Menu;
Expand Down Expand Up @@ -595,7 +596,7 @@ Up to now you have been adding all the logic that will allow your extension to r
* A JavaScript file that contains the client side logic for the user interface. Call it `main.js`

3. Open `index.html`.
4. Replace its contents with the following:
4. Replace its contents with the following:

```html
<html lang="en">
Expand Down Expand Up @@ -641,7 +642,7 @@ Up to now you have been adding all the logic that will allow your extension to r
</html>
```

5. Open `main.js` and add the JavaScript logic by replacing the contents of the file with the following:
5. Open `main.js` and add the JavaScript logic by replacing the contents of the file with the following:

```js
function postMessage(message, data) {
Expand Down Expand Up @@ -750,7 +751,7 @@ It is important to set these two `index.html` and `main.js` files to *Copy alway
So far you have configured the extension to be usable in Studio Pro. You added support for storing the to do items. You also added a user interface that users can interact with. The last step in this process is to link the extension c# logic with the web-based JavaScript logic.

1. Start with adding a utility class to help simplify the way you interact with web responses. Call the file `HttpListenerResponseUtils.cs`.
2. Replace the contents of the file with the following:
2. Replace the contents of the file with the following:

```csharp
using System.Net;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ You can download the example in this how-to in [this GitHub repository](https://

1. Open the project that you previously created when you [created the menu extension](/apidocs-mxsdk/apidocs/extensibility-api/create-menu-extension/).
2. Add a new class to the project and name it `MyEntityContextMenuExtension.cs`.
3. Replace the code in the file with the following code:
3. Replace the code in the file with the following code:

```csharp
namespace MyCompany.MyProject.MendixExtension;
Expand Down Expand Up @@ -115,4 +115,4 @@ class MyDocumentContextMenuExtension(IMessageBoxService messageBoxService) : Con
yield return new MenuViewModel("This document is a page", () => messageBoxService.ShowInformation(page.Name));
}
}
```
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You can download the example in this how-to in [this GitHub repository](https://

1. Open the project that you previously created when you [created the menu extension](/apidocs-mxsdk/apidocs/extensibility-api/create-menu-extension/).
2. Add a new class to the project and name it `MyDockablePaneExtension.cs`.
3. Replace the code in the file with the following code:
3. Replace the code in the file with the following code:

```csharp
using System.ComponentModel.Composition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can download the example in this how-to in [this GitHub repository](https://
1. Create a new project in Visual Studio based on `C# Class Library` template.
2. Choose a name for the project. Use a format similar to `MyCompany.MyProject.MendixExtension`, but it is not a hard requirement.
3. Choose `.NET 8.0` Framework.
4. Add `Mendix.StudioPro.ExtensionsAPI` NuGet package to the project references. Pick the version that does not exceed the Studio Pro version you installed. To do so, perform the following steps:
4. Add `Mendix.StudioPro.ExtensionsAPI` NuGet package to the project references. Pick the version that does not exceed the Studio Pro version you installed. To do so, perform the following steps:
1. Include a reference to the Extensions API [NuGet package](https://www.nuget.org/packages/Mendix.StudioPro.ExtensionsAPI):
2. Add new file named `manifest.json` to your project. Put the following content into it:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ In this more advanced example, you will see the `IMicroflowExpressionService.Cre
transaction.Commit();
}
```

The `IMicroflowService.CreateMicroflow` method is a bit easier to use than the `IMicroflowService.Initialize` method because it doesn't require manually creating the microflow with `IModel.Create<IMicroflow>` and then manually adding it to the `IFolderBase` container. It can do everything behind the scenes as long as everything is supplied to it. For a comprehensive example on how to create microflows, see [Create Microflows for Calculations](/apidocs-mxsdk/apidocs/extensibility-api/create-microflows-for-calculations/)

## 4 `TryInsertAfterStart` and `TryInsertBeforeActivity`
Expand Down Expand Up @@ -140,4 +141,4 @@ public void AddNewActivity(IModel currentApp, IMicroflow microflow, string activ

transaction.Commit();
}
```
```
Loading