Skip to content

Commit

Permalink
Revert "feat: Remove default values from URL (#666)"
Browse files Browse the repository at this point in the history
This reverts commit 9f0c5dc.
  • Loading branch information
murilx committed Dec 13, 2024
1 parent 9f0c5dc commit 0aa0b8f
Show file tree
Hide file tree
Showing 42 changed files with 154 additions and 296 deletions.
5 changes: 3 additions & 2 deletions dashboard/src/components/BootsTable/BootsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ import { FormattedMessage, useIntl } from 'react-intl';

import type {
TestByCommitHash,
TestsTableFilter,
TTestByCommitHashResponse,
} from '@/types/tree/TreeDetails';
import { possibleTestsTableFilter } from '@/types/general';
import { possibleTestsTableFilter } from '@/types/tree/TreeDetails';

import { TooltipDateTime } from '@/components/TooltipDateTime';

Expand All @@ -32,7 +33,7 @@ import {
TableRow,
} from '@/components/ui/table';

import type { TestHistory, TestsTableFilter } from '@/types/general';
import type { TestHistory } from '@/types/general';

import BaseTable, { TableHead } from '@/components/Table/BaseTable';

Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/components/BuildDetails/BuildDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Sheet, SheetTrigger } from '@/components/Sheet';

import { LogSheet } from '@/pages/TreeDetails/Tabs/LogSheet';

import type { TableFilter, TestsTableFilter } from '@/types/general';
import type { TableFilter, TestsTableFilter } from '@/types/tree/TreeDetails';

import BuildDetailsTestSection from './BuildDetailsTestSection';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { Separator } from '@/components/ui/separator';

import { useBuildTests } from '@/api/buildTests';

import { TestsTable } from '@/components/TestsTable/TestsTable';
import type { TableFilter, TestsTableFilter } from '@/types/tree/TreeDetails';

import type { TableFilter, TestsTableFilter } from '@/types/general';
import { TestsTable } from '@/components/TestsTable/TestsTable';

interface IBuildDetailsTestSection {
buildId: string;
Expand Down
8 changes: 5 additions & 3 deletions dashboard/src/components/BuildsTable/BuildsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ import TableStatusFilter from '@/components/Table/TableStatusFilter';
import { TableBody, TableCell, TableRow } from '@/components/ui/table';
import type { IAccordionItems } from '@/pages/TreeDetails/Tabs/Build/BuildAccordionContent';
import AccordionBuildContent from '@/pages/TreeDetails/Tabs/Build/BuildAccordionContent';
import type { AccordionItemBuilds } from '@/types/tree/TreeDetails';
import type {
AccordionItemBuilds,
BuildsTableFilter,
} from '@/types/tree/TreeDetails';
import { possibleBuildsTableFilter } from '@/types/tree/TreeDetails';

import { useBuildStatusCount } from '@/api/treeDetails';
import WrapperTable from '@/pages/TreeDetails/Tabs/WrapperTable';
Expand All @@ -43,8 +47,6 @@ import { cn } from '@/lib/utils';
import { usePaginationState } from '@/hooks/usePaginationState';

import type { TableKeys } from '@/utils/constants/tables';
import { possibleBuildsTableFilter } from '@/types/general';
import type { BuildsTableFilter } from '@/types/general';

export interface IBuildsTable {
tableKey: TableKeys;
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/components/Table/TableStatusFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import classNames from 'classnames';
import { useCallback, useMemo } from 'react';

import { Button } from '@/components/ui/button';

import type { BuildsTableFilter, TestsTableFilter } from '@/types/general';
import type {
BuildsTableFilter,
TestsTableFilter,
} from '@/types/tree/TreeDetails';

interface ITableStatusFilter {
onClickBuild?: (value: BuildsTableFilter) => void;
Expand Down
10 changes: 3 additions & 7 deletions dashboard/src/components/TestsTable/TestsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ import { FormattedMessage, useIntl } from 'react-intl';

import type { LinkProps } from '@tanstack/react-router';

import { possibleTestsTableFilter } from '@/types/general';
import type { TestsTableFilter } from '@/types/tree/TreeDetails';
import { possibleTestsTableFilter } from '@/types/tree/TreeDetails';

import type {
TestHistory,
TestsTableFilter,
TIndividualTest,
TPathTests,
} from '@/types/general';
import type { TestHistory, TIndividualTest, TPathTests } from '@/types/general';

import { StatusTable } from '@/utils/constants/database';

Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/components/TreeListingPage/InputTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { Controller, useForm } from 'react-hook-form';
import type { ChangeEvent } from 'react';
import { useCallback } from 'react';

import { DEFAULT_TREE_INTERVAL_IN_DAYS } from '@/pages/treeConstants';
import { DEFAULT_TIME_SEARCH } from '@/pages/treeConstants';
import { toast } from '@/hooks/useToast';

import DebounceInput from '../DebounceInput/DebounceInput';
Expand All @@ -37,7 +37,7 @@ export function InputTime(): JSX.Element {
const { handleSubmit, control } = useForm<z.infer<typeof InputTimeSchema>>({
resolver: zodResolver(InputTimeSchema),
defaultValues: {
intervalInDays: `${DEFAULT_TREE_INTERVAL_IN_DAYS}`,
intervalInDays: `${DEFAULT_TIME_SEARCH}`,
},
});

Expand Down Expand Up @@ -94,7 +94,7 @@ export function InputTime(): JSX.Element {
min={1}
className={`${fieldError ? 'border-red' : 'border-gray'} mx-[10px] flex w-[100px] flex-1 rounded-md border`}
startingValue={
interval ? interval.toString() : `${DEFAULT_TREE_INTERVAL_IN_DAYS}`
interval ? interval.toString() : `${DEFAULT_TIME_SEARCH}`
}
placeholder="7"
{...rest}
Expand Down
9 changes: 5 additions & 4 deletions dashboard/src/components/TreeListingPage/TreeTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ import { useSearch } from '@tanstack/react-router';
import { TooltipDateTime } from '@/components/TooltipDateTime';

import type { TreeTableBody } from '@/types/tree/Tree';
import { zOrigin } from '@/types/general';

import { formattedBreakLineValue } from '@/locales/messages';

import {
possibleBuildsTableFilter,
possibleTestsTableFilter,
zOrigin,
zPossibleTabValidator,
} from '@/types/general';

import { formattedBreakLineValue } from '@/locales/messages';
} from '@/types/tree/TreeDetails';

import { usePaginationState } from '@/hooks/usePaginationState';

Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/BuildDetails/BuildDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import {
useRouterState,
} from '@tanstack/react-router';

import type { TestsTableFilter } from '@/types/tree/TreeDetails';
import BuildDetails from '@/components/BuildDetails/BuildDetails';

import { RedirectFrom } from '@/types/general';
import type { TestsTableFilter } from '@/types/general';

import TreeBuildDetails from '@/pages/TreeBuildDetails';
import HardwareBuildDetails from '@/pages/HardwareBuildDetails';
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/Hardware/HardwareTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { sumStatus } from '@/utils/status';

import { usePaginationState } from '@/hooks/usePaginationState';

import { zPossibleTabValidator } from '@/types/general';
import { zPossibleTabValidator } from '@/types/tree/TreeDetails';

import type { ListingTableColumnMeta } from '@/types/table';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@/components/Breadcrumb/Breadcrumb';

import BuildDetails from '@/components/BuildDetails/BuildDetails';
import type { TestsTableFilter } from '@/types/general';
import type { TestsTableFilter } from '@/types/tree/TreeDetails';

const HardwareBuildDetails = (): JSX.Element => {
const searchParams = useSearch({ from: '/build/$buildId' });
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/TreeBuildDetails/TreeBuildDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from '@/components/Breadcrumb/Breadcrumb';

import BuildDetails from '@/components/BuildDetails/BuildDetails';
import type { TestsTableFilter } from '@/types/general';
import type { TestsTableFilter } from '@/types/tree/TreeDetails';

const TreeBuildDetails = (): JSX.Element => {
const searchParams = useSearch({ from: '/build/$buildId' });
Expand Down
10 changes: 5 additions & 5 deletions dashboard/src/pages/TreeDetails/Tabs/Boots/BootsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Skeleton } from '@/components/Skeleton';
import { BootsTable } from '@/components/BootsTable/BootsTable';
import MemoizedIssuesList from '@/components/Cards/IssuesList';
import MemoizedHardwareTested from '@/components/Cards/HardwareTested';
import type { TestsTableFilter } from '@/types/tree/TreeDetails';
import {
DesktopGrid,
MobileGrid,
Expand All @@ -23,8 +24,7 @@ import MemoizedConfigList from '@/components/Tabs/Tests/ConfigsList';
import MemoizedErrorsSummary from '@/components/Tabs/Tests/ErrorsSummary';

import MemoizedStatusCard from '@/components/Tabs/Tests/StatusCard';

import type { TestsTableFilter, TFilter } from '@/types/general';
import type { TFilter } from '@/types/general';

import TreeCommitNavigationGraph from '@/pages/TreeDetails/Tabs/TreeCommitNavigationGraph';

Expand All @@ -34,16 +34,16 @@ interface BootsTabProps {

const BootsTab = ({ reqFilter }: BootsTabProps): JSX.Element => {
const { treeId } = useParams({
from: '/tree/$treeId',
from: '/tree/$treeId/',
});
const { tableFilter, diffFilter } = useSearch({
from: '/tree/$treeId',
from: '/tree/$treeId/',
});
const currentPathFilter = diffFilter.bootPath
? Object.keys(diffFilter.bootPath)[0]
: undefined;

const navigate = useNavigate({ from: '/tree/$treeId' });
const navigate = useNavigate({ from: '/tree/$treeId/' });

const updatePathFilter = useCallback(
(pathFilter: string) => {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/TreeDetails/Tabs/Build/BuildTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const BuildTab = ({ treeDetailsData }: BuildTab): JSX.Element => {
});

const { diffFilter } = useSearch({
from: '/tree/$treeId',
from: '/tree/$treeId/',
});

const toggleFilterBySection = useCallback(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import ColoredCircle from '@/components/ColoredCircle/ColoredCircle';
import { ItemType } from '@/components/ListingItem/ListingItem';
import { TableHeader } from '@/components/Table/TableHeader';
import { TooltipDateTime } from '@/components/TooltipDateTime';
import type { AccordionItemBuilds } from '@/types/tree/TreeDetails';
import type { BuildsTableFilter } from '@/types/general';
import type {
AccordionItemBuilds,
BuildsTableFilter,
} from '@/types/tree/TreeDetails';

export interface TTreeDetailsBuildsTable {
buildItems: AccordionItemBuilds[];
Expand Down Expand Up @@ -104,9 +106,9 @@ const columns: ColumnDef<AccordionItemBuilds>[] = [
export function TreeDetailsBuildsTable({
buildItems,
}: TTreeDetailsBuildsTable): JSX.Element {
const { treeId } = useParams({ from: '/tree/$treeId' });
const { tableFilter } = useSearch({ from: '/tree/$treeId' });
const navigate = useNavigate({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/tree/$treeId/' });
const { tableFilter } = useSearch({ from: '/tree/$treeId/' });
const navigate = useNavigate({ from: '/tree/$treeId/' });

const navigateToBuildDetails = useCallback(
(buildId: string) => {
Expand Down
9 changes: 5 additions & 4 deletions dashboard/src/pages/TreeDetails/Tabs/Tests/TestsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { Skeleton } from '@/components/Skeleton';
import { useTreeDetails } from '@/api/treeDetails';
import BaseCard from '@/components/Cards/BaseCard';

import type { TestsTableFilter } from '@/types/tree/TreeDetails';

import MemoizedIssuesList from '@/components/Cards/IssuesList';
import MemoizedHardwareTested from '@/components/Cards/HardwareTested';

Expand All @@ -24,8 +26,7 @@ import MemoizedConfigList from '@/components/Tabs/Tests/ConfigsList';
import MemoizedErrorsSummary from '@/components/Tabs/Tests/ErrorsSummary';

import MemoizedStatusCard from '@/components/Tabs/Tests/StatusCard';

import type { TestsTableFilter, TFilter } from '@/types/general';
import type { TFilter } from '@/types/general';

import TreeCommitNavigationGraph from '@/pages/TreeDetails/Tabs/TreeCommitNavigationGraph';

Expand All @@ -34,14 +35,14 @@ interface TestsTabProps {
}

const TestsTab = ({ reqFilter }: TestsTabProps): JSX.Element => {
const { treeId } = useParams({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/tree/$treeId/' });
const { isLoading, data, error } = useTreeDetails({
treeId: treeId ?? '',
filter: reqFilter,
});

const { tableFilter, diffFilter } = useSearch({
from: '/tree/$treeId',
from: '/tree/$treeId/',
});
const currentPathFilter = diffFilter.testPath
? Object.keys(diffFilter.testPath)[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ const TreeCommitNavigationGraph = (): React.ReactNode => {
currentPageTab,
diffFilter,
treeInfo: { gitUrl, gitBranch, headCommitHash },
} = useSearch({ from: '/tree/$treeId' });
} = useSearch({ from: '/tree/$treeId/' });

const { treeId } = useParams({
from: '/tree/$treeId',
from: '/tree/$treeId/',
});

const navigate = useNavigate({
Expand Down
6 changes: 4 additions & 2 deletions dashboard/src/pages/TreeDetails/Tabs/TreeDetailsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import { useCallback, useMemo } from 'react';
import type { ITabItem } from '@/components/Tabs/Tabs';
import Tabs from '@/components/Tabs/Tabs';

import { zPossibleTabValidator } from '@/types/tree/TreeDetails';

import type { ITreeDetails } from '@/pages/TreeDetails/TreeDetails';

import { zPossibleTabValidator, type TFilter } from '@/types/general';
import type { TFilter } from '@/types/general';

import BuildTab from './Build';
import BootsTab from './Boots';
Expand All @@ -33,7 +35,7 @@ const TreeDetailsTab = ({
countElements,
}: ITreeDetailsTab): JSX.Element => {
const { currentPageTab } = useSearch({
from: '/tree/$treeId',
from: '/tree/$treeId/',
});
const navigate = useNavigate({ from: '/tree/$treeId' });
const treeDetailsTab: ITabItem[] = useMemo(
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/pages/TreeDetails/TreeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ const TreeHeader = ({
};

function TreeDetails(): JSX.Element {
const { treeId } = useParams({ from: '/tree/$treeId' });
const searchParams = useSearch({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/tree/$treeId/' });
const searchParams = useSearch({ from: '/tree/$treeId/' });
const { diffFilter, treeInfo } = searchParams;
const navigate = useNavigate({ from: '/tree/$treeId' });
const navigate = useNavigate({ from: '/tree/$treeId/' });

const reqFilter = mapFilterToReq(diffFilter);

Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/pages/TreeDetails/TreeDetailsFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const TreeDetailsFilter = ({
paramFilter,
treeUrl,
}: ITreeDetailsFilter): JSX.Element => {
const { treeId } = useParams({ from: '/tree/$treeId' });
const { treeId } = useParams({ from: '/tree/$treeId/' });

const { data, isLoading } = useTreeDetails({
treeId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const HardwareDetailsFilter = ({
const isLoading = false;

const navigate = useNavigate({
from: '/hardware/$hardwareId',
from: '/hardware/$hardwareId/',
});

const filter: TFilterCreate = useMemo(() => {
Expand Down
3 changes: 2 additions & 1 deletion dashboard/src/pages/hardwareDetails/Tabs/Boots/BootsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import MemoizedIssuesList from '@/components/Cards/IssuesList';

import type { THardwareDetails } from '@/types/hardware/hardwareDetails';

import type { TestsTableFilter } from '@/types/tree/TreeDetails';

import {
DesktopGrid,
MobileGrid,
Expand All @@ -23,7 +25,6 @@ import MemoizedConfigList from '@/components/Tabs/Tests/ConfigsList';
import MemoizedErrorsSummary from '@/components/Tabs/Tests/ErrorsSummary';

import HardwareCommitNavigationGraph from '@/pages/hardwareDetails/Tabs/HardwareCommitNavigationGraph';
import type { TestsTableFilter } from '@/types/general';

interface TBootsTab {
boots: THardwareDetails['boots'];
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/pages/hardwareDetails/Tabs/Build/BuildTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ interface TBuildTab {

const BuildTab = ({ builds, hardwareId, trees }: TBuildTab): JSX.Element => {
const navigate = useNavigate({
from: '/hardware/$hardwareId',
from: '/hardware/$hardwareId/',
});

const { diffFilter } = useSearch({
from: '/hardware/$hardwareId',
from: '/hardware/$hardwareId/',
});

const toggleFilterBySection = useCallback(
Expand Down
Loading

0 comments on commit 0aa0b8f

Please sign in to comment.