Constructor
new VersionHistoryView()
Backbone view that orchestrates fetching the version chain for a PID and
visualizing it as a grouped timeline with citations and status updates.
- Since:
- Source:
Extends
Members
className :string
CSS class names applied to the view's root element.
Type:
- Source:
tagName :string
Root element tag for the view.
Type:
- Source:
Settings for the toggle and refresh button tooltips. Can be set to
false to disable tooltips entirely.
Type:
- Source:
type :string
Identifier used when the application inspects view types.
Type:
- Source:
Methods
abortChainFetch(reasonopt)
Abort the current request to find all versions
Parameters:
| Name |
Type |
Attributes |
Description |
reason |
string
|
<optional>
|
Optional reason for aborting, useful for
debugging. |
- Source:
Add tooltips to Version views once they're rendered and in the DOM.
- Source:
applyDateNotes(conflicts)
Apply row-level notes for detected version date conflicts, i.e.
cases where the date a obsoleting version was uploaded is *earlier*
than the date of the version it obsoletes.
Parameters:
| Name |
Type |
Description |
conflicts |
Array.<VersionTracker.DateConflict>
|
An array of
detected version date conflicts. If not provided, any existing row
notes will be cleared. |
- Source:
clearDateNotes()
Remove any row-level date note flags from version models.
- Source:
findVersions() → {Promise.<void>}
Requests the full version chain for the view's PID.
- Source:
Returns:
-
Type
-
Promise.<void>
getErrorMessage(record) → {string}
Generates an error message based on the obsolescence chain record.
Parameters:
| Name |
Type |
Description |
record |
object
|
The version tracker record for the current PID. |
- Source:
Returns:
A concatenated error message based on the record's
properties.
-
Type
-
string
getVersionSummaryMessage() → {string}
Generates HTML strings for the number of next and previous versions.
- Source:
Returns:
A string summarizing the number of versions found for
the current PID.
-
Type
-
string
initialize(optionsopt)
Initializes the VersionHistoryView and prepares the version tracker.
Parameters:
| Name |
Type |
Attributes |
Description |
options |
object
|
<optional>
|
Configuration options for the view.
Properties
| Name |
Type |
Attributes |
Description |
pid |
string
|
<optional>
|
The PID whose history should be shown. |
|
- Source:
listenToVersionsFound()
Sets up listeners to respond to VersionTracker updates and to mirror
the fetched collection into the timeline groups collection.
- Source:
onClose()
Cleans up listeners, nested views, and collections before re-rendering
or destroying the view.
- Source:
onToggle(value)
When the toggle is changed, update the "hiddenByUI" attribute on each object
model to control whether it is shown in the timeline groups.
Parameters:
| Name |
Type |
Description |
value |
"all"
|
"doi"
|
The currently selected toggle value. |
- Source:
onVersionFound(sysMeta)
Runs when the VersionTracker notifies the view that a new version
of the PID has been found.
Parameters:
| Name |
Type |
Description |
sysMeta |
object
|
The system metadata object for the found
version. |
- Source:
refresh()
Refresh the version history by clearing the VersionTracker cache and
re-rendering the view (which will trigger a new fetch).
- Source:
remove()
- Source:
Renders the base markup and loads version history for the current PID.
- Source:
Returns:
The current view instance.
-
Type
-
VersionHistoryView
Fetches additional Solr metadata so the citation header can be
rendered.
- Source:
Renders the refresh button, which allows users to clear stored versions
and re-fetch the version history from the server.
- Source:
renderToggle()
Create the toggle view for showing all versions vs. DOI-only versions,
and listen for changes to update the timeline groups accordingly.
- Source:
showComplete(erroropt)
Displays a success banner once the VersionTracker finishes traversing.
Parameters:
| Name |
Type |
Attributes |
Description |
error |
string
|
<optional>
|
An optional error message to append. |
- Source:
showError(message)
Displays an error banner in the status region.
Parameters:
| Name |
Type |
Description |
message |
string
|
The error message to display. |
- Source:
showLoading()
Presents a loading message in the status region.
- Source:
showPartial(erroropt)
Displays a warning banner if the VersionTracker could not fully
traverse the version chain.
Parameters:
| Name |
Type |
Attributes |
Description |
error |
string
|
<optional>
|
An optional error message to append. |
- Source:
showProgress(messageopt)
Updates the status region to show progress as versions are found.
Parameters:
| Name |
Type |
Attributes |
Description |
message |
string
|
<optional>
|
Custom progress message. If not provided, a
default message based on the number of versions found will be shown. |
- Source:
showWarning(message)
Displays a warning banner in the status region.
Parameters:
| Name |
Type |
Description |
message |
string
|
The warning message to display. |
- Source:
template() → {string}
Template for the static layout of the view.
- Source:
Returns:
HTML string representing the view skeleton.
-
Type
-
string
updateStatus(message, typeopt)
Updates the status alert with the provided HTML payload.
Parameters:
| Name |
Type |
Attributes |
Description |
message |
string
|
|
HTML string. |
type |
"info"
|
"danger"
|
"success"
|
"warning"
|
<optional>
|
Type of alert to
show. |
- Source: