This documentation is intended to help you create plugins for Datashare client. All methods currently exposed in the Core class are available to a global variable called datashare
.
Example
Class representing the core application with public methods for plugins.
Kind: global class
Mixes: FiltersMixin
, HooksMixin
, I18nMixin
, PipelinesMixin
, ProjectsMixin
, WidgetsMixin
instance
.ready : Promise.<Object>
.bootstrapVue ⇒ Plugin
.i18n : I18n
.router : VueRouter
.store : Vuex.Store
.plugin ⇒ *
.auth : Auth
.config : Object
.api : Api
.vue : Vue
.wait : VueWait
.mode : String
.buildCorePlugin() ⇒ VueCore
.configure() ⇒ Promise.<Object>
.mount([selector]) ⇒ Vue
.getUser() ⇒ Promise.<Object>
.loadUser() ⇒ Promise
.loadSettings() ⇒ Promise
static
Create an application
api
Datashare api interface
mode
mode of authentication ('local' or 'server'
Get a promise that is resolved when the application is ready
Kind: instance property of Core
Fullfil: Object The actual application core instance.
Core
Deprecated
The application core instance. Deprecated in favor or the core
property.
Kind: instance property of Core
Core
The application core instance
Kind: instance property of Core
The Bootstrap Vue plugin instance.
Kind: instance property of Core
The I18n instance
Kind: instance property of Core
The VueRouter instance
Kind: instance property of Core
The Vuex instance
Kind: instance property of Core
The CorePlugin instance
Kind: instance property of Core
The Auth module instance
Kind: instance property of Core
The configuration object provided by Murmur
Kind: instance property of Core
The Datashare api interface
Kind: instance property of Core
The Vue app
Kind: instance property of Core
The VueWait
Kind: instance property of Core
Get current Datashare mode
Kind: instance property of Core
Core
Add a Vue plugin to the app
Kind: instance method of Core
Returns: Core
- the current instance of Core
Plugin
Object
The actual Vue plugin class
options
Object
Option to pass to the plugin
Core
Configure all default Vue plugins for this application
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Configure vue-i18n plugin
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Configure bootstrap-vue plugin
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Configure vue-router plugin
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Configure vuex plugin
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Configure most common Vue plugins (Murmur, VueShortkey, VueScrollTo and VueCalendar)
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Configure vue-wait plugin
Kind: instance method of Core
Returns: Core
- the current instance of Core
Core
Add a $core property to the instance's Vue
Kind: instance method of Core
Returns: Core
- the current instance of Core
Build a VueCore instance with the current Core instance as parameter of the global properties.
Kind: instance method of Core
Load settings from the server and instantiate most the application configuration.
Kind: instance method of Core
Fullfil: Core
- The instance of the core application
Reject: Object - The Error object
Mount the instance's vue application
Kind: instance method of Core
Returns: Vue - The instantiated Vue
[selector]
String
#app
Query selector to the mounting point
Build a promise to be resolved when the application is configured.
Kind: instance method of Core
Core
Dispatch an event from the document root, passing the core application through event message.
Kind: instance method of Core
Returns: Core
- the current instance of Core
name
String
Name of the event to fire
...args
Mixed
Additional params to pass to the event
Get the current signed user.
Kind: instance method of Core
Fullfil: Object Current user
Get and update user definition in place
Kind: instance method of Core
Get settings (both from the server settings and the current mode)
Kind: instance method of Core
Append the given title to the page title
Kind: instance method of Core
title
String
Title to append to the page
[suffix]
String
Datashare
Suffix to the title
Register a callback to an event using the EventBus singleton.
Kind: instance method of Core
event
String
callback
*
Unregister a callback to an event using the EventBus singleton.
Kind: instance method of Core
event
String
callback
*
Emit an event using the EventBus singleton.
Kind: instance method of Core
event
String
payload
*
Core
instantiate a Core class (useful for chaining usage or mapping)
Kind: static method of Core
...options
Mixed
Options to pass to the Core constructor
Mixin class extending the core to add helpers for components.
Kind: global mixin
Mixin class extending the core to add helpers for filters.
Kind: global mixin
Register a filter
Kind: instance method of FiltersMixin
...args
Mixed
Filter's params.
args.type
String
Type of the filter.
args.options
Object
Options to pass to the filter constructor.
args.options.name
String
Name of the filter.
args.options.key
String
Key of the filter. Typically ElasticSearch field name.
[args.options.icon]
String
Icon of the filter.
[args.options.isSearchable]
Boolean
false
Set if this filter should be searchable or not.
[args.options.alternativeSearch]
function
()=>{})
Set a function about how to transform query term before searching for it.
[args.options.order]
Number
Order of the filter. Will be added as last filter by default.
Unregister a filter
Kind: instance method of FiltersMixin
name
String
Name of the filter to unregister
Register a filter only for a specific project
Kind: instance method of FiltersMixin
name
String
Name of the project
...args
Mixed
Filter's options.
args.name
String
Name of the filter
args.type
String
Type of the filter.
args.options
Object
Options to pass to the filter constructor
Unregister a filter only for a specific project
Kind: instance method of FiltersMixin
name
String
Name of the project
name
String
Name of the filter
Mixin class extending the core to add helpers for hooks.
Kind: global mixin
Register a hook
Kind: instance method of HooksMixin
...args
Mixed
Hook's options
args.name
String
Name of the hook
args.target
String
Target of the hook
args.order
Number
Priority of the hook
args.definition
Object
Options to pass to the hook constructor
Unregister a specific hook
Kind: instance method of HooksMixin
name
String
Name of the hook
Unregister all hooks from a target
Kind: instance method of HooksMixin
name
String
Name of the target
Unregister all hooks, on every targets
Kind: instance method of HooksMixin
Register a hook for a specific project
Kind: instance method of HooksMixin
project
String
Project to add this hook to
options
Object
Hook's options
options.name
String
Name of the hook
options.target
String
Target of the hook
options.order
Number
Priority of the hook
options.definition
Object
Options to pass to the hook constructor
Mixin class extending the core to add helpers for i18n.
Kind: global mixin
.initializeI18n() ⇒ Promise
.setI18nLocale(locale) ⇒ String
.hasI18Locale(locale) ⇒ Boolean
.loadI18Locale(locale) ⇒ Promise
Initialize i18N using the local storage and load the necessary locale's messages
Kind: instance method of I18nMixin
Set the active locale both in local stoage and VueI18n.
Kind: instance method of I18nMixin
locale
String
Key of the local (fr, de, en, ja, ...)
Check the given locale storage was loaded.
Kind: instance method of I18nMixin
locale
String
Key of the local (fr, de, en, ja, ...)
Load i18n messages for the given locale (if needed) and set it as the current locale.
Kind: instance method of I18nMixin
locale
String
Key of the local (fr, de, en, ja, ...)
Mixin class extending the core to add helpers for pipelines.
Kind: global mixin
Register a pipeline
Kind: instance method of PipelinesMixin
...args
Mixed
Pipeline's options.
args.name
String
Name of the pipeline
args.type
String | function
Type of the pipeline.
category
String
The pipeline to target
Unregister a pipeline
Kind: instance method of PipelinesMixin
name
String
Name of the pipeline
Register a pipeline for a specific project
Kind: instance method of PipelinesMixin
project
String
Name of the project
...args
Mixed
Pipeline's options.
args.name
String
Name of the pipeline
args.type
String | function
Type of the pipeline.
category
String
The pipeline to target
Unregister a pipeline for a specific project
Kind: instance method of PipelinesMixin
project
String
Name of the project
name
String
Name of the pipeline
Mixin class extending the core to add helpers for projects.
Kind: global mixin
Call a function when a project is selected
Kind: instance method of ProjectsMixin
name
String
Name of the project
withFn
function
Function to call when the project is selected
withoutFn
function
Function to call when the project is unselected
mutationType
String
Mutation type that will be watched for changes.
storePath
String
Path to the project in the store
Create a default project on Datashare using the API
Kind: instance method of ProjectsMixin
Returns: Promise:Object - The HTTP response object
Mixin class extending the core to add helpers for widgets.
Kind: global mixin
Register a widget
Kind: instance method of WidgetsMixin
...args
Mixed
Widget's options passed to widget constructor
args.name
String
Name of the widget
args.card
Boolean
Either or not this widget should be a card
component from Boostrap.
args.cols
Number
Number of columns to fill in the grid (from 1 to 12)
[args.type]
String
WidgetEmpty
Type of the widget
Unregister a widget
Kind: instance method of WidgetsMixin
name
String
Name of the widget to unregister
Unregister all widgets
Kind: instance method of WidgetsMixin
Register a widget for a specific project
Kind: instance method of WidgetsMixin
project
String
Name of the project to add this widget to
options
Object
Widget's options passed to widget constructor
options.name
String
Name of the widget
options.card
Boolean
Either or not this widget should be a card
component from Boostrap
options.cols
Number
Number of columns to fill in the grid (from 1 to 12)
[options.type]
String
WidgetEmpty
Type of the widget
Replace an existing widget
Kind: instance method of WidgetsMixin
name
String
Name of the widget to replace
options
Object
Widget's options passed to widget constructor.
options.card
Boolean
Either or not this widget should be a card
component from Boostrap
options.cols
Number
Number of columns to fill in the grid (from 1 to 12)
[options.type]
String
WidgetEmpty
Type of the widget
Example
Replace an existing widget for a specific project
Kind: instance method of WidgetsMixin
project
String
Name of the project to add this widget to
name
String
Name of the widget to replace
options
Object
Widget's options passed to widget constructor. Each widget class can define its own default values.
options.card
Boolean
Either or not this widget should be a card
component from Boostrap
options.cols
Number
Number of columns to fill in the grid (from 1 to 12)
[options.type]
String
WidgetEmpty
Type of the widget
List all projects this user has access to.
Kind: global variable
List all projects name ids this user has access to.
Kind: global variable
Get the name of the default project
Kind: global variable
Asynchronously find a component in the lazyComponents object by its name.
Kind: global function Returns: Promise.<(object|null)> - - A promise that resolves with the found component object, or null if not found.
name
string
The name of the component to find.
Asynchronously get a component from the lazyComponents object based on its name.
Kind: global function Returns: Promise.<(object|Error)> - - A promise that resolves with the found component object, or rejects with an Error if not found.
name
string
The name of the component to retrieve.
Check if multiple component names are the same when slugified.
Kind: global function Returns: boolean - - True if all names are the same when slugified, false otherwise.
...names
string
The component names to compare.
Generate a slug from the component name using kebab case and lowercase.
Kind: global function Returns: string - - The slugified component name.
name
string
The name of the component to slugify.
Get the lazyComponents object using require.context for lazy loading of components.
Kind: global function Returns: Object - - The lazyComponents object generated using require.context.
Return true if the default project exists
Kind: global function
Retrieve a project by its name
Kind: global function Returns: Object - The project matching with this name
name
String
Name of the project to retrieve
Delete a project by it name identifier.
Kind: global function Returns: Promise:Integer - Index of the project deleted or -1 if project does not exist
name
String
Name of the project to retrieve
Delete a project from the search store
Kind: global function
name
String
Name of the project to delete fropm the store
Update a project in the list or add it if it doesn't exist yet.
Kind: global function Returns: Object - The project
project
Object