Merge pull request #396 from sosedoff/show-pgweb-version
Show current release and check for updates
This commit is contained in:
commit
9e3872c980
File diff suppressed because one or more lines are too long
@ -571,14 +571,32 @@
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.connection-settings h1 {
|
||||
.connection-settings .header {
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.connection-settings .header h1 {
|
||||
text-align: center;
|
||||
text-shadow: 0px 1px 0px #fff;
|
||||
margin-bottom: 25px;
|
||||
color: #999;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.connection-settings .header .version {
|
||||
font-size: 12px;
|
||||
color: #aaa;
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.connection-settings .header .update {
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
padding: 4px;
|
||||
margin: 12px 0px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.connection-settings form {
|
||||
background: #f6f6f6;
|
||||
padding: 25px;
|
||||
|
@ -119,7 +119,11 @@
|
||||
|
||||
<div id="connection_window">
|
||||
<div class="connection-settings">
|
||||
<h1>pgweb</h1>
|
||||
<div class="header">
|
||||
<h1>pgweb</h1>
|
||||
<div class="version"></div>
|
||||
<div class="update alert alert-warning"></div>
|
||||
</div>
|
||||
|
||||
<form role="form" class="form-horizontal" id="connection_form">
|
||||
<div class="text-center">
|
||||
|
@ -78,6 +78,7 @@ function apiCall(method, path, params, cb) {
|
||||
});
|
||||
}
|
||||
|
||||
function getInfo(cb) { apiCall("get", "/info", {}, cb); }
|
||||
function getObjects(cb) { apiCall("get", "/objects", {}, cb); }
|
||||
function getTables(cb) { apiCall("get", "/tables", {}, cb); }
|
||||
function getTableRows(table, opts, cb) { apiCall("get", "/tables/" + table + "/rows", opts, cb); }
|
||||
@ -770,7 +771,36 @@ function addShortcutTooltips() {
|
||||
}
|
||||
}
|
||||
|
||||
// Get the latest release from Github API
|
||||
function getLatestReleaseInfo(current) {
|
||||
try {
|
||||
$.get("https://api.github.com/repos/sosedoff/pgweb/releases/latest", function(release) {
|
||||
if (release.name != current.version) {
|
||||
var message = "Update available. Check out " + release.tag_name + " on <a target='_blank' href='" + release.html_url + "'>Github</a>";
|
||||
$(".connection-settings .update").html(message).fadeIn();
|
||||
}
|
||||
});
|
||||
}
|
||||
catch(error) {
|
||||
console.log("Cant get last release from github:", error);
|
||||
}
|
||||
}
|
||||
|
||||
function showConnectionSettings() {
|
||||
// Fetch server info
|
||||
getInfo(function(data) {
|
||||
if (data.error) return;
|
||||
if (!data.version) return;
|
||||
|
||||
// Show the current postgres version
|
||||
$(".connection-settings .version").text("v" + data.version).show();
|
||||
|
||||
// Check for updates if running the actual release from Github
|
||||
if (data.git_sha == "") {
|
||||
getLatestReleaseInfo(data);
|
||||
}
|
||||
});
|
||||
|
||||
getBookmarks(function(data) {
|
||||
// Do not add any bookmarks if we've got an error
|
||||
if (data.error) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user