mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-09 04:28:38 -05:00
Port Table, Column, Primary key, Foreign key, Check constraint, Unique constraint, Exclusion constraint.
This commit is contained in:
committed by
Akshay Joshi
parent
725d9b4bbf
commit
261cec1d20
@@ -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, fieldIdx)=>{
|
||||
}).map((field)=>{
|
||||
let colInfo = {
|
||||
Header: field.label||<> </>,
|
||||
accessor: field.id,
|
||||
@@ -333,7 +333,7 @@ export default function DataGridView({
|
||||
...(field.width ? {width: field.width} : {}),
|
||||
Cell: ({value, row, ...other}) => {
|
||||
/* Make sure to take the latest field info from schema */
|
||||
field = schemaRef.current.fields[fieldIdx];
|
||||
field = _.find(schemaRef.current.fields, (f)=>f.id==field.id) || field;
|
||||
|
||||
let {visible, editable, readonly, ..._field} = field;
|
||||
|
||||
@@ -359,6 +359,10 @@ export default function DataGridView({
|
||||
editable = _.isUndefined(editable) ? true : editable;
|
||||
editable = evalFunc(schemaRef.current, editable, row.original || {});
|
||||
|
||||
if(_.isUndefined(_field.cell)) {
|
||||
console.error('cell is required ', _field);
|
||||
}
|
||||
|
||||
return <MappedCellControl rowIndex={row.index} value={value}
|
||||
row={row.original} {..._field}
|
||||
readonly={_readonly}
|
||||
@@ -399,7 +403,7 @@ export default function DataGridView({
|
||||
path: accessPath,
|
||||
value: newRow,
|
||||
});
|
||||
}, []);
|
||||
}, [props.canAddRow]);
|
||||
|
||||
const defaultColumn = useMemo(()=>({
|
||||
minWidth: 175,
|
||||
|
||||
@@ -370,7 +370,7 @@ export default function FormView({
|
||||
<Box height="100%" display="flex" flexDirection="column" className={className} ref={formRef}>
|
||||
{Object.keys(finalTabs).map((tabName)=>{
|
||||
return (
|
||||
<>{finalTabs[tabName]}</>
|
||||
<React.Fragment key={tabName}>{finalTabs[tabName]}</React.Fragment>
|
||||
);
|
||||
})}
|
||||
</Box>
|
||||
|
||||
@@ -137,11 +137,19 @@ export default class BaseUISchema {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Check */
|
||||
/* Check if node in catalog */
|
||||
inCatalog() {
|
||||
if(this.nodeInfo && 'catalog' in this.nodeInfo) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the server version */
|
||||
getServerVersion() {
|
||||
if(!_.isUndefined(this.nodeInfo) && !_.isUndefined(this.nodeInfo.server)
|
||||
&& !_.isUndefined(this.nodeInfo.server.version)) {
|
||||
return this.nodeInfo.server.version;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ function SchemaDialogView({
|
||||
data = data || {};
|
||||
/* Set the origData to incoming data, useful for comparing and reset */
|
||||
schema.origData = prepareData(data || {});
|
||||
schema.initialise(data);
|
||||
schema.initialise(schema.origData);
|
||||
sessDispatch({
|
||||
type: SCHEMA_STATE_ACTIONS.INIT,
|
||||
payload: schema.origData,
|
||||
@@ -487,6 +487,7 @@ function SchemaDialogView({
|
||||
} else {
|
||||
/* Use the defaults as the initital data */
|
||||
schema.origData = prepareData(schema.defaults);
|
||||
schema.initialise(schema.origData);
|
||||
sessDispatch({
|
||||
type: SCHEMA_STATE_ACTIONS.INIT,
|
||||
payload: schema.origData,
|
||||
@@ -734,6 +735,7 @@ function SchemaPropertiesView({
|
||||
let defaultTab = 'General';
|
||||
let tabs = {};
|
||||
let tabsClassname = {};
|
||||
let groupLabels = {};
|
||||
const [origData, setOrigData] = useState({});
|
||||
const [loaderText, setLoaderText] = useState('');
|
||||
|
||||
@@ -760,7 +762,9 @@ function SchemaPropertiesView({
|
||||
}
|
||||
|
||||
readonly = true;
|
||||
if(visible && modeSupported) {
|
||||
if(modeSupported) {
|
||||
group = groupLabels[group] || group || defaultTab;
|
||||
|
||||
if(!tabs[group]) tabs[group] = [];
|
||||
if(field && field.type === 'nested-fieldset') {
|
||||
tabs[group].push(
|
||||
@@ -793,6 +797,11 @@ function SchemaPropertiesView({
|
||||
visible={visible}
|
||||
/>
|
||||
);
|
||||
} else if(field.type === 'group') {
|
||||
groupLabels[field.id] = field.label;
|
||||
if(!visible) {
|
||||
schema.filterGroups.push(field.label);
|
||||
}
|
||||
} else {
|
||||
tabs[group].push(
|
||||
<MappedFormControl
|
||||
@@ -813,6 +822,7 @@ function SchemaPropertiesView({
|
||||
}
|
||||
});
|
||||
|
||||
let finalTabs = _.pickBy(tabs, (v, tabName)=>schema.filterGroups.indexOf(tabName) <= -1);
|
||||
return (
|
||||
<Box className={classes.root}>
|
||||
<Loader message={loaderText}/>
|
||||
@@ -825,7 +835,7 @@ function SchemaPropertiesView({
|
||||
</Box>
|
||||
<Box className={classes.form}>
|
||||
<Box>
|
||||
{Object.keys(tabs).map((tabName)=>{
|
||||
{Object.keys(finalTabs).map((tabName)=>{
|
||||
let id = tabName.replace(' ', '');
|
||||
return (
|
||||
<Accordion key={id}>
|
||||
@@ -838,7 +848,7 @@ function SchemaPropertiesView({
|
||||
</AccordionSummary>
|
||||
<AccordionDetails>
|
||||
<Box style={{width: '100%'}}>
|
||||
{tabs[tabName]}
|
||||
{finalTabs[tabName]}
|
||||
</Box>
|
||||
</AccordionDetails>
|
||||
</Accordion>
|
||||
|
||||
Reference in New Issue
Block a user