Constructor
new DatasetControls()
- Since:
- Source:
Extends
Members
References to rendered button root elements keyed by name. These will
be added during render().
Type:
-
Object.<string, HTMLElement>
- Source:
Button configuration map keyed by logical button name.
Type:
- Source:
subviews :Array.<Backbone.View>
Subviews created by this view (MetricView, CitationModalView, etc.).
These will be added during render().
Type:
- Source:
Settings passed to the Formantic UI popup module to configure a tooltip
shown over the metric button.
Type:
- Since:
- Source:
- See:
-
Methods
canDisplayMDQ() → {boolean}
Determine if MDQ button should be displayed based on configuration.
- Source:
Returns:
True if MDQ can be displayed, false otherwise.
-
Type
-
boolean
canPublish() → {boolean}
Determine if this metadata can be published with a DOI, assuming the
user has permission to edit it and it is not obsolete or archived.
- Source:
Returns:
True if the metadata can be published, false
otherwise
-
Type
-
boolean
createEditUrl() → {string}
Build the URL to edit this dataset in the submit workflow.
- Source:
Returns:
The edit URL.
-
Type
-
string
Build the WholeTale dropdown menu element from configured environments.
- Source:
Returns:
The populated unordered list element.
-
Type
-
HTMLUListElement
createWholetaleUrl(env) → {string}
Construct a WholeTale URL for the given environment targeting this
dataset.
Parameters:
| Name |
Type |
Description |
env |
string
|
The WholeTale environment name. |
- Source:
Returns:
The generated WholeTale dashboard URL.
-
Type
-
string
events()
- Source:
Check if the current formatId is supported by the metadata quality
suite
- Source:
Returns:
True if the formatId is supported by MDQ, false
otherwise
-
Type
-
boolean
Get the container element where a button should be inserted.
Parameters:
| Name |
Type |
Description |
name |
string
|
Logical button name. |
- Source:
Returns:
The container element or null if not found.
-
Type
-
HTMLElement
|
null
Get a previously rendered button element by name.
Parameters:
| Name |
Type |
Description |
name |
string
|
Logical button name. |
- Source:
Returns:
The button element if it exists.
-
Type
-
HTMLElement
|
null
getMetricsModel() → {MetricsModel}
Get or create the metrics model used to fetch dataset metrics.
- Source:
Returns:
The metrics model instance for this view.
-
Type
-
MetricsModel
initialize(optionsopt)
Initialize the DatasetControls view.
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Options to configure the view.
Properties
| Name |
Type |
Attributes |
Description |
pid |
string
|
<optional>
|
Dataset identifier for this view. |
metadataModel |
SolrResults
|
EML211
|
<optional>
|
Associated
metadata model. |
hasWritePermission |
boolean
|
<optional>
|
Whether the current
user has write permission for the dataset. |
publishMethod |
function
|
<optional>
|
Function to publish the
dataset. It must return a Promise that resolves when publishing is
complete, throwing an error if publishing fails. |
|
- Source:
Determine if the metadata format is editable in this repository.
- Source:
Returns:
True if the current formatId is allowed to edit.
-
Type
-
boolean
isObsoleteOrArchived() → {boolean}
Determine if the dataset is obsolete or archived.
- Source:
Returns:
True if obsolete or archived, otherwise false.
-
Type
-
boolean
onClose()
Methods to run when the view is closed and removed
- Source:
openCitationModal()
Open the citation modal, creating and rendering it if needed.
- Source:
publish(event) → {Promise|null}
Publish the data package with a DOI. Calls the publishMethod passed to
the view during initialization. Updates the button to show progress,
success, or error states.
Parameters:
| Name |
Type |
Description |
event |
Event
|
The click event |
- Source:
Returns:
A promise that resolves/rejects when
publishing is complete, or undefined if publishing did not start.
-
Type
-
Promise
|
null
remove()
- Source:
Remove a button and clear its container.
Parameters:
| Name |
Type |
Description |
name |
string
|
Logical button name to remove. |
- Source:
render() → {this}
Render the view content and all configured buttons/metrics.
- Source:
Returns:
This view instance for chaining.
-
Type
-
this
Render a button by name into its configured container.
Parameters:
| Name |
Type |
Attributes |
Description |
name |
string
|
|
Logical button key. |
options |
object
|
<optional>
|
Button option
Properties
| Name |
Type |
Attributes |
Description |
href |
string
|
<optional>
|
URL for the button link. |
disabled |
boolean
|
<optional>
|
Whether to disable the button.
overrides. |
|
- Source:
Returns:
The root element for the button, or null if
skipped.
-
Type
-
HTMLElement
|
null
renderCitations()
Render the citations metric view if enabled.
- Source:
renderCite()
Show the citation modal with the ability to copy the citation text
- Source:
renderDownloads()
Render the downloads metric view if enabled.
- Source:
renderEdit()
Render the Edit Metadata button if the user is authorized and the
metadata format is editable.
- Source:
renderMDQ()
Render the metadata quality report button
- Source:
renderMetric(name)
Render a specific metric widget by name and insert into its container.
Parameters:
| Name |
Type |
Description |
name |
"downloads"
|
"views"
|
"citations"
|
The metric to render. |
- Source:
renderPublish()
Render the Publish with DOI button if user is authorized and publishing
is allowed.
- Source:
renderViews()
Render the views metric view if enabled.
- Source:
renderWholetale()
Render the WholeTale Analyze dropdown button when configured.
- Source:
reset(destroyCitationModalopt)
Clear the view content and remove subviews and event listeners.
Parameters:
| Name |
Type |
Attributes |
Description |
destroyCitationModal |
boolean
|
<optional>
|
If true, also destroy the
citation modal subview. We avoid this unless the entire view is being
destroyed because the modal is modified externally (see renderCite()). |
- Source:
template() → {string}
Render the container structure for metrics and actions.
- Source:
Returns:
HTML string for the view root content.
-
Type
-
string
Update a button's inner content and classes for a given state.
Parameters:
| Name |
Type |
Attributes |
Description |
name |
string
|
|
Button key |
text |
string
|
<optional>
|
Text label to display |
state |
"default"
|
"progress"
|
"success"
|
"error"
|
|
Visual state |
- Source: