A set of Vue components for openEO.
This library's version is 1.0.0-beta.5 and supports openEO API versions 0.4.x and 1.0.x. Legacy versions are available as releases.
Note: Methods, properties and slots not listed here are not meant to be used as public and stable API.
Visualizes the billing information of the back-end.
Properties:
version
(string): openEO versionbilling
(object): Billing information as defined by the openEO API.
Methods:
getPlanCount()
- Get the number of billing plans.
Visualizes all the server information of the back-end. Shows the title, description, back-end version, SupportedFeatures
and BillingPlans
. May add FileFormats
, ServiceTypes
and UdfRuntimes
.
Properties:
capabilities
(object): Capabilities response as defined by the openEO API.url
(string): URL to the APIserviceTypes
(object): If given, shows the supported web service types.fileFormats
(object): If given, shows the supported file formats (input and output).udfRuntimes
(object): If given, shows the supported UDF runtimes.
Visualizes a collection following the STAC-based collection description.
Properties:
version
(string): openEO version (defaults tonull
, which tries to auto-detect the version).collectionData
(object): A single STAC-based collection object as defined by the openEO API.initiallyCollapsed
(boolean): Allow collapsing/expanding the details and collapse the details by default (defaults tofalse
).mapOptions
(object): For fine-tuning the behaviour of the map that displays the collection's spatial extent. Entirely optional. Possible keys:height
(string): Height of the map container div. Defaults to"300px"
.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 totrue
.onAfterMapInit
(function): Callback function with two parametersmap
(Leaflet Map) andrectangle
(Bounding Box as Leaflet Rectangle) that is called after the map has been initialized. Can be used to further customize the map behavior. Defaults to no callback.
Slots:
collection-before-summary
collection-after-summary
collection-before-details
collection-after-details
collection-spatial-extent
- Custom HTML to display the spatial extent, e.g. a map. The variableextent
is provides an array containing four elements (west, south, east, north) with the WGS84 coordinates.collection-temporal-extent
- Custom HTML to display the temporal extent. The variableextent
is provides an array with two elements (start, end). Each is a RFC3339 compatibledate-time
ornull
to indicate an open range.
A simple text renderer, which supports CommonMark.
Properties:
description
(string): The text to show.preprocessor
(function): A function that further processes the text, before CommonMark is parsed.compact
(boolean): Renders the description more compact if set totrue
. Defaults tofalse
.
A Mixin for components to manage EventBus listeners across the lifecycle of your components.
After importing the Mixin, include it in your component by adding mixins: [EventBusMixin],
. This components helps to keep track of events over the lifecycle of components. It removes all event listeners after the listening component has been destroyed. This ensures that no old listeners are called and produce errors due to missing data. The Mixin also ensures that listeners are not added twice.
Methods:
listen(eventName, callback)
- Adds a listener for an event with the specified name. Replaces existing listeners with the same name in the component.emit(eventName, ...args)
- Emits an event with the specified name and arguments.
Visualizes the supported file formats of the back-end.
Properties:
version
(string): openEO versionformats
(object): Supported file formats as defined by the respective version of the openEO API.showInput
(boolean): Show the input file formats. Defaults tofalse
.showOutput
(boolean): Show the output file formats. Defaults tofalse
.
One of showInput
or showOutput
must be set to true
, otherwise the list will be empty. If both are set to true
, a single list will be shown.
Methods:
getCount()
- Get the number of shown file formats.
A simple list of links.
Properties:
links
(array<object>): 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): If given, a heading is shown above the list. Defaults tonull
(no heading shown).headingTag
(string): HTML Tag to put the heading into. Defaults tostrong
.ignoreRel
: (array<string>): List ofrel
types to hide. Defaults to['self']
.showRel
: (boolean): Shows/Hides therel
types. Defaults tofalse
.
Methods:
getCount()
- Get the number of shown links.
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. objects, arrays, null)
Visualizes a process following the openEO process description in the latest version.
Note: ProcessExample
is not meant to be used separately.
Properties:
version
(string): openEO version (defaults tonull
, which tries to auto-detect the version).processData
(object): Process specification as defined by the openEO API.provideDownload
(boolean): Provide a link to download the JSON file (defaults totrue
).initiallyCollapsed
(boolean): Allow collapsing/expanding the details and collapse the details by default (defaults tofalse
).processReferenceBuilder
(function): A function that generates a link to a process by its process identifier.
Slots:
process-before-summary
process-after-summary
process-before-details
process-after-details
Visualizes the supported secondary web service types of the back-end.
Properties:
version
(string): openEO versionservices
(object): Supported service types as defined by the openEO API.
Methods:
getCount()
- Get the number of shown service types.
Visualizes the supported functionalities of the back-end.
Properties:
version
(string): openEO versionendpoints
(object): Supported endpoints as defined by the openEO API.
Methods:
getFeatures()
- Get a list of features (i.e. the categories).getFeatureCount()
- Get the number of supported and unsupported features that are shown by the component.getSupportedFeatureCount()
- Get the number of supported features by the back-end.
Creates a tab interface.
Properties:
id
(string, required): A unique identifier for the tab container.pills
(boolean, defaultfalse
): Switch between normal boxed tabs and tabs with pills styling.
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
.null
to show no icon.data
(any): Additional data that is passed to the tab.id
(string): An id for the tab. 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 parameter to the function.hide
(function): Function that is called when the tab is about to be hidden. The tab is passed as parameter to the function.close
(function): Function that is called when the tab is about to be closed. The tab is passed as 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 parameter.
getTab(id)
- Get the VueTab
instance by id. Returnsnull
if not found.getActiveTabId()
- Get the id of the tab that is currently active.selectTab(tab)
- Set the currently active tab (asynchronously).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 variabletabs
holds a reference to theTabs
component.tabName
- Slot that can be used to customize the appearance of the tab name for each tab. The slot applies to all tabs. The variabletab
holds an object with the properties of the tab set with theaddTab
method.dynamic
- Default content for dynamic tabs. The variabletab
holds an object with the properties of the tab set with theaddTab
method.- The content for each dynamic tab that is added programattically 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 variabletab
holds an object with the properties of the tab set with theaddTab
method.
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);
});
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
.null
to show 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
(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 parameter.
Slots:
default
- Place for the content of your tab. The variabletab
holds a reference to theTab
component.
Events:
@show
- Fired when the tab is shown. The tab is passed as parameter to the listener.@hide
- Fired when the tab was hidden. The tab is passed as parameter to the listener.@close
- Fired when the tab has been closed. The tab is passed as parameter to the listener.
<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:abc@mailprovider.com">abc@mailprovider.com</a>.
</Tab>
</Tabs>
</template>
<script>
import Tabs from './Tabs.vue';
import Tab from './Tab.vue';
export default {
name: 'Viewer',
components: {
Tab,
Tabs
}
}
</script>
<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 './Tabs.vue';
import Tab from './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>
Visualizes the supported UDF (user-defined function) runtimes of the back-end.
Properties:
version
(string): openEO versionudfRuntimes
(object): Supported UDF runtimes as defined by the openEO API.
Methods:
getCount()
- Get the number of shown UDF runtimes.
A list of categorized features with their corresponding endpoints as used by the components SupportedFeatures
.
compareStringCaseInsensitive(string a, string b) : integer
- Compares both strings case-insensitive. 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.- and other functions not meant for public use.