Skip to content

Commit 5003c73

Browse files
committed
review comments; rationalized community widget guidance
1 parent e2d4400 commit 5003c73

12 files changed

+61
-381
lines changed

.openpublishing.redirection.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"redirections": [
3-
{
3+
{
44
"source_path": "articles/api-management/zone-redundancy.md",
55
"redirect_url": "/azure/availability-zones/migrate-api-mgt",
66
"redirect_document_id": false
77
},
8+
{
9+
"source_path": "articles/api-management/developer-portal-implement-widgets.md",
10+
"redirect_url": "/azure/api-management/developer-portal-extend-custom-functionality",
11+
"redirect_document_id": false
12+
},
813
{
914
"source_path": "articles/virtual-machines/linux/find-unattached-nics.md",
1015
"redirect_url": "/previous-versions/azure/virtual-machines/linux/find-unattached-nics",

articles/api-management/TOC.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@
323323
href: developer-portal-deprecated-migration.md
324324
- name: Extend portal with custom functionality
325325
href: developer-portal-extend-custom-functionality.md
326+
- name: Contribute widgets
327+
href: developer-portal-widget-contribution-guidelines.md
328+
- name: Use community widgets
329+
href: developer-portal-use-community-widgets.md
326330
- name: Enable console OAuth support
327331
href: api-management-howto-oauth2.md
328332
- name: Integrate Application Insights
@@ -335,12 +339,6 @@
335339
href: developer-portal-self-host.md
336340
- name: Alternative approaches to self-hosting
337341
href: developer-portal-alternative-processes-self-host.md
338-
- name: Implement widgets in self-hosted portal
339-
href: developer-portal-implement-widgets.md
340-
- name: Contribute widgets
341-
href: developer-portal-widget-contribution-guidelines.md
342-
- name: Use community widgets
343-
href: developer-portal-use-community-widgets.md
344342
- name: Test self-hosted portal
345343
href: developer-portal-testing.md
346344
- name: Monitor APIs

articles/api-management/api-management-howto-developer-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Your API Management service includes a built-in, always up-to-date, **managed**
4747
In some cases you might need functionality beyond the customization and styling options provided in the managed developer portal. If you need to implement custom logic, which isn't supported out-of-the-box, you have [several options](developer-portal-extend-custom-functionality.md):
4848
* [Add custom HTML](developer-portal-extend-custom-functionality.md#use-custom-html-code-widget) directly through a developer portal widget designed for small customizations - for example, add HTML for a form or to embed a video player. The custom code is rendered in an inline frame (iframe).
4949
* [Create and upload a custom widget](developer-portal-extend-custom-functionality.md#create-and-upload-custom-widget) to develop and add more complex custom portal features.
50-
* [Self-host the portal](developer-portal-self-host.md) by cloning and modifying the portal's codebase, available on [GitHub](https://github.com/Azure/api-management-developer-portal). When you self-host the portal, you have complete flexibility but become its maintainer and you're responsible for its upgrades. Azure Support's assistance is limited only to the basic setup of self-hosted portals.
50+
* [Self-host the portal](developer-portal-self-host.md), only if you need to make modifications to the core of the developer portal [codebase](https://github.com/Azure/api-management-developer-portal). This option requires advanced configuration. Azure Support's assistance is limited only to the basic setup of self-hosted portals.
5151

5252
> [!NOTE]
5353
> Because the API Management developer portal codebase is maintained on [GitHub](https://github.com/Azure/api-management-developer-portal), you can open issues and make pull requests for the API Management team to merge new functionality at any time.

articles/api-management/developer-portal-extend-custom-functionality.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ ms.topic: how-to
1111

1212
# Extend the developer portal with custom features
1313

14-
The API Management [developer portal](api-management-howto-developer-portal.md) features a visual editor and built-in widgets so that you can customize and style the portal's appearance. However, you may need to customize the developer portal further with custom functionality. For example, you might want to integrate your developer portal with a support system that involves adding a custom control. This article explains ways to add custom functionality such as custom widgets to your API Management developer portal.
14+
The API Management [developer portal](api-management-howto-developer-portal.md) features a visual editor and built-in widgets so that you can customize and style the portal's appearance. However, you may need to customize the developer portal further with custom functionality. For example, you might want to integrate your developer portal with a support system that involves adding a custom interface. This article explains ways to add custom functionality such as custom widgets to your API Management developer portal.
1515

1616
The following table summarizes three options, with links to more detail.
1717

1818

1919
|Method |Description |
2020
|---------|---------|
21-
|[Custom HTML code widget](#use-custom-html-code-widget) | - Lightweight solution for API publishers to add custom logic for basic use cases<br/><br/>- Copy and paste custom HTML code into a form, and developer portal renders in an iframe |
22-
|[Create and upload custom widget](#create-and-upload-custom-widget) | - Developer solution for more advanced widget use cases<br/><br/>- Requires local implementation in React, Vue, or plain TypeScript<br/><br/>- Widget scaffold provided to help developers create widget and upload to developer portal<br/><br/>- Supports workflows for source control, versioning, and code reuse<br/><br/> |
23-
|[Self-host developer portal](developer-portal-self-host.md) | - Legacy extensibility option to customize source code of the entire portal core<br/><br/> - Gives complete flexibility for customizing portal experience<br/><br/>- Customer responsible for managing complete code lifecycle: fork code base, develop, deploy, host, patch, and upgrade |
21+
|[Custom HTML code widget](#use-custom-html-code-widget) | - Lightweight solution for API publishers to add custom logic for basic use cases<br/><br/>- Copy and paste custom HTML code into a form, and developer portal renders it in an iframe |
22+
|[Create and upload custom widget](#create-and-upload-custom-widget) | - Developer solution for more advanced widget use cases<br/><br/>- Requires local implementation in React, Vue, or plain TypeScript<br/><br/>- Widget scaffold and tools provided to help developers create widget and upload to developer portal<br/><br/>- Supports workflows for source control, versioning, and code reuse<br/><br/> |
23+
|[Self-host developer portal](developer-portal-self-host.md) | - Legacy extensibility option for customers who need to customize source code of the entire portal core<br/><br/> - Gives complete flexibility for customizing portal experience<br/><br/>- Requires advanced configuration<br/><br/>- Customer responsible for managing complete code lifecycle: fork code base, develop, deploy, host, patch, and upgrade |
2424

2525

2626
## Use Custom HTML code widget
@@ -50,7 +50,6 @@ The managed developer portal includes a **Custom HTML code** widget where you ca
5050

5151
### Prerequisites
5252

53-
* Active [developer portal](api-management-howto-developer-portal.md)
5453
* Install [Node.JS runtime](https://nodejs.org/en/) locally
5554
* Basic knowledge of programming and web development
5655

@@ -117,7 +116,7 @@ The managed developer portal includes a **Custom HTML code** widget where you ca
117116
If prompted, sign in to your Azure account.
118117
119118
120-
The custom widget is now deployed to your developer portal. Using the portal's administrative interface, you can add it on pages in the developer portal and set any custom properties configured in the widget.
119+
The custom widget is now deployed to your developer portal. Using the portal's administrative interface, you can add it on pages in the developer portal and set values for any custom properties configured in the widget.
121120
122121
### Publish the developer portal
123122
@@ -139,20 +138,20 @@ All templates are based on the TypeScript programming language.
139138
140139
The React template contains prepared custom hooks in the `hooks.ts` file and established providers for sharing context through the component tree with dedicated `useSecrets`, `useValues`, and `useEditorValues` hooks.
141140
142-
### Using another framework
143-
144-
To implement your widget using another JavaScript UI framework and libraries, you need to set up the project yourself with the following guidelines:
145-
146-
* In most cases, we recommend that you start from the TypeScript template.
147-
* Install dependencies as in any other npm project.
148-
* If your framework of choice isn't compatible with [Vite build tool](https://vitejs.dev/), configure it so that it outputs compiled files to the `./dist` folder. Optionally, redefine where the compiled files are located by providing a relative path as the fourth argument for the [`deployNodeJs`](#azureapi-management-custom-widgets-toolsdeploynodejs) function.
149-
* For local development, the `config.msapim.json` file must be accessible at the URL `localhost:<port>/config.msapim.json` when the server is running.
141+
### Use the `@azure/api-management-custom-widgets-tools` package
150142
143+
This [npm package](https://www.npmjs.com/package/@azure/api-management-custom-widgets-tools) contains the following functions to help you develop your custom widget and provides features including communication between the developer portal and your widget:
151144
152145
153-
### Use the `@azure/api-management-custom-widgets-tools` package
146+
|Function |Description |
147+
|---------|---------|
148+
|[getValues](#azureapi-management-custom-widgets-toolsgetvalues) | Returns a JSON object containing values set in the widget editor combined with default values |
149+
|[getEditorValues](#azureapi-management-custom-widgets-toolsgeteditorvalues) | Returns a JSON object containing only values set in the widget editor |
150+
|[buildOnChange](#azureapi-management-custom-widgets-toolsbuildonchange) | Takes one parameter: a JSON object with updated values; returns a function to update the widget values |
151+
|[askForSecrets](#azureapi-management-custom-widgets-toolsaskforsecrets) | Returns a JavaScript promise, which after resolution returns a JSON object of data needed to communicate with backend |
152+
|[deployNodeJs](#azureapi-management-custom-widgets-toolsdeploynodejs) | Deploys widget to blob storage |
153+
|[getWidgetData](#azureapi-management-custom-widgets-toolsgetwidgetdata) | Returns all data passed to your custom widget from the developer portal<br/><br/>Used internally in templates |
154154
155-
This package contains a set of tools to help you develop your custom widget and provides features including communication between the developer portal and your widget.
156155
157156
#### `@azure/api-management-custom-widgets-tools/getValues`
158157
@@ -219,22 +218,33 @@ This function returns all data passed to your custom widget from the developer p
219218

220219
* `instanceId` - ID of this instance of the widget
221220

222-
### Add or remove input fields
221+
### Add or remove custom properties
223222

224-
You can further customize every instance of your custom widget through the developer portal editor. By default, four input fields are defined. You can add or remove other input fields as needed.
223+
Custom properties let you adjust values in the custom widget's code from the administrative user interface of the developer portal, without changing the code or redeploying the custom widget. By default, input fields for four custom properties are defined. You can add or remove other custom properties as needed.
225224

226-
To add an input field:
225+
To add a custom property:
227226

228-
1. In the file `src/values.ts`, add to the `Values` type the name of the field and type of the data it will save.
227+
1. In the file `src/values.ts`, add to the `Values` type the name of the property and type of the data it will save.
229228
1. In the same file, add a default value for it.
230229
1. Navigate to the `editor.html` or `editor/index` file (exact location depends on the framework you've chosen) and duplicate an existing input or add one yourself.
231230
1. Make sure the input field reports the changed value to the `onChange` function, which you can get from `[buildOnChange`](#azureapi-management-custom-widgets-toolsbuildonchange).
232231

232+
### (Optional) Use another framework
233+
234+
To implement your widget using another JavaScript UI framework and libraries, you need to set up the project yourself with the following guidelines:
235+
236+
* In most cases, we recommend that you start from the TypeScript template.
237+
* Install dependencies as in any other npm project.
238+
* If your framework of choice isn't compatible with [Vite build tool](https://vitejs.dev/), configure it so that it outputs compiled files to the `./dist` folder. Optionally, redefine where the compiled files are located by providing a relative path as the fourth argument for the [`deployNodeJs`](#azureapi-management-custom-widgets-toolsdeploynodejs) function.
239+
* For local development, the `config.msapim.json` file must be accessible at the URL `localhost:<port>/config.msapim.json` when the server is running.
240+
241+
242+
233243
## Next steps
234244

235245
Learn more about the developer portal:
236246

237247
- [Azure API Management developer portal overview](api-management-howto-developer-portal.md)
238-
239248
- [Frequently asked questions](developer-portal-faq.md)
240-
249+
- [Scaffolder of a custom widget for developer portal of Azure API Management service](https://www.npmjs.com/package/@azure/api-management-custom-widgets-scaffolder)
250+
- [Tools for working with custom widgets of developer portal of Azure API Management service](https://www.npmjs.com/package/@azure/api-management-custom-widgets-tools)

articles/api-management/developer-portal-faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You have the following options:
2323

2424
* For larger customizations, [create and upload](developer-portal-extend-custom-functionality.md#create-and-upload-custom-widget) a custom widget to the managed developer portal.
2525

26-
* [Self-host the developer portal](developer-portal-self-host.md) to update and manage the portal codebase yourself.
26+
* [Self-host the developer portal](developer-portal-self-host.md), only if you need to make modifications to the core of the developer portal codebase.
2727

2828
* Open a feature request in the [GitHub repository](https://github.com/Azure/api-management-developer-portal).
2929

0 commit comments

Comments
 (0)