Class: MetadataDocumentView

MetadataDocumentView()

Renders science metadata HTML and enhances its markup

Screenshot

Constructor

new MetadataDocumentView()

Since:
  • 2.39.0
Source:

Extends

  • Backbone.View

Members

alertTemplate

Alert template for displaying messages to the user
Source:

alternativeIdentifierHelpText :string

Text to display in the help tooltip for the alternative identifier field, if the field is present.
Type:
  • string
Since:
  • 2.26.0
Source:

dataDisplayTemplate

Template for displaying data details
Source:

events

Source:

mapTemplate

Template for displaying a map of the dataset's spatial coverage
Source:

pid

Source:

Methods

addSubview(view) → {void}

Add a subview to the list of subviews for this view. This is used to keep track of subviews so they can be closed when this view is closed.
Parameters:
Name Type Description
view Backbone.View The subview to add
Source:
Returns:
Type
void

canDrawProvCharts() → {boolean}

Whether the rendered metadata is ready for provenance charts.
Source:
Returns:
Whether the charts can be drawn
Type
boolean

checkForProv() → {void}

Draw provenance charts when the rendered metadata is ready.
Source:
Returns:
Type
void

createAnnotationViews() → {void}

Insert the interactive annotation views.
Source:
Returns:
Type
void

createDataDetailsModel(member) → {SolrResult|null}

Adapt a package member into a model shaped like a SolrResult for the data download/view buttons, which consume the SolrResult API (`get()`, `getInfo()`, `downloadWithCredentials()`).
Parameters:
Name Type Description
member DataPackageMember Package member
Source:
Returns:
The adapter model, or null when no member
Type
SolrResult | null

drawProvCharts() → {void}

Render source and derivation charts beside each data entity.
Source:
Returns:
Type
void

enhanceWithPackage(options) → {MetadataDocumentView}

Add package-dependent details to the rendered metadata document.
Parameters:
Name Type Description
options object Enhancement options
Properties
Name Type Description
editModeOn boolean Whether provenance is editable
Source:
Returns:
This view
Type
MetadataDocumentView

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

Finds the element in the rendered metadata that describes the given data entity.
Parameters:
Name Type Attributes Description
model object | string Either a model/member that represents the data object or the identifier of the data object
containerEl Element <optional>
The DOM element to exclusively search inside
Source:
Returns:
The entity section or false if it cannot be found
Type
jQuery | boolean

findSingleEntityDetailsContainer(id) → {jQuery|boolean}

If there is only one data entity and one entity section, assume they match.
Parameters:
Name Type Description
id string Entity PID
Source:
Returns:
Matching entity section or false
Type
jQuery | boolean

getBoundsZoomLevel(bounds, mapDim) → {number}

Returns the zoom level that will display the given bounding box at the given dimensions.
Parameters:
Name Type Description
bounds LatLngBounds The bounding box to display
mapDim object The dimensions of the map
Properties
Name Type Description
height number The height of the map
width number The width of the map
Source:
Returns:
The zoom level
Type
number

getEntityDetailsLookup(model) → {object}

Normalize the data needed to find one rendered entity section.
Parameters:
Name Type Description
model object | string Model, member, or PID
Source:
Returns:
Lookup values
Type
object

getEntityFileNameForPid(pid) → {string|null}

Get a known file name for a package member PID.
Parameters:
Name Type Description
pid string Package member PID
Source:
Returns:
File name, if known
Type
string | null

getGoogleMapsUrl(latLngCEN, bounds) → {string}

Returns a URL to a Google Maps instance that is centered on the given coordinates and zoomed to the appropriate level to display the given bounding box.
Parameters:
Name Type Description
latLngCEN LatLng The center point of the map
bounds LatLngBounds The bounding box to display
Source:
Returns:
The URL to the Google Maps instance
Type
string

hideMessages() → {void}

Remove all current messages.
Source:
Returns:
Type
void

highlightNode(e) → {void}

When the user clicks on a node in the provenance chart, highlight the node and its metadata section
Parameters:
Name Type Description
e Event The click event
Source:
Returns:
Type
void

initialize(options) → {void}

Initialize the MetadataDocumentView
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
dataPackage DataPackage <optional>
Package containing the object
indexResults Array.<object> <optional>
Existing index records
displayState object <optional>
Resolved display state
editModeOn boolean <optional>
Whether provenance may be edited
signal AbortSignal <optional>
Signal for cancelling requests
viewServiceUrl string <optional>
The URL of the view service to use when rendering the metadata. If not provided, will use the view service URL from the app model
resolveBaseUrl string <optional>
The base URL to use when resolving member identifiers to URLs. Defaults to app model's resolveServiceUrl, then objectServiceUrl, then ""
altIdentifierHelpText string <optional>
Alternative identifier help text
Source:
Returns:
Type
void

initializeAttributeListTables() → {void}

Initialize attribute table tab row highlighting.
Source:
Returns:
Type
void

insertCopiables() → {void}

Enable copy controls rendered by the Metacat View Service.
Source:
Returns:
Type
void

insertDataDetails() → {void}

Enhance each rendered data entity section with the additional details that aren't part of the View Service markup: an inline preview for image objects, and the download/view interaction buttons.
Source:
Returns:
Type
void

insertImagePreview(member, container) → {Promise.<void>}

Insert an inline image preview into a data entity's section.
Parameters:
Name Type Description
member DataPackageMember The image package member
container jQuery The entity section to insert the preview into
Source:
Returns:
Resolves after the preview is prepared
Type
Promise.<void>

insertMarkdownViews() → {void}

Insert the markdown views.
Source:
Returns:
Type
void

insertMissingFallbackFileSections() → {void}

Add file sections omitted when index fallback rendering finished before package membership loaded.
Source:
Returns:
Type
void

insertSpatialCoverageMap(customCoordinatesopt) → {boolean}

Shows a map with the bounding coordinates of the spatial coverage of the dataset.
Parameters:
Name Type Attributes Description
customCoordinates Array <optional>
An array of custom coordinates to use for the map in the order of [north, south, east, west]
Source:
Returns:
Returns false if the map could not be inserted
Type
boolean

onClose() → {void}

Clean up the view and its subviews.
Source:
Returns:
Type
void

previewData(event) → {boolean}

Scroll to a package member instead of navigating away from the dataset.
Parameters:
Name Type Description
event Event Preview link click
Source:
Returns:
Whether the member could be previewed
Type
boolean

redrawProvCharts() → {void}

Step through all prov charts and rerender each one that has been marked for rerendering.
Source:
Returns:
Type
void

render() → {Promise.<MetadataDocumentView>}

Render metadata and enhance the resulting document.
Source:
Returns:
This view
Type
Promise.<MetadataDocumentView>

renderAltIdentifierHelpText() → {jQuery|null}

Inserts an info icon next to the alternate identifier field, if it exists. The icon will display a tooltip with the help text for the field.
Source:
Returns:
The jQuery object for the icon element
Type
jQuery | null

renderDataInteractionButtons(member, container) → {void}

Insert the buttons to download and view a data object beside its entity details. The button views consume a SolrResult shaped model created by createDataDetailsModel()
Parameters:
Name Type Description
member DataPackageMember The package member for the object
container jQuery The entity section that describes the object
Source:
Returns:
Type
void

renderMetadataDocument(metadataViewDoc) → {void}

Insert one normalized document regardless of its original source.
Parameters:
Name Type Description
metadataViewDoc ViewServiceDoc Parsed metadata document
Source:
Returns:
Type
void

renderMetadataFromIndex() → {Promise.<ViewServiceDoc>}

Display metadata fields from the index when View Service rendering is unavailable.
Source:
Returns:
Parsed metadata document
Type
Promise.<ViewServiceDoc>

renderMetadataFromViewService() → {Promise.<ViewServiceDoc>}

Download and validate metadata rendered by the View Service
Source:
Throws:
When the service returns empty or unsupported markup
Type
Error
Returns:
Parsed metadata document
Type
Promise.<ViewServiceDoc>

scheduleProvChartRedraw() → {void}

Queue one provenance redraw for the current metadata document.
Source:
Returns:
Type
void

showMessage(message, optionsopt) → {HTMLElement}

Replace the current message with an alert
Parameters:
Name Type Attributes Description
message string | HTMLElement | jQuery Alert content
options object <optional>
Alert options
Properties
Name Type Attributes Description
type string <optional>
Alert type
Source:
Returns:
Message container
Type
HTMLElement

template() → {string}

Build the containers for messages and rendered metadata
Source:
Returns:
View markup
Type
string