Skip to content

Commit 60e49eb

Browse files
authored
Merge pull request AdobeDocs#301 from asalloum5/admin-ui-sdk-2.1
Update documentation for Admin UI SDK 2.1.0 release
2 parents 0114f8e + 439f9dd commit 60e49eb

File tree

11 files changed

+333
-60
lines changed

11 files changed

+333
-60
lines changed

src/data/navigation/sections/admin-ui-sdk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = [
8181
]
8282
},
8383
{
84-
title: "Admin configuration and local testing",
84+
title: "Admin configuration and testing",
8585
path: "/admin-ui-sdk/configuration.md"
8686
},
8787
{
79.6 KB
Loading
Loading
Loading
Loading

src/pages/admin-ui-sdk/app-registration.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,15 @@ Update the `app.config.yaml` [configuration file](https://developer.adobe.com/ap
134134
```yaml
135135
extensions:
136136
commerce/backend-ui/1:
137-
$include: ext.config.yaml
137+
$include: src/commerce-backend-ui-1/ext.config.yaml
138138
```
139139

140140
This file now declares extensions and redirects to an `ext.config.yaml` file.
141141

142142
## Add or update the `ext.config.yaml`
143143

144+
Add or update the `src/commerce-backend-ui-1/ext.config.yaml` file. The `commerce-backend-ui-1` directory contains the `actions` and `web-src` code.
145+
144146
Your extension configuration file should look like this:
145147

146148
```yaml
@@ -162,8 +164,12 @@ runtimeManifest:
162164
inputs:
163165
LOG_LEVEL: debug
164166
annotations:
165-
require-adobe-auth: false
167+
require-adobe-auth: true
166168
final: true
167169
```
168170

171+
The package name must be `admin-ui-sdk`, and the action must be `registration`. The `function` can point to any route that returns the registration in the correct expected format.
172+
173+
We recommend securing the registration runtime action by setting `require-adobe-auth` to `true`. The Adobe Commerce instance will correctly load registrations securely based on the provided IMS credentials.
174+
169175
Complete this file with the actions from your app.

src/pages/admin-ui-sdk/configuration.md

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Admin configuration and testing
3-
description: Learn how to configure the Admin to enable local testing of your Admin customizations.
3+
description: Learn how to configure the Admin to enable testing of your Admin customizations.
44
keywords:
55
- App Builder
66
- Extensibility
@@ -10,47 +10,61 @@ keywords:
1010

1111
The Adobe Commerce Admin UI SDK allows you to use a local server to view and test your Admin customizations before you submit your app to the Adobe Marketplace.
1212

13-
## Configure the Admin
13+
Navigate to **Stores** > Settings > **Configuration** > **Adobe Services** > **Admin UI SDK** screen.
1414

15-
Navigate to **Stores** > Settings > **Configuration** > **Adobe Services** > **Admin UI SDK** and edit the **Local testing** screen. When you enable the local service, all calls are automatically redirected to the local server, instead of connecting to Adobe's App Registry. The values you specify must match the contents of your local `server.js` file.
15+
## General configuration
1616

17-
[Test with a sample app](#test-with-a-sample-app) provides a sample `server.js` file.
17+
The **General configuration** section enables the Admin UI SDK and refreshes registrations when changes are made.
1818

19-
![Local server configuration](../_images/sdk-config.png)
19+
![Admin UI SDK general configuration](../_images/admin-ui-sdk-general-config.png)
2020

21-
1. Select **Yes** from the **Enable Admin UI SDK** menu.
21+
The Admin UI SDK is disabled by default. To enable it, set the **Enable Admin UI SDK** field to **Yes**.
2222

23-
1. Select **Yes** from the **Enable Local Testing** menu.
23+
The `Refresh registrations` button reloads all registrations from the registries. It is typically used when changes are made to the registration on the app builder application side or when a new app is added and published, to reflect these changes in the Admin.
2424

25-
1. Set the **Local Server Base URL** that points to your localhost, including the port.
25+
## Database logging configuration
2626

27-
1. The **Mock Admin IMS Module** menu determines whether to send mock or real authentication credentials for the Adobe Identity Management Service (IMS). Ensure this value is set to **Yes** for early-stage testing. Set the value to **No** when you are ready to test with real credentials.
27+
The **Database logging configuration** section allows you to save Admin UI SDK log entries for the specified retention period.
2828

29-
1. Set the **Mock IMS Token**. In the sample `server.js` file, this value is set to `dummyToken`.
29+
![Admin UI SDK database logging configuration](../_images/admin-ui-sdk-db-log-config.png)
3030

31-
1. Set the **Mock IMS Org ID**. In the sample `server.js` file, this value is set to `imsOrg`.
31+
To save logs, set the **Enable Logs** field to **Yes**. By default, this field is set to **No**.
3232

33-
1. Save your configuration.
33+
Set the minimum log level to save. Any logs at this level or higher will be stored. By default, the minimum level is set to **Warning**.
3434

35-
1. Clear the cache.
35+
Set the retention period for logs to be cleaned from the database. This field specifies the number of days. By default, the retention period is set to 1 day.
3636

37-
```bash
38-
bin/magento cache:flush
39-
```
37+
## Staging testing
38+
39+
The staging testing option provides a sandbox environment to test your applications using the Admin UI SDK in a real-world setting. This environment can be shared with colleagues for collaborative testing before publishing and deploying to production.
40+
41+
![Admin UI SDK staging testing configuration](../_images/admin-ui-sdk-stage-test-config.png)
42+
43+
1. Select **Yes** from the **Enable testing** menu.
44+
45+
1. Set the **Testing mode** to **Staging**.
4046

41-
## Clean the Admin UI SDK cache
47+
1. Select all app statuses to load.
4248

43-
The `admin_ui_sdk` cache type stores Admin customizations. As you develop these customizations, run the following command to ensure you are seeing the latest changes:
49+
## Local testing
4450

45-
```bash
46-
bin/magento cache:clean admin_ui_sdk
47-
```
51+
When you enable the local service, all calls are automatically redirected to the local server, instead of connecting to Adobe's App Registry. The values you specify must match the contents of your local `server.js` file.
4852

49-
## Test with a sample app
53+
![Admin UI SDK local testing configuration](../_images/admin-ui-sdk-local-test-config.png)
5054

51-
### Prerequisites
55+
1. Select **Yes** from the **Enable testing** menu.
5256

53-
- An Adobe Commerce instance installed on the local machine.
57+
1. Set the **Testing mode** to `Local testing`.
58+
59+
1. Set the **Local Server Base URL** that points to your localhost, including the port.
60+
61+
1. The **Mock Admin IMS Module** menu determines whether to send mock or real authentication credentials for the Adobe Identity Management Service (IMS). Ensure this value is set to **Yes** for early-stage testing. Set the value to **No** when you are ready to test with real credentials.
62+
63+
1. Set the **Mock IMS Token**. In the sample `server.js` file, this value is set to `dummyToken`.
64+
65+
1. Set the **Mock IMS Org ID**. In the sample `server.js` file, this value is set to `imsOrg`.
66+
67+
1. Save your configuration.
5468

5569
### Configuration
5670

src/pages/admin-ui-sdk/extension-points/customer/grid-columns.md

Lines changed: 86 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ keywords:
1010

1111
The `customer grid columns` extension point enables you to add columns to the grid on the **Customers** > **All Customers** page in the Adobe Commerce Admin. This extension point requires an [API Mesh](https://developer.adobe.com/graphql-mesh-gateway/gateway) for Adobe Developer App Builder instance to retrieve the data to be added to the custom columns.
1212

13-
You can use the [`aio api-mesh:describe` command](https://developer.adobe.com/graphql-mesh-gateway/gateway/command-reference/#aio-api-meshdescribe) to retrieve the values of the API key and mesh ID. The key is appended to the mesh endpoint URL.
13+
You can use the [`aio api-mesh:describe` command](https://developer.adobe.com/graphql-mesh-gateway/gateway/command-reference/#aio-api-meshdescribe) to retrieve the value of the mesh ID.
1414

1515
## Example customization
1616

@@ -20,8 +20,7 @@ You can use the [`aio api-mesh:describe` command](https://developer.adobe.com/gr
2020
customer: {
2121
gridColumns: {
2222
data: {
23-
meshId: 'MESH_ID',
24-
apiKey: 'API_KEY'
23+
meshId: 'MESH_ID'
2524
},
2625
properties:[
2726
{
@@ -35,12 +34,6 @@ customer: {
3534
columnId: 'second_column',
3635
type: 'integer',
3736
align: 'left'
38-
},
39-
{
40-
label: 'Third App Column',
41-
columnId: 'third_column',
42-
type: 'date',
43-
align: 'left'
4437
}
4538
]
4639
}
@@ -50,6 +43,7 @@ customer: {
5043
### Sample API Mesh configuration file
5144

5245
The following sample mesh configuration file defines the external source that contains the data to populate in the custom columns.
46+
It leverages API Mesh [JSON Schemas handler](https://developer.adobe.com/graphql-mesh-gateway/mesh/basic/handlers/json-schema/).
5347

5448
```json
5549
{
@@ -60,11 +54,15 @@ The following sample mesh configuration file defines the external source that co
6054
"handler": {
6155
"JsonSchema": {
6256
"baseUrl": "https://www.example.com",
57+
"operationHeaders": {
58+
"Authorization": "Bearer {context.headers['x-ims-token']}",
59+
"x-gw-ims-org-id": "{context.headers['x-gw-ims-org-id']}"
60+
},
6361
"operations": [
6462
{
6563
"type": "Query",
6664
"field": "customers",
67-
"path": "/graphql",
65+
"path": "/get-customers?ids={args.ids}",
6866
"method": "GET",
6967
"responseSchema": "./schema.json"
7068
}
@@ -77,9 +75,57 @@ The following sample mesh configuration file defines the external source that co
7775
}
7876
```
7977

78+
### Sample runtime action to retrieve data
79+
80+
The `get-customers` sample runtime action is referenced in the mesh configuration file. It defines the path to the runtime action that retrieves the data of custom columns.
81+
82+
It is important to add the `ids={args.ids}` as part of the query and handle this filtering in the runtime action. This allows Admin UI SDK to load only the necessary data needed to display in the grid columns in the Admin.
83+
84+
```javascript
85+
export async function main(props) {
86+
87+
const selectedIds = props.ids ? props.ids.split(',') : [];
88+
89+
const customerGridColumns = {
90+
"customerGridColumns": {
91+
"1": {
92+
"first_column": "value_1",
93+
"second_column": 1
94+
},
95+
"2": {
96+
"first_column": 1,
97+
"second_column": "test"
98+
}
99+
}
100+
}
101+
102+
if (selectedIds.length === 0) {
103+
return {
104+
statusCode: 200,
105+
body: customerGridColumns,
106+
}
107+
}
108+
109+
const filteredColumns = {
110+
"customerGridColumns": {}
111+
}
112+
113+
selectedIds.forEach(id => {
114+
if (customerGridColumns.customerGridColumns[id]) {
115+
filteredColumns.customerGridColumns[id] = customerGridColumns.customerGridColumns[id]
116+
}
117+
})
118+
119+
return {
120+
statusCode: 200,
121+
body: filteredColumns
122+
}
123+
}
124+
```
125+
80126
### Sample schema file
81127

82-
This sample `schema.json` file is referenced in the mesh configuration file. It defines the response of the external `customerGridColumns` query that fetches column data.
128+
The `schema.json` sample file, which is also referenced in the mesh configuration file, defines the response of the external `customerGridColumns` query that fetches column data.
83129

84130
```json
85131
{
@@ -97,9 +143,6 @@ This sample `schema.json` file is referenced in the mesh configuration file. It
97143
},
98144
"second_column": {
99145
"type": "integer"
100-
},
101-
"third_column": {
102-
"type": "integer"
103146
}
104147
}
105148
}
@@ -112,11 +155,39 @@ This sample `schema.json` file is referenced in the mesh configuration file. It
112155
}
113156
```
114157

158+
### Create or update your mesh
159+
160+
Use one of the following commands to create or update your mesh. Be sure to store the mesh ID provided.
161+
162+
```bash
163+
aio api-mesh:create mesh.json
164+
```
165+
166+
```bash
167+
aio api-mesh:update mesh.json
168+
```
169+
170+
### Customer data matching
171+
172+
The Admin UI SDK expects the customer ID in Adobe Commerce to correctly match the customer to the data and fill the correct cell.
173+
174+
A default value can be provided to be added to unmatched IDs, or in case data doesn't match, the expected type of the column. If a value is not provided, the cell is left empty.
175+
176+
In case of error, check the Adobe Commerce logs.
177+
178+
The following example provides a default value.
179+
180+
```javascript
181+
"*": {
182+
"first_column": "Default value",
183+
"second_column": 0
184+
}
185+
```
186+
115187
## Parameters
116188

117189
| Field | Type | Required | Description |
118190
| --- | --- | --- | --- |
119-
| `data.apiKey` | string | Yes | The API key assigned to the GraphQL mesh. |
120191
| `data.meshId` | string | Yes | The ID of the mesh used to retrieve the column data.|
121192
| `properties.align` | string | Yes | The alignment of the values in the column. One of `left`, `right`, `center`. |
122193
| `properties.columnId` | string | Yes | The identifier used in the external dataset to identify the column. |

0 commit comments

Comments
 (0)