-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Database -> Show Connected Clients
- Loading branch information
Showing
10 changed files
with
314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class ServerController { | ||
async showConnectionList () { | ||
var server = global.App.currentTab.instance.connection.server; | ||
var dialog = new Dialog.ConnectionList(server); | ||
// dialog.showWindow(); | ||
} | ||
} | ||
|
||
|
||
module.exports = ServerController; | ||
global.ServerController = ServerController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
class ConnectionList extends DialogBase { | ||
/*:: | ||
server: string[] | ||
*/ | ||
constructor (server) { | ||
super(null, { | ||
title: "Connected Clients", | ||
dialogClass: "connection-list", | ||
server: server | ||
}); | ||
this.showWindow(); | ||
} | ||
|
||
async showWindow () { | ||
var connections = await this.server.listConnections(); | ||
var nodes = App.renderView('dialogs/connection_list', {connections: connections}); | ||
this.content = this.renderWindow(this.title, nodes); | ||
this.content.find('code').forEach(codeElement => { | ||
window.hljs.highlightBlock(codeElement); | ||
}) | ||
} | ||
} | ||
|
||
/*:: | ||
declare var ConnectionList__: typeof ConnectionList | ||
*/ | ||
module.exports = ConnectionList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1918,6 +1918,32 @@ small.help-icon { | |
.related-records-dialog table ~ table { | ||
margin-top: 15px; } | ||
|
||
.alertify-inner.connection-list { | ||
width: 900px; | ||
margin-bottom: 5px; } | ||
.alertify-inner.connection-list table td, .alertify-inner.connection-list table th { | ||
word-break: break-all; } | ||
.alertify-inner.connection-list table code { | ||
max-width: 700px; | ||
margin: 1px 0; | ||
padding: 5px; | ||
background: #f5f5f5; | ||
display: block; | ||
font-family: Consolas, "Liberation Mono", Menlo, Monaco, Lucida Console, Courier New, monospace, serif; | ||
word-break: break-all; | ||
padding: 3px 5px; | ||
overflow: auto; | ||
max-height: 400px; | ||
box-shadow: inset 0px 0px 2px 0px rgba(0, 0, 0, 0.15); | ||
text-align: left; | ||
white-space: pre-wrap; | ||
word-break: normal; } | ||
.alertify-inner.connection-list table i.null { | ||
font-style: normal; | ||
color: #b8b8b8; | ||
font-size: 12px; | ||
opacity: 0.75; } | ||
|
||
/* | ||
*Original style from softwaremaniacs.org (c) Ivan Sagalaev <[email protected]> */ | ||
.hljs { | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.rescol-wrapper.with-borders | ||
.rescol-header-wrapper | ||
.rescol-content-wrapper | ||
table | ||
thead | ||
tr | ||
th PID | ||
th Database | ||
th User | ||
th IP | ||
th Application | ||
th State | ||
th Query | ||
tbody | ||
each client in connections | ||
tr | ||
td= client.pid | ||
td | ||
if client.datname | ||
= client.datname | ||
else | ||
i.null NULL | ||
td= client.usename | ||
td= client.client_addr | ||
td= client.state_change ? client.application_name : client.backend_type | ||
td= client.state | ||
td | ||
if client.state == 'active' | ||
code.result.pgsql= client.query | ||
|
||
p.buttons | ||
button.cancel Close |