Skip to content

Commit

Permalink
SHort-cut for selecting XML-to-JSON custom class
Browse files Browse the repository at this point in the history
When editing a Transformation Step, a button allows "Custom class" to
be set to the XML-to-JSON class.

Fixes UIHAADM-111.
  • Loading branch information
MikeTaylor committed Jan 22, 2024
1 parent c86fa75 commit 3bc3541
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* When editing a Transformation Pipeline, allow re-ordering of steps. Fixes UIHAADM-108.
* Status is once more displayed in Job pane-title. Fixes UIHAADM-120.
* When viewing a Storage Engine, obscure possible passwords in JSON configuration. Fixes UIHAADM-107.
* When editing a Transformation Step, a button allows "Custom class" to be set to the XML-to-JSON class. Fixes UIHAADM-111.

## [2.0.0](https://github.com/folio-org/ui-harvester-admin/tree/v2.0.0) (2023-10-13)

Expand Down
19 changes: 16 additions & 3 deletions src/settings/StepForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import { useIntl, FormattedMessage } from 'react-intl';
import arrayMutators from 'final-form-arrays';
import { Pane, Row, Select, Checkbox, TextArea } from '@folio/stripes/components';
import { Pane, Row, Col, Select, Checkbox, TextArea, Button } from '@folio/stripes/components';
import { TitleManager } from '@folio/stripes/core';
import stripesFinalForm from '@folio/stripes/final-form';
import { isEqual } from 'lodash';
Expand Down Expand Up @@ -30,7 +30,7 @@ function validate(values) {


const StepForm = (props) => {
const { handleSubmit, onCancel, pristine, submitting } = props;
const { form, handleSubmit, onCancel, pristine, submitting } = props;
const intl = useIntl();

const noValue = {
Expand All @@ -39,6 +39,7 @@ const StepForm = (props) => {
};
const types = ['XmlTransformStep', 'CustomTransformStep'].map(x => ({ value: x, label: x }));
const formats = ['XML', 'JSON', 'Other'].map(x => ({ value: x, label: x }));
const ccXML2JSON = 'com.indexdata.masterkey.localindices.harvest.messaging.InstanceXmlToInstanceJsonTransformerRouter';

const title = props.initialValues?.name;

Expand Down Expand Up @@ -66,7 +67,16 @@ const StepForm = (props) => {
<RCF tag="script" domain="step" component={TextArea} rows="4" />
<RCF tag="testData" domain="step" component={TextArea} rows="4" />
<RCF tag="testOutput" domain="step" component={TextArea} rows="4" />
<RCF tag="customClass" domain="step" />
<Row>
<CF tag="customClass" domain="step" xs={9} />
<Col xs={3}>
<div style={{ marginTop: '1.9em' }}>
<Button marginBottom0 onClick={() => form.change('customClass', ccXML2JSON)}>
<FormattedMessage id="ui-harvester-admin.set-to-xml2json" />
</Button>
</div>
</Col>
</Row>
</form>
</TitleManager>
</Pane>
Expand All @@ -75,6 +85,9 @@ const StepForm = (props) => {


StepForm.propTypes = {
form: PropTypes.shape({
change: PropTypes.func.isRequired,
}).isRequired,
initialValues: PropTypes.object,
handleSubmit: PropTypes.func.isRequired,
onCancel: PropTypes.func,
Expand Down
1 change: 1 addition & 0 deletions translations/ui-harvester-admin/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"invalidJSON": "Invalid JSON: {error}",
"selectToContinue": "Please select to continue",
"resultCount": "{count, number} {count, plural, one {record found} other {records found}}",
"set-to-xml2json": "Choose XML-to-JSON",
"settings.storage": "Storage engines",
"settings.storage.heading": "Manage storage engines",
"settings.pipeline": "Transformation pipelines",
Expand Down

0 comments on commit 3bc3541

Please sign in to comment.