mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Sort parent objects as well in Schema Diff tool.
This commit is contained in:
parent
a9799f25a2
commit
2c81b33925
@ -369,8 +369,21 @@ function checkRowExpanedStatus(rows, record) {
|
|||||||
function prepareRows(rows, gridData, filterParams) {
|
function prepareRows(rows, gridData, filterParams) {
|
||||||
let newRows = [];
|
let newRows = [];
|
||||||
|
|
||||||
let adedIds = [];
|
let addedIds = [];
|
||||||
gridData.map((record) => {
|
// Filter data objects with label 'Database Objects'.
|
||||||
|
let newGridData = gridData.filter(function (obj) {
|
||||||
|
return obj.label === gettext('Database Objects');
|
||||||
|
});
|
||||||
|
// Filter data objects except 'Database Objects'
|
||||||
|
let otherObjects = gridData.filter(function (obj) {
|
||||||
|
return obj.label !== gettext('Database Objects');
|
||||||
|
});
|
||||||
|
// Sort other objects
|
||||||
|
otherObjects.sort((a, b) => (a.label > b.label) ? 1 : -1);
|
||||||
|
// Merge 'Database Objects' and other data
|
||||||
|
newGridData = newGridData.concat(otherObjects);
|
||||||
|
|
||||||
|
newGridData.map((record) => {
|
||||||
let children = getChildrenRows(record);
|
let children = getChildrenRows(record);
|
||||||
// Sort the children using label
|
// Sort the children using label
|
||||||
children.sort((a, b) => (a.label > b.label) ? 1 : -1);
|
children.sort((a, b) => (a.label > b.label) ? 1 : -1);
|
||||||
@ -384,18 +397,18 @@ function prepareRows(rows, gridData, filterParams) {
|
|||||||
subChildren.map((subChild) => {
|
subChildren.map((subChild) => {
|
||||||
if (filterParams.includes(subChild.status)) {
|
if (filterParams.includes(subChild.status)) {
|
||||||
tempChildList.push(subChild);
|
tempChildList.push(subChild);
|
||||||
adedIds.push(subChild.id);
|
addedIds.push(subChild.id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!adedIds.includes(record.id) && tempChildList.length > 0) {
|
if (!addedIds.includes(record.id) && tempChildList.length > 0) {
|
||||||
adedIds.push(record.id);
|
addedIds.push(record.id);
|
||||||
record.isExpanded = true;
|
record.isExpanded = true;
|
||||||
newRows.push(record);
|
newRows.push(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!adedIds.includes(child.id) && tempChildList.length > 0) {
|
if (!addedIds.includes(child.id) && tempChildList.length > 0) {
|
||||||
adedIds.push(child.id);
|
addedIds.push(child.id);
|
||||||
child.isExpanded = checkRowExpanedStatus(rows, child);
|
child.isExpanded = checkRowExpanedStatus(rows, child);
|
||||||
newRows.push(child);
|
newRows.push(child);
|
||||||
newRows = checkAndAddChild(child, newRows, tempChildList);
|
newRows = checkAndAddChild(child, newRows, tempChildList);
|
||||||
|
Loading…
Reference in New Issue
Block a user