VersionHistoryDialog

Modal dialog for browsing, creating, and restoring project version snapshots.

Constructor

new VersionHistoryDialog(projectId, accessLevel, server, callbacks)

Parameters:
NameTypeDescription
projectIdstringID of the project whose versions are displayed.
accessLevelstring'viewer' | 'editor' | 'owner'
serverobjectServer instance
callbacksobjectCallback functions for version actions.
Properties
NameTypeAttributesDescription
onRevertCurrentfunctionCalled with the full version object to revert in place
onOpenAsNewfunctionCalled with the full version object to open as a new project
onSaveVersionfunction<optional>
Called with label string to save a named version; if omitted the Save button is hidden

Classes

VersionHistoryDialog

Methods

_buildDOM()

Builds and attaches the dialog's DOM structure.

_buildVersionRow(v) → {HTMLElement}

Parameters:
NameTypeDescription
vobjectVersion index entry to render as a list row.
Returns:
The constructed row element.
Type: 
HTMLElement

(async) _deleteVersion(versionId, row)

Parameters:
NameTypeDescription
versionIdstringID of the version to delete.
rowHTMLElementRow element to remove on success.

(async) _load()

Fetches the version list from the server and renders it.

(async) _openAsNew(versionId, btn)

Parameters:
NameTypeDescription
versionIdstringID of the version to open.
btnHTMLButtonElementButton element to show loading state on.

_openSaveVersionUI()

Shows the inline save-version form and wires up its confirm/cancel handlers.

_renderList(versions)

Parameters:
NameTypeDescription
versionsArray.<object>Array of version index entries to render.

(async) _revertCurrent(versionId, btn)

Parameters:
NameTypeDescription
versionIdstringID of the version to revert to.
btnHTMLButtonElementButton element to show loading state on.

close()

Removes the dialog and backdrop from the DOM.