Skip to content

Commit

Permalink
corrected the variable name using right naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
vardhan0604 committed Jun 28, 2024
1 parent e164e9b commit 0c9632c
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
12 changes: 6 additions & 6 deletions src/components/BrowserFilter/BrowserFilter.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class BrowserFilter extends React.Component {
if (this.props.filters.size === 0) {
const available = Filters.findRelatedClasses(
this.props.className,
this.props.AllclassesSchema,
this.props.allClassesSchema,
this.state.blacklistedFilters,
this.state.filters
);
Expand All @@ -72,7 +72,7 @@ export default class BrowserFilter extends React.Component {
addRow() {
const available = Filters.findRelatedClasses(
this.props.className,
this.props.AllclassesSchema,
this.props.allClassesSchema,
this.state.blacklistedFilters,
this.state.filters
);
Expand Down Expand Up @@ -137,7 +137,7 @@ export default class BrowserFilter extends React.Component {
}
const available = Filters.findRelatedClasses(
this.props.className,
this.props.AllclassesSchema,
this.props.allClassesSchema,
this.state.blacklistedFilters,
this.state.filters
);
Expand Down Expand Up @@ -169,10 +169,10 @@ export default class BrowserFilter extends React.Component {
filters={this.state.filters}
onChange={filters => this.setState({ filters: filters })}
onSearch={this.apply.bind(this)}
Allclasses={this.props.AllclassesSchema}
AllclassesSchema={Filters.findRelatedClasses(
allClasses={this.props.allClassesSchema}
allClassesSchema={Filters.findRelatedClasses(
this.props.className,
this.props.AllclassesSchema
this.props.allClassesSchema
)}
renderRow={props => (
<FilterRow
Expand Down
4 changes: 2 additions & 2 deletions src/components/Filter/Filter.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function deleteRow(filters, index) {
const Filter = ({
schema,
filters,
Allclasses,
allClasses,
renderRow,
onChange,
onSearch,
Expand All @@ -92,7 +92,7 @@ const Filter = ({
}) => {
const currentApp = React.useContext(CurrentApp);
blacklist = blacklist || [];
const available = Filters.findRelatedClasses(className, Allclasses, blacklist, filters);
const available = Filters.findRelatedClasses(className, allClasses, blacklist, filters);
const classes = Object.keys(available).concat([]);
return (
<div
Expand Down
22 changes: 11 additions & 11 deletions src/dashboard/Data/Browser/Browser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ class Browser extends DashboardView {
draggedRowSelection: false,

classes: {},
AllclassesSchema: {}
allClassesSchema: {}
};

this.addLocation = this.addLocation.bind(this);
this.AllclassesSchema = this.getAllclassesSchema.bind(this);
this.allClassesSchema = this.getAllClassesSchema.bind(this);
this.removeLocation = this.removeLocation.bind(this);
this.prefetchData = this.prefetchData.bind(this);
this.fetchData = this.fetchData.bind(this);
Expand Down Expand Up @@ -229,7 +229,7 @@ class Browser extends DashboardView {
if (!nextProps.params.className && nextProps.schema.data.get('classes')) {
const t = nextProps.schema.data.get('classes');
this.classes = Object.keys(t.toObject());
this.AllclassesSchema = this.getAllclassesSchema(this.classes ,nextProps.schema.data.get('classes'));
this.allClassesSchema = this.getAllClassesSchema(this.classes ,nextProps.schema.data.get('classes'));
this.redirectToFirstClass(nextProps.schema.data.get('classes'), nextContext);
}
}
Expand Down Expand Up @@ -758,10 +758,10 @@ class Browser extends DashboardView {
}
}

getAllclassesSchema(Allclasses , allclassesdata) {
getAllClassesSchema(allClasses , allClassesData) {
const schemaSimplifiedData = {};
Allclasses.forEach((className) => {
const classSchema = allclassesdata.get(className);
allClasses.forEach((className) => {
const classSchema = allClassesData.get(className);
if (classSchema) {
schemaSimplifiedData[className] = {};
classSchema.forEach(({ type, targetClass }, col) => {
Expand Down Expand Up @@ -797,9 +797,9 @@ class Browser extends DashboardView {
}
}

async fetchParseData(source, filters, AllclassesSchema) {
async fetchParseData(source, filters) {
const { useMasterKey } = this.state;
const query = await queryFromFilters(source, filters, AllclassesSchema);
const query = await queryFromFilters(source, filters);
const sortDir = this.state.ordering[0] === '-' ? '-' : '+';
const field = this.state.ordering.substr(sortDir === '-' ? 1 : 0);

Expand Down Expand Up @@ -839,15 +839,15 @@ class Browser extends DashboardView {
}
}

async fetchParseDataCount(source, filters,AllclassesSchema) {
const query = await queryFromFilters(source, filters,AllclassesSchema);
async fetchParseDataCount(source, filters) {
const query = await queryFromFilters(source, filters);
const { useMasterKey } = this.state;
const count = await query.count({ useMasterKey });
return count;
}

async fetchData(source, filters = new List()) {
const data = await this.fetchParseData(source, filters,this.AllclassesSchema);
const data = await this.fetchParseData(source, filters);
const filteredCounts = { ...this.state.filteredCounts };
if (filters.size > 0) {
if (this.state.isUnique) {
Expand Down
10 changes: 5 additions & 5 deletions src/dashboard/Data/Browser/BrowserToolbar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ const BrowserToolbar = ({
toggleMasterKeyUsage,

selectedData,
Allclasses,
AllclassesSchema,
allClasses,
allClassesSchema,
}) => {
const selectionLength = Object.keys(selection).length;
const isPendingEditCloneRows = editCloneRows && editCloneRows.length > 0;
Expand Down Expand Up @@ -227,7 +227,7 @@ const BrowserToolbar = ({
});
}

Allclasses.forEach(className => {
allClasses.forEach(className => {
const classSchema = schema.data.get('classes').get(className);

if (classSchema) {
Expand Down Expand Up @@ -366,8 +366,8 @@ const BrowserToolbar = ({
className={classNameForEditors}
blacklistedFilters={onAddRow ? [] : ['unique']}
disabled={isPendingEditCloneRows}
Allclasses={Allclasses}
AllclassesSchema={AllclassesSchema}
allClasses={allClasses}
allClassesSchema={allClassesSchema}
/>
{onAddRow && <div className={styles.toolbarSeparator} />}
{enableSecurityDialog ? (
Expand Down
14 changes: 7 additions & 7 deletions src/dashboard/Data/Browser/DataBrowser.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class DataBrowser extends React.Component {
editing: false,
copyableValue: undefined,
simplifiedSchema: this.getSimplifiedSchema(props.schema, props.className),
AllclassesSchema: this.getAllclassesSchema(props.schema,props.classes),
allClassesSchema: this.getAllClassesSchema(props.schema,props.classes),

selectedCells: { list: new Set(), rowStart: -1, rowEnd: -1, colStart: -1, colEnd: -1 },
firstSelectedCell: null,
Expand Down Expand Up @@ -109,13 +109,13 @@ export default class DataBrowser extends React.Component {
}, 1000);
}

getAllclassesSchema(schema,Allclasses) {
getAllClassesSchema(schema,allClasses) {

const schemaSimplifiedData = {};
if(!Allclasses){
Allclasses = Object.keys(schema.data.get('classes').toObject());
if(!allClasses){
allClasses = Object.keys(schema.data.get('classes').toObject());
}
Allclasses.forEach((className) => {
allClasses.forEach((className) => {
const classSchema = schema.data.get('classes').get(className);
if (classSchema) {
schemaSimplifiedData[className] = {};
Expand Down Expand Up @@ -471,8 +471,8 @@ export default class DataBrowser extends React.Component {
onCancelPendingEditRows={onCancelPendingEditRows}
order={this.state.order}
selectedData={this.state.selectedData}
Allclasses={Object.keys(this.props.schema.data.get('classes').toObject())}
AllclassesSchema={this.state.AllclassesSchema}
allClasses={Object.keys(this.props.schema.data.get('classes').toObject())}
allClassesSchema={this.state.allClassesSchema}
{...other}
/>

Expand Down
8 changes: 4 additions & 4 deletions src/lib/Filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,13 @@ export function availableFilters(schema, currentFilters, blacklist) {
return available;
}

export function findRelatedClasses(referClass , Allclasses, blacklist, currentFilters) {
export function findRelatedClasses(referClass , allClasses, blacklist, currentFilters) {
const relatedClasses = {};
for (const className in Allclasses) {
if (!checkRelation(referClass,Allclasses[className]) && referClass !== className){
for (const className in allClasses) {
if (!checkRelation(referClass,allClasses[className]) && referClass !== className){
continue;
}
const schema = Allclasses[className];
const schema = allClasses[className];
const available = availableFilters(schema, currentFilters, blacklist);
if (Object.keys(available).length > 0) {
relatedClasses[className] = available;
Expand Down
12 changes: 6 additions & 6 deletions src/lib/queryFromFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default async function queryFromFilters(className, filters) {

primaryQuery.applySchemaConstraints = async function () {
try {
const AllclassesSchema = await fetchAllSchemas();
const allClassesSchema = await fetchAllSchemas();
await Promise.all(
Object.keys(queries).map(async filterClassName => {
let tempquery;
Expand All @@ -40,14 +40,14 @@ export default async function queryFromFilters(className, filters) {
} else if (typeof className === 'object' && className instanceof Parse.Relation) {
tempquery = className.query();
}
const reversePointerField = getPointerField(AllclassesSchema, filterClassName, className);
const pointerField = getPointerField(AllclassesSchema, className, filterClassName);
const reversePointerField = getPointerField(allClassesSchema, filterClassName, className);
const pointerField = getPointerField(allClassesSchema, className, filterClassName);
if (pointerField) {
tempquery.matchesQuery(pointerField, queries[filterClassName]);
} else if (reversePointerField) {
await tempquery.matchesKeyInQuery(
'objectId',
'userPointer.objectId',
`${reversePointerField}.objectId`,
queries[filterClassName]
)
querieslist.push(tempquery);
Expand Down Expand Up @@ -77,8 +77,8 @@ async function fetchAllSchemas() {
return schemaMap;
}

function getPointerField(AllClassSchema, fromClassName, toClassName) {
const schema = AllClassSchema[fromClassName];
function getPointerField(allClassesSchema, fromClassName, toClassName) {
const schema = allClassesSchema[fromClassName];
if (schema) {
for (const field of Object.keys(schema)) {
if (schema[field].type === 'Pointer' && schema[field].targetClass === toClassName) {
Expand Down

0 comments on commit 0c9632c

Please sign in to comment.