@openeo/vue-components
v2.17.0
Published
Common Vue components for openEO.
Downloads
133
Readme
Vue Components for openEO
A set of Vue components for openEO.
This library's version is 2.17.0 and supports openEO API versions 1.x.x. Legacy versions supporting API version 0.x are available as releases.
Examples: https://open-eo.github.io/openeo-vue-components/
Table of Contents:
- Vue Components for openEO
- Usage
- Components
BillingPlans
Capabilities
Collection
Collections
DataTable
DeprecationNotice
FederationMissingNotice
Description
ExperimentalNotice
FileFormat
FileFormats
JsonSchema
Item
Items
Job
JobEstimate
LinkList
Logs
ObjectTree
Process
ModelBuilder
Processes
SearchableList
SearchBox
Service
ServiceType
ServiceTypes
SupportedFeatures
Tabs
andTab
UdfRuntime
UdfRuntimes
- Other features
Usage
All components listed below can be used in two different environments: Directly as HTML tag in an HTML page or in a Vue environment as normal Single File Components (SFC).
HTML
To use the components in HTML (as so-called 'Web Components'), simply include the following into the head
of your HTML page:
<script src="https://cdn.jsdelivr.net/npm/@openeo/vue-components@2/assets/openeo.min.js"></script>
All components can be used as HTML tags in kebab-case. Also, ALL parameters must be converted to kebab-case!
For example, the component BillingPlans
can be used as <billing-plans></billing-plans>
.
Props can be passed as HTML attributes if the value is a scalar.
For arrays and objects, you have to specify them as child script
tags with the attributes prop="..."
and type="application/json"
.
For example, the Capabilities
component can be used as follows:
<capabilities url="https://example.com/api">
<script prop="capabilities" type="application/json">
{
"api_version": "1.0.0",
...
}
</script>
</capabilities>
The components are async web components, which means only the components you are actually using are requested. This keeps page loading times at a minimum.
Note for Contributors: Web Components must be built via npm run build
and will be placed in the assets
folder. Examples can be generated using npm run wc-examples
and will be placed in the examples
folder. You can also serve the examples via HTTP with the command npm run wc-serve
.
FontAwesome
To display a nice user interface, some components use icons from the project Font Awesome.
Unfortunately, fonts can't be loaded in Web Components so you need to embed them directly in the head
of your HTML page as follows:
<link rel="preload" as="font" type="font/woff2" crossorigin href="https://use.fontawesome.com/releases/v5.13.0/webfonts/fa-solid-900.woff2" />
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css" type="text/css" media="all" />
The components that use such icons and need these additional files mention it in their descriptions below.
Note: This is not required in Vue environments, which will load the required files automatically.
Vue
In a Vue environment, you can just import the Single File Components (SFC) directly. I.e., they must be imported from the components
folder as demonstrated below.
First, you need to install the package: npm install @openeo/vue-components --save
Now, you can import the Vue components with the import
or require
, depending on the module system you are using.
For example, the Capabilities
component can be imported as follows:
const Capabilities = require('@openeo/vue-components/components/Capabilities.vue');
(Node.js require)import Capabilities from '@openeo/vue-components/components/Capabilities.vue';
(ES6 modules)
Afterwards, you need to declare the component in the components
section of your SFC, e.g. components: { Capabilities }
.
In the Template of your SFC you can now include the component as shown in the example below. Please note that the values myUrl
and myCapabilities
must be defined in the SFC, e.g. in the data
property or as a computed
property.
<Capabilities :url="myUrl" :capabilities="myCapabilities"></Capabilities>
Note for Contributors: This usage mode doesn't require the initial build step npm run build
. The Vue Components can simply be imported from the components
folder. You can also serve examples via HTTP with the command npm run serve
.
Components
Note: Methods, properties and slots not listed here are not meant to be used as public and stable API. They can change at any time without prior notice.
BillingPlans
Visualizes the billing information of the back-end.
Properties:
billing
(object, required): Billing information as defined by the openEO API (GET /
, propertybilling
).heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toBilling
.headingTag
/heading-tag
(string): HTML Tag to use for the heading. Defaults toh2
.
Capabilities
Visualizes fundamental server information of the back-end. Shows the URL, title, description, version numbers, links, the production flag, SupportedFeatures
and BillingPlans
.
Properties:
capabilities
(object, required): Capabilities response as defined by the openEO API (GET /
).url
(string): URL to the API. If not set, the URL from the link with relation typeself
is shown. If neither is available, no URL is shown.
Collection
Visualizes a single collection following the STAC-based collection description.
Properties:
data
(object, required): A single STAC-based collection object as defined by the openEO API (GET /collections/{collection_id}
).mapOptions
/map-options
(object): For fine-tuning the behavior of the map that displays the collection's spatial extent. Entirely optional. Possible keys:height
(string): Height of the map container div. Defaults to250px
.width
(string): Width of the map container div. Defaults toauto
.basemap
(string): Templated URI for the XYZ basemap. Default tohttps://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png
. Please make sure that your usage complies with the OpenStreetMap Tile Usage Policy!attribution
(string): Attributon for the basemap. HTML is allowed. Default toMap data © <a href="http://www.osm.org">OpenStreetMap</a>
.wrapAroundAntimeridian
(boolean): Whether the world map wraps around the antimeridian (defined the other way round it's also known as "noWrap"). Defaults tofalse
.scrollWheelZoom
(boolean): Whether zooming via the mouse scroll wheel is enabled (regardless of this setting, buttons for+
and-
are always displayed). Defaults tofalse
.onAfterMapInit
(function|null): Callback function with two parametersmap
(Leaflet Map) andgeometries
(Bounding Boxes as Leaflet Rectangle or Leaflet Wrapped Polygon in a Leaflet FeatureGroup) that is called after the map has been initialized. Can be used to further customize the map behavior. Defaults tonull
(no callback).
federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display as the main heading. The component properties are passed through as slot properties with the same names.before-description
: HTML to display before the description. The component properties are passed through as slot properties with the same names.end
: HTML to display after the component. The component properties are passed through as slot properties with the same names.spatial-extents
: HTML to display the spatial extents, e.g. a map. The slot propertyextents
provides an array of arrays, each containing four elements (west, south, east, north) with the WGS84 coordinates. The propertiesmapOptions
andworldwide
are also available as slot property.temporal-extents
: HTML to display the temporal extents. The slot propertyextents
provides an array of arrays, each with two elements (start, end). Both are RFC3339 compatibledate-time
, ornull
to indicate an open range.
Collections
Shows an (expandable) list of all STAC-based collections available at a back-end.
Properties:
collections
(array, required): An array of STAC-based collection objects as defined by the openEO API (GET /collections
, propertycollections
).mapOptions
/map-options
(object): See the corresponding prop inCollection
.searchTerm
/search-term
(string|null): See the propexternalSearchTerm
inSearchableList
.sort
(boolean): See the corresponding prop inSearchableList
.offerDetails
/offer-details
(string): See the corresponding prop inSearchableList
.collapsed
(boolean|null): See the corresponding prop inSearchableList
.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toCollections
.loadAdditionalData
/load-additional-data
(function|null): See the corresponding prop inSearchableList
.showKeywords
/show-keywords
(boolean): Adds the keywords to the third line of the summary if set totrue
. Defaults tofalse
.federation
(object): The data of thefederation
property obtained from the capabilities.missing
(array): The identifiers of the federated back-ends that are not providing data for the list of collections due to an issue.hideDeprecated
/hide-deprecated
(boolean): See the propexternalHideDeprecated
inSearchableList
.deprecatedFilter
/deprecated-filter
(boolean): See the propdeprecatedFilter
inSearchableList
.hideExperimental
/hide-experimental
(boolean): See the propexternalHideExperimental
inSearchableList
.experimentalFilter
/experimental-filter
(boolean): See the propexperimentalFilter
inSearchableList
.
Slots:
heading
: See the corresponding slot inSearchableList
.summary
: See the corresponding slot inSearchableList
.collection-before-description
: See the corresponding slotbefore-description
inCollection
.collection-end
: See the corresponding slotend
inCollection
.collection-spatial-extents
: See the corresponding slotspatial-extents
inCollection
.collection-temporal-extents
: See the corresponding slottemporal-extents
inCollection
.
Events:
headingToggled(expanded)
: See the corresponding event inSearchableList
.detailsToggled(expanded, key, identifier, data)
: See the corresponding event inSearchableList
.
DataTable
A relatively simple table component to show a list of data.
Warning: This component is experimental and may change in future releases!
Properties:
columns
(object, required): The columns to show in the table.data
(array, required): An array of objects containing the data to show.
Slots:
toolbar
: A place on the top left to show a toolbar, e.g. for "Add" buttons.- column-id: A slot for the column with the name being the column identifer. Can be used to better visualize the values in the column. Passes the slot properties
row
,col
andid
.
DeprecationNotice
Show a message that something has been deprecated.
Properties:
entity
(string): A noun that describes the entity that has been deprecated, e.g.process
orcollection
.
FederationMissingNotice
Show a message that a response is incomplete due to missing data from an inaccessible service in the federation.
Properties:
missing
(array, required): The identifiers of the federated back-ends that are not providing data for the list of processes due to an issue.federation
(object): The data of thefederation
property obtained from the capabilities.retry
(function): Displays a "retry" button which executes the given function.
Slots:
button-text
: The content (e.g. text) of the retry button.
Description
A simple text renderer, which supports CommonMark.
Properties:
description
(string, required): The text to show.preprocessor
(function|null): A function that further processes the text, before CommonMark is parsed. Defaults tonull
.processor
(function|null): A function that further processes the text, after CommonMark is parsed. Defaults tonull
.processUrl
/process-url
(string): The URL to point process references (``process_id()``
) to.${}
gets replaced with the process id. Set tonull
(default) to disable process links. Example:https://processes.openeo.org/#${}
compact
(boolean): Renders the description more compact if set totrue
. Defaults tofalse
.allowHTML
/allow-html
(boolean): By default (false
), HTML is removed from the rendered version. To show HTML set this totrue
. Only set totrue
if you trust the content, it may contain insecure elements.
ExperimentalNotice
Show a message that something is experimental.
Properties:
entity
(string): A noun that describes the entity that is still experimental, e.g.process
orcollection
.
FileFormat
Visualizes a single supported file format of the back-end.
Properties:
The properties must be filled with parts of the response for supported file formats as defined by the openEO API (GET /file_formats
). Returned is an object like { input: { GTiff: {...} }, output: { PNG: {...} } }
and some of the keys and values must be passed.
id
(string, required): The identifier of the file format (i.e. the key of the second level;GTiff
orPNG
in the example above)format
(object, required): The file format specification (i.e. the value of the second level;{...}
in the example above)type
(boolean, required): Eitherinput
oroutput
(i.e. the key of the first level)federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display as the main heading.badges
: HTML to display as the badges.before-description
: HTML to display before the description.end
: HTML to display after the component.
For all slots, the component properties are passed through as slot properties with the same names.
FileFormats
Visualizes all supported file formats of the back-end.
Properties:
formats
(object, required): Supported file formats as defined by the openEO API (GET /file_formats
).showInput
/show-input
(boolean): Show the input file formats. Defaults totrue
.showOutput
/show-output
(boolean): Show the output file formats. Defaults totrue
.searchTerm
/search-term
(string|null): See the propexternalSearchTerm
inSearchableList
.sort
(boolean): See the corresponding prop inSearchableList
.offerDetails
/offer-details
(string): See the corresponding prop inSearchableList
.collapsed
(boolean|null): See the corresponding prop inSearchableList
.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toFile Formats
.federation
(object): The data of thefederation
property obtained from the capabilities.missing
(array): The identifiers of the federated back-ends that are not providing data for the list of file formats due to an issue.hideDeprecated
/hide-deprecated
(boolean): See the propexternalHideDeprecated
inSearchableList
.deprecatedFilter
/deprecated-filter
(boolean): See the propdeprecatedFilter
inSearchableList
.hideExperimental
/hide-experimental
(boolean): See the propexternalHideExperimental
inSearchableList
.experimentalFilter
/experimental-filter
(boolean): See the propexperimentalFilter
inSearchableList
.
Note: At least one of showInput
or showOutput
must be set to true
. Otherwise, the list will be empty.
Slots:
heading
: See the corresponding slot inSearchableList
.summary
: See the corresponding slot inSearchableList
.file-format-before-description
: See the corresponding slotbefore-description
inFileFormat
.file-format-end
: See the corresponding slotend
inFileFormat
.
Events:
headingToggled(expanded)
: See the corresponding event inSearchableList
.detailsToggled(expanded, key, identifier, data)
: See the corresponding event inSearchableList
.
JsonSchema
Renders JSON Schemas in a way that it's a bit easier for humans to read.
Properties:
schema
(object|array<object>, required): Either a single JSON Schema as object or an array of JSON Schema objects.processUrl
/process-url
(string): See the corresponding prop inDescription
.
Item
Visualizes a single STAC Item, e.g. a batch job result.
Warning: This component is experimental and may change in future releases!
Properties:
data
(object, required): A single STAC-based Item object as defined by the openEO API (GET /jobs/{job_id}/results
).mapOptions
/map-options
(object): For fine-tuning the behavior of the map that displays the item's geometry. Entirely optional. Possible keys:height
(string): Height of the map container div. Defaults to"250px"
.width
(string): Width of the map container div. Defaults to"auto"
.wrapAroundAntimeridian
(boolean): Whether the world map wraps around the antimeridian (defined the other way round it's also known as "noWrap"). Defaults tofalse
.scrollWheelZoom
(boolean): Whether zooming via the mouse scroll wheel is enabled (regardless of this setting, buttons for+
and-
are always displayed). Defaults tofalse
.onAfterMapInit
(function|null): Callback function with two parametersmap
(Leaflet Map) andgeometries
(Geometry as Leaflet Geometry or Leaflet Wrapped Geometry in a Leaflet FeatureGroup) that is called after the map has been initialized. Can be used to further customize the map behavior. Defaults tonull
(no callback).
federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display as the main heading. The component properties are passed through as slot properties with the same names.before-description
: HTML to display before the description. The component properties are passed through as slot properties with the same names.end
: HTML to display after the component. The component properties are passed through as slot properties with the same names.location
: HTML to display the geometry and/or bbox, e.g. a map. The slot propertygeometry
provides a GeoJSON geometry and the slot propertybbox
contains an array with four elements (west, south, east, north) with the WGS84 coordinates. The component propertymapOptions
is also available as slot property.
Items
Shows an (expandable) list of STAC-based Items.
Warning: This component is experimental and may change in future releases!
Properties:
items
(array|object, required): An array of STAC-based Item objects or a GeoJSON FeatureCollection containins STAC Items.showMap
/show-map
(boolean): Show an overview map with all items. Default tofalse
.mapOptions
/map-options
(object): See the corresponding prop inItem
.searchTerm
/search-term
(string|null): See the propexternalSearchTerm
inSearchableList
.sort
(boolean): See the corresponding prop inSearchableList
.offerDetails
/offer-details
(string): See the corresponding prop inSearchableList
.collapsed
(boolean|null): See the corresponding prop inSearchableList
.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toItems
.loadAdditionalData
/load-additional-data
(function|null): See the corresponding prop inSearchableList
.federation
(object): The data of thefederation
property obtained from the capabilities.missing
(array): The identifiers of the federated back-ends that are not providing data for the list of items due to an issue.hideDeprecated
/hide-deprecated
(boolean): See the propexternalHideDeprecated
inSearchableList
.deprecatedFilter
/deprecated-filter
(boolean): See the propdeprecatedFilter
inSearchableList
.hideExperimental
/hide-experimental
(boolean): See the propexternalHideExperimental
inSearchableList
.experimentalFilter
/experimental-filter
(boolean): See the propexperimentalFilter
inSearchableList
.
Slots:
heading
: See the corresponding slot inSearchableList
.summary
: See the corresponding slot inSearchableList
.item-before-description
: See the corresponding slotbefore-description
inItem
.item-end
: See the corresponding slotend
inItem
.item-location
: See the corresponding slotlocation
inItem
.
Events:
headingToggled(expanded)
: See the corresponding event inSearchableList
.detailsToggled(expanded, key, identifier, data)
: See the corresponding event inSearchableList
.
Job
Visualizes a single batch job.
Properties:
job
(object, required): Batch Job details as defined by the openEO API (Either one of the array elements in the propertyjobs
returned byGET /jobs
or the response fromGET /jobs/{job_id}
).currency
(string|null): The currency of the service (see openEO API endpointGET /
).federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display the main heading.before-description
: HTML to display before the description.process-graph
: See the corresponding slotprocess-graph
inProcess
.end
: HTML to display after the component.
For all slots, the component properties are passed through as slot properties with the same names.
JobEstimate
Visualizes an estimate for a batch job.
Properties:
estimate
(object, required): Batch Job estimate as defined by the openEO API (response fromGET /jobs/{job_id}/estimate
).currency
(string|null): The currency of the service (see openEO API endpointGET /
).
LinkList
A simple list of links.
Properties:
links
(array<object>, required): An array of objects, each describing a link as defined by the openEO API.sort
(boolean): Sort the links by title. Defaults totrue
.heading
(string|null): If given, a heading is shown above the list. Defaults tonull
(no heading shown).headingTag
/heading-tag
(string): HTML Tag to use for the heading. Defaults tostrong
.ignoreRel
/ignore-rel
: (array<string>): List ofrel
types to hide. Defaults to['self']
.showRel
/show-rel
: (boolean): If set totrue
, shows therel
types. Defaults tofalse
.
Logs
Show log messages.
Properties:
logs
(array<object>): A list of logs as defined by the openEO API (e.g. response fromGET /jobs/{job_id}/logs
, propertylogs
).externalSearchTerm
/external-search-term
(string|null): Pass a string if a search term is injected from an external source and no search box should be shown. Defaults tonull
, which will show a search box in the component itself so that users can filter the logs.
ObjectTree
Renders JavaScript objects in a more human-readable form. Often used as a fallback if no other form of presentation is known by the client.
Properties:
data
(object): Any object (i.e. object, array or null)collapseAfter
/collapse-after
(integer|null): The number of elements to display for each object or array until a "show all" button is shown. Set tonull
to show all elements. Defaults to10
.
Process
Visualizes a single process following the openEO process description.
Properties:
process
(object, required): Process specification as defined by the openEO API (Either one of the array elements in the propertyprocesses
returned byGET /process
or the response fromGET /process_graphs/{process_graph_id}
).provideDownload
/provide-download
(boolean): Provide a link to download the JSON file (defaults totrue
).processUrl
/process-url
(string): See the corresponding prop inDescription
.showGraph
/show-graph
(boolean): Show and visualize the process graph (defaults tofalse
).federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display the main heading.before-description
: HTML to display before the description.process-graph
: HTML to visualize the process graph.end
: HTML to display after the component.
For all slots, the component properties are passed through as slot properties with the same names. In the slot title
, you can additionally access displayableNamespace
.
ModelBuilder
Show a process (graph) nicely visualized, includes support for basic editing.
Note: This may require to load FontAwesome. Also, you should assign the height and width for the Model Builder in the parent HTML tag.
Warning: This component is experimental and may change in future releases!
Properties:
id
(string, required): A document-wide unique identifier for the ModelBuilder instance.editable
(boolean): Allows to edit the model (defaults tofalse
). You need to use theeditArguments
event to implement parameter editing.value
/ v-model (boolean): The process to show/edit (defaults to an empty object).collections
(array): Allows to add the collections from the API for better visualizations (defaults to an empty array).processes
(array|ProcessRegistry): Allows to add the processes from the API for better visualizations (defaults to an empty array). Can be given as aProcessRegistry
.parent
(object): The parentBlock
if a Model Builder is shown for a child process (defaults tonull
).parentSchema
/parent-schema
(object): The schema for the parent parameter if a Model Builder is shown for a child process (defaults tonull
).historySize
/history-size
(integer): The amount of steps for undo/redo (defaults to30
)explicitZoom
/explicit-zoom
(boolean): If set totrue
: The control zooms only if the control has focus or one of the keysSTRG
(Win/*nix) orMeta
(Mac) has been pressed. Default tofalse
, which always scrolls on mouse wheel interaction over the control.height
(string): Set the height of the component as CSS-compatible value, e.g.400px
or10rem
. This is especially useful for web components if you can't set a size for the surrounding elements.
Events:
input(value)
/ v-model: Fired when the process has been updated.error(message, title)
: Informs about an error, e.g. to show error messages in the UI.message
(string): The error message.title
(string|null): Some errors provide a title, too.
showProcess(id, namespace)
: Providing this event will enable a button on each process so that user can click it to get more details. This event is fired when the user has clicked the button. The UI can then show the process details to the user.id
(string): ID of the process to shownamespace
(string): Namespace of the process
showCollection(id)
: Providing this event will enable a button on each collection so that user can click it to get more details. This event is fired when the user has clicked the button. The UI can then show the collection details to the user.id
(string): ID of a collection to show
showParameter(parameter, origin)
: Providing this event will enable a button on each parameter so that user can click it to get more details about the parameter and its schema. This event is fired when the user has clicked the button. The UI can then show the parameter details to the user.parameter
(object): A process parameter compliant to the openEO API.origin
(string): Indicates who made the parameter available:user
if the parameter has been added by the userschema
if the parameter is coming from the parent process- Might return other values in the future.
editParameter(parameter, title, saveCallback)
: Providing this event will enable a button on each parameter so that user can click it to edit the parameter. This event is fired when the user has clicked the button. The UI can then show the parameter editor to the user.parameter
(object): A process parameter compliant to the openEO API.
editArguments(parameters, values, title, isEditable, selectParameterName , saveCallback, parentBlock)
: Providing this event will enable a button on each block so that user can click it to get more details about the parameters and corresponding values. This event is fired when the user has clicked the button. The UI can then show the parameter viewer or editor to the user.parameters
(array<ProcessParameter>): An array with the details about the parameters, seeProcessParameter
for details.values
(object): An object with values for the parameters. The keys are the parameter names (parameters.name
) and the objects are the values for the corresponding parameter.title
(string): A title for the UIisEditable
(boolean): Indicates whether theModelBuilder
is editable or not, see propertyeditable
.selectParameterName
(string|null): If the user has not clicked the general button for the parameter viewer / editor, but instead clicked a specific parameter in the block, it passes the parameter name so that a UI can jump directly to the specific parameter or highlight it.saveCallback
(function|null): A callback function that is called when the parameter editor indicates that a user wants to persist/save the data. The callback will receive one parameter with the new values in the same format as thevalues
parameter above.parentBlock
(object): The VueBlock
instance that is the origin of this event.
compactMode(enabled)
: Informs about the current state of compact mode.enabled
(boolean):true
when compact mode is active,false
otherwise.
historyChanged(history, index)
: The history has been changed, e.g. usingredo
,undo
or by editing the process in the model builder.history
(array): The full history.index
(intener): The index of the element in the history that is currently shown.
Methods:
async clear() -> boolean
: Clears the process shown (similar effect as setting v-model to{}
, but also reset edge/block counters).async undo()
: Go one step back in history if available. Otherwise does nothing.async redo()
: Go one step forward in history if available. Otherwise does nothing.async deleteSelected() -> boolean
: Deletes all selected blocks and edges. Returnstrue
on success andfalse
on faile or if nothing has been selected.async toggleCompact()
: Toggles compact mode (e.g. doesn't show parameter values).perfectScale()
: Fits the view to the blocks and edges so that it is fully shown.getPgParameters() -> array<object>
: Returns all process parameters blocks.async addPgParameter(parameter, origin, position)
: Adds a process parameter block to the model builder.parameter
(object): The parameter to add, should at least include aname
and aschema
as defined by the openEO API.origin
(string): The origin of the parameter, defaults touser
for user-defined parameters.position
(array|null): The position to show the newly created block. UsegetPositionForPageXY
to get the position from a Browser event. Set tonull
(default value) to place it automatically.
getPositionForPageXY(x, y) -> array<number>
: Get's the local position in the model builder from the page coordinates (pageX
,pageY
) of a Browser event (e.g. mouse). Useful e.g. for theposition
parameters ofaddPgParameter
oraddProcess
. Returns the computed x and y coordinates as array.x
(number): The x coordinate on the page, usually thepageX
property of the Browser event.y
(number): The y coordinate on the page, usually thepageY
property of the Browser event.
addProcess(name, args, position, namespace) -> object
: Adds a process block to the model builder.name
(string): The ID of the process to add.args
(object): The arguments for the process. The keys are the parameter names and the objects are the values for the corresponding parameter. Defaults to no arguments (empty object).position
(array|null): The position to show the newly created block. UsegetPositionForPageXY
to get the position from a Browser event. Set tonull
to place it automatically.namespace
(string|null): The namespace of the process to add, defaults tonull
.
Processes
Shows an (expandable) list of all processes available at a back-end.
Properties:
processes
(array, required): An array of processes as defined by the openEO API (GET /processes
orGET /process_graphs
although the latter is usually not complete).provideDownload
/provide-download
(boolean): See the corresponding prop inProcess
.processUrl
/process-url
(string): See the corresponding prop inDescription
.searchTerm
/search-term
(string|null): See the propexternalSearchTerm
inSearchableList
.sort
(boolean): See the corresponding prop inSearchableList
.offerDetails
/offer-details
(string): See the corresponding prop inSearchableList
.collapsed
(boolean|null): See the corresponding prop inSearchableList
.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toProcesses
.showGraph
/show-graph
(boolean): See the corresponding prop inProcess
.showCategories
/show-categories
(boolean): Adds the categories to the third line of the summary if set totrue
. Defaults tofalse
.loadAdditionalData
/load-additional-data
(function|null): See the corresponding prop inSearchableList
.federation
(object): The data of thefederation
property obtained from the capabilities.missing
(array): The identifiers of the federated back-ends that are not providing data for the list of processes due to an issue.hideDeprecated
/hide-deprecated
(boolean): See the propexternalHideDeprecated
inSearchableList
.deprecatedFilter
/deprecated-filter
(boolean): See the propdeprecatedFilter
inSearchableList
.hideExperimental
/hide-experimental
(boolean): See the propexternalHideExperimental
inSearchableList
.experimentalFilter
/experimental-filter
(boolean): See the propexperimentalFilter
inSearchableList
.
Slots:
heading
: See the corresponding slot inSearchableList
.summary
: See the corresponding slot inSearchableList
.process-before-description
: See the corresponding slotbefore-description
inProcess
.process-end
: See the corresponding slotend
inProcess
.
Events:
headingToggled(expanded)
: See the corresponding event inSearchableList
.detailsToggled(expanded, key, identifier, data)
: See the corresponding event inSearchableList
.
SearchableList
A template to implement searchable, sortable and collapsible lists (all optional).
Properties:
data
(array<object>|object, required): The data to show in the list. Usually an array, but if an object is given the key of the elements is used as the default identifier. Each value of the array or object must be an object.identifierKey
/identifier-key
(string|null): The key in the object to use as identifiers (first line of the list). If notnull
, overrides the default identifier set from object keys. Defaults toid
.summaryKey
/summary-key
(string|null): The key in the object to use as summary (second line of the list). If set tonull
, no summary is shown. Defaults tosummary
.keywordsKey
/keywords-key
(string|null): The key in the object to use as a list of keywords to display (third line of the list ifshowKeywords
is set totrue
) and search through. Set tonull
to not consider keywords. Defaults tonull
.showKeywords
/show-keywords
(boolean): Adds the keywords referenced inkeywordsKey
to the third line of the list if set totrue
. Defaults tofalse
.externalSearchTerm
/external-search-term
(string|null): Pass a string if a search term is injected from an external source and no search box should be shown. Setting to the empty string""
effectively disables searching. Defaults tonull
, which will show a search box in the component itself so that users can filter the data by identifier and summary.externalHideDeprecated
/external-hide-deprecated
(boolean): Whether to hide deprecated items (true
) or not (false
).deprecatedFilter
/deprecated-filter
(boolean): Whether to show the deprecated filter checkbox (true
) or not (false
).externalHideExperimental
/external-hide-experimental
(boolean): Whether to hide experimental items (true
) or not (false
).experimentalFilter
/experimental-filter
(boolean): Whether to show the experimental filter checkbox (true
) or not (false
).searchPlaceholder
/search-placeholder
(string): A text to show as a placeholder in the search box. Defaults toSearch
.sort
(boolean): Sort the data by identifier. Defaults totrue
.offerDetails
/offer-details
(boolean): If set tofalse
, the data can't be expanded and no details will be shown. Defaults totrue
, which will show what has been defined in thedetails
slot after a user has expanded the element.collapsed
(boolean|null): If set to a boolean value, the component is collapsible. If it's set totrue
the component is collapsed and only the heading is shown initially. If set tofalse
the component is expanded. Defaults tonull
, which expands the list and doesn't offer to collapse it.showSummaryOnExpand
/show-summary-on-expand
(boolean): If set tofalse
, the summary gets hidden for expanded elements. Defaults totrue
.allowCopy
(boolean): If set totrue
, shows a copy button for the identifier when the heading is hovered. May not work if thesummary
slot is used.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults tonull
.searchMinLength
/search-min-length
(integer): The number of characters required to be given until the search starts. Defaults to2
as it's usually not very meaningful to search for a single character.loadAdditionalData
/load-additional-data
(function|null): An asynchronous function that returns newly loaded data and replaces the original data in the viewer. The function has three parameters:key
(integer): Gives the index (for arrays) or the key (for objects) of the toggled element in the array or object given in the propdata
.identifier
(number|string): Gives the identifier of the toggled element (corresponds to the values selected via the propidentifierKey
).data
(object): The original data.
Slots:
heading
: HTML to display the heading, which by default consists of a title (see propertyheading
) and the count of elements available in total. Will also show the count of elements matching the search term, if a search term has been given. The following slot properties are made available:filteredCount
(integer|null): The count of elements matching the search term.null
if no filters are applied and all elements are shown.totalCount
(integer): The total count of elements.
content-start
: After heading, before searchbox and list.after-search-box
:filteredCount
(integer|null): see abovesummaries
(array<object>): The list of summaries.
summary
: HTML to display for the overview of the list element (includes identifier and summary). The following slot properties are made available:summary
(object): An object with some high-level information for the list element:identifier
,summary
,show
andindex
. This is what you usually want to show here.item
(object): The original object fromdata
for the list element.
details
: HTML to display for the details of the list element. This is what is shown after an element has been expanded. The following slot properties are made available:summary
(object): An object with saome high-level information for the list element:identifier
,summary
,show
andindex
.item
(object): The original object fromdata
for the list element. This is what you usually want to show here.
Events:
headingToggled(expanded)
: Emits if the component has been expanded or collapsed by the user via the heading.expanded
(boolean): Istrue
if the component is expanded,false
otherwise.
detailsToggled(expanded, key, identifier, data)
: Emits if an element has been expanded or collapsed by the user.expanded
(boolean): Istrue
if the component is expanded,false
otherwise.key
(integer): Gives the index (for arrays) or the key (for objects) of the toggled element in the array or object given in the propdata
.identifier
(number|string): Gives the identifier of the toggled element (corresponds to the values selected via the propidentifierKey
).data
(object): Gives the toggled element from the array or object given in the propdata
. This is equal to accessing the array/object given indata
with thekey
from above directly.
summaries(summaries)
: Emits if the summaries have changed.summaries
(array<object>): The list of summaries.
SearchBox
A simple input field for searching.
Properties:
value
/ v-model (string, required): The search term given by the user.placeholder
(string): A placeholder string to show in the input field if no search term has been typed in. Defaults toSearch
.minLength
/min-length
(number): Minimum length required for the search term. Defaults to1
.compact
(boolean): Renders the search box more compact if set totrue
. Defaults tofalse
.
Events:
@input
/ v-model: Fired when the value has changed.
Service
Visualizes a single secondary web service.
Properties:
service
(object, required): Service details as defined by the openEO API (Either one of the array elements in the propertyservices
returned byGET /services
or the response fromGET /services/{service_id}
).currency
(string|null): The currency of the service (see openEO API endpointGET /
).
Slots:
title
: HTML to display the main heading.before-description
: HTML to display before the description.process-graph
: See the corresponding slotprocess-graph
inProcess
.end
: HTML to display after the component.
For all slots, the component properties are passed through as slot properties with the same names.
ServiceType
Visualizes a single secondary web service type supported by the back-end.
Properties:
The properties must be filled with parts of the response for supported secondary web services as defined by the openEO API (GET /service_types
). Returned is an object like { WMS: {...}, WFS: {...} }
and one of the keys and values must be passed to the component.
id
(string, required): The identifier of the secondary web service (i.e. a key of the object;WMS
orWFS
in the example above)service
(object, required): The secondary web service specification (i.e. the value for the corresponding key;{...}
in the example above)federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display as the main heading.before-description
: HTML to display before the description.end
: HTML to display after the component.
For all slots, the component properties are passed through as slot properties with the same names.
ServiceTypes
Visualizes all secondary web service types supported by the back-end.
Properties:
services
(object, required): Supported secondary web services as defined by the openEO API (GET /service_types
).searchTerm
/search-term
(string|null): See the propexternalSearchTerm
inSearchableList
.sort
(boolean): See the corresponding prop inSearchableList
.offerDetails
/offer-details
(string): See the corresponding prop inSearchableList
.collapsed
(boolean|null): See the corresponding prop inSearchableList
.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toSecondary Web Services
.federation
(object): The data of thefederation
property obtained from the capabilities.hideDeprecated
/hide-deprecated
(boolean): See the propexternalHideDeprecated
inSearchableList
.deprecatedFilter
/deprecated-filter
(boolean): See the propdeprecatedFilter
inSearchableList
.hideExperimental
/hide-experimental
(boolean): See the propexternalHideExperimental
inSearchableList
.experimentalFilter
/experimental-filter
(boolean): See the propexperimentalFilter
inSearchableList
.
Slots:
heading
: See the corresponding slot inSearchableList
.summary
: See the corresponding slot inSearchableList
.service-type-before-description
: See the corresponding slotbefore-description
inServiceType
.service-type-end
: See the corresponding slotend
inServiceType
.
Events:
headingToggled(expanded)
: See the corresponding event inSearchableList
.detailsToggled(expanded, key, identifier, data)
: See the corresponding event inSearchableList
.
SupportedFeatures
Visualizes the supported functionalities of the back-end.
Properties:
endpoints
(array, required): Supported endpoints as defined by the openEO API (GET /capabilities
, propertyendpoints
).heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toSupported Functionalities
.headingTag
/heading-tag
(string): HTML Tag to use for the heading. Defaults toh2
.
Tabs
and Tab
Creates a tab interface.
Tabs
Properties:
id
(string, required): A unique identifier for the tab container, preferrably only usinga
-z
(upper- and lower-case),0
-9
,-
and_
.pills
(boolean, defaultfalse
): Switch between normal boxed tabs and tabs with pills styling.pillsMultiline
/pills-multiline
(boolean, defaultfalse
): If pills are active, the pills in the tabs header can be shown in multiple lines instead of squeezing all pills into a single line.position
(string, defaulttop
): Position of the tabs/pills, eithertop
orbottom
.allowTabRename
(boolean, default:false
): Enables that dynamic tabs can be renamed by a user
Methods:
addTab(name, icon = null, data = null, id = null, selected = false, closable = false, show = null, hide = null, close = null, allowShow = null)
: Adds a new dynamic tab programatically, which is enabled by default.name
(string): The title of the tab.icon
(string): A FontAwesome icon identifier, e.g.fa-address-book
. This may require to load FontAwesome. Defaults tonull
, which shows no icon.data
(any): Additional data that is passed to the tab.id
(string|null): An id for the tab, preferrably only usinga
-z
(upper- and lower-case),0
-9
,-
and_
. Specifyingnull
generates an id.selected
(boolean): If set totrue
, the tab is getting selected and the active tab is set hidden.closable
(boolean): Set totrue
to show a close symbol, which can be used to close/remove the tab.show
(function): Function that is called when the tab is about to be shown. The tab is passed as a parameter to the function.hide
(function): Function that is called when the tab is about to be hidden. The tab is passed as a parameter to the function.close
(function): Function that is called when the tab is about to be closed. The tab is passed as a parameter to the function.allowShow
(function): Asynchronous function that determines whether a tab can be shown. The function musttrue
to allow switching the active tab. Iffalse
is returned, switching the tab is prevented. The tab to be shown is passed as a parameter.
getTab(id) -> object|null
: Get the VueTab
instance by id. Returnsnull
if not found.getActiveTab() -> object
: Get the VueTab
instance that is currently active.getActiveTabId() -> string
: Get the id of the tab that is currently active.async selectTab(tab)
: Set the currently active tab.tab
can be either a VueTab
instance or the id of a tab.resetActiveTab(force = false)
: Selects the first tab if no tab is selected yet orforce
is set totrue
.closeTab(tab)
: Removes the specified tab.tab
can be either a VueTab
instance or the id of a tab.
Slots:
default
: Place forTab
components to be added by default. Must only contain children of typeTab
which contain the content for each of the tabs. The slot propertytabs
holds a reference to theTabs
component.empty
: Content that is shown when no tab is available to be shown.tabName
: A slot that can be used to customize the appearance of the tab name for each tab. The slot applies to all tabs. The slot propertytab
holds an object with the properties of the tab set with theaddTab
method.dynamic
: Default content for dynamic tabs. The slot propertytab
holds an object with the properties of the tab set with theaddTab
method.- The content for each dynamic tab that is added programmatically via the
addTab
method can also be filled with a slot that has the id of the tab (see example below). Otherwise the content of thedynamic
slot is used. The slot propertytab
holds an object with the properties of the tab set with theaddTab
method.
Events:
@selected
: Fired when a Tab has been selected. The selected tab is passed as a parameter to the listener.@empty
: Fired when no tab is available to be shown. The first parameter istrue
when no tab is available, otherwisefalse
.
Notes:
The component allows to hide the tab label texts if an icon is specified and not enough space is available. Therefore, the component listens to a windowResized
event. To react on window size changes, you have to add the following code into the mounted()
method of your central Vue component:
window.addEventListener('resize', event => {
this.$root.$emit('windowResized', event);
});
Tab
Properties:
id
(string, required): A unique identifier for the tab.name
(string, required): The title of the tab.icon
(string, defaultnull
): A FontAwesome icon identifier, e.g.fa-address-book
. This may require to load FontAwesome. Defaults tonull
, which shows no icon.selected
(boolean, defaultfalse
): A single tab of a group should be selected by default by setting this property totrue
.enabled
(boolean, defaulttrue
): Set tofalse
to hide the tab completely from the user.closable
(boolean, defaultfalse
): Set totrue
to show a close symbol, which can be used to close/remove the tab.allowShow
/allow-show
(function, defaultnull
): Asynchronous function that determines whether a tab can be shown. The function musttrue
to allow switching the active tab. Iffalse
is returned, switching the tab is prevented. The tab to be shown is passed as a parameter.
Slots:
default
: Place for the content of your tab. The slot propertytab
holds a reference to this component.
Events:
@show
: Fired when the tab is shown. The tab is passed as a parameter to the listener.@hide
: Fired when the tab was hidden. The tab is passed as a parameter to the listener.@close
: Fired when the tab has been closed. The tab is passed as a parameter to the listener.
Examples
Simple example with three static tabs
<template>
<Tabs id="viewerContent">
<Tab id="news" name="News" icon="fa-newspaper" :selected="true">
Add the most recent news here.
</Tab>
<Tab id="docs" name="Documentation" icon="fa-books">
Add the documentation here.
</Tab>
<Tab id="contact" name="Contact" icon="fa-envelope">
Contact me at <a href="mailto:[email protected]">[email protected]</a>.
</Tab>
</Tabs>
</template>
<script>
import Tabs from '@openeo/vue-components/components/Tabs.vue';
import Tab from '@openeo/vue-components/components/Tab.vue';
export default {
name: 'Viewer',
components: {
Tab,
Tabs
}
}
</script>
Dynamically adding tabs + custom tab names appearance
<template>
<Tabs id="viewerContent" ref="tabs">
<template #default>
<!-- The content for map tab that is added directly when the component is instantiated. -->
<Tab id="mapView" name="Map" icon="fa-map" :selected="true">
<template #default="{ tab }">
<MapViewer id="mapCanvas" ref="mapViewer" :show="tab.active" />
</template>
</Tab>
</template>
<template #imageView="{ tab }">
<!-- The content for the dynmaic tab with the id 'imageView' -->
<ImageViewer :data="tab.data" />
</template>
<template #dynamic="{ tab }">
<!-- The default content for all other dynamic tabs -->
<DataViewer :data="tab.data" />
</template>
<template #tabName="{ tab }">
<!-- How to render the tab name, e.g. all upper-case -->
{{ tab.name.toUpperCase() }}
</template>
</Tabs>
</template>
<script>
import Tabs from '@openeo/vue-components/components/Tabs.vue';
import Tab from '@openeo/vue-components/components/Tab.vue';
import ImageViewer from './ImageViewer.vue';
import DataViewer from './DataViewer.vue';
import MapViewer from './MapViewer.vue'
export default {
name: 'Viewer',
components: {
Tab,
Tabs,
DataViewer,
ImageViewer,
MapViewer
},
methods: {
addNewTab(data, image = true) {
if (image) {
this.$refs.tabs.addTab(
"Images",
"fa-image",
data, //
"imageView", // Id of the tab
true, // Is the tab selected after adding it?
true // Is the tab closable?
);
}
else {
this.$refs.tabs.addTab("Data", "fa-database", data, null, true, true);
}
}
}
}
</script>
UdfRuntime
Visualizes a single UDF (user-defined function) runtime supported by the back-end.
Properties:
The properties must be filled with parts of the response for supported UDF runtime as defined by the openEO API (GET /udf_runtimes
). Returned is an object like { R: {...}, Python: {...} }
and one of the keys and values must be passed to the component.
id
(string, required): The identifier of the UDF runtime (i.e. a key of the object;R
orPython
in the example above)runtime
(object, required): The UDF runtime specification (i.e. the value for the corresponding key;{...}
in the example above)version
(string|null): If one of the versions or tags available for the runtime should be pre-selected and shown, specify the version or tag here. By default (null
), the default version or tag specified by the back-end will be shown.federation
(object): The data of thefederation
property obtained from the capabilities.
Slots:
title
: HTML to display as the main heading.badges
: HTML to display as the badges.before-description
: HTML to display before the description.
For all slots, the component properties are passed through as slot properties with the same names.
UdfRuntimes
Visualizes all UDF (user-defined function) runtimes supported by the back-end.
Properties:
runtimes
(object, required): Supported UDF runtimes as defined by the openEO API (GET /udf_runtimes
).searchTerm
/search-term
(string|null): See the propexternalSearchTerm
inSearchableList
.sort
(boolean): See the corresponding prop inSearchableList
.offerDetails
/offer-details
(string): See the corresponding prop inSearchableList
.collapsed
(boolean|null): See the corresponding prop inSearchableList
.heading
(string|null): Specifies the title of the component. If set tonull
, the title is hidden. Defaults toUDF Runtimes
.federation
(object): The data of thefederation
property obtained from the capabilities.hideDeprecated
/hide-deprecated
(boolean): See the propexternalHideDeprecated
inSearchableList
.deprecatedFilter
/deprecated-filter
(boolean): See the propdeprecatedFilter
inSearchableList
.hideExperimental
/hide-experimental
(boolean): See the propexternalHideExperimental
inSearchableList
.experimentalFilter
/experimental-filter
(boolean): See the propexperimentalFilter
inSearchableList
.
Slots:
heading
: See the corresponding slot inSearchableList
.summary
: See the corresponding slot inSearchableList
.udf-runtime-badges
: See the corresponding slotbadges
inUdfRuntime
.udf-runtime-before-description
: See the corresponding slotbefore-description
inUdfRuntime
.
Events:
headingToggled(expanded)
: See the corresponding event inSearchableList
.detailsToggled(expanded, key, identifier, data)
: See the corresponding event inSearchableList
.
Other features
Attention: The following features may get (partially) moved to @openeo/js-commons
in one of the next beta releases. The documentation may be incomplete, too.
FeatureList
A list of categorized features with their corresponding endpoints as used by the components SupportedFeatures
.
Utils
compareStringCaseInsensitive(string a, string b) -> integer
: Compares both strings (a) case-insensitive and (b) in natural order. Returns-1
ifa
is sorted beforeb
,0
if they are equal and1
otherwise.friendlyLinks(array linkList, boolean sort = true, array ignoreRel = ['self']) -> array
: Accepts an array of links as defined by the openEO API and pre-processes it for better handling in templates. It tries to generate a meaningful title, if not available. It optionally also sorts the links by title and removes links with the given relation types inignoreRel
.htmlentities(string str) -> string
: Replace"
,'
,<
and>
characters in strings with HTML entities.htmlentities_decode(string str) -> string
: Replace the HTML entities for"
,'
,<
and>
with their respective characters.prettifyAbbreviation(string str) -> string
: Converts a string to uppercase if all letters given are lower-cased.prettifyString(string str) -> string
: Tries to convert strings in snake-case, camel-case or kebab-case into more human-readable texts, mostly by adding spaces.search(string searchterm, array|string|object values, boolean and = true)
: Searches for search term(s) in various inputs. Splits thesearchterm
at certain word boundaries (e.g. whitespaces and punctuation). Does 'and' search by default. Can be switched to 'or' by settingand
tofalse
.values
can be an array of strings, a string or an object of strings (searches the values only).isUrl(string url, boolean httpOnly = true)
: Checks a absolute URL for validity. Only allows http and https ifhttpOnly
is set totrue
.- and other functions not meant for public use.