From e13495ccf0c53ac7db15816d9e0ffb8753848f03 Mon Sep 17 00:00:00 2001
From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com>
Date: Mon, 16 Oct 2023 10:11:06 +0530
Subject: [PATCH 1/4] Show camera feed only for admin and doctor
---
src/Components/Assets/AssetManage.tsx | 31 ++++++++++---------
.../Facility/ConsultationDetails/index.tsx | 9 ++++--
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx
index e6d1836e27b..b6d4af8792e 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -453,20 +453,23 @@ const AssetManage = (props: AssetManageProps) => {
{t("update")}
- {asset?.asset_class && (
-
- navigate(
- `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
- )
- }
- id="configure-asset"
- data-testid="asset-configure-button"
- >
-
- {t("configure")}
-
- )}
+ {asset?.asset_class !== "ONVIF" ||
+ (["DistrictAdmin", "StateAdmin", "Doctor"].includes(
+ authUser.user_type
+ ) && (
+
+ navigate(
+ `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
+ )
+ }
+ id="configure-asset"
+ data-testid="asset-configure-button"
+ >
+
+ {t("configure")}
+
+ ))}
{checkAuthority(authUser.user_type, "DistrictAdmin") && (
{
{CONSULTATION_TABS.map((p: OptionsType) => {
if (p.text === "FEED") {
if (
- !consultationData?.current_bed?.bed_object?.id ??
- consultationData?.discharge_date !== null
+ consultationData?.discharge_date || // Discharged
+ !consultationData?.current_bed?.bed_object?.id || // Not admitted to bed
+ !["DistrictAdmin", "StateAdmin", "Doctor"].includes(
+ authUser.user_type
+ ) // Not admin or doctor
)
- return null;
+ return null; // Hide feed tab
}
return (
Date: Tue, 17 Oct 2023 15:50:54 +0530
Subject: [PATCH 2/4] Fix issue with hiding config button
---
src/Components/Assets/AssetManage.tsx | 32 +++++++++++++--------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx
index b6d4af8792e..ad251ae6a2c 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -453,23 +453,23 @@ const AssetManage = (props: AssetManageProps) => {
{t("update")}
- {asset?.asset_class !== "ONVIF" ||
- (["DistrictAdmin", "StateAdmin", "Doctor"].includes(
+ {(asset?.asset_class !== "ONVIF" ||
+ ["DistrictAdmin", "StateAdmin", "Doctor"].includes(
authUser.user_type
- ) && (
-
- navigate(
- `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
- )
- }
- id="configure-asset"
- data-testid="asset-configure-button"
- >
-
- {t("configure")}
-
- ))}
+ )) && (
+
+ navigate(
+ `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
+ )
+ }
+ id="configure-asset"
+ data-testid="asset-configure-button"
+ >
+
+ {t("configure")}
+
+ )}
{checkAuthority(authUser.user_type, "DistrictAdmin") && (
Date: Fri, 20 Oct 2023 13:10:31 +0530
Subject: [PATCH 3/4] Hide configure button for assets without class
---
src/Components/Assets/AssetManage.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx
index 40dd8028687..eb0032527cc 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -432,7 +432,7 @@ const AssetManage = (props: AssetManageProps) => {
{t("update")}
- {(asset?.asset_class !== "ONVIF" ||
+ {((asset?.asset_class && asset?.asset_class !== "ONVIF") ||
["DistrictAdmin", "StateAdmin", "Doctor"].includes(
authUser.user_type
)) && (
From b3fd4ed8670d002f97d6196f0e4cd92537810445 Mon Sep 17 00:00:00 2001
From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com>
Date: Fri, 20 Oct 2023 13:15:50 +0530
Subject: [PATCH 4/4] Refactor conditional rendering logic for configure button
in AssetManage component
---
src/Components/Assets/AssetManage.tsx | 35 ++++++++++++++-------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/Components/Assets/AssetManage.tsx b/src/Components/Assets/AssetManage.tsx
index eb0032527cc..4f65bc6a569 100644
--- a/src/Components/Assets/AssetManage.tsx
+++ b/src/Components/Assets/AssetManage.tsx
@@ -432,23 +432,24 @@ const AssetManage = (props: AssetManageProps) => {
{t("update")}
- {((asset?.asset_class && asset?.asset_class !== "ONVIF") ||
- ["DistrictAdmin", "StateAdmin", "Doctor"].includes(
- authUser.user_type
- )) && (
-
- navigate(
- `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
- )
- }
- id="configure-asset"
- data-testid="asset-configure-button"
- >
-
- {t("configure")}
-
- )}
+ {asset?.asset_class &&
+ (asset?.asset_class !== "ONVIF" ||
+ ["DistrictAdmin", "StateAdmin", "Doctor"].includes(
+ authUser.user_type
+ )) && (
+
+ navigate(
+ `/facility/${asset?.location_object.facility.id}/assets/${asset?.id}/configure`
+ )
+ }
+ id="configure-asset"
+ data-testid="asset-configure-button"
+ >
+
+ {t("configure")}
+
+ )}
{checkAuthority(authUser.user_type, "DistrictAdmin") && (