Class: MetadataView

MetadataView()

A human-readable view of a science metadata file

Screenshot

Constructor

new MetadataView()

Source:

Extends

  • Backbone.View

Members

className

Source:

descriptions :object

Descriptions for the tooltips
Type:
  • object
Source:

events

Source:

tagName

Source:

tooltipSettings :object

Settings for the tooltips
Type:
  • object
Source:
See:

type :string

The type of the view
Type:
  • string
Source:

Methods

abortRender() → {void}

Cancel the active render and its scheduled index refresh
Since:
  • 2.39.0
Source:
Returns:
Type
void

addInfoIcon(iconType, iconClass, baseClass, titleText) → {HTMLElement}

Add an info icon to the metadata controls panel.
Parameters:
Name Type Description
iconType string The type of icon to add.
iconClass string The class
baseClass string The base class
titleText string The text to display when the icon is hovered over.
Since:
  • 2.32.0
Source:
Returns:
The icon element that was added to the view.
Type
HTMLElement

addTooltip(element, content)

Add a tooltip to an element
Parameters:
Name Type Description
element HTMLElement The element to add the tooltip to
content string The content of the tooltip
Source:

allVersionsTemplate(url) → {string}

Template for the All Versions link
Parameters:
Name Type Description
url string The URL for the link
Source:
Returns:
The HTML string for the link
Type
string

checkProvenanceWritePermission(optionsopt) → {Promise.<boolean>}

Determine whether provenance may be edited. Provenance editing requires write access to a current, unarchived resource map; it must not be inferred from metadata write permission.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Whether provenance editing is allowed
Type
Promise.<boolean>

checkWritePermissions(optionsopt) → {Promise.<boolean>}

Check whether the user has write permissions on the resource map and the EML. Once the permission checks have finished, continue with the functions that depend on them.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Source:
Returns:
A promise that resolves to true if the user has write permissions, false otherwise.
Type
Promise.<boolean>

closeFileTableView() → {void}

Close and remove the package file table child view.
Since:
  • 2.39.0
Source:
Returns:
Type
void

closeMetadataView() → {void}

Close and remove the rendered metadata child view.
Since:
  • 2.39.0
Source:
Returns:
Type
void

closePopovers(e)

Close any active popovers when the user clicks outside of them
Parameters:
Name Type Description
e Event The click event
Source:

confirmPackageDownloadAll(dataPackage)

Set whole package download state before file table rows are built
Parameters:
Name Type Description
dataPackage DataPackage Package to inspect
Since:
  • 2.39.0
Source:

createDataDetailsModel(member) → {object|null}

Adapt a package member for legacy data detail and download views.
Parameters:
Name Type Description
member DataPackageMember Package member
Since:
  • 2.39.0
Source:
Returns:
Backbone style data model
Type
object | null

downloadFileTableRow(rowModel, actionModel, event) → {Promise.<boolean>}

Download the package or member represented by a file table row.
Parameters:
Name Type Description
rowModel FileItemViewModel File table row model
actionModel FileItemActionViewModel Download action model
event Event Click event
Since:
  • 2.39.0
Source:
Returns:
Whether the row could be downloaded
Type
Promise.<boolean>

downloadPackageFileTableRow(rowModel, actionModel) → {Promise.<boolean>}

Download the package represented by the dataset row.
Parameters:
Name Type Description
rowModel FileItemViewModel Dataset row model
actionModel FileItemActionViewModel Download action model
Since:
  • 2.39.0
Source:
Returns:
Whether the package could be downloaded
Type
Promise.<boolean>

enrichFileTableMemberDetails(optionsopt) → {Promise.<void>}

Load missing System Metadata used by file table rows
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Resolves after enrichment
Type
Promise.<void>

fetchParentPackageMetadata(parentResourceMapPids, optionsopt) → {Promise.<Array.<object>>}

Query for the latest metadata documents in the given parent resource maps.
Parameters:
Name Type Attributes Description
parentResourceMapPids Array.<string> Parent resource map PIDs
options object <optional>
Options
Properties
Name Type Attributes Description
signal AbortSignal <optional>
Active render signal
Since:
  • 2.39.0
Source:
Returns:
Latest parent metadata index docs
Type
Promise.<Array.<object>>

findEntityDetailsContainer(model, containerElopt) → {jQuery|boolean}

Finds the element in the rendered metadata that describes the given data entity.
Parameters:
Name Type Attributes Description
model string | object Data member identifier or model
containerEl Element | jQuery <optional>
Container to search within
Since:
  • 2.39.0
Source:
Returns:
The entity section or false if it cannot be found
Type
jQuery | boolean

getAllVersionsUrl(pid) → {string}

Get the URL to view all versions of a metadata document by its PID
Parameters:
Name Type Description
pid string The PID of the metadata document
Source:
Returns:
The URL to view all versions of the metadata document
Type
string

getDataMemberIsPublic(member) → {boolean|null}

Get the public read flag for a data member.
Parameters:
Name Type Description
member DataPackageMember Package member
Since:
  • 2.39.0
Source:
Returns:
Public read state
Type
boolean | null

getFileListingNotice(state) → {object|null}

Build the FileTableView notice attributes for a listing state.
Parameters:
Name Type Description
state string | null File listing state
Since:
  • 2.39.0
Source:
Returns:
File table notice attributes
Type
object | null

getFileTableRows(fallbackMember) → {Array.<object>}

Convert the current data package members to generic file table rows.
Parameters:
Name Type Description
fallbackMember object | null Member to display when the package has no rows yet
Since:
  • 2.39.0
Source:
Returns:
File table rows
Type
Array.<object>

getParentResourceMapPids(rmMember, optionsopt) → {Promise.<Array.<string>>}

Resolve the resource map PIDs that aggregate this package's resource map (its parents). Prefers the resolved member's `resourceMap` index field and falls back to querying the resource map object directly.
Parameters:
Name Type Attributes Description
rmMember DataPackageMember Root resource map member
options object <optional>
Options
Properties
Name Type Attributes Description
signal AbortSignal <optional>
Active render signal
Since:
  • 2.39.0
Source:
Returns:
Parent resource map PIDs, excluding this package's own resource map
Type
Promise.<Array.<string>>

getRenderOptions(optionsopt) → {object}

Fill in the active render identifier for child work
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Properties
Name Type Attributes Description
renderId string <optional>
Render identifier
signal AbortSignal <optional>
Cancellation signal
Since:
  • 2.39.0
Source:
Returns:
Render options
Type
object

getViewUrl(pid) → {string}

Get the URL to view a metadata document by its PID
Parameters:
Name Type Description
pid string The PID of the metadata document
Source:
Returns:
The URL to view the metadata document
Type
string

handleDataInput(result, optionsopt) → {Promise.<MetadataView>}

Handle an input PID that resolves to a data object: route to the metadata that documents it, preserving the data PID in the URL fragment, or fall back when the documenting metadata is ambiguous or absent.
Parameters:
Name Type Attributes Description
result object Resolution result from resolveFromPid
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
This view
Type
Promise.<MetadataView>

handleFileTableAction(rowModel, actionModel, event) → {boolean|Promise.<boolean>}

Handle an action emitted by the generic file table.
Parameters:
Name Type Description
rowModel FileItemViewModel File table row model
actionModel FileItemActionViewModel Action view model
event Event Click event
Since:
  • 2.39.0
Source:
Returns:
Whether the action was handled
Type
boolean | Promise.<boolean>

handleFileTableNoticeAction(actionId) → {void}

Handle a table level file listing action.
Parameters:
Name Type Description
actionId string Action id
Since:
  • 2.39.0
Source:
Returns:
Type
void

hasRecoverablePackageRecord(optionsopt) → {Promise.<boolean>}

Check whether this viewer has a local interrupted save record.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Whether recovery is available
Type
Promise.<boolean>

hideEditorControls()

Hide the editor controls
Source:

hideLoading()

Hide the loading message
Source:

hideSaving()

Activate the save button after the save process
Source:

initialize(options)

Initialize the MetadataView
Parameters:
Name Type Description
options object Object containing the view's options
Properties
Name Type Attributes Description
pid string <optional>
The identifier of the metadata object to render
el string <optional>
The jQuery selector for the element in which to render the view
Source:

initialize(options)

Initialize the VersionNavigationView
Parameters:
Name Type Description
options object Object containing the view's options
Properties
Name Type Attributes Description
pid pid The PID of the metadata document
showAllVersionsLink boolean <optional>
Whether to show a link to view all versions of the document. This will be always be false if the AppModel's showVersionHistory setting is false.
descriptions object <optional>
An object containing custom descriptions for the tooltips
documentType string <optional>
The type of document (e.g. dataset, article, etc.) to use in the default tooltip descriptions
signal AbortSignal <optional>
Signal used to abort version lookups
Source:

insertBreadcrumbs()

Add breadcrumbs to the page to show the user where they are in the app
Source:

insertCitation()

Insert the citation header into the view
Source:

insertCitationMetaTags()

Insert citation information as meta tags into the head of the page Currently supports Highwire Press style tags (citation_) which is supposedly what Google (Scholar), Mendeley, and Zotero support.
Source:

insertDataSource()

Show a logo for the repository that hosts this metadata
Source:

insertPackageTable(fallbackMember, options) → {MetadataView}

Inserts the refactored file table into the metadata view.
Parameters:
Name Type Description
fallbackMember object | null Optional member to render when the data package has not been populated
options object File table options
Source:
Returns:
This view
Type
MetadataView
Insert a link to the parent dataset(s) when this package is nested inside another package. The parents are the latest metadata documents aggregated by the resource map(s) that aggregate this package's resource map.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Source:
Returns:
Type
Promise.<void>

isCurrentDataPackage(dataPackage) → {boolean}

Check whether table specific async work still targets this package.
Parameters:
Name Type Description
dataPackage DataPackage DataPackage captured before an await
Since:
  • 2.39.0
Source:
Returns:
True when the package is still active
Type
boolean

isCurrentFileTable(dataPackage, fileTableView, optionsopt) → {boolean}

Check whether asynchronous work belongs to the active file table
Parameters:
Name Type Attributes Description
dataPackage DataPackage Captured package
fileTableView FileTableView Captured file table
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Whether the file table is current
Type
boolean

isCurrentRender(renderId) → {boolean}

Check whether asynchronous work belongs to the active render
Parameters:
Name Type Description
renderId string Render identifier
Since:
  • 2.39.0
Source:
Returns:
Whether the render is active
Type
boolean

loadFileTableMetrics() → {Promise.<void>}

Fetch per PID metrics for the file table in a single grouped request and merge the values into existing rows. Best effort: failures leave metric cells empty.
Since:
  • 2.39.0
Source:
Returns:
Type
Promise.<void>

loadNestedPackageTitles(optionsopt) → {Promise.<void>}

Load dataset titles for nested resource maps from their metadata docs.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Type
Promise.<void>

loadPackageMembers(dataPackage, unauthorizedPackage, optionsopt) → {Promise.<(object|null)>}

Load members from the authoritative resource map, then enrich them from the index. Fall back to index membership when the resource map cannot be loaded.
Parameters:
Name Type Attributes Description
dataPackage DataPackage Package receiving loaded members
unauthorizedPackage boolean Whether resolution was unauthorized
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Package load state, or null when a newer render starts
Type
Promise.<(object|null)>

mergeCurrentFileTableRows(dataPackage, fileTableView, optionsopt) → {Promise.<boolean>}

Replace rows in the active file table
Parameters:
Name Type Attributes Description
dataPackage DataPackage Captured package
fileTableView FileTableView Captured file table
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Whether rows were merged
Type
Promise.<boolean>

metadataHeaderNeedsIndexRefresh(dataPackageopt) → {boolean}

Check whether the metadata header lacks indexed display fields
Parameters:
Name Type Attributes Description
dataPackage DataPackage <optional>
Package to inspect
Since:
  • 2.39.0
Source:
Returns:
Whether index metadata is needed
Type
boolean

modifyMetadataView(renderOptions, metadataView) → {Promise.<MetadataView>}

Enhance the rendered metadata document and finish the landing page
Parameters:
Name Type Description
renderOptions object Active render options
metadataView MetadataDocumentView Rendered document view
Since:
  • 2.39.0
Source:
Returns:
This view
Type
Promise.<MetadataView>
Navigate to a new /view URL with a fragment Used in getModel() when the pid originally passed into MetadataView is not a metadata PID but is, instead, a data PID. getModel() does the work of finding an appropriate metadata PID for the data PID and this method handles re-routing to the correct URL.
Parameters:
Name Type Description
metadataPid string The new metadata PID
dataPid string Optional. A data PID that's part of the package metadataPid exists within.
Source:

normalizeResourceMapList(raw, selfPid) → {Array.<string>}

Normalize a resourceMap relationship value to an array of PIDs, excluding the package's own resource map PID.
Parameters:
Name Type Description
raw string | Array.<string> The raw resourceMap value
selfPid string The package's own resource map PID to exclude
Since:
  • 2.39.0
Source:
Returns:
Parent resource map PIDs
Type
Array.<string>

onClose()

Actions to perform when the view is closed
Source:

onClose()

Clean up tasks before the view is closed
Source:

onModelError(status, message)

When there is an error retrieving the metadata from Solr, check the status code. If it's a 404, check if the object exists in the system and is just indexing. If it's a 401, show a message that this dataset is private. For other errors, show a generic error message with the status code and message if they exist.
Parameters:
Name Type Description
status string | number The status code of the error
message string The error message
Since:
  • 2.39.0
Source:

packageNeedsIndexRefresh(dataPackageopt) → {boolean}

Check whether the package still needs index enrichment
Parameters:
Name Type Attributes Description
dataPackage DataPackage <optional>
Package to inspect
Since:
  • 2.39.0
Source:
Returns:
Whether index data is still needed
Type
boolean

prepareCitationModel() → {void}

Prepare the citation/header model from the current metadata member.
Since:
  • 2.39.0
Source:
Returns:
Type
void

prevNextBtnTemplate(url, direction) → {string}

Template for the Previous and Next version buttons
Parameters:
Name Type Description
url string The URL for the button
direction "next" | "prev" The direction of the button
Source:
Returns:
The HTML string for the button
Type
string

previewData(event) → {boolean}

Delegate in-page data previews to the rendered metadata document.
Parameters:
Name Type Description
event Event Preview link click
Source:
Returns:
Whether the member could be previewed
Type
boolean

previewFileTableRow(rowModel, event) → {boolean}

Scroll to the rendered entity section for a file table preview click.
Parameters:
Name Type Description
rowModel FileItemViewModel File table row model
event Event Click event
Since:
  • 2.39.0
Source:
Returns:
True when a row was handled
Type
boolean

publish() → {Promise.<string>}

Publish the current package after user confirmation.
Source:
Throws:
When publishing is cancelled or fails
Type
Error
Returns:
Published package identifier
Type
Promise.<string>

refreshMetadataHeaderFromPackage(dataPackageopt, optionsopt) → {boolean}

Refresh the header from the active package metadata
Parameters:
Name Type Attributes Description
dataPackage DataPackage <optional>
Package to read
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Whether the header was refreshed
Type
boolean

refreshMetadataTitleFromIndex(dataPackage, optionsopt) → {Promise.<boolean>}

Refresh a missing metadata title from the index
Parameters:
Name Type Attributes Description
dataPackage DataPackage Package to update
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Whether the header was refreshed
Type
Promise.<boolean>

remove()

Source:

removeViewAlert() → {void}

Remove the current app alert owned by MetadataView, if any.
Since:
  • 2.39.0
Source:
Returns:
Type
void

render()

Source:

render()

Source:

renderControls() → {void}

Render controls for the current metadata object
Since:
  • 2.39.0
Source:
Returns:
Type
void

renderInfoIcons(optionsopt) → {Promise.<void>}

Add the info icons to the metadata controls panel. Shows if the dataset is private or archived.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Since:
  • 2.32.0
Source:
Returns:
Resolves when public state has been checked
Type
Promise.<void>

renderMetadata(optionsopt) → {MetadataView}

Render the main components of the metadata view. Insert HTML from the view service or fallback to rendering from the index. Insert breadcrumbs, citation, data source logo, metadata controls, and metadata metrics.
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Source:
Returns:
This view
Type
MetadataView

renderMetadataShell(optionsopt) → {void}

Render the page shell before the full metadata body is available.
Parameters:
Name Type Attributes Description
options object <optional>
Shell options
Properties
Name Type Attributes Description
metadataMessage string <optional>
Metadata loading message
Since:
  • 2.39.0
Source:
Returns:
Type
void

renderNoMetadata(optionsopt) → {MetadataView}

Render a limited view for a package that has no identifiable science metadata (a data PID with no documenting metadata, or a resource map with no metadata member). Shows the package files that can be displayed and explains that descriptive metadata is unavailable. Never renders the data object or resource map XML as science metadata.
Parameters:
Name Type Attributes Description
options object <optional>
Options
Properties
Name Type Attributes Description
id string <optional>
Resource map or object PID to anchor the limited view on
renderId string <optional>
Active render identifier
signal AbortSignal <optional>
Active render signal
Since:
  • 2.39.0
Source:
Returns:
This view
Type
MetadataView

repairDataset(metadataPid) → {Promise.<void>}

Finish an interrupted save by replaying its durable local recovery record, then reload so the recovered package resolves.
Parameters:
Name Type Description
metadataPid string Metadata PID with an interrupted save
Since:
  • 2.39.0
Source:
Returns:
Resolves once recovery has been attempted
Type
Promise.<void>

resolveFileListingState(result, packageError, optionsopt) → {Promise.<(string|null)>}

Choose the quiet file listing note for the table header.
Parameters:
Name Type Attributes Description
result object Resolution result from DataPackageLoader
packageError object | null Resource map / manifest load error
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
File listing state, or null
Type
Promise.<(string|null)>

resolveInput(dataPackage, optionsopt) → {Promise.<(object|null)>}

Resolve the input PID, retrying without a trailing route section when the full value is not found
Parameters:
Name Type Attributes Description
dataPackage DataPackage Package used to resolve the input
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Resolution result, or null when a newer render starts
Type
Promise.<(object|null)>

saveError(errorMsg)

When the data package collection fails to save, tell the user
Parameters:
Name Type Description
errorMsg string The error message to display
Source:

saveProv()

If provenance relationships have been modified by the provenance editor (in ProvChartView), then update the ORE Resource Map and save it to the server.
Source:

saveSuccess()

When the data package collection saves successfully, tell the user
Source:

scheduleFileTableIndexRefresh(dataPackage, fileTableView, optionsopt) → {void}

Poll the index for package details that are still processing
Parameters:
Name Type Attributes Description
dataPackage DataPackage Captured package
fileTableView FileTableView Captured file table
options object <optional>
Render options
Since:
  • 2.39.0
Source:
Returns:
Type
void

scheduleFileTableScrollIndicatorUpdate() → {void}

Schedule one overflow cue update for the file table
Since:
  • 2.39.0
Source:
Returns:
Type
void

scrollToFragment()

Try to scroll to the section on a page describing the identifier in the fragment/hash portion of the current page. This function depends on there being an `id` dataset attribute on an element on the page set to an XML-safe version of the value in the fragment/hash. Used to provide direct links to sub-resources on a page.
Source:

selectContainers() → {object}

Convenience method to select important containers in the view
Source:
Returns:
An object containing references to the containers for the previous & next button containers and the all versions link container.
Type
object

setupFileTableScrollIndicators(container) → {void}

Observe a file table scroll container and update its overflow cue
Parameters:
Name Type Description
container HTMLElement Scroll container
Since:
  • 2.39.0
Source:
Returns:
Type
void

showEditorControls()

Show the editor controls
Source:

showError(msg, optionsopt)

Show an error message to the user
Parameters:
Name Type Attributes Description
msg string The error message to display
options object <optional>
Additional options to pass to the alert template.
Source:

showIndexing() → {void}

Show that the object exists but is not indexed yet
Since:
  • 2.39.0
Source:
Returns:
Type
void

showIndexingOrNotFound()

Render the authoritative resolver state when Solr returns a 404.
Since:
  • 2.39.0
Source:

showIsPrivate()

When the metadata object is private, display a message to the user
Source:

showLatestVersion(pid)

Show an alert at the top of the metadata if there is a newer version of this metadata available
Parameters:
Name Type Description
pid string The PID of the latest version. If null or undefined, the alert will be removed.
Source:

showLoading(message)

Indicate that the metadata is being loaded
Parameters:
Name Type Description
message string The message to display while loading
Source:

showMultipleDocumentingDatasets(result) → {void}

Handle a data PID documented by more than one independent metadata version chain. Lists each candidate dataset (preserving the data PID in the fragment) rather than selecting one arbitrarily.
Parameters:
Name Type Description
result object Resolution result from resolveFromPid
Since:
  • 2.39.0
Source:
Returns:
Type
void

showMultipleResourceMaps(result, optionsopt) → {void}

Handle metadata that is linked to multiple unrelated resource maps. Lists each candidate with its upload time and /view/ route.
Parameters:
Name Type Attributes Description
result object Resolution result from resolveFromPid
options object <optional>
Options
Properties
Name Type Attributes Description
scoped boolean <optional>
When true, metadata is already on screen and the warning stays in the file/package area; when false the warning replaces the page
Since:
  • 2.39.0
Source:
Returns:
Type
void

showNotFound()

When the metadata object doesn't exist, display a message to the user
Source:

showSaving()

Inactivate the save button during the save process
Source:

showVersionNavigation(optionsopt)

Show the previous/next version navigation buttons
Parameters:
Name Type Attributes Description
options object <optional>
Render options
Since:
  • 2.36.0
Source:

showViewAlert(…args) → {Array.<Element>|Element|null}

Show an app alert owned by MetadataView and keep a handle so it can be removed when this view is replaced.
Parameters:
Name Type Attributes Description
args * <repeatable>
Arguments forwarded to AppView.showAlert()
Since:
  • 2.39.0
Source:
Returns:
The alert element returned by AppView.showAlert()
Type
Array.<Element> | Element | null

startMetadataRender(metadata, options) → {Promise.<MetadataDocumentView>|null}

Start rendering the active metadata document without waiting for the rest of the package to resolve.
Parameters:
Name Type Description
metadata DataPackageMember Metadata member to render
options object Render options
Properties
Name Type Description
renderId string Render identifier
Since:
  • 2.39.0
Source:
Returns:
In-flight render
Type
Promise.<MetadataDocumentView> | null

startRender() → {Object}

Start a render and cancel work from the previous render
Since:
  • 2.39.0
Source:
Returns:
Render identity
Type
Object

stopPackageLoading() → {void}

Remove the loading indicator from the file and package area
Since:
  • 2.39.0
Source:
Returns:
Type
void

teardownFileTableScrollIndicators() → {void}

Remove file table scroll and resize observers
Since:
  • 2.39.0
Source:
Returns:
Type
void

template() → {string}

Template for the view
Source:
Returns:
The HTML string for the view
Type
string

updateDataPackageLoadProgress(progressopt) → {void}

Update the loading message for a typed DataPackage load phase.
Parameters:
Name Type Attributes Description
progress object <optional>
DataPackage load progress payload
Since:
  • 2.39.0
Source:
Returns:
Type
void

updateFileTableScrollIndicators() → {boolean}

Update whether the file table has more content below
Since:
  • 2.39.0
Source:
Returns:
Whether more rows are below the viewport
Type
boolean

updateLoadingText(message) → {void}

Update the visible loading message, if one is currently rendered.
Parameters:
Name Type Description
message string Loading message
Since:
  • 2.39.0
Source:
Returns:
Type
void