mirror of
https://github.com/sosedoff/pgweb.git
synced 2024-12-12 07:03:55 +03:00
Compare commits
5 Commits
35944ec50a
...
28e8c7b166
Author | SHA1 | Date | |
---|---|---|---|
|
28e8c7b166 | ||
|
7fe302ed7c | ||
|
bcd170ab74 | ||
|
e63945ee71 | ||
|
ab913bfac8 |
34
CHANGELOG.md
34
CHANGELOG.md
@ -1,8 +1,18 @@
|
||||
# 0.16.1 - 2024-09-07
|
||||
## Changelog
|
||||
|
||||
Current [release](https://github.com/sosedoff/pgweb/releases) is `0.16.2`.
|
||||
|
||||
## 0.16.2 - 2024-11-02
|
||||
|
||||
- `FIX` Build a new Docker image with PostgreSQL 17 support
|
||||
- `FIX` Run CI against PostgreSQL 17, GH-758
|
||||
- `FIX` Rename master to main branch, GH-750
|
||||
|
||||
## 0.16.1 - 2024-09-07
|
||||
|
||||
- `FIX` Remove linux/arm/v5 from docker release action, GH-742
|
||||
|
||||
# 0.16.0 - 2024-06-04
|
||||
## 0.16.0 - 2024-06-04
|
||||
|
||||
- `NEW` Allow database stats downloads, GH-738
|
||||
- `NEW` Add analyze table action, GH-737
|
||||
@ -12,26 +22,26 @@
|
||||
- `FIX` Drop linux/arm/v5 from docker build, GH-728
|
||||
- `FIX` Propagate CGO_ENABLED environment variable to docker build, GH-724
|
||||
|
||||
# 0.15.0 - 2024-03-14
|
||||
## 0.15.0 - 2024-03-14
|
||||
|
||||
- `NEW` Add support for a bookmarks-only mode, GH-716
|
||||
- `FIX` Fix missing indexes by quoting schema/table name to ::regclass, GH-711
|
||||
- `FIX` Continue on parseJSON error, GH-708
|
||||
|
||||
# 0.14.3 - 2024-01-28
|
||||
## 0.14.3 - 2024-01-28
|
||||
|
||||
- `NEW` Allow retrying a connection on startup, GH-695
|
||||
- `NEW` Allow setting readonly mode in bookmarks, GH-707
|
||||
- `FIX` Add UPDATE to list of restricted keywords in read-only mode, GH-697
|
||||
|
||||
# 0.14.2 - 2023-10-29
|
||||
## 0.14.2 - 2023-10-29
|
||||
|
||||
- `NEW` Execute tests using PostgreSQL 16, GH-691
|
||||
- `FIX` Unclosed database sessions and tunnels, GH-688
|
||||
- `FIX` Use pg_table_size for table stats query, GH-685
|
||||
- `FIX` Use `HasSuffix` to correctly determine URL prefix, GH-684
|
||||
|
||||
# 0.14.1 - 2023-06-17
|
||||
## 0.14.1 - 2023-06-17
|
||||
|
||||
- `NEW` Add process start time metric, GH-675
|
||||
- `NEW` Configure pgweb user for docker container, GH-674
|
||||
@ -39,7 +49,7 @@
|
||||
- `FIX` Fix typo in the healthy metric, GH-657
|
||||
- `NEW` Use entrypoint instead of cmd in in dockerfile, GH-654
|
||||
|
||||
# 0.14.0 - 2023-02-21
|
||||
## 0.14.0 - 2023-02-21
|
||||
|
||||
- `FIX` History page query loading fixup, GH-632
|
||||
- `NEW` Display cell content via context menu, GH-634
|
||||
@ -51,11 +61,11 @@
|
||||
- `FIX` Ensure that objects are sorted by schema and name, GH-648
|
||||
- `FIX` Fetch local queries on db connect, GH-650
|
||||
|
||||
# 0.13.1 - 2022-12-27
|
||||
## 0.13.1 - 2022-12-27
|
||||
|
||||
- Fix connect flow when `~/.pgweb/bookmarks` directory is not available, GH-631
|
||||
|
||||
# 0.13.0 - 2022-12-25
|
||||
## 0.13.0 - 2022-12-25
|
||||
|
||||
- Add support for .pgpass file, GH-617
|
||||
- Request logging additions (request id, forwarded user), GH-618
|
||||
@ -67,7 +77,7 @@
|
||||
- Add duration_ms to log entries, GH-628
|
||||
- Add query execution stats to api endpoint, GH-629
|
||||
|
||||
# 0.12.0 - 2022-12-13
|
||||
## 0.12.0 - 2022-12-13
|
||||
|
||||
- Deprecate usage of Gox for binary builds, GH-571
|
||||
- Add netcat install in dockerfile to provide a way to healthcheck, GH-572
|
||||
@ -94,12 +104,12 @@
|
||||
- Switch windows tests from Appveyor to Github Actions, GH-611
|
||||
- Fix activity endpoint panic when server version is not detected, GH-612
|
||||
|
||||
# 0.11.12 - 2022-07-05
|
||||
## 0.11.12 - 2022-07-05
|
||||
|
||||
- Update base docker image (alpine), update deps, GH-558
|
||||
- Refactor docker images building, include ARM, GH-568
|
||||
|
||||
# 0.11.11 - 2022-03-29
|
||||
## 0.11.11 - 2022-03-29
|
||||
|
||||
- Auto-detect the query from the query source based on user selection, GH-547
|
||||
- Added binary codec base58 as well as improving the help for --binary-codec flag, GH-548
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
const (
|
||||
// Version is the current Pgweb application version
|
||||
Version = "0.16.1"
|
||||
Version = "0.16.2"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -342,6 +342,8 @@
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="#" data-action="display_value">Display Value</a></li>
|
||||
<li><a href="#" data-action="copy_value">Copy Value</a></li>
|
||||
<li><a href="#" data-action="copy_as_insert">Copy row as INSERT</a></li>
|
||||
<li><a href="#" data-action="copy_as_update">Copy row as UPDATE</a></li>
|
||||
<li><a href="#" data-action="filter_by_value">Filter Rows By Value</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -460,7 +460,7 @@ function buildTable(results, sortColumn, sortOrder, options) {
|
||||
|
||||
// Add all actual row data here
|
||||
for (i in row) {
|
||||
r += "<td data-col='" + i + "'><div>" + escapeHtml(row[i]) + "</div></td>";
|
||||
r += "<td data-type='"+ typeof row[i]+"' data-col='" + i + "'><div>" + escapeHtml(row[i]) + "</div></td>";
|
||||
}
|
||||
|
||||
// Add row action button
|
||||
@ -1232,6 +1232,15 @@ function bindTableHeaderMenu() {
|
||||
var isEmpty = $("#results").hasClass("empty");
|
||||
var isAllowed = browseMode == "browse" || browseMode == "query";
|
||||
|
||||
if ( browseMode == 'browse' ){
|
||||
$('.dropdown-menu li a[data-action="copy_as_insert"]').show();
|
||||
$('.dropdown-menu li a[data-action="copy_as_update"]').show();
|
||||
} else {
|
||||
$('.dropdown-menu li a[data-action="copy_as_insert"]').hide();
|
||||
$('.dropdown-menu li a[data-action="copy_as_update"]').hide();
|
||||
}
|
||||
|
||||
|
||||
if (isEmpty || !isAllowed) {
|
||||
e.preventDefault();
|
||||
this.closemenu();
|
||||
@ -1242,6 +1251,12 @@ function bindTableHeaderMenu() {
|
||||
var menuItem = $(e.target);
|
||||
|
||||
switch(menuItem.data("action")) {
|
||||
case "copy_as_insert":
|
||||
copyAsInsert(context);
|
||||
break;
|
||||
case "copy_as_update":
|
||||
copyAsUpdate(context);
|
||||
break;
|
||||
case "display_value":
|
||||
var value = $(context).text();
|
||||
$("#content_modal .content").text(value);
|
||||
@ -1264,6 +1279,81 @@ function bindTableHeaderMenu() {
|
||||
});
|
||||
}
|
||||
|
||||
function copyAsInsert(context){
|
||||
var values = getValuesFromContext(context);
|
||||
var columns = getColumnsFromResults();
|
||||
var tableName = $("#results").data("table");
|
||||
if(tableName === undefined){
|
||||
alert('table must be selected.');
|
||||
return;
|
||||
}
|
||||
var str = "INSERT INTO "+tableName+"("+columns.join(',')+") VALUES("+values.map(function(o){return o.value}).join(",")+")";
|
||||
copyToClipboard(str);
|
||||
}
|
||||
|
||||
function copyAsUpdate(context){
|
||||
var values = getValuesFromContext(context);
|
||||
var columns = getColumnsFromResults();
|
||||
var tableName = $("#results").data("table");
|
||||
if(tableName === undefined){
|
||||
alert('table must be selected.');
|
||||
return;
|
||||
}
|
||||
var where = [];
|
||||
var set = [];
|
||||
columns.forEach(function(row, index){
|
||||
var val = values[index];
|
||||
set.push(row+"="+val.value);
|
||||
if(val.isNull){
|
||||
where.push(row+" IS "+val.value);
|
||||
return;
|
||||
}
|
||||
where.push(row+"="+val.value);
|
||||
})
|
||||
var str = "UPDATE "+tableName+" SET "+set.join(',')+' WHERE '+ where.join(' AND ');
|
||||
copyToClipboard(str);
|
||||
}
|
||||
|
||||
function getColumnsFromResults(){
|
||||
let columns = [];
|
||||
$("#results_header th").each(function(){
|
||||
columns.push(this.innerText);
|
||||
})
|
||||
return columns;
|
||||
}
|
||||
|
||||
function getValuesFromContext(context){
|
||||
let values = [];
|
||||
$(context).parent().children().each(function(){
|
||||
const isNull = $(this).find("span[class*='null']").length;
|
||||
const fieldType = this.dataset["type"] ?? "string";
|
||||
let obj = {isNull:false, value:''};
|
||||
if (isNull){
|
||||
obj.isNull = true;
|
||||
obj.value = 'NULL';
|
||||
values.push(obj);
|
||||
return;
|
||||
}
|
||||
switch (fieldType) {
|
||||
case 'string':
|
||||
obj.value = "'"+this.innerText+"'";
|
||||
values.push(obj);
|
||||
break;
|
||||
case 'number':
|
||||
case 'boolean':
|
||||
obj.value = this.innerText;
|
||||
values.push(obj);
|
||||
break;
|
||||
default:
|
||||
obj.value = this.innerText;
|
||||
values.push(obj);
|
||||
break;
|
||||
|
||||
}
|
||||
})
|
||||
return values;
|
||||
}
|
||||
|
||||
function bindCurrentDatabaseMenu() {
|
||||
$("#current_database").contextmenu({
|
||||
target: "#current_database_context_menu",
|
||||
|
Loading…
Reference in New Issue
Block a user