Module: alfresco/header/Warning

alfresco/header/Warning

This is a generic banner warning that can be used to display warning and error messages to the user. The banner can contain multiple warning messages with different levels. The level of the warning indicates the image that will be used. It is also possible to configure each warning to have a subscription topic that can be used to control dynamically control the visibility of the warning. The payload published on the subscription topic should contain a boolean attribute called "value" that indicates whether or not the warning should be displayed or hidden.
Author:
  • Dave Draper
License:
Source:

Examples

Basic single warning

{
  name: "alfresco/header/Warning",
  config: {
    warnings: [
      {
        message: "You have been warned",
        level: 1
      }
    ]
  }
}

Multiple warnings with subscription topics

{
  name: "alfresco/header/Warning",
  config: {
    warnings: [
      {
        message: "First warning",
        level: 1,
        subscriptionTopic: "WARNING_1_VISIBILITY"
      },
      {
        message: "Second warning",
        level: 1,
        subscriptionTopic: "WARNING_2_VISIBILITY"
      }
    ]
  }
}

Mixes In

Members

_dynamicWarnings :object

This attribute is used to track the visibility status of all the warnings that are configured with a subscriptionTopic attribute. When all warnings are hidden then the overall widget will also be hidden.
Type:
  • object
Since:
  • 1.0.32
Default Value:
  • null
Source:

cssRequirements :object[]

An array of the CSS files to use with this widget.
Type:
  • object[]
Default Value:
  • [{cssFile:"./css/LicenseWarning.css"}]
Source:

templateString :String

The HTML template to use for the widget.
Type:
  • String
Source:

warnings :array

This should be set to an array of objects defined the warnings to be displayed. Each object should contain a message and a severity level.
Type:
  • array
Default Value:
  • null
Source:

Methods

addError(error, index)

Adds an error message
Parameters:
Name Type Description
error string The error message to add
index number The index to add
Source:

addMessage(message, index, level)

Adds a message to be displayed
Parameters:
Name Type Description
message string The message to add
index number The index of the message
level number The severity of the message
Source:

addWarning(warning, index)

Adds a warning message.
Parameters:
Name Type Description
warning string The warning message to add
index number The index to add
Source:

postCreate()

Source:

updateVisibility(warningNode, subscriptionTopic, payload)

If a warning is configured with a subscriptionTopic attribute then this function will be called each time that topic is published and will update the visibility of that warning according to the payload provided. If all of the warnings are hidden then the overall widget will also be hidden.
Parameters:
Name Type Description
warningNode element This is the DOM element for the warning being updated
subscriptionTopic string This is the topic subscribed to for the warning being updated.
payload object This is the payload published on the subscriptionTopic. It is expected to contain a "value" attribute
Since:
  • 1.0.32
Source: