- Fix Jasmine test cases failing in framework. - More stability fixes and enhancements.

This commit is contained in:
Aditya Toshniwal 2021-08-17 12:19:10 +05:30 committed by Akshay Joshi
parent 351cb3e6ca
commit 9274df0f11
6 changed files with 18 additions and 12 deletions

View File

@ -65,7 +65,7 @@ export default class PrivilegeRoleSchema extends BaseUISchema {
},
{
id: 'grantor', label: gettext('Grantor'), type: 'text', readonly: true,
cell: ()=>({cell: 'select', options: obj.grantorOptions}),
cell: ()=>({cell: 'select', options: obj.grantorOptions}), minWidth: 150,
}];
}

View File

@ -140,6 +140,7 @@ export function getNodeListById(nodeObj, treeNodeInfo, itemNodeData, params={},
/* Get the nodes list based on node name passed */
export function getNodeListByName(node, treeNodeInfo, itemNodeData, params={}, filter=()=>true, postTransform=(res)=>res) {
let nodeObj = pgAdmin.Browser.Nodes[node];
let {includeItemKeys} = params;
/* Transform the result to add image details */
const transform = (rows) => {
var res = [];
@ -157,6 +158,7 @@ export function getNodeListByName(node, treeNodeInfo, itemNodeData, params={}, f
'value': r.label,
'image': image,
'label': l,
..._.pick(r, includeItemKeys),
});
}
});

View File

@ -322,7 +322,7 @@ export default function DataGridView({
return props.columns.indexOf(firstF.id) < props.columns.indexOf(secondF.id) ? -1 : 1;
}
return 0;
}).map((field)=>{
}).map((field, fieldIdx)=>{
let colInfo = {
Header: field.label||<>&nbsp;</>,
accessor: field.id,
@ -332,6 +332,9 @@ export default function DataGridView({
...(field.minWidth ? {minWidth: field.minWidth} : {}),
...(field.width ? {width: field.width} : {}),
Cell: ({value, row, ...other}) => {
/* Make sure to take the latest field info from schema */
field = schemaRef.current.fields[fieldIdx];
let {visible, editable, readonly, ..._field} = field;
let verInLimit = (_.isUndefined(viewHelperProps.serverInfo) ? true :

View File

@ -123,12 +123,12 @@ export default class BaseUISchema {
getNewData(data={}) {
let newRow = {};
this.fields.forEach((field)=>{
if(!_.isUndefined(data[field.id])){
newRow[field.id] = data[field.id];
} else {
newRow[field.id] = this.defaults[field.id];
}
newRow[field.id] = this.defaults[field.id];
});
newRow = {
...newRow,
...data,
};
return newRow;
}

View File

@ -764,8 +764,9 @@ function SchemaPropertiesView({
accessPath={[]}
formErr={{}}
controlClassName={classes.controlRow}
{...field}
visible={visible}
{...field} />
/>
);
} else if(field.type === 'collection') {
tabs[group].push(
@ -792,10 +793,10 @@ function SchemaPropertiesView({
state={origData}
name={field.id}
value={origData[field.id]}
{...field}
readonly={readonly}
disabled={disabled}
visible={visible}
{...field}
className={classes.controlRow}
/>
);

View File

@ -264,7 +264,7 @@ describe('SchemaView', ()=>{
ctrl.update();
expect(ctrl.find('DefaultButton[data-test="Reset"]').prop('disabled')).toBeTrue();
expect(ctrl.find('PrimaryButton[data-test="Save"]').prop('disabled')).toBeTrue();
expect(onDataChange).toHaveBeenCalledWith(false);
expect(onDataChange).toHaveBeenCalledWith(false, {});
done();
}, 0);
});
@ -298,7 +298,7 @@ describe('SchemaView', ()=>{
expect(confirmSpy).not.toHaveBeenCalled();
expect(ctrl.find('DefaultButton[data-test="Reset"]').prop('disabled')).toBeTrue();
expect(ctrl.find('PrimaryButton[data-test="Save"]').prop('disabled')).toBeTrue();
expect(onDataChange).toHaveBeenCalledWith(false);
expect(onDataChange).toHaveBeenCalledWith(false, {});
done();
}, 0);
});
@ -411,7 +411,7 @@ describe('SchemaView', ()=>{
ctrl.update();
expect(ctrl.find('DefaultButton[data-test="Reset"]').prop('disabled')).toBeTrue();
expect(ctrl.find('PrimaryButton[data-test="Save"]').prop('disabled')).toBeTrue();
expect(onDataChange).toHaveBeenCalledWith(false);
expect(onDataChange).toHaveBeenCalledWith(false, {});
done();
}, 0);
}, 0);