Skip to content

Commit

Permalink
feat: Support for SystemActions in Xlf, ToolTips etc. (#459)
Browse files Browse the repository at this point in the history
* feat: Support for SystemActions in Xlf, ToolTips etc.
  • Loading branch information
jwikman committed May 7, 2024
1 parent 2ef2313 commit 58330f2
Show file tree
Hide file tree
Showing 28 changed files with 173 additions and 19 deletions.
1 change: 1 addition & 0 deletions extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

- New Features:
- Added support for namespaces in symbols.
- Added support for System Actions on pages of type PromptDialog.
- Fixes:
- Added support for captions in the `layout` of a `rendering` section in reports. Thanks to [lv-janpieter](https://github.com/lv-janpieter) for bringing us the attention to this in [issue 441](https://github.com/jwikman/nab-al-tools/issues/441).
- Removed a couple of semicolons from the test snippets (see [this post on X](https://twitter.com/arthrvdv/status/1727729430737342791) for more information)
Expand Down
6 changes: 6 additions & 0 deletions extension/src/ALObject/ALParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,12 @@ export function matchALControl(
case "action":
control = new ALControl(ALControlType.action, alControlResultFiltered[2]);
break;
case "systemaction":
control = new ALControl(
ALControlType.systemaction,
alControlResultFiltered[2]
);
break;
case "label":
control = new ALControl(ALControlType.label, alControlResultFiltered[2]);
control.xliffTokenType = XliffTokenType.control;
Expand Down
2 changes: 2 additions & 0 deletions extension/src/ALObject/Enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export enum ALControlType {
pageField = "PageField", // Used for tooltip sorting
group = "Group", // Used for tooltip sorting
action = "Action", // Used for tooltip sorting
systemaction = "Action", // Used for tooltip sorting
part = "Part", // Used for tooltip sorting
systemPart = "SystemPart",
dataItem = "DataItem",
Expand Down Expand Up @@ -133,6 +134,7 @@ export enum XliffTokenType {
enumValue = "EnumValue",
method = "Method",
action = "Action",
systemaction = "Action",
field = "Field",
change = "Change",
view = "View",
Expand Down
1 change: 1 addition & 0 deletions extension/src/ALObject/RegexPatterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const controlPatterns = [
"^\\s*\\b(labels)\\b$",
"^\\s*\\b(actions)\\b$",
"^\\s*\\b(action)\\b\\((.*)\\)",
"^\\s*\\b(systemaction)\\b\\((.*)\\)",
"^\\s*\\b(label)\\b\\((.*)\\)",
"^\\s*\\b(trigger)\\b (.*)\\(.*\\)",
"^\\s*\\b(procedure)\\b ([^()]*)\\(",
Expand Down
1 change: 1 addition & 0 deletions extension/src/ToolTipsDocumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ function getControlTypeText(control: ALControl): string {
case ALControlType.group:
controlTypeText = "Group";
break;
case ALControlType.systemaction:
case ALControlType.action:
controlTypeText = "Action";
break;
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 1 addition & 0 deletions test-app/Xliff-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ title: Reference | Al
##### [TestMethod](docs/tableextension-nab-test-table-ext/test-method.md)
#### [ToolTip](docs/tableextension-nab-tool-tip/index.md)
### [Pages](docs/pages.md)
#### [PromptDialog](docs/page-nab-prompt-dialog/index.md)
#### [Test Table](docs/page-nab-test-table/index.md)
##### [TestMethodPage](docs/page-nab-test-table/test-method-page.md)
#### [Test View](docs/page-nab-test-view/index.md)
Expand Down
9 changes: 9 additions & 0 deletions test-app/Xliff-test/ToolTips.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ title: Pages Overview | Al

## Pages

### PromptDialog

| Type | Caption | Description |
| ----- | --------- | ------- |
| Action | Generate | Generate function proposals with Dynamics 365 Copilot. |
| Action | Confirm | Proceed with the selected functions. |
| Action | Discard | Discard the function proposals by Dynamics 365 Copilot. |
| Action | Regenerate | Regenerate function proposals with Dynamics 365 Copilot. |

### Page Caption

| Type | Caption | Description |
Expand Down
45 changes: 45 additions & 0 deletions test-app/Xliff-test/Translations/Al.g.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,51 @@
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB API Sub Test - Control testField - Property Caption</note>
</trans-unit>
<trans-unit id="Page 838873363 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve">
<source>PromptDialog</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Property Caption</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 788258546 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Discard the function proposals by Dynamics 365 Copilot.</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action Cancel - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 788258546 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve">
<source>Discard</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action Cancel - Property Caption</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 2626368477 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Generate function proposals with Dynamics 365 Copilot.</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action Generate - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 2626368477 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve">
<source>Generate</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action Generate - Property Caption</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 2079045816 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Proceed with the selected functions.</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action OK - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 2079045816 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve">
<source>Confirm</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action OK - Property Caption</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 2388911040 - Property 1295455071" size-unit="char" translate="yes" xml:space="preserve">
<source>Regenerate function proposals with Dynamics 365 Copilot.</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action Regenerate - Property ToolTip</note>
</trans-unit>
<trans-unit id="Page 838873363 - Action 2388911040 - Property 2879900210" size-unit="char" translate="yes" xml:space="preserve">
<source>Regenerate</source>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Page NAB PromptDialog - Action Regenerate - Property Caption</note>
</trans-unit>
<trans-unit id="Page 596208023 - Property 1968111052" size-unit="char" translate="yes" xml:space="preserve">
<source>Instructions</source>
<note from="Developer" annotates="general" priority="2"></note>
Expand Down
12 changes: 5 additions & 7 deletions test-app/Xliff-test/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"help": "",
"url": "",
"logo": "",
"application": "17.0.0.0",
"application": "24.0.0.0",
"dependencies": [],
"screenshots": [],
"platform": "17.0.0.0",
"platform": "24.0.0.0",
"idRanges": [
{
"from": 50000,
Expand All @@ -24,8 +24,6 @@
"to": 50149
}
],
"features": [
"TranslationFile"
],
"runtime": "9.0"
}
"features": ["TranslationFile"],
"runtime": "13.0"
}
3 changes: 3 additions & 0 deletions test-app/Xliff-test/docs/TOC.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
- name: Pages
href: pages.md
items:
- name: PromptDialog
href: page-nab-prompt-dialog/TOC.yml
topicHref: page-nab-prompt-dialog/index.md
- name: Test Table
href: page-nab-test-table/TOC.yml
topicHref: page-nab-test-table/index.md
Expand Down
2 changes: 0 additions & 2 deletions test-app/Xliff-test/docs/deprecated-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ title: Deprecated Features | Al
| Object | Type | Name | Reason | Deprecated since |
| ------ | ---- | ---- | ------ | ---------------- |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Object | NAB WS Deprecated | Testing deprecation | 12.0 |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Action Group | Navigation | Testing deprecation | 12.0 |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Group | TestGroup | Testing deprecation | 12.0 |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Action | TestAction | Testing deprecation | 12.0 |

Expand All @@ -30,7 +29,6 @@ title: Deprecated Features | Al
| Object | Type | Name | Reason | Deprecated since |
| ------ | ---- | ---- | ------ | ---------------- |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Object | NAB WS Deprecated | Testing deprecation | 12.0 |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Action Group | Navigation | Testing deprecation | 12.0 |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Group | TestGroup | Testing deprecation | 12.0 |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Action | TestAction | Testing deprecation | 12.0 |

Expand Down
1 change: 0 additions & 1 deletion test-app/Xliff-test/docs/deprecated-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ title: Deprecated Features - Pages | Al
| Object | Type | Name | Reason | Deprecated since |
| ------ | ---- | ---- | ------ | ---------------- |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Object | NAB WS Deprecated | Testing deprecation | 12.0 |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Action Group | Navigation | Testing deprecation | 12.0 |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Group | TestGroup | Testing deprecation | 12.0 |
| [WS Deprecated](page-nab-ws-deprecated/index.md) | Action | TestAction | Testing deprecation | 12.0 |
1 change: 0 additions & 1 deletion test-app/Xliff-test/docs/deprecated-web-services-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ title: Deprecated Features - Web Services Pages | Al
| Object | Type | Name | Reason | Deprecated since |
| ------ | ---- | ---- | ------ | ---------------- |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Object | NAB WS Deprecated | Testing deprecation | 12.0 |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Action Group | Navigation | Testing deprecation | 12.0 |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Group | TestGroup | Testing deprecation | 12.0 |
| [wsDeprecated](ws-page-nab-ws-deprecated/index.md) | Action | TestAction | Testing deprecation | 12.0 |
10 changes: 5 additions & 5 deletions test-app/Xliff-test/docs/info.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"generated-date": "2022-06-27",
"generator": "NAB AL Tools v1.27.206232222",
"generated-date": "2024-05-07",
"generator": "NAB AL Tools v1.33.402290847",
"app-id": "ed43c16b-7d86-4b49-ab59-d1660c4ef64f",
"app-name": "Al",
"app-publisher": "Default publisher",
"app-version": "1.0.0.0",
"app-application": "17.0.0.0",
"app-platform": "17.0.0.0",
"app-runtime": "7.0"
"app-application": "24.0.0.0",
"app-platform": "24.0.0.0",
"app-runtime": "13.0"
}
1 change: 1 addition & 0 deletions test-app/Xliff-test/docs/page-nab-prompt-dialog/TOC.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
items:
23 changes: 23 additions & 0 deletions test-app/Xliff-test/docs/page-nab-prompt-dialog/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
uid: page_nab_prompt_dialog
title: Page PromptDialog | Al
---
# PromptDialog

## Object Definition

<table>
<tr><td><b>Object Type</b></td><td>Page</td></tr>
<tr><td><b>Object ID</b></td><td>50011</td></tr>
<tr><td><b>Object Name</b></td><td>NAB PromptDialog</td></tr>
<tr><td><b>Source Table</b></td><td></td></tr>
</table>

## Controls

| Type | Caption | ToolTip |
| ---- | ------- | ----------- |
| Action | Generate | Generate function proposals with Dynamics 365 Copilot. |
| Action | Confirm | Proceed with the selected functions. |
| Action | Discard | Discard the function proposals by Dynamics 365 Copilot. |
| Action | Regenerate | Regenerate function proposals with Dynamics 365 Copilot. |
1 change: 1 addition & 0 deletions test-app/Xliff-test/docs/pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ title: Public Pages | Al

| Name | Source Table | Read-only |
| ----- | ------ | ------ |
| [PromptDialog](page-nab-prompt-dialog/index.md) | | |
| [Test Table](page-nab-test-table/index.md) | NAB Test Table | |
| [Test View](page-nab-test-view/index.md) | NAB Test Table | |
| [ToolTip Part 1](page-nab-tool-tip-part-1/index.md) | Item | |
Expand Down
1 change: 1 addition & 0 deletions test-app/Xliff-test/docs/public-objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ title: Public Objects | Al

| Name | Source Table | Read-only |
| ----- | ------ | ------ |
| [PromptDialog](page-nab-prompt-dialog/index.md) | | |
| [Test Table](page-nab-test-table/index.md) | NAB Test Table | |
| [Test View](page-nab-test-view/index.md) | NAB Test Table | |
| [ToolTip Part 1](page-nab-tool-tip-part-1/index.md) | Item | |
Expand Down
64 changes: 64 additions & 0 deletions test-app/Xliff-test/src/PromptDialog.Page.al
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
page 50011 "NAB PromptDialog"
{
ApplicationArea = All;
Caption = 'PromptDialog';
Extensible = false;
PageType = PromptDialog;


layout
{
area(Prompt)
{
field(ChatRequest; InputText)
{
MultiLine = true;
ShowCaption = false;

trigger OnValidate()
begin
CurrPage.Update();
end;
}
}
}
actions
{
area(SystemActions)
{
systemaction(Generate)
{
Caption = 'Generate';
ToolTip = 'Generate function proposals with Dynamics 365 Copilot.';

trigger OnAction()
begin
RunGeneration();
end;
}
systemaction(OK)
{
Caption = 'Confirm';
ToolTip = 'Proceed with the selected functions.';
}
systemaction(Cancel)
{
Caption = 'Discard';
ToolTip = 'Discard the function proposals by Dynamics 365 Copilot.';
}
systemaction(Regenerate)
{
Caption = 'Regenerate';
ToolTip = 'Regenerate function proposals with Dynamics 365 Copilot.';
}
}
}
var
InputText: Text;

local procedure RunGeneration()
begin
Error('Procedure RunGeneration not implemented.');
end;

}
7 changes: 4 additions & 3 deletions test-app/Xliff-test/src/WSDeprecated.Page.al
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ page 50010 "NAB WS Deprecated"
{
area(Navigation)
{
ObsoleteState = Pending;
ObsoleteReason = 'Testing deprecation';
ObsoleteTag = '12.0';
// Action Areas cannot be obsoleted in runtime 13 and later
// ObsoleteState = Pending;
// ObsoleteReason = 'Testing deprecation';
// ObsoleteTag = '12.0';
group(TestGroup)
{
ObsoleteState = Pending;
Expand Down

0 comments on commit 58330f2

Please sign in to comment.