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.
Type:
- Object
Methods
-
<static> addSyncTask(task)
-
Adds a task/file/app to be fetched and synced
Parameters:
Name Type Description taskPromise | function -
<static> clearCache()
-
Purges metadata from the persistent cache.
-
<static> copy(meta [, options])
-
Copies a metadata fragment.
The default implementation performs a deep copy. Client apps may override this behavior.
Parameters:
Name Type Argument Description metaObject Metadata object to be copied.
optionsObject <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()
-
Gets the whole metadata object returned by the server.
Returns:
The metadata object.
- Type
- Object
-
<static> getBaseCurrencyId()
-
Gets the base currency Id. Currently it returns the hardcoded value
-99.Returns:
The value
-99;- Type
- string
-
<static> getConfig()
-
Gets Config.
Returns:
Dictionary of Configs.
- Type
- Object
-
<static> getCurrencies()
-
Gets currencies.
Returns:
the currency dictionary.
- Type
- Object
-
<static> getCurrency(currencyId)
-
Gets a currency.
Parameters:
Name Type Description currencyIdstring Identifier for the currency to retrieve.
Returns:
The currency object.
- Type
- Object
-
<static> getEditableDropdownFilter(dropdown)
-
Gets the list of dropdown keys that can be used when modifying a record.
Parameters:
Name Type Description dropdownstring The dropdown field to get the filter for.
Returns:
The list of dropdown keys.
- Type
- Array.<Array> | Object
-
<static> getField(options)
-
Gets a field metadata or all fields metadata.
Parameters:
Name Type Description optionsObject A hash of options.
Properties
Name Type Argument Description modulestring The module that we want to get the vardefs.
namestring <optional>
The field name to get the field def.
Returns:
Field def for the given Module, or all fields if no
options.nameis supplied.- Type
- Object | undefined
-
<static> getFilterOperators( [module])
-
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 Argument Description modulestring <optional>
The module to get the filters for.
Returns:
The list of filter operators.
- Type
- Object
-
<static> getFullModuleList()
-
Gets the full module list.
Returns:
Full module list. Keys and values are equal.
- Type
- Object
-
<static> getHash(isPublic)
-
Gets metadata hash.
Parameters:
Name Type Description isPublicboolean Flag indicating if the public metadata hash is requested.
Returns:
Metadata hash.
- Type
- string
-
<static> getHiddenSubpanels()
-
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 [, layout] [, loadModule])
-
Gets a layout metadata or all layouts metadata.
Parameters:
Name Type Argument Description modulestring The module name.
layoutstring <optional>
Layout name.
loadModulestring <optional>
The module that should be considered base. Defaults to core metadata.
Returns:
Layout metadata if
layoutname is specified. Otherwise, metadata for all layouts of the given module. If the optionallayoutparameter is provided we instead returnnullif layout for module not found.- Type
- Object | null
-
<static> getLogoUrl(isDarkMode)
-
Gets the company logo url.
Parameters:
Name Type Description isDarkModeboolean True if we need to return the dark mode logo url
Returns:
The logo url
- Type
- string
-
<static> getModule(module [, type])
-
Gets module metadata.
Parameters:
Name Type Argument Description modulestring The module name.
typestring <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( [options])
-
Gets an array of module names.
Parameters:
Name Type Argument Description optionsObject <optional>
A hash of options.
Properties
Name Type Argument Description filterstring <optional>
Returns only modules that have this property enabled.
accessstring <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()
-
Gets metadata for all modules.
Returns:
Metadata for all modules.
- Type
- Object
-
<static> getModuleTabMap()
-
Gets the module tab mapping for megamenu.
Returns:
Mapping object.
- Type
- Object
-
<static> getRelationship(name)
-
Gets a relationship definition.
Parameters:
Name Type Description namestring Relationship name.
Returns:
Relationship metadata or nothing if not found.
- Type
- Object
-
<static> getServerInfo()
-
Gets server information.
Returns:
Server information.
- Type
- Object
-
<static> getStrings(type)
-
Gets language strings for a given type.
Parameters:
Name Type Description typestring Type of string pack:
app_strings,app_list_stringsormod_strings.Returns:
Dictionary of strings.
- Type
- Object
-
<static> getTabMappedModule(module)
-
Gets the mapped module name for a menu item if one exists. Otherwise gets the module that was passed in.
Parameters:
Name Type Description modulestring The module to get the mapped module for.
Returns:
The mapped module name.
- Type
- string
-
<static> getView(module [, view] [, loadModule])
-
Gets a view metadata or all views metadata.
Parameters:
Name Type Argument Description modulestring The module name.
viewstring <optional>
The view name.
loadModulestring <optional>
The module that should be considered base. Defaults to core metadata.
Returns:
View metadata if
view nameis specified. Otherwise, metadata for all views of the givenmodule. If the optional view parameter is provided we instead returnnullif view for module not found.- Type
- Object | null
-
<static> init()
-
Binds an event listeners on
cache:cleanglobal event and on the windowstorageevent.When
storageis triggered bywindow, we will check re-sync the app if necessary. IfcacheMetaconfig property is set totrue, we grab the metadata from the local storage. -
<static> isSyncing()
-
Used to check if a metadata sync is currently in progress.
Returns:
trueif a sync is in progress.- Type
- boolean
-
<static> removeSyncTask(task)
-
Removes a task/file/app from being fetched and synced
Parameters:
Name Type Description taskPromise | 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
resetparameter equals totrue.Parameters:
Name Type Description dataObject Metadata payload returned by the server.
isPublicboolean Flag indicating if the public metadata must be fetched.
resetboolean 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( [callback] [, options])
-
Syncs metadata from the server. Saves the metadata to the local cache.
Parameters:
Name Type Argument Description callbackfunction <optional>
Callback function to be executed after sync completes.
optionsObject <optional>
A hash of options.
Properties
Name Type Argument Description getPublicboolean <optional>
trueto sync the public metadata. Defaults tofalse.metadataTypesArray.<string> <optional>
The metadata types to sync. If omitted, the ones specified in the config will be used.