Skip to content

Commit

Permalink
Fixed protocol for copy
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Oct 3, 2022
1 parent b93b29c commit 86012a7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ui/src/app/metadata/copy/CopySource.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export function CopySource({ copy, onNext }) {

const target = watch('target');

const form = watch();

const { errors, isValid } = formState;

React.useEffect(() => {
Expand All @@ -57,6 +59,8 @@ export function CopySource({ copy, onNext }) {

const sections = useMetadataSourceSections();

React.useEffect(() => console.log(form), [form]);

return (
<>
<div className="row">
Expand Down
8 changes: 7 additions & 1 deletion ui/src/app/metadata/copy/SaveCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ import { MetadataConfiguration } from '../component/MetadataConfiguration';
import Translate from '../../i18n/components/translate';

export function useCopiedModel (copy) {

const { properties, target, serviceProviderName, entityId } = copy;
const copied = removeNull(properties.reduce((c, section) => ({ ...c, ...{ [section]: target[section] } }), {}));
const { protocol } = target;

let copied = removeNull(properties.reduce((c, section) => ({ ...c, ...{ [section]: target[section] } }), {}));

const model = {
serviceProviderName,
entityId,
protocol,
...copied
};
return model;
Expand All @@ -31,6 +36,7 @@ export function SaveCopy ({ copy, saving, onSave, onBack }) {
const schema = React.useContext(MetadataSchemaContext);

const model = useCopiedModel(copy);

const configuration = useCopiedConfiguration(model, schema, definition);

const { handleSubmit } = useForm({
Expand Down
1 change: 0 additions & 1 deletion ui/src/app/metadata/hoc/MetadataSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export function MetadataSelector({ children, ...props }) {
function reload() {
setLoading(true);
loadMetadata(id);

}

React.useEffect(() => reload(), [id]);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/app/metadata/view/MetadataCopy.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function MetadataCopy ({ onShowNav }) {
return (
<React.Fragment>
{!confirm &&
<CopySource copy={copy} onNext={next} />
<CopySource copy={copy} onNext={next} />
}
{confirm && copy &&
<SaveCopy copy={copy} onBack={back} onSave={save} saving={loading} />
Expand Down

0 comments on commit 86012a7

Please sign in to comment.