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

Fix url dashboard bug #545

Merged
merged 1 commit into from
Jan 17, 2025
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
2 changes: 1 addition & 1 deletion src/backend/partaj/core/api/referral_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def dashboard(self, request, *args, **kwargs):
permission_classes=[IsAuthenticated],
)
# pylint: disable=too-many-locals,too-many-branches,too-many-statements,consider-using-set-comprehension
def unit_dashboard(self, request, *args, **kwargs):
def unit(self, request, *args, **kwargs):
"""
Handle requests for lists of referrals in unit dashboard. We're managing access rights inside the method
as permissions depend on the supplied parameters.
Expand Down
4 changes: 1 addition & 3 deletions src/frontend/js/components/NewDashboard/ReferralTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ export const ReferralTable: React.FC<{
resetFilters,
} = useDashboardContext();

const { path } = useRouteMatch();

const formatDate = (date: string) => new Date(date).toLocaleDateString();
const navigateToReferral = (referral: ReferralLite) => {
history.push(`${path}/referral-detail/${referral.id}`);
history.push(`/${url}/referral-detail/${referral.id}`);
};

const columns: Column[] = [
Expand Down
11 changes: 10 additions & 1 deletion src/frontend/js/components/Root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { NoteDetailView } from '../Notes/NoteDetailView';
import { ReferralForm } from '../ReferralForm';
import { Dashboard } from '../Dashboard';
import { UnitDashboard } from '../UnitDashboard';
import { ReferralDetail } from '../ReferralDetail';

const PAGE_ENTRYPOINT_ELEMENT_ID = 'page-entrypoint';

Expand Down Expand Up @@ -158,7 +159,15 @@ export const Root: React.FC = () => {
to="/unit/referral-detail/:referralId"
/>

<Route path="/unit/:unitId">
<Route path="/unit/referral-detail/:referralId">
<ReferralDetail />
<Crumb
key="dashboard-referral-detail"
title={<FormattedMessage {...messages.crumbUnit} />}
/>
</Route>

<Route exact path="/unit/:unitId">
<UnitDashboard />
<Crumb
key="unit"
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/js/components/UnitDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const UnitDashboard: React.FC = () => {
<DashboardProvider forceFilters={['contributors_unit_names']}>
<NewDashboard
forceFilters={['contributors_unit_names']}
url={'unit_dashboard'}
url={'unit'}
unitId={unitId}
/>
</DashboardProvider>
Expand Down
Loading