The metadata manager is responsible for parsing and returning various
metadata to components that request it.
Members
#
(static) fieldTypeMap :Object
Map of fields types.
Specifies correspondence between field types and field widget types.
Methods
#
(static) addSyncTask(task)
Adds a task/file/app to be fetched and synced
Parameters:
Name |
Type |
Description |
task |
Promise
|
function
|
|
#
(static) clearCache()
Purges metadata from the persistent cache.
#
(static) copy(meta, optionsopt) → {Object}
Copies a metadata fragment.
The default implementation performs a deep copy. Client apps may override
this behavior.
Parameters:
Name |
Type |
Attributes |
Description |
meta |
Object
|
|
Metadata object to be copied. |
options |
Object
|
<optional>
|
Options that describe the type of metadata to
copy. The default implementation does not use them as it always
performs deep copy regardless of metadata type. |
Returns:
Copy of the given metadata object.
-
Type
-
Object
#
(static) get() → {Object}
Gets the whole metadata object returned by the server.
#
(static) getBaseCurrencyId() → {string}
Gets the base currency Id. Currently it returns the hardcoded value -99
.
#
(static) getConfig() → {Object}
#
(static) getCurrencies() → {Object}
#
(static) getCurrency(currencyId) → {Object}
Parameters:
Name |
Type |
Description |
currencyId |
string
|
Identifier for the currency to retrieve. |
#
(static) getDropdownViews(module, view) → {*|null}
Get the dropdown based views metadata if defined
Parameters:
Name |
Type |
Description |
module |
|
module name |
view |
|
type of view (Record views to begin with, others will be added later) |
Returns:
returns the metadata for any dropdown based views available for a specific module.
Returned meta object would be of the pattern dropdownViews[view][dropdownField][dropdownValue]
-
Type
-
*
|
null
#
(static) getEditableDropdownFilter(dropdown) → {Array.<Array>|Object}
Gets the list of dropdown keys that can be used when modifying a record.
Parameters:
Name |
Type |
Description |
dropdown |
string
|
The dropdown field to get the filter for. |
Returns:
The list of dropdown keys.
-
Type
-
Array.<Array>
|
Object
#
(static) getField(options) → {Object|undefined}
Gets a field metadata or all fields metadata.
Parameters:
Name |
Type |
Description |
options |
Object
|
A hash of options.
Properties
Name |
Type |
Attributes |
Description |
module |
string
|
|
The module that we want to get the
vardefs. |
name |
string
|
<optional>
|
The field name to get the field def. |
|
Returns:
Field def for the given Module, or all
fields if no options.name
is supplied.
-
Type
-
Object
|
undefined
#
(static) getFilterOperators(moduleopt) → {Object}
Gets the list of filter operators.
If any filter operators of a certain field type are defined at module
level, these will take precedence over the ones available on core,
thus completely overriding the latter.
Parameters:
Name |
Type |
Attributes |
Description |
module |
string
|
<optional>
|
The module to get the filters for. |
Returns:
The list of filter operators.
-
Type
-
Object
#
(static) getFullModuleList() → {Object}
Gets the full module list.
Returns:
Full module list. Keys and values are equal.
-
Type
-
Object
#
(static) getHash(isPublic) → {string}
Parameters:
Name |
Type |
Description |
isPublic |
boolean
|
Flag indicating if the public metadata hash is
requested. |
#
(static) getHiddenSubpanels() → {Object}
Gets the list of module names that need to be hidden in subpanels.
Returns:
Collection of module names that are hidden in subpanels.
-
Type
-
Object
#
(static) getLayout(module, layoutopt, loadModuleopt) → {Object|null}
Gets a layout metadata or all layouts metadata.
Parameters:
Name |
Type |
Attributes |
Description |
module |
string
|
|
The module name. |
layout |
string
|
<optional>
|
Layout name. |
loadModule |
string
|
<optional>
|
The module that should be considered base.
Defaults to core metadata. |
Returns:
Layout metadata if layout
name is specified.
Otherwise, metadata for all layouts of the given module. If the
optional layout
parameter is provided we instead return null
if
layout for module not found.
-
Type
-
Object
|
null
#
(static) getLogoUrl(isDarkMode) → {string}
Gets the company logo url.
Parameters:
Name |
Type |
Description |
isDarkMode |
boolean
|
True if we need to return the dark mode logo url |
#
(static) getModule(module, typeopt) → {Object}
Parameters:
Name |
Type |
Attributes |
Description |
module |
string
|
|
The module name. |
type |
string
|
<optional>
|
Metadata type. e.g 'fields', 'layouts', etc. |
Returns:
Module metadata of specific type if type is
specified. Otherwise, module's overall metadata.
-
Type
-
Object
#
(static) getModuleNames(optionsopt) → {Array}
Gets an array of module names.
Parameters:
Name |
Type |
Attributes |
Description |
options |
Object
|
<optional>
|
A hash of options.
Properties
Name |
Type |
Attributes |
Description |
filter |
string
|
<optional>
|
Returns only modules
that have this property enabled. |
access |
string
|
<optional>
|
Returns only modules
the user has permission to perform this given action on. |
|
Returns:
List of module names sorted by user settings.
-
Type
-
Array
#
(static) getModules() → {Object}
Gets metadata for all modules.
Returns:
Metadata for all modules.
-
Type
-
Object
#
(static) getModuleTabMap() → {Object}
Gets the module tab mapping for megamenu.
#
(static) getRelationship(name) → {Object}
Gets a relationship definition.
Parameters:
Name |
Type |
Description |
name |
string
|
Relationship name. |
Returns:
Relationship metadata or nothing if not found.
-
Type
-
Object
#
(static) getServerInfo() → {Object}
#
(static) getStrings(type) → {Object}
Gets language strings for a given type.
Parameters:
Name |
Type |
Description |
type |
string
|
Type of string pack: app_strings ,
app_list_strings or mod_strings . |
#
(static) getTabMappedModule(module) → {string}
Gets the mapped module name for a menu item if one exists. Otherwise
gets the module that was passed in.
Parameters:
Name |
Type |
Description |
module |
string
|
The module to get the mapped module for. |
#
(static) getView(module, viewopt, loadModuleopt) → {Object|null}
Gets a view metadata or all views metadata.
Parameters:
Name |
Type |
Attributes |
Description |
module |
string
|
|
The module name. |
view |
string
|
<optional>
|
The view name. |
loadModule |
string
|
<optional>
|
The module that should be considered base.
Defaults to core metadata. |
Returns:
View metadata if view name
is specified.
Otherwise, metadata for all views of the given module
.
If the optional view parameter is provided we instead return null
if view for module not found.
-
Type
-
Object
|
null
#
(static) init()
Binds an event listeners on cache:clean
global event and on the
window storage
event.
When storage
is triggered by window
, we will check re-sync the app if
necessary. If cacheMeta
config property is set to true
, we grab the
metadata from the local storage.
#
(static) isSyncing() → {boolean}
Used to check if a metadata sync is currently in progress.
Returns:
true
if a sync is in progress.
-
Type
-
boolean
#
(static) removeSyncTask(task)
Removes a task/file/app from being fetched and synced
Parameters:
Name |
Type |
Description |
task |
Promise
|
function
|
|
#
(static) reset()
Resets internal memory cache and clears persistent storage.
#
(static) set(data, isPublic, reset)
Sets the metadata.
By default this function is used by MetadataManager to translate server
responses into metadata usable internally. The currently set metadata is
preserved and extended by new metadata unless reset
parameter equals to
true
.
Parameters:
Name |
Type |
Description |
data |
Object
|
Metadata payload returned by the server. |
isPublic |
boolean
|
Flag indicating if the public metadata must be
fetched. |
reset |
boolean
|
Flag indicating if the the current metadata must
be deleted. |
#
(static) storageHandler()
Checks to see if the metadata needs to sync with the server.
#
(static) sync(callbackopt, optionsopt)
Syncs metadata from the server. Saves the metadata to the local cache.
Parameters:
Name |
Type |
Attributes |
Description |
callback |
function
|
<optional>
|
Callback function to be executed after sync
completes. |
options |
Object
|
<optional>
|
A hash of options.
Properties
Name |
Type |
Attributes |
Description |
getPublic |
boolean
|
<optional>
|
true to sync the public metadata.
Defaults to false .
|
metadataTypes |
Array.<string>
|
<optional>
|
The metadata types to sync. If
omitted, the ones specified in the config will be used. |
|