A page extension allows the creation of custom web page and rendering a navigation link in the product UI.
Name | Type | Description |
---|---|---|
This extension doesn't support any attributes |
Name | Type | Description |
---|---|---|
@clientside-extension * | - | Indicates that the next function is an extension factory to be consumed by the webpack plugin. |
@extension-point * | string | Defines the location where the page navigation link will be rendered. |
@label * | string | Defines a label that's going to be used when rendering navigation link. The value can be either a raw string or a property key than will be translated. |
@page-url * | string |
Defines an url of the web page. The page will be accessible at this url prefixed with Example: Using |
@page-title * | string | Defines a title of the web page. The value can be either a raw string or a property key than will be translated. |
@page-decorator | string |
A custom page decorator. The default value is List of built-in decorators supported by all products:
|
@page-data-provider | string |
A page data provider Java class. Page data providers can be used to provide a custom set of a server-side data into your browser page extension. To read more about the page data providers check the usage section. Example: |
@link | string |
Defines a custom URL that's going to be used when rendering navigation link. By default, the link value is not required. Setting a custom link will overwrite the one generated from the |
@weight | number |
Determines the order in which the navigation link appears respect to others in the same location. Extensions are displayed top to bottom or left to right in order of ascending weight. |
@condition | string | Condition, UrlReadingCondition |
Defines one or multiple conditions that must be satisfied for the navigation link to be displayed. The conditions are evaluated on the server, and created with Java. If one of the conditions is not met, the code of the extension won't be loaded in the client. For more information about the conditions please refer to the examples of Web items documentation. |
* required
1 2import { PageExtension } from '@atlassian/clientside-extensions'; /** * @clientside-extension * @extension-point example.extension.point * @label "My page" * @page-url /my-page * @page-title "My page" */ export default PageExtension.factory((container) => { // attach content to the container container.innerHTML = 'My new page!'; });
The @label
and @page-title
annotations support passing either a raw string value or a property key that will be used to render translated value.
For more information about the translation mechanism and the *.properties
files, refer to the documentation.
my-translations.properties
1 2some.property.key.button.title = A custom page some.property.key.page.title = My custom page
my-extension.ts
1 2/** * @clientside-extension * @extension-point example.extension.point * @label some.property.key.button.title * @page-title some.property.key.page.title * @page-url /my-custom-page */ export default PageExtension.factory((container) => { container.innerHTML = '<div>My custom page</div>'; });
The @page-decorator
annotation allows you to configure the base markup of the page. By default, the page will be rendered using the atl.general
decorator that is a standard blank page with basic navigation.
If your page needs to be rendered with the admin layout, you can use atl.admin
decorator. Different products can provide an additional custom page decorators you can use.
To read more about page decorators, refer to the documentation.
1 2/** * @clientside-extension * @extension-point example.extension.point * @label "My admin page" * @page-url /my-admin-page * @page-title "My admin page" * @page-decorator atl.admin */ export default PageExtension.factory((container) => { container.innerHTML = '<div>Very secure page!</div>'; });
If you need to retrieve a server-side data in your page extension, you can use the @page-data-provider
annotation to specify a Java data provider class.
The extension data provider class needs to implement ExtensionDataProvider
interface and return Jsonable
data.
For information about returning the more complex large JSON structures refer to the documentation for data providers.
MyDataProvider.java
1 2package com.example.plugin; import com.atlassian.json.marshal.Jsonable; import com.atlassian.json.marshal.wrapped.JsonableString; import com.atlassian.plugin.clientsideextensions.ExtensionDataProvider; /** * A simple DataProvider class that returns a string as JSON */ public class MyDataProvider implements ExtensionDataProvider { @Override public Jsonable get() { return new JsonableString("Hello world!"); } }
my-extension.ts
1 2type DataPayload = 'string'; /** * @clientside-extension * @extension-point example.extension.point * @label "My page" * @page-url /my-page * @page-title "My page" * @page-data-provider com.example.plugin.MyDataProvider */ export default PageExtension.factory<DataPayload>((container, data) => { container.innerHTML = `<p>${data}</p>`; // Outputs <p>Hello World!</p> });
Rate this page: