Added React framework for the properties dialog and port Server Group, Server, and Database dialogs. 

Following changes done for the framework:
 - Framework for creating React based dynamic form view out of a pre-defined UI schema. Previously, it was based on Backform/Backbone.
 - The new framework and components will use MaterialUI as the base. Previously, Bootstrap/Backform/jQuery components were used.
 - The new code uses JSS instead of CSS since material UI and most modern React libraries also use JSS. In the future, this will allow us to change the theme in real-time without refresh.
 - 90% code covered by 80-85 new jasmine test cases.
 - Server group node UI Schema migration to new, with schema test cases.
 - Server node UI Schema migration to new, with schema test cases.
 - Database node UI Schema migration to new, with schema test cases.
 - Few other UI changes.

Fixes #6130
This commit is contained in:
Aditya Toshniwal
2021-06-29 14:33:36 +05:30
committed by Akshay Joshi
parent a10b0c7786
commit 764677431f
63 changed files with 8489 additions and 1181 deletions

View File

@@ -0,0 +1,46 @@
/////////////////////////////////////////////////////////////
//
// 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 {default as OrigCodeMirror} from 'bundled_codemirror';
import CodeMirror from 'sources/components/CodeMirror';
import { mount } from 'enzyme';
describe('CodeMirror', ()=>{
let cmInstance, options={
lineNumbers: true,
mode: 'text/x-pgsql',
}, cmObj = jasmine.createSpyObj('cmObj', {'setValue': ()=>{}, 'refresh': ()=>{}});
beforeEach(()=>{
jasmineEnzyme();
spyOn(OrigCodeMirror, 'fromTextArea').and.returnValue(cmObj);
cmInstance = mount(
<CodeMirror
value={'Init text'}
options={options}
className="testClass"
/>);
});
it('init', ()=>{
/* textarea ref passed to fromTextArea */
expect(OrigCodeMirror.fromTextArea).toHaveBeenCalledWith(cmInstance.getDOMNode(), options);
expect(cmObj.setValue).toHaveBeenCalledWith('Init text');
expect(cmObj.refresh).toHaveBeenCalled();
});
it('change value', ()=>{
cmInstance.setProps({value: 'the new text'});
expect(cmObj.setValue).toHaveBeenCalledWith('the new text');
expect(cmObj.refresh).toHaveBeenCalled();
});
});