public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][React]: Port catalog object columns
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][React]: Port catalog object columns
@ 2021-10-13 07:17 Nikhil Mohite <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Mohite @ 2021-10-13 07:17 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Please find the attached patch to port catalog object columns to react.
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] catalog_object_column.patch (7.1K, 3-catalog_object_column.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js
index 1bad38d2..76e22aaa 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.js
@@ -6,6 +6,7 @@
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
+import CatalogObjectColumnSchema from './catalog_object_column.ui';
define('pgadmin.node.catalog_object_column', [
'sources/gettext', 'jquery', 'underscore', 'sources/pgadmin',
@@ -41,6 +42,9 @@ define('pgadmin.node.catalog_object_column', [
this.initialized = true;
},
+ getSchema: function() {
+ return new CatalogObjectColumnSchema();
+ },
model: pgAdmin.Browser.Node.Model.extend({
defaults: {
attname: undefined,
@@ -56,24 +60,12 @@ define('pgadmin.node.catalog_object_column', [
schema: [{
id: 'attname', label: gettext('Column'), cell: 'string',
type: 'text', readonly: true,
- },{
- id: 'attowner', label: gettext('Owner'), cell: 'string',
- type: 'text', readonly: true,
},{
id: 'attnum', label: gettext('Position'), cell: 'string',
type: 'text', readonly: true,
},{
id: 'cltype', label: gettext('Data type'), cell: 'string',
group: gettext('Definition'), type: 'text', readonly: true,
- },{
- id: 'collspcname', label: gettext('Collation'), cell: 'string',
- group: gettext('Definition'), type: 'text', readonly: true,
- },{
- id: 'attacl', label: gettext('Privileges'), cell: 'string',
- group: gettext('Security'), type: 'text', readonly: true,
- },{
- id: 'is_sys_obj', label: gettext('System column?'),
- cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', readonly: true,
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.ui.js b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.ui.js
new file mode 100644
index 00000000..98541eb4
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.ui.js
@@ -0,0 +1,66 @@
+/////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2021, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////
+
+import gettext from 'sources/gettext';
+import BaseUISchema from 'sources/SchemaView/base_schema.ui';
+
+
+export default class CatalogObjectColumnSchema extends BaseUISchema {
+ constructor(fieldOptions={}, initValues) {
+ super({
+ attname: undefined,
+ attowner: undefined,
+ attnum: undefined,
+ cltype: undefined,
+ collspcname: undefined,
+ attacl: undefined,
+ description: undefined,
+ ...initValues
+ });
+
+ this.fieldOptions = {
+ ...fieldOptions,
+ };
+
+ }
+
+ get idAttribute() {
+ return 'oid';
+ }
+
+ get baseFields() {
+ return [
+ {
+ id: 'attname', label: gettext('Column'), cell: 'string',
+ type: 'text', readonly: true,
+ },{
+ id: 'attowner', label: gettext('Owner'), cell: 'string',
+ type: 'text', readonly: true,
+ },{
+ id: 'attnum', label: gettext('Position'), cell: 'string',
+ type: 'text', readonly: true,
+ },{
+ id: 'cltype', label: gettext('Data type'), cell: 'string',
+ group: gettext('Definition'), type: 'text', readonly: true,
+ },{
+ id: 'collspcname', label: gettext('Collation'), cell: 'string',
+ group: gettext('Definition'), type: 'text', readonly: true,
+ },{
+ id: 'attacl', label: gettext('Privileges'), cell: 'string',
+ group: gettext('Security'), type: 'text', readonly: true,
+ },{
+ id: 'is_sys_obj', label: gettext('System column?'),
+ cell:'boolean', type: 'switch', mode: ['properties'],
+ },{
+ id: 'description', label: gettext('Comment'), cell: 'string',
+ type: 'multiline', readonly: true,
+ }
+ ];
+ }
+}
diff --git a/web/regression/javascript/schema_ui_files/catalog_object_column.ui.spec.js b/web/regression/javascript/schema_ui_files/catalog_object_column.ui.spec.js
new file mode 100644
index 00000000..33bc5485
--- /dev/null
+++ b/web/regression/javascript/schema_ui_files/catalog_object_column.ui.spec.js
@@ -0,0 +1,73 @@
+/////////////////////////////////////////////////////////////
+//
+// pgAdmin 4 - PostgreSQL Tools
+//
+// Copyright (C) 2013 - 2021, The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+//////////////////////////////////////////////////////////////
+
+import jasmineEnzyme from 'jasmine-enzyme';
+import React from 'react';
+import '../helper/enzyme.helper';
+import { createMount } from '@material-ui/core/test-utils';
+import pgAdmin from 'sources/pgadmin';
+import {messages} from '../fake_messages';
+import SchemaView from '../../../pgadmin/static/js/SchemaView';
+import CatalogObjectColumn from '../../../pgadmin/browser/server_groups/servers/databases/schemas/catalog_objects/columns/static/js/catalog_object_column.ui';
+
+describe('CatalogObjectColumn', ()=>{
+ let mount;
+ let schemaObj = new CatalogObjectColumn();
+ let getInitData = ()=>Promise.resolve({});
+
+ /* Use createMount so that material ui components gets the required context */
+ /* https://material-ui.com/guides/testing/#api */
+ beforeAll(()=>{
+ mount = createMount();
+ });
+
+ afterAll(() => {
+ mount.cleanUp();
+ });
+
+ beforeEach(()=>{
+ jasmineEnzyme();
+ /* messages used by validators */
+ pgAdmin.Browser = pgAdmin.Browser || {};
+ pgAdmin.Browser.messages = pgAdmin.Browser.messages || messages;
+ pgAdmin.Browser.utils = pgAdmin.Browser.utils || {};
+ });
+
+ it('create', ()=>{
+ mount(<SchemaView
+ formType='dialog'
+ schema={schemaObj}
+ viewHelperProps={{
+ mode: 'create',
+ }}
+ onSave={()=>{}}
+ onClose={()=>{}}
+ onHelp={()=>{}}
+ onEdit={()=>{}}
+ onDataChange={()=>{}}
+ confirmOnCloseReset={false}
+ hasSQL={false}
+ disableSqlHelp={false}
+ />);
+ });
+
+ it('properties', ()=>{
+ mount(<SchemaView
+ formType='tab'
+ schema={schemaObj}
+ getInitData={getInitData}
+ viewHelperProps={{
+ mode: 'properties',
+ }}
+ onHelp={()=>{}}
+ onEdit={()=>{}}
+ />);
+ });
+
+});
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][React]: Port catalog object columns
@ 2021-10-13 09:00 Akshay Joshi <[email protected]>
parent: Nikhil Mohite <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2021-10-13 09:00 UTC (permalink / raw)
To: Nikhil Mohite <[email protected]>; +Cc: pgadmin-hackers
Thanks, the patch applied.
On Wed, Oct 13, 2021 at 12:48 PM Nikhil Mohite <
[email protected]> wrote:
> Hi Hackers,
>
> Please find the attached patch to port catalog object columns to react.
>
> --
> *Thanks & Regards,*
> *Nikhil Mohite*
> *Software Engineer.*
> *EDB Postgres* <https://www.enterprisedb.com/;
> *Mob.No: +91-7798364578.*
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2021-10-13 09:00 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 07:17 [pgAdmin][React]: Port catalog object columns Nikhil Mohite <[email protected]>
2021-10-13 09:00 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox