diff --git a/CHANGELOG.md b/CHANGELOG.md index c4a8fb9c00a5dd7957349ac3331bd8ccadd5ce08..db162b92527ce937fca6e6eecc0f1f66c22dc2e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added (for new features, dependecies etc.) +* A `#version_history` URI fragment which can be used to directly open the modal + with the full version history of the first entity on the page. + ### Changed (for changes in existing functionality) ### Deprecated (for soon-to-be removed features) diff --git a/src/core/js/webcaosdb.js b/src/core/js/webcaosdb.js index 03cc7bfbb399e898a88cb99dc0a05cc90289f96a..270c8891703ad4c257c514aef88701f15977170f 100644 --- a/src/core/js/webcaosdb.js +++ b/src/core/js/webcaosdb.js @@ -990,6 +990,11 @@ var version_history = new function () { const logger = log.getLogger("version_history"); this.logger = logger; + this._has_version_fragment = function () { + const fragment = window.location.hash.substr(1); + return fragment === 'version_history'; + } + this._get = connection.get; /** * Retrieve the version history of an entity and return a table with the @@ -1161,6 +1166,18 @@ var version_history = new function () { this.init_load_history_buttons(); this.init_export_history_buttons(); this.init_restore_version_buttons(); + + // check for the version_history fragment and open the modal if present. + if (this._has_version_fragment()) { + const first_entity = $(".caosdb-entity-panel")[0]; + if (first_entity && hasEntityPermission(first_entity, "RETRIEVE:HISTORY")) { + logger.debug("Showing full version modal for first entity"); + const version_button = $(first_entity).find(".caosdb-f-entity-version-button"); + version_button.click(); + const full_version_history_button = $(first_entity).find(".caosdb-f-entity-version-load-history-btn"); + full_version_history_button.click(); + } + } } } @@ -2000,4 +2017,4 @@ class _CaosDBModules { var caosdb_modules = new _CaosDBModules() -$(document).ready(initOnDocumentReady); \ No newline at end of file +$(document).ready(initOnDocumentReady);