Skip to content

Commit

Permalink
removed tabs from mri violation module
Browse files Browse the repository at this point in the history
remove noDynamicDataTable
fix the filter not working for resolution status
update test plan
  • Loading branch information
cmadjar committed Feb 28, 2023
1 parent f245787 commit 51e4662
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 553 deletions.
57 changes: 15 additions & 42 deletions modules/mri_violations/jsx/mriViolationsIndex.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import {Tabs, TabPane} from 'Tabs';
import Loader from 'Loader';
import FilterableDataTable from 'FilterableDataTable';
import React, {useEffect, useState} from 'react';

import {formatColumnUnresolved, unresolvedFilters}
from './unresolvedViolations.js';
import {formatColumnResolved, resolvedFilters}
from './resolvedViolations.js';
import {formatColumn, violationFilters} from './violations.js';

import ProtocolModal from './protocolModal.js';

Expand All @@ -20,10 +16,6 @@ import ProtocolModal from './protocolModal.js';
function MRIViolationsIndex(props) {
const [fieldOptions, setFieldOptions] = useState({});
const [violationModal, setViolationModal] = useState(false);
const tabs = [
{id: 'notresolved', label: 'Not Resolved'},
{id: 'resolved', label: 'Resolved'},
];

const mapper = columnMapper(fieldOptions);

Expand All @@ -35,33 +27,18 @@ function MRIViolationsIndex(props) {

return <div>
{violationsModal}
<Tabs tabs={tabs} defaultTab="notresolved" updateURL={true}>
<TabPane TabId={tabs[0].id}>
<ViolationsTable
URL={props.unresolvedURL}
name="notresolved"
mapper={mapper}
formatter={formatColumnUnresolved(
mapper,
setViolationModal,
props.ModuleURL + '/resolve'
)}
fields={unresolvedFilters(fieldOptions)}
setFieldOptions={setFieldOptions}
noDynamicTable={true}
/>
</TabPane>
<TabPane TabId={tabs[1].id}>
<ViolationsTable
URL={props.resolvedURL}
name="resolved"
formatter={formatColumnResolved(mapper, setViolationModal)}
fields={resolvedFilters(fieldOptions)}
mapper={mapper}
noDynamicTable={true}
/>
</TabPane>
</Tabs>
<ViolationsTable
URL={props.dataURL}
name="violations"
mapper={mapper}
formatter={formatColumn(
mapper,
setViolationModal,
props.ModuleURL + '/resolve'
)}
fields={violationFilters(fieldOptions)}
setFieldOptions={setFieldOptions}
/>
</div>;
}

Expand Down Expand Up @@ -106,7 +83,6 @@ function ViolationsTable(props) {
fields={props.fields}
getFormattedCell={props.formatter}
getMappedCell={props.mapper}
noDynamicTable={props.noDynamicTable}
/>;
}

Expand Down Expand Up @@ -142,11 +118,8 @@ window.addEventListener('load', () => {
root.render(
<MRIViolationsIndex
ModuleURL={`${loris.BaseURL}/mri_violations/`}
unresolvedURL={`${loris.BaseURL}/mri_violations/?format=json`}
resolvedURL={
`${loris.BaseURL}/mri_violations/resolved_violations?format=json`
}
/>
dataURL={`${loris.BaseURL}/mri_violations/?format=json`}
/>,
);
});

190 changes: 0 additions & 190 deletions modules/mri_violations/jsx/resolvedViolations.js

This file was deleted.

Loading

0 comments on commit 51e4662

Please sign in to comment.