Constructor
new DataObjectView()
- Since:
- Source:
Extends
Members
alertTemplate :UnderscoreTemplate
The template for the alert message
Type:
- Source:
className
- Source:
The data formats that are supported by this view, mapped to the
functions that render them, i.e. { renderFunction: [format1, format2]
}. Formats should include all relevant DataONE object formats as well
as the possible Content-Type values from the headers of the response.
Type:
- Source:
loadingTemplate :UnderscoreTemplate
The template for the loading spinner
Type:
- Source:
sizeLimit :number|null
The file size limit for viewing files, in bytes. If the file is larger
than this limit, the object will not be displayed. Default is 20 megabytes.
Type:
- Source:
tagName
- Source:
type
- Source:
Methods
downloadObject() → {Promise}
Downloads the DataONE object
- Source:
Returns:
Promise that resolves with the Response from DataONE
-
Type
-
Promise
Fetches the metadata for the object
Parameters:
Name |
Type |
Description |
callback |
function
|
The function to call when the metadata is
fetched |
- Source:
handleResponse(response)
Handle the response from the DataONE object API. Renders the data and
shows the download button if the response is successful.
Parameters:
Name |
Type |
Description |
response |
Response
|
The response from the DataONE object API |
- Source:
Checks if the model has the required metadata fields
- Source:
Returns:
True if the model has the required metadata fields
and they are not empty
-
Type
-
boolean
hideLoading()
Remove the loading spinner
- Source:
initialize(options)
Initializes the DataObjectView
Parameters:
Name |
Type |
Description |
options |
object
|
Options for the view
Properties
Name |
Type |
Attributes |
Description |
model |
SolrResult
|
|
A SolrResult model |
id |
string
|
|
The ID of the DataONE object to view. Used
to create a SolrResult model if one is not provided. |
buttonContainer |
Element
|
<optional>
|
The container for the
download button (defaults to the view's element) |
|
- Source:
Checks if the size and format of the object are valid
- Source:
Returns:
True if the size and format are valid, or an
object with error messages if they are not
-
Type
-
boolean
|
object
render()
- Source:
Renders a download button
- Source:
renderObject(response)
With the already fetched DataONE object, check the format and render
the object accordingly.
Parameters:
Name |
Type |
Description |
response |
Response
|
The response from the DataONE object API |
- Source:
renderTable(response)
Shows the CSV file as a table
Parameters:
Name |
Type |
Description |
response |
Response
|
The response from the DataONE object API |
- Source:
showError(message)
Display an error message to the user
Parameters:
Name |
Type |
Description |
message |
string
|
The error message to display |
- Source:
showLoading(messageopt)
Indicate that the data is loading
Parameters:
Name |
Type |
Attributes |
Description |
message |
string
|
<optional>
|
The message to display while loading |
- Source: