File

core/common/options.service.ts

Description

A service that allows to set or get application options which configure the default behavior of the UI.

Extends

ApplicationOptions

Index

Properties
Methods

Constructor

constructor(options, systemOptionsService: SystemOptionsService, tenantOptionService: TenantOptionsService)
Parameters :
Name Type Optional
options No
systemOptionsService SystemOptionsService No
tenantOptionService TenantOptionsService No

Methods

get
get(optionKey, defaultValue?: any, attemptParse?: boolean)

Returns an application option used to configure the UI.

Parameters :
Name Type Optional Description
optionKey No

The application options key.

defaultValue any Yes

A value to return if non is set.

attemptParse boolean Yes

Indicates whether the value should be parsed with JSON.parse.

Returns : any
Async getActivateSupportUser
getActivateSupportUser()

Returns if the tenant allows to show the activate-support user menu entry. Note: Only if system-level support-user/enabled is false we can activate it at tenant level.

Returns : unknown
Async getSupportUrl
getSupportUrl()

Gets support url from tenant options. If response returns '404 not found' it gets the support url from application options. If the support link within application options is not provided the UI will use the system options. Is the support link explicitly set to false it will be hidden.

Returns : unknown

Returns support url or false.

Async getSystemOption
getSystemOption(category: string, key: string, defaultValue?: any)

Gets a value from the system service and parses it.

Parameters :
Name Type Optional Description
category string No

The category for this option.

key string No

The key for that option.

defaultValue any Yes

The default if the option was not found.

Returns : unknown
Async getTenantOption
getTenantOption(category: string, key: string, defaultValue?: any)

Gets a value from the tenant service and parses it.

Parameters :
Name Type Optional Description
category string No

The category for this option.

key string No

The key for that option.

defaultValue any Yes

The default if the option was not found.

Returns : unknown
set
set(key: string, value: any)

Sets an application option.

Parameters :
Name Type Optional Description
key string No

The key to set.

value any No

The value to set.

Returns : void

Properties

Optional brandingCssVars
Type : BrandingCssVars

Object with properties that will be converted to CSS custom variables.

Optional brandingEntry
Type : string

Path to the branding entry file.

Optional brandingUrl
Type : string

URL to *.css file which will replace default branding.

Optional breadcrumbs
Type : boolean

Enable or disable breadcrumbs in the header for groups and devices (default: false).

Optional companyName
Type : string

Name of company handling support requests from app users (displayed in notification message).

Optional contentSecurityPolicy
Type : string

CSP string to be applied to index.html by replacing default values.

Optional contextHelp
Type : boolean | string

Allows to enable or disable context help. By default the context help uses the base URL defined in the "docsBaseUrl" option, if this option is not defined the following will be used as the base URL: https://www.cumulocity.com/guides. The base URL can also be passed to this option to override the previously mentioned values.

contextPath
Type : string

Application context path (saved to the server).

Optional cookieBanner
Type : CookieBannerConfiguration

Cookie Banner configuration

Optional cookiePreferences
Type : CookiePreferencesConfiguration

Cookie preferences configuration. Here you can enable or disable cookie categories

Optional copy
Type : []

Additional assets to copy to the build output. See https://github.com/webpack-contrib/copy-webpack-plugin for more information about the patterns to add here.

Optional disableOnlyRootsQuery
Type : boolean

By default, cockpit and devicemanagement use the onlyRoots query to resolve root nodes. This could lead to performance issues, if a customer has a lot of root nodes. Therefore you can disable the use of this query with this flag.

Optional docs
Type : Docs

Documentation links settings.

Optional docsBaseUrl
Type : string

Base URL for documentation links.

Optional dynamicOptionsUrl
Type : string

URL to dynamically fetched options.

Optional entryModule
Type : string

Entry module for Angular compiler (only used with lazy loaded routes), e.g. 'app.module.ts#AppModule'.

Optional exports
Type : PluginsExports[]

NgModule export for plugins.

Optional extraCssUrls
Type : string[]

Array of URLs to additional *.css files to be loaded at runtime.

Optional faviconUrl
Type : string

URL to favicon.

Optional forceSetup
Type : boolean

Allows to force showing the setup wizard.

Optional gainsightKey
Type : string

A key for the product experience software Gainsight.

Optional globalTitle
Type : string

HTML page title.

Optional guideHrefTemplate
Type : string

URL template for documentation links (default: '${docsBaseUrl}${partialUrl}').

Optional hideNavigator
Type : boolean

Collapse navigator on initial load.

Optional hidePowered
Type : boolean

Hide "powered by" and version info at the bottom of the navigator and in the user menu.

Optional i18nExtra
Type : I18nExtra

Allows for adding custom translations. It is an optional property.

Its keys are language codes (https://cumulocity.com/guides/users-guide/getting-started/#a-name-languages-a-available-languages) and its values are objects with key-value pairs, where the key is the original string in English and the value - its translation.

  • Home: "Startseite"

For example you can add the translation of your custom cookie banner configured in the branding settings:

"i18nExtra": {
  "de": {
    "About cookies on Cumulocity IoT": "Informationen zu Cookies in Cumulocity IoT",
    "Click Agree and Proceed to accept cookies and go directly to the platform or click on Privacy Policy to see detailed descriptions of the used cookies.": "Klicken Sie auf Zustimmen und fortfahren, um Cookies zu akzeptieren und direkt zur Plattform zu gelangen, oder klicken Sie auf Datenschutzrichtlinie, um detaillierte Beschreibungen der verwendeten Cookies anzuzeigen."
  }
}
Optional icon
Type : Icon

Application icon to be displayed in app switcher and header bar.

Optional indexTemplate
Type : string

Path to custom index.html (otherwise default one will be used).

Optional isSetup
Type : boolean

Indicates if the application needs to show the setup wizard.

key
Type : string

Application key (saved to the server).

Optional languages
Type : Languages

Allows for adding or overriding languages available in the application.

Its keys are language codes and its values are objects with the following properties:

  • name: English name of the language,
  • nativeName: native name of the language,
  • url: full URL to JSON file with compiled translations; if not defined, translations will be loaded from ${localePath}/${langCode}.json.

Example:

"languages": {
  "de": {
    "name": "German",
    "nativeName": "Deutsch",
    "url": "/apps/public/ui-assets/de.json"
  }
}
Optional localePath
Type : string

Path to the folder from which *.po files will be loaded.

Optional loginExtraLink
Type : LoginExtraLink

Additional link to display on login screen.

name
Type : string

Application name (saved to the server).

Optional newsletter
Type : boolean

Show or hide a newsletter subscription checkbox in edit user modal.

Optional noAppSwitcher
Type : boolean

Hide application in app switcher (saved to the server).

Optional remotes
Type : RemotePlugins

List of imported remote plugins.

Optional rightDrawer
Type : boolean

Enable or disable the right drawer.

Optional rootNodeModulesPath
Type : string

Path to the root node_modules dir (useful when working in monorepo setup, e.g. yarn workspaces).

Optional sensorPhone
Type : boolean

Enables cloud sensor wizard

Optional source
Type : string | number | IApplication

The package source a application origins from as IApplication or simply the id of the source

Optional storageLimitationFeatureEnabled
Type : boolean

Enable or disable storage limitation feature.

Optional supportUrl
Type : boolean | string

URL to support page (set to false to hide the link).

Optional supportUserString
Type : string

Replacement string for user field in audit logs for actions performed by a support user (available placeholders: {{support_user}}, {{supported_user}}).

Optional tabsHorizontal
Type : boolean

Show tabs horizontally or vertically.

Optional tsConfigPath
Type : string

Path to tsccnfig.json file if TypeScript is used (default: ./tsconfig.json).

Optional upgrade
Type : boolean

Set to true if the application is hybrid and uses Angular and AngularJS simultaneously.

results matching ""

    No results matching ""