1. Resolved resize window issue for DDL result panel.

2. Updated the Screenshots.
3. Updated server group title to bold.

refs #6133
This commit is contained in:
Nikhil Mohite 2022-09-08 15:24:43 +05:30 committed by Akshay Joshi
parent 18b77f15dd
commit 0c9c57e608
13 changed files with 109 additions and 137 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 300 KiB

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 275 KiB

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -99,6 +99,8 @@ following comparison criteria:
Click on any of the database objects in the object comparison panel to Click on any of the database objects in the object comparison panel to
display the DDL Statements of that object in the DDL Comparison panel. display the DDL Statements of that object in the DDL Comparison panel.
Click the *Help* icon to open Schema Diff documentation.
Schema Diff DDL Comparison Panel Schema Diff DDL Comparison Panel
================================ ================================

View File

@ -709,6 +709,7 @@ const customReactSelectStyles = (theme, readonly) => ({
...provided, ...provided,
color: 'inherit', color: 'inherit',
fontSize: '0.85em', fontSize: '0.85em',
fontWeight: 'bold',
textTransform: 'none', textTransform: 'none',
}), }),
menu: (provided) => ({ menu: (provided) => ({

View File

@ -159,5 +159,5 @@ PgReactDataGrid.propTypes = {
onItemSelect: PropTypes.func, onItemSelect: PropTypes.func,
onItemClick: PropTypes.func, onItemClick: PropTypes.func,
noRowsText: PropTypes.string, noRowsText: PropTypes.string,
noRowsIcon: PropTypes.elementType noRowsIcon: PropTypes.object
}; };

View File

@ -31,7 +31,7 @@ import Notifier from '../../../../../static/js/helpers/Notifier';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: { root: {
paddingTop: '0.5rem', paddingTop: '0.5rem',
display: 'flex', display: 'flex',
@ -216,9 +216,9 @@ function CellExpanderFormatter({
isCellSelected, isCellSelected,
expanded, expanded,
filterParams, filterParams,
onCellExpand onCellExpand,
classes
}) { }) {
const classes = useStyles();
const { ref, tabIndex } = useFocusRef(isCellSelected); const { ref, tabIndex } = useFocusRef(isCellSelected);
'identicalCount' in row && setRecordCount(row, filterParams); 'identicalCount' in row && setRecordCount(row, filterParams);
@ -257,6 +257,7 @@ CellExpanderFormatter.propTypes = {
expanded: PropTypes.bool, expanded: PropTypes.bool,
onCellExpand: PropTypes.func, onCellExpand: PropTypes.func,
filterParams: PropTypes.array, filterParams: PropTypes.array,
classes: PropTypes.object
}; };
@ -328,7 +329,7 @@ function collapseRows(newRows, filterParams, rowIndex) {
} }
}); });
let totalChCount = filteredChild.length; let totalChCount = filteredChild.length;
for (let i = 0; i <= filteredChild.length; i++) { for (let i = 0; i < filteredChild.length; i++) {
let _index = i + 1; let _index = i + 1;
let indx = totalChild ? rowIndex + totalChild + _index : rowIndex + _index; let indx = totalChild ? rowIndex + totalChild + _index : rowIndex + _index;
if (newRows[indx]?.isExpanded) { if (newRows[indx]?.isExpanded) {
@ -417,26 +418,6 @@ function reducer(rows, { type, id, filterParams, gridData }) {
} }
} }
function getStyleClassName(row, selectedRowIds, isCellSelected, activeRowId, isCheckbox = false) {
const classes = useStyles();
let clsName = null;
if (selectedRowIds.includes(`${row.id}`) || isCellSelected || row.id == activeRowId) {
clsName = isCheckbox ? classes.selectedRowCheckBox : classes.selectedRow;
} else {
if (row.status == FILTER_NAME.DIFFERENT) {
clsName = classes.different;
} else if (row.status == FILTER_NAME.SOURCE_ONLY) {
clsName = classes.source;
} else if (row.status == FILTER_NAME.TARGET_ONLY) {
clsName = classes.target;
} else if (row.status == FILTER_NAME.IDENTICAL) {
clsName = classes.identical;
}
}
return clsName;
}
export function ResultGridComponent({ gridData, allRowIds, filterParams, selectedRowIds, transId, sourceData, targetData }) { export function ResultGridComponent({ gridData, allRowIds, filterParams, selectedRowIds, transId, sourceData, targetData }) {
const classes = useStyles(); const classes = useStyles();
const [rows, dispatch] = useReducer(reducer, [...gridData]); const [rows, dispatch] = useReducer(reducer, [...gridData]);
@ -470,11 +451,10 @@ export function ResultGridComponent({ gridData, allRowIds, filterParams, selecte
let isChildAllInclude = checkAllChildInclude(row, tempSelectedRows); let isChildAllInclude = checkAllChildInclude(row, tempSelectedRows);
isChildAllInclude && tempSelectedRows.push(`${row.metadata.parentId}`); isChildAllInclude && tempSelectedRows.push(`${row.metadata.parentId}`);
for (let i = 0; i < rows.length; i++) { for(let rowData of rows) {
if (rows[i].id == row.metadata.parentId) { if (rowData.id == row.metadata.parentId) {
let isChildInclude = checkAllChildInclude(rows[i], tempSelectedRows); let isChildInclude = checkAllChildInclude(rowData, tempSelectedRows);
isChildInclude && tempSelectedRows.push(`${rows[i].metadata.parentId}`); isChildInclude && tempSelectedRows.push(`${rowData.metadata.parentId}`);
break;
} }
} }
@ -528,7 +508,6 @@ export function ResultGridComponent({ gridData, allRowIds, filterParams, selecte
let rootIndex = tempSelectedRows.indexOf(`${row.metadata.rootId}`); let rootIndex = tempSelectedRows.indexOf(`${row.metadata.rootId}`);
rootIndex != -1 && tempSelectedRows.splice(rootIndex, 1); rootIndex != -1 && tempSelectedRows.splice(rootIndex, 1);
row.dependencieRowIds.map((id) => { row.dependencieRowIds.map((id) => {
let deptRowIndex = tempSelectedRows.indexOf(`${id}`); let deptRowIndex = tempSelectedRows.indexOf(`${id}`);
deptRowIndex != -1 && tempSelectedRows.splice(deptRowIndex, 1); deptRowIndex != -1 && tempSelectedRows.splice(deptRowIndex, 1);
@ -536,6 +515,25 @@ export function ResultGridComponent({ gridData, allRowIds, filterParams, selecte
} }
} }
function getStyleClassName(row, selectedRowIds, isCellSelected, activeRowId, isCheckbox = false) {
let clsName = null;
if (selectedRowIds.includes(`${row.id}`) || isCellSelected || row.id == activeRowId) {
clsName = isCheckbox ? classes.selectedRowCheckBox : classes.selectedRow;
} else {
if (row.status == FILTER_NAME.DIFFERENT) {
clsName = classes.different;
} else if (row.status == FILTER_NAME.SOURCE_ONLY) {
clsName = classes.source;
} else if (row.status == FILTER_NAME.TARGET_ONLY) {
clsName = classes.target;
} else if (row.status == FILTER_NAME.IDENTICAL) {
clsName = classes.identical;
}
}
return clsName;
}
const columns = [ const columns = [
{ {
key: 'id', key: 'id',
@ -617,6 +615,7 @@ export function ResultGridComponent({ gridData, allRowIds, filterParams, selecte
expanded={row.isExpanded === true} expanded={row.isExpanded === true}
filterParams={filterParams} filterParams={filterParams}
onCellExpand={() => dispatch({ id: row.id, type: 'toggleSubRow', filterParams: filterParams, gridData: gridData, selectedRows: selectedRows })} onCellExpand={() => dispatch({ id: row.id, type: 'toggleSubRow', filterParams: filterParams, gridData: gridData, selectedRows: selectedRows })}
classes={classes}
/> />
)} )}
<div className="rdg-cell-value"> <div className="rdg-cell-value">

View File

@ -18,34 +18,6 @@ import { SCHEMA_DIFF_EVENT } from '../SchemaDiffConstants';
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
root: {
display: 'flex',
flexDirection: 'column',
flexGrow: 1,
},
table: {
minWidth: 650,
},
summaryContainer: {
flexGrow: 1,
minHeight: 0,
overflow: 'auto',
},
panelTitle: {
borderBottom: '1px solid ' + theme.otherVars.borderColor,
padding: '0.5rem',
},
editorStyle: {
height: '100%'
},
editor: {
height: '100%',
padding: '0.5rem 0.2rem 2rem 0.5rem',
},
editorLabel: {
padding: '0.3rem 0.6rem 0 0.6rem',
},
header: { header: {
padding: '0.5rem', padding: '0.5rem',
borderBottom: '1px solid ' + theme.otherVars.borderColor, borderBottom: '1px solid ' + theme.otherVars.borderColor,
@ -64,8 +36,19 @@ const useStyles = makeStyles((theme) => ({
padding: '0.2rem 0.5rem', padding: '0.2rem 0.5rem',
width: '33.33%', width: '33.33%',
}, },
labelContainer: {
display: 'flex',
flexDirection: 'row',
},
label: { label: {
padding: '0.2rem 0.5rem',
width: '33.33%'
},
sqlInput: {
display: 'flex',
flexDirection: 'column',
flexGrow: 1, flexGrow: 1,
height: '100%',
} }
})); }));
@ -95,40 +78,50 @@ export function Results() {
<Box className={classes.header}> <Box className={classes.header}>
<span>{gettext('DDL Comparision')}</span> <span>{gettext('DDL Comparision')}</span>
</Box> </Box>
<Box className={classes.labelContainer}>
<Box className={classes.label}>{gettext('Source')}</Box>
<Box className={classes.label}>{gettext('Target')}</Box>
<Box className={classes.label}>{gettext('Difference')}</Box>
</Box>
<Box className={classes.sqlContainer}> <Box className={classes.sqlContainer}>
<Box className={classes.sqldata}> <Box className={classes.sqldata}>
<Box className={classes.label}>{gettext('Source')}</Box> <Box className={classes.sqlInput}>
<InputSQL <InputSQL
onLable={true} onLable={true}
value={sourceSQL} value={sourceSQL}
options={{ options={{
readOnly: true, readOnly: true,
}} }}
readonly={true} readonly={true}
/> width='100%'
/>
</Box>
</Box> </Box>
<Box className={classes.sqldata}> <Box className={classes.sqldata}>
<Box className={classes.label}>{gettext('Target')}</Box> <Box className={classes.sqlInput}>
<InputSQL <InputSQL
onLable={true} onLable={true}
value={targetSQL} value={targetSQL}
options={{ options={{
readOnly: true, readOnly: true,
}} }}
readonly={true} readonly={true}
/> width='100%'
/>
</Box>
</Box> </Box>
<Box className={classes.sqldata}> <Box className={classes.sqldata}>
<Box className={classes.label}>{gettext('Difference')}</Box> <Box className={classes.sqlInput}>
<InputSQL <InputSQL
onLable={true} onLable={true}
value={sqlDiff} value={sqlDiff}
options={{ options={{
readOnly: true, readOnly: true,
}} }}
readonly={true} readonly={true}
/> width='100%'
/>
</Box>
</Box> </Box>
</Box> </Box>
</> </>

View File

@ -198,7 +198,7 @@ export function SchemaDiffCompare({ params }) {
setSelectedTargetScid(null); setSelectedTargetScid(null);
} }
} }
} }
function setSourceTargetSid(diff_type, selectedOption) { function setSourceTargetSid(diff_type, selectedOption) {
@ -224,7 +224,7 @@ export function SchemaDiffCompare({ params }) {
} }
} }
} }
setSourceGroupServerList(serverList); setSourceGroupServerList(serverList);
}; };
@ -513,26 +513,27 @@ export function SchemaDiffCompare({ params }) {
let keyList = Object.keys(tempData); let keyList = Object.keys(tempData);
let temp = []; let temp = [];
let rowDependencies = {}; let rowDependencies = {};
for (let i = 0; i < keyList.length; i++) {
tempData[keyList[i]]['children'] = Object.values(tempData[keyList[i]]['children']);
for (let keyItem of keyList) {
tempData[keyItem]['children'] = Object.values(tempData[keyItem]['children']);
let subChildList = []; let subChildList = [];
tempData[keyList[i]]['children'].map((ch) => ch.children.map(({ id }) => subChildList.push(`${id}`)));
tempData[keyList[i]]['metadata'] = { tempData[keyItem]['children'].map((ch) => ch.children.map(({ id }) => subChildList.push(`${id}`)));
tempData[keyItem]['metadata'] = {
isRoot: true, isRoot: true,
children: tempData[keyList[i]]['children'].map(({ id }) => `${id}`), children: tempData[keyItem]['children'].map(({ id }) => `${id}`),
subChildren: subChildList, subChildren: subChildList,
}; };
tempData[keyList[i]]['children'].map((child) => { tempData[keyItem]['children'].map((child) => {
child['metadata'] = { child['metadata'] = {
parentId: tempData[keyList[i]].id, parentId: tempData[keyItem].id,
children: tempData[keyList[i]]['children'].map(({ id }) => `${id}`), children: tempData[keyItem]['children'].map(({ id }) => `${id}`),
subChildren: child.children.map(({ id }) => `${id}`), subChildren: child.children.map(({ id }) => `${id}`),
dependencies: [], dependencies: [],
}; };
child.children.map((ch) => { child.children.map((ch) => {
if (ch.dependenciesOid.length > 0) { if (ch.dependenciesOid.length > 0) {
tempData[keyList[i]]['children'].map((el) => { tempData[keyItem]['children'].map((el) => {
el.children.map((data) => { el.children.map((data) => {
if (ch.dependenciesOid.includes(data.oid)) { if (ch.dependenciesOid.includes(data.oid)) {
ch.dependencieRowIds.push(`${data.id}`); ch.dependencieRowIds.push(`${data.id}`);
@ -543,16 +544,14 @@ export function SchemaDiffCompare({ params }) {
} }
ch['metadata'] = { ch['metadata'] = {
parentId: child.id, parentId: child.id,
rootId: tempData[keyList[i]].id, rootId: tempData[keyItem].id,
children: child.children.map(({ id }) => `${id}`), children: child.children.map(({ id }) => `${id}`),
}; };
child['metadata']['dependencies'].push(...ch.dependencieRowIds); child['metadata']['dependencies'].push(...ch.dependencieRowIds);
}); });
}); });
temp.push(tempData[keyList[i]]); temp.push(tempData[keyItem]);
} }
setRowDep(rowDependencies); setRowDep(rowDependencies);
@ -622,7 +621,7 @@ export function SchemaDiffCompare({ params }) {
} }
} }
} }
if (diff_type == TYPE.SOURCE) { if (diff_type == TYPE.SOURCE) {
setSelectedSourceSid(sid); setSelectedSourceSid(sid);
} else { } else {
@ -697,7 +696,7 @@ export function SchemaDiffCompare({ params }) {
if(isInit && filterOptions.length == 0) { if(isInit && filterOptions.length == 0) {
opt = [FILTER_NAME.DIFFERENT, FILTER_NAME.SOURCE_ONLY, FILTER_NAME.TARGET_ONLY]; opt = [FILTER_NAME.DIFFERENT, FILTER_NAME.SOURCE_ONLY, FILTER_NAME.TARGET_ONLY];
} else if(filterOptions.length > 0 ) { } else if(filterOptions.length > 0 ) {
opt = filterOptions; opt = filterOptions;
} }
return opt; return opt;
} }
@ -748,7 +747,7 @@ export function SchemaDiffCompare({ params }) {
diff_type={TYPE.TARGET} diff_type={TYPE.TARGET}
></InputComponent> ></InputComponent>
</Grid> </Grid>
<Grid item lg={5} md={5} sm={12} xs={12} key={_.uniqueId('c')} className={classes.diffBtn}> <Grid item lg={5} md={5} sm={12} xs={12} key={_.uniqueId('c')} className={classes.diffBtn}>
<SchemaDiffButtonComponent <SchemaDiffButtonComponent
sourceData={{ sourceData={{
@ -762,7 +761,7 @@ export function SchemaDiffCompare({ params }) {
'sid': selectedTargetSid, 'sid': selectedTargetSid,
'did': selectedTargetDid, 'did': selectedTargetDid,
'scid': selectedTargetScid, 'scid': selectedTargetScid,
}} }}
filterParams={getFilterParams()} filterParams={getFilterParams()}
compareParams={compareOptions} compareParams={compareOptions}
></SchemaDiffButtonComponent> ></SchemaDiffButtonComponent>
@ -809,4 +808,4 @@ SchemaDiffCompare.propTypes = {
params: PropTypes.object, params: PropTypes.object,
'params.transId': PropTypes.number, 'params.transId': PropTypes.number,
}; };

View File

@ -26,42 +26,23 @@ export const SchemaDiffEventsContext = createContext();
export const SchemaDiffContext = createContext(); export const SchemaDiffContext = createContext();
const useStyles = makeStyles((theme) => ({ const useStyles = makeStyles((theme) => ({
resetRoot: {
padding: '2px 4px',
display: 'flex',
alignItems: 'center',
gap: '4px',
backgroundColor: theme.otherVars.editorToolbarBg,
flexWrap: 'wrap',
...theme.mixins.panelBorder.bottom,
'& #id-schema-diff': {
overflow: 'auto'
},
'& #id-results': {
overflow: 'auto'
}
},
resultPanle: { resultPanle: {
backgroundColor: theme.palette.default.main, backgroundColor: theme.palette.default.main,
zIndex: 5, zIndex: 5,
border: '1px solid ' + theme.otherVars.borderColor, border: '1px solid ' + theme.otherVars.borderColor,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
flexGrow: 1, flexGrow: 1,
height: '50%', height: 0,
minHeight: 150, overflow: 'hidden',
overflow: 'hidden',
}, },
comparePanel:{ comparePanel:{
overflow: 'hidden', overflow: 'hidden',
border: '1px solid ' + theme.otherVars.borderColor, border: '1px solid ' + theme.otherVars.borderColor,
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
flexGrow: 1, flexGrow: 1,
minHeight: 150, height: 0,
height: '50%',
} }
})); }));
@ -102,11 +83,11 @@ export default function SchemaDiffComponent({params}) {
})); }));
}); });
} }
return ( return (
<SchemaDiffContext.Provider value={schemaDiffContextValue}> <SchemaDiffContext.Provider value={schemaDiffContextValue}>
<SchemaDiffEventsContext.Provider value={eventBus.current}> <SchemaDiffEventsContext.Provider value={eventBus.current}>
<Box display="flex" flexDirection="column" flexGrow="1" tabIndex="0" style={{overflowY: 'auto', minHeight: 80}}> <Box display="flex" flexDirection="column" flexGrow="1" height="100%" tabIndex="0" style={{minHeight: 80}}>
<DividerBox mode='vertical' style={{flexGrow: 1}}> <DividerBox mode='vertical' style={{flexGrow: 1}}>
<div className={classes.comparePanel} id="schema-diff-compare-container" ref={containerRef}><SchemaDiffCompare params={params} /></div> <div className={classes.comparePanel} id="schema-diff-compare-container" ref={containerRef}><SchemaDiffCompare params={params} /></div>
<div className={classes.resultPanle} id="schema-diff-result-container"> <div className={classes.resultPanle} id="schema-diff-result-container">
@ -121,4 +102,4 @@ export default function SchemaDiffComponent({params}) {
SchemaDiffComponent.propTypes = { SchemaDiffComponent.propTypes = {
params: PropTypes.object params: PropTypes.object
}; };

View File

@ -19,7 +19,6 @@ import jasmineEnzyme from 'jasmine-enzyme';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import axios from 'axios/index'; import axios from 'axios/index';
// import pgAdmin from 'sources/pgadmin';
import pgWindow from 'sources/window'; import pgWindow from 'sources/window';
import url_for from 'sources/url_for'; import url_for from 'sources/url_for';
@ -59,8 +58,6 @@ describe('Schema Diff Component', () => {
schemaDiffInstance = new SchemaDiff(pgWindow.pgAdmin, pgWindow.pgAdmin.Browser); schemaDiffInstance = new SchemaDiff(pgWindow.pgAdmin, pgWindow.pgAdmin.Browser);
// nodeInfo = { parent: {} };
// eslint-disable-next-line // eslint-disable-next-line
let docker = new wcDocker( let docker = new wcDocker(
'.dockerContainer', { '.dockerContainer', {