Skip to content

Commit

Permalink
Fixed issue with duplicate properties
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 1, 2022
1 parent 5e41183 commit 6ceb832
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ui/src/app/admin/component/ConfigurationForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { useProperties } from '../hoc/PropertiesProvider';
import Form from 'react-bootstrap/Form';
import FloatingLabel from 'react-bootstrap/FloatingLabel';
import { useTranslator } from '../../i18n/hooks';
import { includes } from 'lodash';

export function ConfigurationForm({ configuration = {}, loading, onSave, onCancel }) {

Expand All @@ -27,20 +28,23 @@ export function ConfigurationForm({ configuration = {}, loading, onSave, onCance
});

const properties = useProperties();
const selected = watch('properties');

const addProperties = (props) => {

const parsed = props.reduce((coll, prop, idx) => {
if (prop.isCategory) {
console.log(properties.filter(p => p.category === prop.category))

return [...coll, ...properties.filter(p => p.category === prop.category)];
} else {
return [...coll, prop];
}
}, []);

append(parsed);
const names = selected.map(p => p.propertyName);

const filtered = parsed.filter(p => includes(names, p.propertyName) ? false : true);

append(filtered);
};

const saveConfig = (formValues) => {
Expand Down

0 comments on commit 6ceb832

Please sign in to comment.