From 13411378e3b530264073f28e1a510269d5308475 Mon Sep 17 00:00:00 2001 From: Shyam prakash Date: Sat, 9 Dec 2023 21:07:09 +0530 Subject: [PATCH 1/4] HideAssetType --- src/Components/Assets/AssetFilter.tsx | 17 ---------- src/Components/Assets/AssetManage.tsx | 5 --- src/Components/Facility/AssetCreate.tsx | 45 +------------------------ 3 files changed, 1 insertion(+), 66 deletions(-) diff --git a/src/Components/Assets/AssetFilter.tsx b/src/Components/Assets/AssetFilter.tsx index 98f7f52e1e1..798ff66e0e0 100644 --- a/src/Components/Assets/AssetFilter.tsx +++ b/src/Components/Assets/AssetFilter.tsx @@ -21,9 +21,6 @@ const getDate = (value: any) => function AssetFilter(props: any) { const { filter, onChange, closeFilter } = props; const [facility, setFacility] = useState({ name: "" }); - const [asset_type, setAssetType] = useState( - filter.asset_type ? filter.asset_type : "" - ); const [asset_status, setAssetStatus] = useState(filter.status || ""); const [asset_class, setAssetClass] = useState( filter.asset_class || "" @@ -55,7 +52,6 @@ function AssetFilter(props: any) { const clearFilter = useCallback(() => { setFacility({ name: "" }); - setAssetType(""); setAssetStatus(""); setAssetClass(""); setFacilityId(""); @@ -69,7 +65,6 @@ function AssetFilter(props: any) { const applyFilter = () => { const data = { facility: facilityId, - asset_type: asset_type ?? "", asset_class: asset_class ?? "", status: asset_status ?? "", location: locationId ?? "", @@ -133,18 +128,6 @@ function AssetFilter(props: any) { )} - o} - optionValue={(o) => o} - value={asset_type} - onChange={({ value }) => setAssetType(value)} - /> - { {asset?.description}
- {asset?.asset_type === "INTERNAL" ? ( - - ) : ( - - )} {asset?.status === "ACTIVE" ? ( ) : ( diff --git a/src/Components/Facility/AssetCreate.tsx b/src/Components/Facility/AssetCreate.tsx index a1e06a8c7ab..6a51dc59931 100644 --- a/src/Components/Facility/AssetCreate.tsx +++ b/src/Components/Facility/AssetCreate.tsx @@ -107,12 +107,10 @@ const AssetCreate = (props: AssetProps) => { const { goBack } = useAppHistory(); const { facilityId, assetId } = props; - let assetTypeInitial: AssetType; let assetClassInitial: AssetClass; const [state, dispatch] = useReducer(asset_create_reducer, initialState); const [name, setName] = useState(""); - const [asset_type, setAssetType] = useState(); const [asset_class, setAssetClass] = useState(); const [not_working_reason, setNotWorkingReason] = useState(""); const [description, setDescription] = useState(""); @@ -199,7 +197,6 @@ const AssetCreate = (props: AssetProps) => { setName(asset.name); setDescription(asset.description); setLocation(asset.location_object.id); - setAssetType(asset.asset_type); setAssetClass(asset.asset_class); setIsWorking(String(asset.is_working)); setNotWorkingReason(asset.not_working_reason); @@ -241,12 +238,6 @@ const AssetCreate = (props: AssetProps) => { invalidForm = true; } return; - case "asset_type": - if (!asset_type || asset_type == "NONE") { - errors[field] = "Select an asset type"; - invalidForm = true; - } - return; case "support_phone": { if (!support_phone) { errors[field] = "Field is required"; @@ -304,7 +295,6 @@ const AssetCreate = (props: AssetProps) => { setName(""); setDescription(""); setLocation(""); - setAssetType(assetTypeInitial); setAssetClass(assetClassInitial); setIsWorking(undefined); setNotWorkingReason(""); @@ -329,7 +319,7 @@ const AssetCreate = (props: AssetProps) => { setIsLoading(true); const data: any = { name: name, - asset_type: asset_type, + asset_type: AssetType.INTERNAL, asset_class: asset_class || "", description: description, is_working: is_working, @@ -567,40 +557,7 @@ const AssetCreate = (props: AssetProps) => { errors={state.errors.location} />
- {/* Asset Type */}
-
- title} - optionDescription={({ description }) => description} - optionValue={({ value }) => value} - onChange={({ value }) => setAssetType(value)} - error={state.errors.asset_type} - /> -
- {/* Asset Class */}
Date: Sat, 9 Dec 2023 21:28:57 +0530 Subject: [PATCH 2/4] Resolved merge conflicts --- src/Components/Assets/AssetFilter.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Components/Assets/AssetFilter.tsx b/src/Components/Assets/AssetFilter.tsx index c328bb04035..b5b691a8bbf 100644 --- a/src/Components/Assets/AssetFilter.tsx +++ b/src/Components/Assets/AssetFilter.tsx @@ -53,7 +53,6 @@ function AssetFilter(props: any) { const clearFilter = useCallback(() => { removeFilters([ "facility", - "asset_type", "asset_class", "status", "location", From f875b532506ac0b44c8217f246d4cc0d07ed8bc6 Mon Sep 17 00:00:00 2001 From: Shyam prakash Date: Thu, 14 Dec 2023 21:11:00 +0530 Subject: [PATCH 3/4] Fixed cypress tests --- cypress/e2e/assets_spec/asset_homepage.cy.ts | 2 -- cypress/e2e/assets_spec/assets_creation.cy.ts | 4 ---- cypress/e2e/assets_spec/assets_manage.cy.ts | 4 ++-- cypress/pageobject/Asset/AssetCreation.ts | 15 --------------- cypress/pageobject/Asset/AssetFilters.ts | 9 --------- 5 files changed, 2 insertions(+), 32 deletions(-) diff --git a/cypress/e2e/assets_spec/asset_homepage.cy.ts b/cypress/e2e/assets_spec/asset_homepage.cy.ts index a2c1c7734d2..f168cac5a09 100644 --- a/cypress/e2e/assets_spec/asset_homepage.cy.ts +++ b/cypress/e2e/assets_spec/asset_homepage.cy.ts @@ -63,7 +63,6 @@ describe("Asset Tab", () => { it("Filter Asset", () => { assetFilters.filterAssets( "Dummy Facility 1", - "INTERNAL", "ACTIVE", "ONVIF Camera", "Camera Loc" @@ -71,7 +70,6 @@ describe("Asset Tab", () => { assetFilters.clickadvancefilter(); assetFilters.clickslideoverbackbutton(); // to verify the back button doesn't clear applied filters assetFilters.assertFacilityText("Dummy Facility 1"); - assetFilters.assertAssetTypeText("INTERNAL"); assetFilters.assertAssetClassText("ONVIF"); assetFilters.assertStatusText("ACTIVE"); assetFilters.assertLocationText("Camera Loc"); diff --git a/cypress/e2e/assets_spec/assets_creation.cy.ts b/cypress/e2e/assets_spec/assets_creation.cy.ts index dde4e0d0e8b..3c8207566c8 100644 --- a/cypress/e2e/assets_spec/assets_creation.cy.ts +++ b/cypress/e2e/assets_spec/assets_creation.cy.ts @@ -29,7 +29,6 @@ describe("Asset", () => { assetPage.clickCreateAsset(); assetPage.verifyEmptyAssetNameError(); - assetPage.verifyEmptyAssetTypeError(); assetPage.verifyEmptyLocationError(); assetPage.verifyEmptyStatusError(); assetPage.verifyEmptyPhoneError(); @@ -41,7 +40,6 @@ describe("Asset", () => { assetPage.createAsset(); assetPage.selectFacility("Dummy Facility 1"); assetPage.selectLocation("Camera Loc"); - assetPage.selectAssetType("Internal"); assetPage.selectAssetClass("ONVIF Camera"); const qr_id_1 = uuidv4(); @@ -68,7 +66,6 @@ describe("Asset", () => { const qr_id_2 = uuidv4(); assetPage.selectLocation("Camera Loc"); - assetPage.selectAssetType("Internal"); assetPage.selectAssetClass("ONVIF Camera"); assetPage.enterAssetDetails( "New Test Asset 2", @@ -141,7 +138,6 @@ describe("Asset", () => { assetPage.createAsset(); assetPage.selectFacility("Dummy Facility 1"); assetPage.selectLocation("Camera Loc"); - assetPage.selectAssetType("Internal"); assetPage.selectAssetClass("HL7 Vitals Monitor"); const qr_id_1 = uuidv4(); diff --git a/cypress/e2e/assets_spec/assets_manage.cy.ts b/cypress/e2e/assets_spec/assets_manage.cy.ts index 92a4f5be9b8..f1191dc0436 100644 --- a/cypress/e2e/assets_spec/assets_manage.cy.ts +++ b/cypress/e2e/assets_spec/assets_manage.cy.ts @@ -19,8 +19,8 @@ describe("Asset", () => { const assetFilters = new AssetFilters(); const fillFacilityName = "Dummy Facility 1"; const assetname = "Dummy Camera"; - const locationName = "Dummy Location 1"; - const initiallocationName = "Camera Location"; + const locationName = "Test Location1"; + const initiallocationName = "Test Location"; before(() => { loginPage.loginAsDisctrictAdmin(); diff --git a/cypress/pageobject/Asset/AssetCreation.ts b/cypress/pageobject/Asset/AssetCreation.ts index 60e3f3ece2d..2426670368d 100644 --- a/cypress/pageobject/Asset/AssetCreation.ts +++ b/cypress/pageobject/Asset/AssetCreation.ts @@ -24,14 +24,6 @@ export class AssetPage { }); } - selectAssetType(assetType: string) { - cy.get("[data-testid=asset-type-input] button") - .click() - .then(() => { - cy.get("[role='option']").contains(assetType).click(); - }); - } - selectAssetClass(assetClass: string) { cy.get("[data-testid=asset-class-input] button") .click() @@ -205,13 +197,6 @@ export class AssetPage { ); } - verifyEmptyAssetTypeError() { - cy.get("[data-testid=asset-type-input] span").should( - "contain", - "Select an asset type" - ); - } - verifyEmptyStatusError() { cy.get("[data-testid=asset-working-status-input] span").should( "contain", diff --git a/cypress/pageobject/Asset/AssetFilters.ts b/cypress/pageobject/Asset/AssetFilters.ts index 9a8d9781786..15265f6fc20 100644 --- a/cypress/pageobject/Asset/AssetFilters.ts +++ b/cypress/pageobject/Asset/AssetFilters.ts @@ -1,7 +1,6 @@ export class AssetFilters { filterAssets( facilityName: string, - assetType: string, assetStatus: string, assetClass: string, assetLocation: string @@ -13,11 +12,6 @@ export class AssetFilters { .then(() => { cy.get("[role='option']").contains(facilityName).click(); }); - cy.get("#asset-type") - .click() - .then(() => { - cy.get("[role='option']").contains(assetType).click(); - }); cy.get("#asset-status") .click() .then(() => { @@ -67,9 +61,6 @@ export class AssetFilters { assertFacilityText(text) { cy.get("[data-testid=Facility]").should("contain", text); } - assertAssetTypeText(text) { - cy.get("[data-testid='Asset Type']").should("contain", text); - } assertAssetClassText(text) { cy.get("[data-testid='Asset Class']").should("contain", text); } From f22276046caa38c2bc0da9f3d1cc10bbac972d59 Mon Sep 17 00:00:00 2001 From: Shyam prakash Date: Sun, 24 Dec 2023 17:45:18 +0530 Subject: [PATCH 4/4] Fixed cypress test --- cypress/e2e/assets_spec/assets_manage.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/assets_spec/assets_manage.cy.ts b/cypress/e2e/assets_spec/assets_manage.cy.ts index f1191dc0436..92a4f5be9b8 100644 --- a/cypress/e2e/assets_spec/assets_manage.cy.ts +++ b/cypress/e2e/assets_spec/assets_manage.cy.ts @@ -19,8 +19,8 @@ describe("Asset", () => { const assetFilters = new AssetFilters(); const fillFacilityName = "Dummy Facility 1"; const assetname = "Dummy Camera"; - const locationName = "Test Location1"; - const initiallocationName = "Test Location"; + const locationName = "Dummy Location 1"; + const initiallocationName = "Camera Location"; before(() => { loginPage.loginAsDisctrictAdmin();