Constructor
new DataItemView()
- Source:
Members
dataItemHierarchyTemplate
The HTML template for a data item
- Source:
events
Events this view listens to
- 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
|
|
- 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:
-
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
|
|
- Source:
generateId()
Generate a unique id for each data item in the table
TODO: This could be replaced with the DataONE identifier
- Source:
getParentDataPackage(event)
Return the parent data package collection associated with the
data or metadata row of the UI event
Parameters:
Name |
Type |
Description |
event |
Event
|
|
- Source:
Return the parent science metadata model associated with the
data or metadata row of the UI event
Parameters:
Name |
Type |
Description |
event |
Event
|
|
- Source:
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
|
|
- Source:
handleRemove(event)
Handle remove events for this row in the data package table
Parameters:
Name |
Type |
Description |
event |
Event
|
|
- 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()
Hide the drop zone for this row in the table
- Source:
hideRequired()
Hides the 'required' styling from this view
- Source:
hideSaving()
- Source:
initialize()
Initialize the object - post constructor
- 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(model)
Renders a DataItemView for the given DataONEObject
Parameters:
- 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
|
|
- Source:
showDropzone()
Show the drop zone for this row in the table
- 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:
updateName(e)
Update the folder name based on the scimeta title
Parameters:
Name |
Type |
Description |
e |
|
The event triggering this method |
- Source: