Class: AutofillAttributesView

AutofillAttributesView()

Screenshot

new AutofillAttributesView()

Source:

Extends

  • Backbone.View

Members

actionConfig :object

The configuration options for the actions available in the view.
Type:
  • object
Properties:
Name Type Description
fillFromFile Action The configuration for the "Fill from file" action.
copyFrom Action The configuration for the "Copy from" action.
copyTo Action The configuration for the "Copy to" action.
Source:

actions :object

The view will populate actions with a cloned copy of the action options. It will be modified to add references to the elements created for each action. See actionConfig for the options.
Type:
  • object
Source:

alertTemplate :UnderscoreTemplate

The template for the alert message
Type:
  • UnderscoreTemplate
Source:

buttonTooltipSettings :object

Settings for the semantic UI popup used to indicate that an attribute will be removed when the remove button is clicked
Type:
  • object
Source:

className :string

The className to add to the view container
Type:
  • string
Source:

errors :object

Records any errors that occur during the autofill process. This object is used to store error messages and other relevant information.
Type:
  • object
Source:

fillableFormats :Array.<string>

A list of file formats that can be auto-filled with attribute information
Type:
  • Array.<string>
Source:

Methods

actionPanelTemplate(id, text) → {HTMLDivElement}

Creates an action panel template as a DOM element.
Parameters:
Name Type Description
id string The unique identifier for the action panel.
text string The text content to display in the panel.
Source:
Returns:
The generated action panel as a `div` element.
Type
HTMLDivElement

actionTabTemplate(target, icon, text) → {HTMLLIElement}

Creates a Bootstrap-styled navigation tab element.
Parameters:
Name Type Description
target string The ID of the target tab content to be displayed when this tab is selected.
icon string The CSS class name(s) for the icon to be displayed on the tab.
text string The text to be displayed on the tab.
Source:
Returns:
- The `
  • ` element representing the navigation tab.
  • Type
    HTMLLIElement

    canCopyFrom() → {"no other files"|"no valid attributes"|true}

    Checks whether attributes can be copied from other files.
    Source:
    Returns:
    - "no other files" if there are no files to copy from - "no valid attributes" if no valid attributes exist in other files - true if all checks pass
    Type
    "no other files" | "no valid attributes" | true

    canCopyTo() → {"no attributes"|"invalid attributes"|"no other files"|true}

    Checks whether attributes can be copied to other files.
    Source:
    Returns:
    - "no attributes" if there are no attributes to copy - "invalid attributes" if the attributes are invalid - "no other files" if there are no other files to copy to - true if all checks pass
    Type
    "no attributes" | "invalid attributes" | "no other files" | true

    createOption(entity) → {HTMLOptionElement}

    Creates an option element for a file in the "Copy from" dropdown.
    Parameters:
    Name Type Description
    entity object The entity model representing the file.
    Source:
    Returns:
    The created option element.
    Type
    HTMLOptionElement

    events()

    Source:

    getCheckedValues(container) → {Array.<string>}

    Retrieves the values of all checked checkboxes within a specified container.
    Parameters:
    Name Type Description
    container HTMLElement The container element to search for checked checkboxes.
    Source:
    Returns:
    An array of values from the checked checkboxes.
    Type
    Array.<string>

    getOtherEntities() → {Array.<object>}

    Retrieves the entities representing other files in the collection.
    Source:
    Returns:
    An array of entity models.
    Type
    Array.<object>

    getOtherFileNames() → {Array.<string>}

    Retrieves the names of other files in the collection.
    Source:
    Returns:
    An array of file names.
    Type
    Array.<string>

    handleActionButtonClick(event)

    Performs the action associated with the clicked button. This method retrieves the action name from the button's data attribute and invokes the corresponding method to handle the action.
    Parameters:
    Name Type Description
    event event The event object containing the action name.
    Source:

    handleCopyFrom(action)

    Handles the "Copy From" action for copying attributes from a selected file to the current file.
    Parameters:
    Name Type Description
    action Action The action object containing configuration for the "Copy from" action.
    Source:

    handleCopyFromSelectChange()

    Handles the change event for the "Copy from" select element. This function updates the button state based on the selected file and disables the button if no valid attributes are available for copying.
    Source:

    handleCopyTo()

    Handles the "Copy To" action for copying attributes from the current entity to selected entities within the collection. This function retrieves the selected entities, copies the attributes using the `copyAttributeList` method, and provides feedback to the user via button updates.
    Source:

    handleCopyToCheckboxChange(event)

    Handles the change event for checkboxes in the "Copy To" action. Updates the button state based on the number of selected checkboxes.
    Parameters:
    Name Type Description
    event Event The change event triggered by a checkbox.
    Source:

    handleEntityUpdate()

    Handles the update of entity panels by re-rendering all non-active panels. This method identifies the currently active panel and iterates over the available actions to re-render the panels that are not active.
    Source:

    handleFill()

    Handles the "Fill from file" action by determining whether to use a File object or fetch the file contents.
    Source:

    handleFillViaFetch()

    Handles the "Fill from file" action by fetching the file contents.
    Source:

    handleFillViaFile(file)

    Handles the "Fill from file" action using a File object.
    Parameters:
    Name Type Description
    file File A File object to fill from.
    Source:

    initialize(options)

    Creates a new AutofillAttributesView
    Parameters:
    Name Type Description
    options object A literal object with options to pass to the view
    Properties
    Name Type Attributes Description
    collection EMLAttributes The collection of EMLAttribute models to display
    parentModel EMLEntity The entity model to which these attributes belong
    isNew boolean <optional>
    Set to true if this is a new attribute
    Source:

    isFillable() → {boolean}

    Checks whether the current file format is supported for the "Fill from file" action.
    Source:
    Returns:
    True if the format is supported, false otherwise.
    Type
    boolean

    onClose()

    Cleans up the view by removing all event listeners.
    Source:

    render()

    Source:

    renderAction(name, activateopt)

    Renders an action tab and panel in the view, and sets up event listeners for the action's button.
    Parameters:
    Name Type Attributes Description
    name string The name of the action to render. Must match a key in the actionConfig object.
    activate boolean <optional>
    If true, the action will be set as the active tab.
    Source:

    renderActions()

    Renders all actions defined in the actionConfig object. This method creates tabs and panels for each action and sets up event listeners.
    Source:

    renderCopyFrom(action)

    Renders the "Copy from" action, allowing the user to copy attributes from another file to the current file.
    Parameters:
    Name Type Description
    action Action The action object containing configuration for the "Copy from" action.
    Source:

    renderCopyTo(action)

    Renders the "Copy to" action, which allows the user to copy attributes from the current file to other files in the package.
    Parameters:
    Name Type Description
    action Action The action object containing configuration for the "Copy to" action.
    Source:

    renderFillFromFile(action)

    Renders the "Fill from file" action, allowing the user to autofill attributes from the uploaded file.
    Parameters:
    Name Type Description
    action Action The action object containing configuration for the "Fill from file" action.
    Source:

    showCantCopyFrom(reason)

    Displays a message and disables the button when attributes cannot be copied.
    Parameters:
    Name Type Description
    reason string The reason why attributes cannot be copied.
    Source:

    showCantCopyTo(reason)

    Displays a warning message and updates the UI when attributes cannot be copied to other files.
    Parameters:
    Name Type Description
    reason "no attributes" | "invalid attributes" | "no other files" The reason why attributes cannot be copied.
    Source:

    showNotification(actionName, msg, classes, emptyContainer)

    Displays a notification message in the UI.
    Parameters:
    Name Type Description
    actionName string The key of the action to show the notification in.
    msg string The message to show in the notification.
    classes Array.<string> The classes to add to the notification.
    emptyContainer boolean Set to true to remove any existing notifications in the container.
    Source:

    showWrongFormat()

    Displays a notification when the file format is not supported for autofill.
    Source:

    template() → {DocumentFragment}

    Generates the HTML template for the AutofillAttributesView.
    Source:
    Returns:
    The HTML template content for the AutofillAttributesView.
    Type
    DocumentFragment

    tryParseAndFillAttributeNames(content)

    Attempts to parse the header of a file and fill attribute names.
    Parameters:
    Name Type Description
    content string The content of the file to parse.
    Source:

    updateButton(buttonEl, state)

    Updates a button to show a new status.
    Parameters:
    Name Type Description
    buttonEl HTMLElement The button to update.
    state ButtonState The new state to set for the button.
    Source: