Skip to content

Commit

Permalink
Merge pull request #225 from 3pillarlabs/feature/disable-jmeter-223
Browse files Browse the repository at this point in the history
Enable Save on dirty values #223
  • Loading branch information
sayantam authored Jan 20, 2021
2 parents 6d282f6 + 5691ba6 commit 3d34773
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions hailstorm-web-client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,11 @@ validate:
git diff ${TRAVIS_COMMIT_RANGE} -- package.json | grep -e '[+\-].*version' > /dev/null; \
[ $$? -eq 0 ]; \
fi

integration_test_bed_up:
cd ../ && docker-compose -f docker-compose.yml -f docker-compose.dc-sim.yml -f docker-compose.web-ci.yml up -d \
hailstorm-api hailstorm-agent-1 hailstorm-agent-2 file-server


integration_test_bed_down:
cd ../ && docker-compose -f docker-compose.yml -f docker-compose.dc-sim.yml -f docker-compose.web-ci.yml down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function ActiveFileDetail({ state, dispatch, setShowModal, setUploadAbort

const onSubmit: FormikActionsHandler = (
values,
{ setSubmitting }
{ setSubmitting, resetForm }
) => {
setSubmitting(true);
const promise = state.wizardState!.activeJMeterFile!.id === undefined ?
Expand All @@ -38,6 +38,7 @@ export function ActiveFileDetail({ state, dispatch, setShowModal, setUploadAbort
dispatch(new MergeJMeterFileAction(jmeterFile));
})
.catch((reason) => console.error(reason))
.then(() => resetForm(values))
.then(() => setSubmitting(false));
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('<JMeterConfiguration />', () => {
)
}

function mockFile(name: string): File {
function mockFile(name: string): {[K in keyof File]?: File[K]} {
return {
name,
type: 'text/xml',
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('<JMeterConfiguration />', () => {
it('should indicate that file upload has started', () => {
const component = mount(createComponent());
const onAccept = component.find('FileUpload').prop('onAccept') as ((file: File) => void);
onAccept(mockFile("a"));
onAccept(mockFile("a") as File);
expect(dispatch).toHaveBeenCalled();
appState.wizardState!.activeJMeterFile = {
name: 'a.jmx',
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('<JMeterConfiguration />', () => {
const component = mount(createComponent());
const onUploadError = component.find('FileUpload').prop('onUploadError') as ((file: File, error: any) => void);
const error = new Error('Server not available');
onUploadError(mockFile("a"), error);
onUploadError(mockFile("a") as File, error);
appState.wizardState!.activeJMeterFile = {
name: 'a.jmx',
uploadProgress: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ function PropertiesForm({
<Formik
{...{initialValues, isInitialValid, onSubmit: handleSubmit, validate}}
>
{({isSubmitting, isValid}) => (
{({isSubmitting, isValid, dirty}) => (
<Form>
<Properties {...{properties}} />
<footer className="card-footer">
<div className="card-footer-item">
<button type="button" className="button is-warning" onClick={onRemove} role="Remove File">Remove</button>
</div>
<div className="card-footer-item">
<button type="submit" className="button is-dark" disabled={isSubmitting || !isValid}> Save </button>
<button type="submit" className="button is-dark" disabled={isSubmitting || !isValid || !dirty}> Save </button>
</div>
</footer>
</Form>
Expand Down

0 comments on commit 3d34773

Please sign in to comment.