Constructor
new DataItemView()
- Source:
Members
dataItemHierarchyTemplate
The HTML template for a data item
- Source:
events
Events this view listens to
- Source:
metricTemplate :Underscore.template
The HTML template for a data item
Type:
- Source:
The DataONEObject model to display in this view
Type:
- Source:
A reference to the parent EditorView that contains this DataItemView
Type:
- Since:
- Source:
template
The HTML template for a data item
- Source:
Methods
addFiles(event)
With a file list from the file picker or drag and drop, add the files
to the collection
Parameters:
Name |
Type |
Description |
event |
Event
|
The event that triggered this method |
- Source:
canShareItem() → {boolean}
Determine whether this item can be shared
Used to control whether the Share button in the template is enabled or
not.
Has special behavior depending on whether the item is metadata or not.
If metadata (ie type is EML), also checks that the resource map can be
shared. Otherwise, only checks if the data item can be shared.
- Since:
- Source:
Returns:
Whether the item can be shared
-
Type
-
boolean
changeAccessPolicy(e)
Changes the access policy of a data object based on user input.
Parameters:
Name |
Type |
Description |
e |
Event
|
The event that triggered this function as a callback |
- Source:
Removes invalid characters and formatting from the given input string
Parameters:
Name |
Type |
Description |
input |
string
|
The string to clean |
- Source:
Returns:
The cleaned string
-
Type
-
string
emptyName(_e)
Clears the text in the cell if the text was the default. We add an
'empty' class, and remove it when the user focuses back out.
Parameters:
Name |
Type |
Description |
_e |
Event
|
The event that triggered this function as a
callback |
- Source:
generateId() → {string}
Generate a unique id for each data item in the table TODO: This could
be replaced with the DataONE identifier
- Source:
Returns:
A unique identifier string for the data item
-
Type
-
string
getParentDataPackage(event) → {DataPackage}
Return the parent data package collection associated with the data or
metadata row of the UI event
Parameters:
Name |
Type |
Description |
event |
Event
|
The event that triggered this method |
- Source:
Returns:
The parent data package collection
-
Type
-
DataPackage
Return the parent science metadata model associated with the data or
metadata row of the UI event
Parameters:
Name |
Type |
Description |
event |
Event
|
The event that triggered this method |
- Source:
Returns:
The parent science metadata model
-
Type
-
DataONEObject
handleAddFiles(event)
Handle the add file event, showing the file picker dialog. Multiple
files are allowed using the shift and or option/alt key.
Parameters:
Name |
Type |
Description |
event |
Event
|
The event that triggered the file picker dialog. |
- Source:
handleRemove(event)
Handle remove events for this row in the data package table
Parameters:
Name |
Type |
Description |
event |
Event
|
The event that triggered this method |
- Source:
handleReplace(event)
Handle the user's click of the Replace item in the DataItemView
dropdown. Triggers replaceFile after some basic validation.
Called indirectly via the "click" event on elements with the class
.replaceFile. See this View's events map.
Parameters:
Name |
Type |
Description |
event |
MouseEvent
|
Browser Click event |
- Source:
hideDropzone(_event)
Hide the drop zone for this row in the table
Parameters:
Name |
Type |
Description |
_event |
Event
|
The event that triggered this method |
- Source:
hideRequired()
Hides the 'required' styling from this view
- Source:
hideSaving()
- Source:
initialize()
- Source:
onClose()
Close the view and remove it from the DOM
- Source:
previewRemove()
Style this table row to indicate it will be removed
- Source:
render()
- Source:
renderShareControl()
Renders a button that opens the AccessPolicyView for editing
permissions on this data item
- Since:
- Source:
replaceFile(event)
Replace a file (DataONEObject) in the collection with another one from
a file picker. Maintains attributes on the original DataONEObject and
maintains the entity information in the parent collection's metadata
record (i.e., keeps your attributes, etc.).
Called indirectly via the "change" event on elements with the class
.file-upload. See this View's events map.
The bulk of the work is done in a try-catch block to catch mistakes
that would cause the editor to get into a broken state. On error, we
attempt to return the editor back to its pre-replace state.
Parameters:
Name |
Type |
Description |
event |
Event
|
Browser Click event |
- Source:
showDropzone()
Show the drop zone for this row in the table
- Source:
showError(message)
Show an error, e.g. if the file can't be fetched
Parameters:
Name |
Type |
Description |
message |
string
|
The error message to display |
- Since:
- Source:
showSaving()
Show the data item as saving
- Source:
showUploadProgress()
Shows the current progress of the file upload
- Source:
showValidation(attr, _errorMsg)
Shows form validation for this data item
Parameters:
Name |
Type |
Description |
attr |
string
|
The modal attribute that has been validated |
_errorMsg |
string
|
The validation error message to display |
- Source:
toggleSaving()
Show or hide the saving icon and progress bar based on the uploadStatus
of the model
- Source:
updateName(e)
Update the folder name based on the scimeta title
Parameters:
Name |
Type |
Description |
e |
Event
|
The event that triggered this method |
- Source:
uploadFilesInBatch(fileList, batchSizeopt)
Method to handle batch file uploads. This method processes files
independently to avoid being slowed down by large files.
Parameters:
Name |
Type |
Attributes |
Description |
fileList |
FileList
|
|
The list of files to be uploaded. |
batchSize |
number
|
<optional>
|
The number of files to upload
concurrently. |
- Since:
- Source: