Skip to content
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

[188912] Improve global program filter #3843

Merged
merged 1 commit into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ Makefile
*.isorted
test_times.txt
screenshot
report
pytest_screenshots
report
archive
output.json
pytest_html_report.html
2 changes: 2 additions & 0 deletions backend/hct_mis_api/apps/program/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ProgramFilter(FilterSet):
start_date = DateFilter(field_name="start_date", lookup_expr="gte")
end_date = DateFilter(field_name="end_date", lookup_expr="lte")
data_collecting_type = CharFilter(field_name="data_collecting_type__code", lookup_expr="exact")
name = CharFilter(field_name="name", lookup_expr="icontains")

class Meta:
fields = (
Expand All @@ -35,6 +36,7 @@ class Meta:
"budget",
"start_date",
"end_date",
"name",
)
model = Program

Expand Down
2 changes: 1 addition & 1 deletion backend/selenium_tests/page_object/base_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BaseComponents(Common):
# Labels
businessAreaContainer = 'div[data-cy="business-area-container"]'
globalProgramFilterContainer = 'div[data-cy="global-program-filter-container"]'
globalProgramFilter = 'div[data-cy="global-program-filter"]'
globalProgramFilter = 'button[data-cy="global-program-filter"]'
menuUserProfile = 'button[data-cy="menu-user-profile"]'
sideNav = 'div[data-cy="side-nav"]'
navCountryDashboard = 'a[data-cy="nav-Country Dashboard"]'
Expand Down
4 changes: 2 additions & 2 deletions frontend/data/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -3713,7 +3713,7 @@ type Query {
dataCollectingType(id: ID!): DataCollectingTypeNode
dataCollectionTypeChoices: [DataCollectingTypeChoiceObject]
program(id: ID!): ProgramNode
allPrograms(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], sector: [String], numberOfHouseholds: String, budget: String, startDate: Date, endDate: Date, numberOfHouseholdsWithTpInProgram: String, dataCollectingType: String, orderBy: String): ProgramNodeConnection
allPrograms(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], sector: [String], numberOfHouseholds: String, budget: String, startDate: Date, endDate: Date, name: String, numberOfHouseholdsWithTpInProgram: String, dataCollectingType: String, orderBy: String): ProgramNodeConnection
chartProgrammesBySector(businessAreaSlug: String!, year: Int!, program: String, administrativeArea: String): ChartDetailedDatasetsNode
chartTotalTransferredByMonth(businessAreaSlug: String!, year: Int!, program: String, administrativeArea: String): ChartDetailedDatasetsNode
cashPlan(id: ID!): CashPlanNode
Expand All @@ -3724,7 +3724,7 @@ type Query {
programScopeChoices: [ChoiceObject]
cashPlanStatusChoices: [ChoiceObject]
dataCollectingTypeChoices: [ChoiceObject]
allActivePrograms(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], sector: [String], numberOfHouseholds: String, budget: String, startDate: Date, endDate: Date, numberOfHouseholdsWithTpInProgram: String, dataCollectingType: String, orderBy: String): ProgramNodeConnection
allActivePrograms(offset: Int, before: String, after: String, first: Int, last: Int, businessArea: String!, search: String, status: [String], sector: [String], numberOfHouseholds: String, budget: String, startDate: Date, endDate: Date, name: String, numberOfHouseholdsWithTpInProgram: String, dataCollectingType: String, orderBy: String): ProgramNodeConnection
targetPopulation(id: ID!): TargetPopulationNode
allTargetPopulation(offset: Int, before: String, after: String, first: Int, last: Int, program: [ID], createdAt: DateTime, createdAt_Lte: DateTime, createdAt_Gte: DateTime, updatedAt: DateTime, updatedAt_Lte: DateTime, updatedAt_Gte: DateTime, status: String, households: [ID], name: String, createdByName: String, totalHouseholdsCountMin: Int, totalHouseholdsCountMax: Int, totalIndividualsCountMin: Int, totalIndividualsCountMax: Int, businessArea: String, createdAtRange: String, paymentPlanApplicable: Boolean, statusNot: String, totalHouseholdsCountWithValidPhoneNoMax: Int, totalHouseholdsCountWithValidPhoneNoMin: Int, orderBy: String): TargetPopulationNodeConnection
targetPopulationHouseholds(targetPopulation: ID!, offset: Int, before: String, after: String, first: Int, last: Int, orderBy: String, businessArea: String): HouseholdNodeConnection
Expand Down
10 changes: 8 additions & 2 deletions frontend/src/__generated__/graphql.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/src/apollo/queries/program/AllProgramsForChoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const AllProgramsForChoices = gql`
$startDate: Date
$endDate: Date
$orderBy: String
$name: String
) {
allPrograms(
before: $before
Expand All @@ -30,6 +31,7 @@ export const AllProgramsForChoices = gql`
orderBy: $orderBy
startDate: $startDate
endDate: $endDate
name: $name
) {
pageInfo {
hasNextPage
Expand Down
1 change: 1 addition & 0 deletions frontend/src/apollo/queries/program/Program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const PROGRAM_QUERY = gql`
individualFiltersAvailable
householdFiltersAvailable
description
type
}
partnerAccess
partners {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ exports[`components/core/CashPlanDetails should render 1`] = `
class="sc-jTQCzO eAkjXM"
>
<div
class="sc-gLLuof bfnybE"
class="sc-gLLuof bfnybE status-box-container"
data-cy="status-container"
status="DISTRIBUTION_COMPLETED"
>
DISTRIBUTION COMPLETED
</div>
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/components/core/StatusBox/StatusBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ const StatusContainer = styled.div`
`;

interface StatusBoxContainerProps {
status: string;
$status: string;
$statusToColor: (theme: any, status: string) => string;
theme: any;
}

const StatusBoxContainer = styled.div<StatusBoxContainerProps>`
color: ${({ status, $statusToColor, theme }) =>
$statusToColor(theme, status)};
background-color: ${({ status, $statusToColor, theme }) =>
`${$statusToColor(theme, status)}${opacityToHex(0.15)}`};
color: ${({ $status, $statusToColor, theme }) =>
$statusToColor(theme, $status)};
background-color: ${({ $status, $statusToColor, theme }) =>
`${$statusToColor(theme, $status)}${opacityToHex(0.15)}`};
border-radius: 16px;
font-family: Roboto;
font-size: 10px;
Expand All @@ -47,7 +47,8 @@ export const StatusBox = ({
return (
<StatusContainer>
<StatusBoxContainer
status={status}
className="status-box-container"
$status={status}
$statusToColor={statusToColor}
data-cy={dataCy || 'status-container'}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ exports[`components/grievances/GrievancesDetails should render 1`] = `
class="sc-jsEeTM xQgAl"
>
<div
class="sc-kFCroH iNLqSI"
class="sc-kFCroH iNLqSI status-box-container"
data-cy="status-container"
status="In Progress"
>
In Progress
</div>
Expand Down Expand Up @@ -76,9 +75,8 @@ exports[`components/grievances/GrievancesDetails should render 1`] = `
class="sc-jsEeTM xQgAl"
>
<div
class="sc-kFCroH jBgGcQ"
class="sc-kFCroH jBgGcQ status-box-container"
data-cy="status-container"
status="High"
>
High
</div>
Expand Down Expand Up @@ -108,9 +106,8 @@ exports[`components/grievances/GrievancesDetails should render 1`] = `
class="sc-jsEeTM xQgAl"
>
<div
class="sc-kFCroH jBgGcQ"
class="sc-kFCroH jBgGcQ status-box-container"
data-cy="status-container"
status="Very urgent"
>
Very urgent
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ exports[`components/paymentmodule/EditPaymentPlanHeader should render 1`] = `
class="sc-eDLKkx deAQag"
>
<div
class="sc-jTQCzO jzWNTC"
class="sc-jTQCzO jzWNTC status-box-container"
data-cy="status-container"
status="LOCKED"
>
LOCKED
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ exports[`components/ProgramDetails should render 1`] = `
class="sc-eDLKkx deAQag"
>
<div
class="sc-jTQCzO cQZnmW"
class="sc-jTQCzO cQZnmW status-box-container"
data-cy="status-container"
status="FINISHED"
>
FINISHED
</div>
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/components/programs/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,3 @@ export const partnerAccessChoices = Object.entries(PartnerAccess).map(
label,
}),
);

console.log(partnerAccessChoices);
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ exports[`components/rdi/details/RegistrationDetails should render 1`] = `
class="sc-eDLKkx deAQag"
>
<div
class="sc-jTQCzO cQZnmW"
class="sc-jTQCzO cQZnmW status-box-container"
data-cy="status-container"
status="MERGED"
>
MERGED
</div>
Expand Down
Loading
Loading