Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved the extendability of the SchemaView and DataGridView. #7876

Merged
merged 28 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
997fba1
Improved the extendability fo the SchemaView and DataGridView.
asheshv Aug 29, 2024
91c5843
Provide the name of the view during the registration as production co…
asheshv Aug 29, 2024
664e9da
Wait to element to appear before finding the source of the rolename
asheshv Aug 30, 2024
9588f15
Merge branch 'master' into extendability
asheshv Aug 30, 2024
044931d
fixed typo introduced during merging the 'master' branch.
asheshv Aug 30, 2024
ab2e467
Pass the reset key to 'FormView' from SchemaDialogView, and set the
asheshv Aug 30, 2024
4c80dd9
Fixed a typo
asheshv Aug 30, 2024
3ff9916
Used 'origData' variable to get the initiail data for validation of
asheshv Sep 2, 2024
1ed674f
Keep the value of the input-box locally as well to solve the caret
asheshv Sep 2, 2024
3fe575b
Fixed the review comments shared by Aditya.
asheshv Sep 2, 2024
740d9c6
Fixed the InputText testcases, failing after the jumping cursor issue…
asheshv Sep 2, 2024
8188504
Introduce the 'useFieldSchema' custom hook to calculate the 'visible'
asheshv Sep 3, 2024
2ce7f90
Set the 'field.schema.top' before validation (if it is not already set).
asheshv Sep 3, 2024
971c895
Fixed the styling for the grid header
asheshv Sep 3, 2024
e905991
Don't listen dependency changes for a grid 'row'
asheshv Sep 3, 2024
ee522f6
Removed ununsed variable
asheshv Sep 3, 2024
f840198
Don't rerender the cell on every rowValue change.
asheshv Sep 3, 2024
c909e0a
Fixed the linter issue
asheshv Sep 3, 2024
490b9e5
Removed unused import (linter issue)
asheshv Sep 3, 2024
d5f56c9
No need to pass 'sessData' to 'FormView' as it is not using it.
asheshv Sep 4, 2024
b87ca9b
Resubscribe to the value, options, and error changes on schemaState o…
asheshv Sep 4, 2024
21972d8
Use a table level schema for the PgTable to use showing the expanded
asheshv Sep 5, 2024
490bb24
Fix the query tool restore connection issue on the server disconnecti…
anilsahoo20 Sep 2, 2024
6ec6cf5
Update release notes.
khushboovashi Sep 2, 2024
77a7211
Fix issues found while testing keyring changes. #7076
yogeshmahajan-1903 Sep 2, 2024
b06b466
Add debug logs to observe the OpenID token response.
khushboovashi Sep 4, 2024
8d7b9ce
Merge branch 'master' into extendability
asheshv Sep 5, 2024
15d97de
Focus on first focussable element in the FormView control
asheshv Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = [
'error',
'only-multiline',
],
'no-console': ['error', { allow: ['warn', 'error'] }],
'no-console': ['error', { allow: ['warn', 'error', 'trace'] }],
// We need to exclude below for RegEx case
'no-useless-escape': 'off',
'no-prototype-builtins': 'off',
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"react-leaflet": "^4.2.1",
"react-new-window": "^1.0.1",
"react-resize-detector": "^11.0.1",
"react-rnd": "^10.3.5",
"react-rnd": "^10.4.12",
"react-select": "^5.7.2",
"react-timer-hook": "^3.0.5",
"react-virtualized-auto-sizer": "^1.0.6",
Expand All @@ -152,7 +152,7 @@
"uplot-react": "^1.1.4",
"valid-filename": "^2.0.1",
"wkx": "^0.5.0",
"zustand": "^4.4.1"
"zustand": "^4.5.4"
},
"scripts": {
"linter": "yarn run eslint -c .eslintrc.js .",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export class DomainConstSchema extends BaseUISchema {
id: 'convalidated', label: gettext('Validate?'), cell: 'checkbox',
type: 'checkbox',
readonly: function(state) {
let currCon = _.find(obj.top.origData.constraints, (con)=>con.conoid == state.conoid);
let currCon = _.find(
obj.top.origData.constraints, (con) => con.conoid == state.conoid
);
return !obj.isNew(state) && currCon.convalidated;
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import DataGridViewWithHeaderForm from 'sources/helpers/DataGridViewWithHeaderForm';
import { DataGridFormHeader } from 'sources/SchemaView/DataGridView';
import { isEmptyString } from '../../../../../../../../static/js/validators';

class TokenHeaderSchema extends BaseUISchema {
Expand Down Expand Up @@ -155,8 +155,8 @@ export default class FTSConfigurationSchema extends BaseUISchema {
group: gettext('Tokens'), mode: ['create','edit'],
editable: false, schema: this.tokColumnSchema,
headerSchema: this.tokHeaderSchema,
headerVisible: function() { return true;},
CustomControl: DataGridViewWithHeaderForm,
headerFormVisible: true,
GridHeader: DataGridFormHeader,
uniqueCol : ['token'],
canAdd: true, canEdit: false, canDelete: true,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import _ from 'lodash';
import { isEmptyString } from 'sources/validators';
import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../../../static/js/SchemaView';
import DataGridViewWithHeaderForm from '../../../../../../../../../../static/js/helpers/DataGridViewWithHeaderForm';
import { SCHEMA_STATE_ACTIONS } from 'sources/SchemaView';
import { DataGridFormHeader } from 'sources/SchemaView/DataGridView';
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../../static/js/node_ajax';
import TableSchema from '../../../../static/js/table.ui';
import pgAdmin from 'sources/pgadmin';
Expand Down Expand Up @@ -342,10 +342,12 @@ export default class ExclusionConstraintSchema extends BaseUISchema {
group: gettext('Columns'), type: 'collection',
mode: ['create', 'edit', 'properties'],
editable: false, schema: this.exColumnSchema,
headerSchema: this.exHeaderSchema, headerVisible: (state)=>obj.isNew(state),
CustomControl: DataGridViewWithHeaderForm,
headerSchema: this.exHeaderSchema,
headerFormVisible: (state)=>obj.isNew(state),
GridHeader: DataGridFormHeader,
uniqueCol: ['column'],
canAdd: false, canDelete: function(state) {
canAdd: (state)=>obj.isNew(state),
canDelete: function(state) {
// We can't update columns of existing
return obj.isNew(state);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import _ from 'lodash';
import { isEmptyString } from 'sources/validators';
import { SCHEMA_STATE_ACTIONS } from '../../../../../../../../../../static/js/SchemaView';
import DataGridViewWithHeaderForm from '../../../../../../../../../../static/js/helpers/DataGridViewWithHeaderForm';
import { SCHEMA_STATE_ACTIONS } from 'sources/SchemaView';
import { DataGridFormHeader } from 'sources/SchemaView/DataGridView';
import { getNodeAjaxOptions, getNodeListByName } from '../../../../../../../../../static/js/node_ajax';
import TableSchema from '../../../../static/js/table.ui';


export function getNodeForeignKeySchema(treeNodeInfo, itemNodeData, pgBrowser, noColumns=false, initData={}) {
return new ForeignKeySchema({
local_column: noColumns ? [] : ()=>getNodeListByName('column', treeNodeInfo, itemNodeData),
Expand Down Expand Up @@ -58,12 +59,20 @@ class ForeignKeyHeaderSchema extends BaseUISchema {
}

addDisabled(state) {
return !(state.local_column && (state.references || this.origData.references) && state.referenced);
return !(
state.local_column && (
state.references || this.origData.references
) && state.referenced
);
}

/* Data to ForeignKeyColumnSchema will added using the header form */
getNewData(data) {
let references_table_name = _.find(this.refTables, (t)=>t.value==data.references || t.value == this.origData.references)?.label;
let references_table_name = _.find(
this.refTables,
(t) => t.value == data.references || t.value == this.origData.references
)?.label;

return {
local_column: data.local_column,
referenced: data.referenced,
Expand Down Expand Up @@ -229,7 +238,10 @@ export default class ForeignKeySchema extends BaseUISchema {
if(!obj.isNew(state)) {
let origData = {};
if(obj.inTable && obj.top) {
origData = _.find(obj.top.origData['foreign_key'], (r)=>r.cid == state.cid);
origData = _.find(
obj.top.origData['foreign_key'],
(r) => r.cid == state.cid
);
} else {
origData = obj.origData;
}
Expand Down Expand Up @@ -304,14 +316,14 @@ export default class ForeignKeySchema extends BaseUISchema {
group: gettext('Columns'), type: 'collection',
mode: ['create', 'edit', 'properties'],
editable: false, schema: this.fkColumnSchema,
headerSchema: this.fkHeaderSchema, headerVisible: (state)=>obj.isNew(state),
CustomControl: DataGridViewWithHeaderForm,
headerSchema: this.fkHeaderSchema,
headerFormVisible: (state)=>obj.isNew(state),
GridHeader: DataGridFormHeader,
uniqueCol: ['local_column', 'references', 'referenced'],
canAdd: false, canDelete: function(state) {
// We can't update columns of existing foreign key.
return obj.isNew(state);
},
readonly: obj.isReadonly, cell: ()=>({
canAdd: (state)=>obj.isNew(state),
canDelete: (state)=>obj.isNew(state),
readonly: obj.isReadonly,
cell: () => ({
cell: '',
controlProps: {
formatter: {
Expand Down Expand Up @@ -358,9 +370,10 @@ export default class ForeignKeySchema extends BaseUISchema {
}
}
if(actionObj.type == SCHEMA_STATE_ACTIONS.ADD_ROW) {
obj.fkHeaderSchema.origData.references = null;
// Set references value.
obj.fkHeaderSchema.origData.references = obj.fkHeaderSchema.sessData.references;
obj.fkHeaderSchema.origData.references = null;
obj.fkHeaderSchema.origData.references =
obj.fkHeaderSchema.sessData.references;
obj.fkHeaderSchema.origData._disable_references = true;
}
return {columns: currColumns};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
//
//////////////////////////////////////////////////////////////

import gettext from 'sources/gettext';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import DataGridViewWithHeaderForm from '../../../../../../../../../static/js/helpers/DataGridViewWithHeaderForm';
import _ from 'lodash';
import { isEmptyString } from 'sources/validators';

import { DataGridFormHeader } from 'sources/SchemaView/DataGridView';
import BaseUISchema from 'sources/SchemaView/base_schema.ui';
import gettext from 'sources/gettext';
import pgAdmin from 'sources/pgadmin';
import { isEmptyString } from 'sources/validators';


function inSchema(node_info) {
Expand All @@ -23,8 +24,8 @@ class IndexColHeaderSchema extends BaseUISchema {
constructor(columns) {
super({
is_exp: true,
colname: undefined,
expression: undefined,
colname: '',
expression: '',
});

this.columns = columns;
Expand Down Expand Up @@ -90,10 +91,10 @@ class IndexColumnSchema extends BaseUISchema {
}

isEditable(state) {
let topObj = this._top;
let topObj = this.top;
if(this.inSchemaWithModelCheck(state)) {
return false;
} else if (topObj._sessData && topObj._sessData.amname === 'btree') {
} else if (topObj.sessData && topObj.sessData.amname === 'btree') {
state.is_sort_nulls_applicable = true;
return true;
} else {
Expand Down Expand Up @@ -155,9 +156,8 @@ class IndexColumnSchema extends BaseUISchema {
* to access method selected by user if not selected
* send btree related op_class options
*/
let amname = obj._top?._sessData ?
obj._top?._sessData.amname :
obj._top?.origData.amname;
let amname = obj.top?.sessData.amname ||
obj.top?.origData.amname;

if(_.isUndefined(amname))
return options;
Expand Down Expand Up @@ -573,10 +573,12 @@ export default class IndexSchema extends BaseUISchema {
group: gettext('Columns'), type: 'collection',
mode: ['create', 'edit', 'properties'],
editable: false, schema: this.indexColumnSchema,
headerSchema: this.indexHeaderSchema, headerVisible: (state)=>indexSchemaObj.isNew(state),
CustomControl: DataGridViewWithHeaderForm,
headerSchema: this.indexHeaderSchema,
headerFormVisible: (state)=>indexSchemaObj.isNew(state),
GridHeader: DataGridFormHeader,
uniqueCol: ['colname'],
canAdd: false, canDelete: function(state) {
canAdd: (state)=>indexSchemaObj.isNew(state),
canDelete: function(state) {
// We can't update columns of existing
return indexSchemaObj.isNew(state);
}, cell: ()=>({
Expand Down
Loading