-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replaced dispatch with useQuery and request in Asset module #6374
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6f5a27b
changed to request in HL7monitor.tsx
kshitijv256 ebc21e1
replaced dispatch in assetTypes
kshitijv256 a355fc6
changed dispatch in filteer, import files
kshitijv256 4f06879
changed all dispatch requests with useQuery and request in asset module
kshitijv256 aae1541
Merge branch 'coronasafe:develop' into assets_update
kshitijv256 79fa2ff
added TBody to various endpoints
kshitijv256 d90b17a
fixed assetfilter page
kshitijv256 dd887bc
fixed asset import modal page
kshitijv256 08d6244
made requested changes
kshitijv256 8d3222a
made requested changes
kshitijv256 ab9824e
reverted to assetBedModel
kshitijv256 f31aeaa
fixed delete asset function
kshitijv256 bcd97ff
fixed after delete redirection
kshitijv256 056a0d3
removed extra setstates
kshitijv256 4226603
Merge branch 'develop' into asset_changes
nihal467 610780d
updated failing cypress tests for asset module
kshitijv256 d4f5079
Merge branch 'develop' into asset_changes
kshitijv256 700ccd0
removed useEffects
kshitijv256 87d6d46
Merge branch 'develop' into asset_changes
kshitijv256 502680f
Merge branch 'develop' into asset_changes
kshitijv256 b1f3b72
removed changes from cypress files
kshitijv256 390f567
Merge branch 'develop' into asset_changes
kshitijv256 7c1bdfe
fixed merge issues
kshitijv256 77ba690
fixed transactions issue
kshitijv256 983a242
Merge branch 'develop' into asset_changes
kshitijv256 9344abe
Merge branch 'develop' into asset_changes
kshitijv256 fc2e15e
remove console logs
rithviknishad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ import { FacilityModel } from "../Facility/models"; | |
import { AssetData } from "./AssetTypes"; | ||
import * as Notification from "../../Utils/Notifications.js"; | ||
import { Cancel, Submit } from "../Common/components/ButtonV2"; | ||
import { listFacilityAssetLocation } from "../../Redux/actions"; | ||
import { useDispatch } from "react-redux"; | ||
import { Link } from "raviger"; | ||
import readXlsxFile from "read-excel-file"; | ||
import { | ||
|
@@ -16,6 +14,8 @@ import { | |
import { parseCsvFile } from "../../Utils/utils"; | ||
import useConfig from "../../Common/hooks/useConfig"; | ||
import DialogModal from "../Common/Dialog"; | ||
import useQuery from "../../Utils/request/useQuery"; | ||
import routes from "../../Redux/api"; | ||
import { SelectFormField } from "../Form/FormFields/SelectFormField"; | ||
|
||
interface Props { | ||
|
@@ -34,7 +34,6 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => { | |
location: "", | ||
}); | ||
const [locations, setLocations] = useState<any>([]); | ||
const dispatchAction: any = useDispatch(); | ||
const { sample_format_asset_import } = useConfig(); | ||
const [locationsLoading, setLocationsLoading] = useState(false); | ||
|
||
|
@@ -43,18 +42,14 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => { | |
setSelectedFile(undefined); | ||
onClose && onClose(); | ||
}; | ||
|
||
useEffect(() => { | ||
setLocationsLoading(true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this removed? The loader for when the locations are still being fetched does not work anymore.. |
||
dispatchAction( | ||
listFacilityAssetLocation({}, { facility_external_id: facility.id }) | ||
).then(({ data }: any) => { | ||
setLocationsLoading(false); | ||
if (data.count > 0) { | ||
useQuery(routes.listFacilityAssetLocation, { | ||
pathParams: { facility_external_id: `${facility.id}` }, | ||
onResponse: ({ res, data }) => { | ||
if (res?.status === 200 && data) { | ||
setLocations(data.results); | ||
} | ||
}); | ||
}, []); | ||
}, | ||
}); | ||
|
||
useEffect(() => { | ||
const readFile = async () => { | ||
|
@@ -362,6 +357,7 @@ const AssetImportModal = ({ open, onClose, facility }: Props) => { | |
<Submit | ||
onClick={handleUpload} | ||
disabled={isImporting || !selectedFile} | ||
data-testid="asset-import-btn" | ||
> | ||
{isImporting ? ( | ||
<i className="fa-solid fa-spinner animate-spin" /> | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this useEffect and set these values in onResponse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing it is causing problems in with location in filter