Class: AppView

AppView()

The top-level view of the UI that contains and coordinates all other views of the UI

Constructor

new AppView()

Source:

Members

contentSelector :string

The JS query selector for the element inside the AppView that contains the main view contents. When a new view is routed to and displayed via AppView#showView, the view will be inserted into this element.
Type:
  • string
Since:
  • 2.22.0
Default Value:
  • "#Content"
Source:

Methods

checkIncompatibility()

Checks if the user's browser is an outdated version that won't work with MetacatUI well, and displays a warning message to the user.. The user agent is checked against the `unsupportedBrowsers` list in the AppModel.
Source:

getContentEl() → {Element}

Gets the Element in this AppView via the AppView#contentSelector
Source:
Returns:
Type
Element

hideTemporaryMessage()

Hides the temporary message
Source:

listenForActivity()

Listens to the focus event on the window to detect when a user switches back to this browser tab from somewhere else When a user checks back, we want to check for log-in status
Source:

listenForTimeout()

Will determine the length of time until the user's current token expires, and will set a window timeout for that length of time. When the timeout is triggered, the sign in modal window will be displayed so that the user can sign in again (which happens in AppView.showTimeoutSignIn())
Source:

render()

Render the main view and/or re-render subviews. Delegate rendering and event handling to sub views. --- If there is no AppView element on the page, don't render the application. --- If there is no AppView element on the page, this function will exit without rendering anything. For instance, this can occur when the AppView is loaded during unit tests. See AppView#el to check which element is required for rendering. By default, it is set to the element with the `metacatui-app` id (check docs for the most up-to-date info). ---- This step is usually unnecessary for Backbone Views since they should only render elements inside of their own `el` anyway. But the APpView is different since it renders the overall structure of MetacatUI.
Source:

showAlert(options)

Displays the given message to the user in a Bootstrap "alert" style.
Parameters:
Name Type Description
options object A literal object of options for the alert message.
Properties:
Name Type Attributes Description
options.message string | Element A message string or HTML Element to display
options.classes string <optional>
A string of HTML classes to set on the alert
options.container string | Element <optional>
The container to show the alert in
options.replaceContents boolean <optional>
If true, the alert will replace the contents of the container element. If false, the alert will be prepended to the container element.
options.delay boolean | number <optional>
Set to true or specify a number of milliseconds to display the alert temporarily
options.remove boolean <optional>
If true, the user will be able to remove the alert with a "close" icon.
options.includeEmail boolean <optional>
If true, the alert will include a link to the AppConfig#emailContact
options.emailBody string <optional>
Specify an email body to use in the email link.
Source:

showAlert_deprecated(msg, classesopt, containeropt, delayopt, optionsopt)

Previous to MetacatUI 2.14.0, the AppView#showAlert function allowed up to five parameters to customize the alert message. As of 2.14.0, the function has condensed these options into a single literal object. See the docs for AppView#showAlert. The old signature of five parameters may soon be deprecated completely, but is still supported.
Parameters:
Name Type Attributes Description
msg string | Element
classes string <optional>
container string | Element <optional>
delay boolean <optional>
options object <optional>
Properties
Name Type Attributes Description
includeEmail boolean <optional>
If true, the alert will include a link to the AppConfig#emailContact
emailBody string <optional>
remove boolean <optional>
replaceContents boolean <optional>
Deprecated:
  • Yes
Source:

showTemporaryMessage()

Shows a temporary message at the top of the view
Source:

showTimeoutSignIn()

If the user's auth token has expired, a new SignInView model window is displayed so the user can sign back in. A listener is set on the appUserModel so that when they do successfully sign back in, we set another timeout listener via AppView.listenForTimeout()
Source: