-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add import button for JotForm in columns configurator * init e2e import jotform * Add Jotform import permission check and update filter options * Refactor imports and add user permissions query * Refactor import-jotform.spec.ts and add SelectionPage class * Add importJotformCta element to SelectionPage * feat(login-selection): if login with no enought permissions show error message * refactor tests * Refactor import jotform functionality and handle form already connected * chore: Update api * test: Use correct playwright version * feat: Use fixed device filter * feat: Add gender filter * feat: Add bughunting level filters * rework: Refactor filters to checkboxfilter component * Add form modal functionality and update import button behavior * Add ImportSurveyModal component and update selectionSlice * rework: Use specific types for filters * chore: Fix types * feat: Add exclude/include testers * Add form inputs to the survey modal * feat: Add age filters * Disable testerId select in ImportSurveyModal and add test case for it * feat: Add style * wip(selection): Jotforms API queries to ImportSurveyModal * feat: Add question filters * feat: Use filtered items to check selected * Fix pagination bug in useItems function * Add SelectAllFirstDevicesCheckbox component to SelectionTable * fix: Remove old component * feat: Move checkbox to thead --------- Co-authored-by: Iacopo Leardini <[email protected]> Co-authored-by: sinatragianpaolo <[email protected]>
- Loading branch information
1 parent
ccd7164
commit 29674a4
Showing
7 changed files
with
112 additions
and
47 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
src/pages/campaigns/selection/SelectionTable/components/SelectAllFirstDevicesCheckbox.tsx
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Checkbox } from "@appquality/appquality-design-system"; | ||
import { FC } from "react"; | ||
import { | ||
checkUserDevice, | ||
clearSelectedDevice, | ||
} from "src/pages/campaigns/selection/selectionSlice"; | ||
import { useAppDispatch } from "src/store"; | ||
import useItems from "../../useItems"; | ||
|
||
const SelectAllFirstDevicesCheckbox: FC<{ campaignId: string }> = ({ | ||
campaignId, | ||
}) => { | ||
const dispatch = useAppDispatch(); | ||
|
||
const { data, isFetching } = useItems(campaignId, { withLimit: false }); | ||
if (isFetching || !data || !data.results) { | ||
return null; // Return null instead of an object | ||
} | ||
const candidatedDevices = data.results.map((tester) => ({ | ||
testerId: tester.id.toString(), | ||
deviceId: tester.devices.length > 0 ? tester.devices[0].id.toString() : "", | ||
})); | ||
|
||
return ( | ||
<Checkbox | ||
name="selectAllFirstDevices" | ||
id="selectAllFirstDevices" | ||
onChange={(e) => { | ||
dispatch(clearSelectedDevice()); | ||
|
||
if (e.target.checked) { | ||
candidatedDevices.forEach((device) => { | ||
dispatch( | ||
checkUserDevice({ | ||
userId: device.testerId, | ||
deviceId: device.deviceId, | ||
}) | ||
); | ||
}); | ||
} | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default SelectAllFirstDevicesCheckbox; |
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
50 changes: 50 additions & 0 deletions
50
src/pages/campaigns/selection/SelectionTable/useColumns.tsx
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { TableType } from "@appquality/appquality-design-system"; | ||
import { useParams } from "react-router-dom"; | ||
import SelectAllFirstDevicesCheckbox from "./components/SelectAllFirstDevicesCheckbox"; | ||
|
||
export const useColumns: () => TableType.Column[] = () => { | ||
const { id } = useParams<{ id: string }>(); | ||
|
||
return [ | ||
{ | ||
dataIndex: "nameId", | ||
key: "nameId", | ||
title: "Name ID", | ||
}, | ||
{ | ||
dataIndex: "age", | ||
key: "age", | ||
title: "Age", | ||
}, | ||
{ | ||
dataIndex: "gender", | ||
key: "gender", | ||
title: "Gender", | ||
}, | ||
{ | ||
dataIndex: "bhlevel", | ||
key: "bhlevel", | ||
title: "BH Level", | ||
}, | ||
{ | ||
dataIndex: "devices", | ||
key: "devices", | ||
title: "Devices", | ||
}, | ||
{ | ||
dataIndex: "os", | ||
key: "os", | ||
title: "OS", | ||
}, | ||
{ | ||
dataIndex: "actions", | ||
key: "actions", | ||
title: ( | ||
<SelectAllFirstDevicesCheckbox | ||
data-testid="selectAllFirstDevices" | ||
campaignId={id} | ||
/> | ||
), | ||
}, | ||
]; | ||
}; |
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