Fix linter issues in previous commit.

This commit is contained in:
Aditya Toshniwal 2021-07-15 15:04:11 +05:30 committed by Akshay Joshi
parent 6fe83d1f06
commit 5d8eeba0dd
6 changed files with 29 additions and 19 deletions

View File

@ -28,9 +28,7 @@ import FormView from './FormView';
import { confirmDeleteRow } from '../helpers/legacyConnector'; import { confirmDeleteRow } from '../helpers/legacyConnector';
import CustomPropTypes from 'sources/custom_prop_types'; import CustomPropTypes from 'sources/custom_prop_types';
import { evalFunc } from 'sources/utils'; import { evalFunc } from 'sources/utils';
import { useOnScreen } from '../custom_hooks';
import { DepListenerContext } from './DepListener'; import { DepListenerContext } from './DepListener';
import { getSchemaRow } from '../utils';
const useStyles = makeStyles((theme)=>({ const useStyles = makeStyles((theme)=>({
grid: { grid: {
@ -219,7 +217,7 @@ export default function DataGridView({
onClick={()=>{ onClick={()=>{
row.toggleRowExpanded(!row.isExpanded); row.toggleRowExpanded(!row.isExpanded);
}} disabled={!canEditRow} }} disabled={!canEditRow}
/> />;
} }
}; };
colInfo.Cell.displayName = 'Cell', colInfo.Cell.displayName = 'Cell',
@ -420,9 +418,21 @@ DataGridView.propTypes = {
dataDispatch: PropTypes.func.isRequired, dataDispatch: PropTypes.func.isRequired,
containerClassName: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), containerClassName: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
columns: PropTypes.array, columns: PropTypes.array,
canEdit: PropTypes.bool, canEdit: PropTypes.oneOfType([
canAdd: PropTypes.bool, PropTypes.bool, PropTypes.func,
canDelete: PropTypes.bool, ]),
canAdd: PropTypes.oneOfType([
PropTypes.bool, PropTypes.func,
]),
canDelete: PropTypes.oneOfType([
PropTypes.bool, PropTypes.func,
]),
canEditRow: PropTypes.oneOfType([
PropTypes.bool, PropTypes.func,
]),
canDeleteRow: PropTypes.oneOfType([
PropTypes.bool, PropTypes.func,
]),
customDeleteTitle: PropTypes.string, customDeleteTitle: PropTypes.string,
customDeleteMsg: PropTypes.string, customDeleteMsg: PropTypes.string,
}; };

View File

@ -26,7 +26,7 @@ export default class DepListener {
if(dataPath.length > 0) { if(dataPath.length > 0) {
data = _.get(state, dataPath); data = _.get(state, dataPath);
} }
data = _.assign(data, listener.callback && listener.callback(data, listener.source, state, actionObj) || {}); _.assign(data, listener.callback && listener.callback(data, listener.source, state, actionObj) || {});
return state; return state;
} }

View File

@ -72,8 +72,8 @@ SQLTab.propTypes = {
/* The first component of schema view form */ /* The first component of schema view form */
export default function FormView({ export default function FormView({
value, formErr, schema={}, viewHelperProps, isNested=false, accessPath, dataDispatch, hasSQLTab, value, formErr, schema={}, viewHelperProps, isNested=false, accessPath, dataDispatch, hasSQLTab,
getSQLValue, onTabChange, firstEleRef, className, isDataGridForm=false}) { getSQLValue, onTabChange, firstEleRef, className, isDataGridForm=false}) {
let defaultTab = 'General'; let defaultTab = 'General';
let tabs = {}; let tabs = {};
let tabsClassname = {}; let tabsClassname = {};
@ -281,7 +281,7 @@ export default function FormView({
{Object.keys(tabs).map((tabName, i)=>{ {Object.keys(tabs).map((tabName, i)=>{
return ( return (
<TabPanel key={tabName} value={tabValue} index={i} classNameRoot={clsx(tabsClassname[tabName], isNested ? classes.nestedTabPanel : null)} <TabPanel key={tabName} value={tabValue} index={i} classNameRoot={clsx(tabsClassname[tabName], isNested ? classes.nestedTabPanel : null)}
className={tabName != sqlTabName ? classes.nestedControl : null}> className={tabName != sqlTabName ? classes.nestedControl : null}>
{tabs[tabName]} {tabs[tabName]}
</TabPanel> </TabPanel>
); );
@ -296,6 +296,7 @@ FormView.propTypes = {
schema: CustomPropTypes.schemaUI.isRequired, schema: CustomPropTypes.schemaUI.isRequired,
viewHelperProps: PropTypes.object, viewHelperProps: PropTypes.object,
isNested: PropTypes.bool, isNested: PropTypes.bool,
isDataGridForm: PropTypes.bool,
accessPath: PropTypes.array.isRequired, accessPath: PropTypes.array.isRequired,
dataDispatch: PropTypes.func, dataDispatch: PropTypes.func,
hasSQLTab: PropTypes.bool, hasSQLTab: PropTypes.bool,

View File

@ -7,7 +7,7 @@
// //
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
import _ from "lodash"; import _ from 'lodash';
/* This is the base schema class for SchemaView. /* This is the base schema class for SchemaView.
* A UI schema must inherit this to use SchemaView for UI. * A UI schema must inherit this to use SchemaView for UI.

View File

@ -237,7 +237,7 @@ const getDepChange = (currPath, newState, oldState, action)=>{
}); });
} }
return newState; return newState;
} };
const getDeferredDepChange = (currPath, newState, oldState, action)=>{ const getDeferredDepChange = (currPath, newState, oldState, action)=>{
if(action.deferredDepChange) { if(action.deferredDepChange) {
@ -248,9 +248,9 @@ const getDeferredDepChange = (currPath, newState, oldState, action)=>{
depChange: action.depChange, depChange: action.depChange,
oldState: _.cloneDeep(oldState), oldState: _.cloneDeep(oldState),
}); });
return deferredPromiseList return deferredPromiseList;
} }
} };
/* The main function which manipulates the session state based on actions */ /* The main function which manipulates the session state based on actions */
/* /*
@ -271,7 +271,7 @@ The state starts with path []
*/ */
const sessDataReducer = (state, action)=>{ const sessDataReducer = (state, action)=>{
let data = _.cloneDeep(state); let data = _.cloneDeep(state);
let rows, cid; let rows, cid, deferredList;
data.__deferred__ = data.__deferred__ || []; data.__deferred__ = data.__deferred__ || [];
switch(action.type) { switch(action.type) {
case SCHEMA_STATE_ACTIONS.INIT: case SCHEMA_STATE_ACTIONS.INIT:
@ -281,7 +281,7 @@ const sessDataReducer = (state, action)=>{
_.set(data, action.path, action.value); _.set(data, action.path, action.value);
/* If there is any dep listeners get the changes */ /* If there is any dep listeners get the changes */
data = getDepChange(action.path, data, state, action); data = getDepChange(action.path, data, state, action);
let deferredList = getDeferredDepChange(action.path, data, state, action); deferredList = getDeferredDepChange(action.path, data, state, action);
// let deferredInfo = getDeferredDepChange(action.path, data, state, action); // let deferredInfo = getDeferredDepChange(action.path, data, state, action);
data.__deferred__ = deferredList || []; data.__deferred__ = deferredList || [];
break; break;
@ -354,7 +354,6 @@ function SchemaDialogView({
const [formErr, setFormErr] = useState({}); const [formErr, setFormErr] = useState({});
const [loaderText, setLoaderText] = useState(''); const [loaderText, setLoaderText] = useState('');
const [saving, setSaving] = useState(false); const [saving, setSaving] = useState(false);
const [sqlTabActive, setSqlTabActive] = useState(false);
const [formReady, setFormReady] = useState(false); const [formReady, setFormReady] = useState(false);
const firstEleRef = useRef(); const firstEleRef = useRef();
const isNew = schema.isNew(schema.origData); const isNew = schema.isNew(schema.origData);
@ -550,8 +549,7 @@ function SchemaDialogView({
<Loader message={loaderText}/> <Loader message={loaderText}/>
<FormView value={sessData} viewHelperProps={viewHelperProps} formErr={formErr} <FormView value={sessData} viewHelperProps={viewHelperProps} formErr={formErr}
schema={schema} accessPath={[]} dataDispatch={sessDispatchWithListener} schema={schema} accessPath={[]} dataDispatch={sessDispatchWithListener}
hasSQLTab={props.hasSQL} getSQLValue={getSQLValue} onTabChange={(i, tabName, sqlActive)=>setSqlTabActive(sqlActive)} hasSQLTab={props.hasSQL} getSQLValue={getSQLValue} firstEleRef={firstEleRef} />
firstEleRef={firstEleRef} />
<FormFooterMessage type={MESSAGE_TYPE.ERROR} message={formErr.message} <FormFooterMessage type={MESSAGE_TYPE.ERROR} message={formErr.message}
onClose={onErrClose} /> onClose={onErrClose} />
</Box> </Box>

View File

@ -822,6 +822,7 @@ const useStylesFormFooter = makeStyles((theme)=>({
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
zIndex: 10,
}, },
container: { container: {
borderWidth: '1px', borderWidth: '1px',