Port Catalog Object node to react. Fixes #6569

This commit is contained in:
Nikhil Mohite
2021-07-07 10:54:21 +05:30
committed by Akshay Joshi
parent 5a27961102
commit 78ac1ee69c
3 changed files with 105 additions and 4 deletions

View File

@@ -7,6 +7,8 @@
//
//////////////////////////////////////////////////////////////
import CatalogObjectSchema from './catalog_object.ui';
define('pgadmin.node.catalog_object', [
'sources/gettext', 'jquery', 'underscore', 'sources/pgadmin',
'pgadmin.browser', 'pgadmin.browser.collection',
@@ -40,12 +42,15 @@ define('pgadmin.node.catalog_object', [
this.initialized = true;
},
getSchema: ()=>new CatalogObjectSchema(),
/* Few fields are kept since the properties tab for collection is not
yet migrated to new react schema. Once the properties for collection
is removed, remove this model */
model: pgAdmin.Browser.Node.Model.extend({
defaults: {
name: undefined,
namespaceowner: undefined,
nspacl: undefined,
is_sys_obj: undefined,
description: undefined,
},
schema: [{
@@ -57,15 +62,13 @@ define('pgadmin.node.catalog_object', [
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', readonly: true,
},{
id: 'is_sys_obj', label: gettext('System catalog object?'),
cell:'boolean', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline' , readonly: true,
},
],
}),
});
}

View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////
//
// 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 CatalogObjectSchema extends BaseUISchema {
constructor() {
super({
name: undefined,
is_sys_obj: undefined,
description: undefined
});
}
get baseFields() {
return [
{
id: 'name', label: gettext('Name'), cell: 'text',
editable: false, type: 'text', mode: ['properties', 'edit']
},
{
id: 'oid', label: gettext('OID'), cell: 'text',
editable: false, type: 'text', mode: ['properties', 'edit']
},
{
id: 'owner', label: gettext('Owner'),
editable: false, type: 'text', mode: ['properties', 'edit']
},{
id: 'is_sys_obj', label: gettext('System database?'),
cell: 'switch', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'),
editable: false, type: 'multiline', mode: ['properties', 'edit']
}
];
}
}