mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fixed following schema diff issues:
1) Avoid template databases from the Database drop-down list. 2) Exclude system schemas while comparing two databases. 3) Escape group name for XSS.
This commit is contained in:
@@ -388,7 +388,8 @@ def databases(sid):
|
||||
view = SchemaDiffRegistry.get_node_view('database')
|
||||
|
||||
server = Server.query.filter_by(id=sid).first()
|
||||
response = view.nodes(gid=server.servergroup_id, sid=sid)
|
||||
response = view.nodes(gid=server.servergroup_id, sid=sid,
|
||||
is_schema_diff=True)
|
||||
databases = json.loads(response.data)['data']
|
||||
for db in databases:
|
||||
res.append({
|
||||
@@ -653,7 +654,8 @@ def get_schemas(sid, did):
|
||||
try:
|
||||
view = SchemaDiffRegistry.get_node_view('schema')
|
||||
server = Server.query.filter_by(id=sid).first()
|
||||
response = view.nodes(gid=server.servergroup_id, sid=sid, did=did)
|
||||
response = view.nodes(gid=server.servergroup_id, sid=sid, did=did,
|
||||
is_schema_diff=True)
|
||||
schemas = json.loads(response.data)['data']
|
||||
return schemas
|
||||
except Exception as e:
|
||||
|
||||
@@ -3,18 +3,6 @@
|
||||
font-size: 1.3em !important;
|
||||
}
|
||||
|
||||
.icon-schema-diff-white {
|
||||
display: inline-block;
|
||||
align-content: center;
|
||||
vertical-align: sub;
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
background-size: 20px !important;
|
||||
background-repeat: no-repeat;
|
||||
background-position-x: center;
|
||||
background-position-y: center;
|
||||
}
|
||||
|
||||
.icon-script {
|
||||
display: inline-block;
|
||||
align-content: center;
|
||||
|
||||
@@ -317,7 +317,7 @@ let SchemaDiffHeaderView = Backform.Form.extend({
|
||||
<div class="col-6 target row"></div>
|
||||
<div class="col-5 target-buttons">
|
||||
<div class="action-btns d-flex">
|
||||
<button class="btn btn-primary mr-auto"><span class="icon-schema-diff icon-schema-diff-white"></span> ` + gettext('Compare') + `</button>
|
||||
<button class="btn btn-primary mr-auto"><span class="pg-font-icon icon-schema-diff sql-icon-lg"></span> ` + gettext('Compare') + `</button>
|
||||
<button id="generate-script" class="btn btn-primary-icon mr-1" disabled><i class="fa fa-file-code sql-icon-lg"></i> ` + gettext('Generate Script') + `</button>
|
||||
<div class="btn-group mr-1" role="group" aria-label="">
|
||||
<button id="btn-filter" type="button" class="btn btn-primary-icon"
|
||||
|
||||
@@ -18,6 +18,7 @@ import {setPGCSRFToken} from 'sources/csrf';
|
||||
import {generateScript} from 'tools/datagrid/static/js/show_query_tool';
|
||||
import 'pgadmin.sqleditor';
|
||||
import pgWindow from 'sources/window';
|
||||
import _ from 'underscore';
|
||||
|
||||
import { SchemaDiffSelect2Control, SchemaDiffHeaderView,
|
||||
SchemaDiffFooterView, SchemaDiffSqlControl} from './schema_diff.backform';
|
||||
@@ -330,7 +331,7 @@ export default class SchemaDiffUI {
|
||||
if (g.rows[0].group_name == 'Database Objects'){
|
||||
icon = 'icon-coll-database';
|
||||
}
|
||||
return '<i class="wcTabIcon '+ icon +'"></i><span>' + g.rows[0].group_name;
|
||||
return '<i class="wcTabIcon '+ icon +'"></i><span>' + _.escape(g.rows[0].group_name);
|
||||
},
|
||||
aggregateCollapsed: true,
|
||||
lazyTotalsCalculation: true,
|
||||
|
||||
Reference in New Issue
Block a user