Skip to content

Commit

Permalink
Merged develop into bugfix/SHIBUI-2352
Browse files Browse the repository at this point in the history
  • Loading branch information
chasegawa committed Aug 30, 2022
2 parents 6e456f1 + d796e56 commit 71b66aa
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 0 additions & 2 deletions ui/src/app/metadata/Filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ export function Filter() {

const { path, url } = useRouteMatch();

console.log(path, url)

return (
<Switch>
<Route path={`${path}/list`} render={() =>
Expand Down
8 changes: 8 additions & 0 deletions ui/src/app/metadata/editor/MetadataFilterEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export function MetadataFilterEditor({children, onNavigate, block}) {
const schema = React.useContext(MetadataSchemaContext);
const current = React.useContext(MetadataFilterContext);

React.useEffect(() => {
const step = definition.steps.find(step => step.id === section);
if (!step) {
onNavigate(definition.steps[0].id);
}
}, [section, current, onNavigate, definition]);

const { state, dispatch } = React.useContext(MetadataFormContext);
const { metadata, errors } = state;

Expand All @@ -38,6 +45,7 @@ export function MetadataFilterEditor({children, onNavigate, block}) {

const warnings = definition.warnings && definition.warnings(metadata);


return (
<div className="">
<div className="row">
Expand Down
6 changes: 5 additions & 1 deletion ui/src/app/metadata/hooks/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ export function useUiSchema(definition, schema, current, locked = true) {

const ui = React.useMemo(() => definition ? { ...definition.uiSchema } : {}, [definition]);
const schemaKeys = React.useMemo(() => schema ? Object.keys(schema.properties) : [], [schema]);
const step = React.useMemo(() => definition ? definition.steps.find(step => step.id === current) : {fields: []}, [definition, current]);
let step = React.useMemo(() => definition ? definition.steps.find(step => step.id === current) : {fields: []}, [definition, current]);

if (!step) {
step = definition.steps[0];
}

const filled = React.useMemo(() => fillInRootProperties(schemaKeys, ui), [schemaKeys, ui]);
const mapped = React.useMemo(() => Object.keys(filled).reduce((sch, key) => {
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/metadata/wizard/MetadataFilterTypeSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Translate from '../../i18n/components/translate';
import { InfoIcon } from '../../form/component/InfoIcon';
import { useTranslator } from '../../i18n/hooks';

export function MetadataFilterTypeSelector({ types = [], children, actions}) {
export function MetadataFilterTypeSelector({ types = [], children}) {

const translator = useTranslator();

Expand All @@ -29,7 +29,7 @@ export function MetadataFilterTypeSelector({ types = [], children, actions}) {
React.useEffect(() => {
setBase({
'@type': type
})
});
}, [type])

return (
Expand Down

0 comments on commit 71b66aa

Please sign in to comment.