Add support for a bookmarks-only mode (#716)

* Add support for bookmarks-only mode

* Add error for missing bookmarks in bookmarks-only mode

* Error when settings url or connect backend together with bookmarks-only

* Add tests for parsing options
This commit is contained in:
Alexandru Gologan
2024-03-15 06:36:53 +02:00
committed by GitHub
parent 605c483d5b
commit f4e7643e22
5 changed files with 63 additions and 5 deletions

View File

@@ -189,14 +189,16 @@
</div>
</div>
<div class="connection-standard-group">
<div class="connection-bookmarks-group">
<div class="form-group bookmarks">
<label class="col-sm-3 control-label">Bookmark</label>
<div class="col-sm-9">
<select class="form-control" id="connection_bookmarks"></select>
</div>
</div>
</div>
<div class="connection-standard-group">
<div class="form-group">
<label class="col-sm-3 control-label">Host</label>
<div class="col-sm-9">

View File

@@ -1091,6 +1091,7 @@ function showConnectionSettings() {
// Show the current postgres version
$(".connection-settings .version").text("v" + appInfo.version).show();
$("#connection_window").show();
initConnectionWindow();
// Check github release page for updates
getLatestReleaseInfo(appInfo);
@@ -1119,11 +1120,32 @@ function showConnectionSettings() {
$(".bookmarks").show();
}
else {
$(".bookmarks").hide();
if (appFeatures.bookmarks_only) {
$("#connection_error").html("Running in <b>bookmarks-only</b> mode but <b>NO</b> bookmarks configured.").show();
$(".open-connection").hide();
} else {
$(".bookmarks").hide();
}
}
});
}
function initConnectionWindow() {
if (appFeatures.bookmarks_only) {
$(".connection-group-switch").hide();
$(".connection-scheme-group").hide();
$(".connection-bookmarks-group").show();
$(".connection-standard-group").hide();
$(".connection-ssh-group").hide();
} else {
$(".connection-group-switch").show();
$(".connection-scheme-group").hide();
$(".connection-bookmarks-group").show();
$(".connection-standard-group").show();
$(".connection-ssh-group").hide();
}
}
function getConnectionString() {
var url = $.trim($("#connection_url").val());
var mode = $(".connection-group-switch button.active").attr("data");