Skip to content

Commit

Permalink
Merge branch 'main' into mta-1967-2
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Jan 19, 2024
2 parents 866bbc5 + 8f83736 commit 6e2dd05
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 28 deletions.
3 changes: 0 additions & 3 deletions client/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import { AppRoutes } from "./Routes";
import { DefaultLayout } from "./layout";
import { NotificationsProvider } from "./components/NotificationsContext";

import "@patternfly/patternfly/patternfly.css";
import "@patternfly/patternfly/patternfly-addons.css";

import "./app.css";

const App: React.FC = () => {
Expand Down
10 changes: 10 additions & 0 deletions client/src/app/dayjs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import dayjs from "dayjs";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import customParseFormat from "dayjs/plugin/customParseFormat";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(customParseFormat);
dayjs.extend(isSameOrBefore);
15 changes: 3 additions & 12 deletions client/src/app/layout/SidebarApp/SidebarApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,17 @@ export const SidebarApp: React.FC = () => {
{selectedPersona === PersonaKey.MIGRATION ? (
<NavList title="Global">
<NavItem>
<NavLink
to={Paths.applications + search}
activeClassName="pf-m-current"
>
<NavLink to={Paths.applications} activeClassName="pf-m-current">
{t("sidebar.applicationInventory")}
</NavLink>
</NavItem>
<NavItem>
<NavLink
to={Paths.archetypes + search}
activeClassName="pf-m-current"
>
<NavLink to={Paths.archetypes} activeClassName="pf-m-current">
{t("sidebar.archetypes")}
</NavLink>
</NavItem>
<NavItem>
<NavLink
to={Paths.reports + search}
activeClassName="pf-m-current"
>
<NavLink to={Paths.reports} activeClassName="pf-m-current">
{t("sidebar.reports")}
</NavLink>
</NavItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,14 @@ export const ApplicationsTable: React.FC = () => {
selectionState: { selectedItems: selectedRows },
} = tableControls;

const clearFilters = () => {
const currentPath = history.location.pathname;
const newSearch = new URLSearchParams(history.location.search);
newSearch.delete("filters");
history.push(`${currentPath}`);
filterToolbarProps.setFilterValues({});
};

const [
saveApplicationsCredentialsModalState,
setSaveApplicationsCredentialsModalState,
Expand Down Expand Up @@ -732,7 +740,7 @@ export const ApplicationsTable: React.FC = () => {
backgroundColor: "var(--pf-v5-global--BackgroundColor--100)",
}}
>
<Toolbar {...toolbarProps}>
<Toolbar {...toolbarProps} clearAllFilters={clearFilters}>
<ToolbarContent>
<ToolbarBulkSelector {...toolbarBulkSelectorProps} />
<FilterToolbar<Application, string> {...filterToolbarProps} />
Expand Down
18 changes: 17 additions & 1 deletion client/src/app/pages/dependencies/dependencies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
useTableControlState,
useTableControlProps,
getHubRequestParams,
deserializeFilterUrlParams,
} from "@app/hooks/table-controls";
import { TablePersistenceKeyPrefix, UI_UNIQUE_ID } from "@app/Constants";
import { SimplePagination } from "@app/components/SimplePagination";
Expand All @@ -30,13 +31,18 @@ import { useSelectionState } from "@migtools/lib-ui";
import { DependencyAppsDetailDrawer } from "./dependency-apps-detail-drawer";
import { useSharedAffectedApplicationFilterCategories } from "../issues/helpers";
import { getParsedLabel } from "@app/utils/rules-utils";
import { useHistory } from "react-router-dom";

export const Dependencies: React.FC = () => {
const { t } = useTranslation();

const allAffectedApplicationsFilterCategories =
useSharedAffectedApplicationFilterCategories();

const urlParams = new URLSearchParams(window.location.search);
const filters = urlParams.get("filters");
const deserializedFilterValues = deserializeFilterUrlParams({ filters });

const tableControlState = useTableControlState({
persistTo: "urlParams",
persistenceKeyPrefix: TablePersistenceKeyPrefix.dependencies,
Expand All @@ -46,6 +52,7 @@ export const Dependencies: React.FC = () => {
provider: "Language",
labels: "Labels",
},
initialFilterValues: deserializedFilterValues,
isFilterEnabled: true,
isSortEnabled: true,
isPaginationEnabled: true,
Expand Down Expand Up @@ -122,6 +129,15 @@ export const Dependencies: React.FC = () => {
activeItemDerivedState: { activeItem, clearActiveItem },
} = tableControls;

const history = useHistory();

const clearFilters = () => {
const currentPath = history.location.pathname;
const newSearch = new URLSearchParams(history.location.search);
newSearch.delete("filters");
history.push(`${currentPath}`);
};

return (
<>
<PageSection variant={PageSectionVariants.light}>
Expand All @@ -135,7 +151,7 @@ export const Dependencies: React.FC = () => {
backgroundColor: "var(--pf-v5-global--BackgroundColor--100)",
}}
>
<Toolbar {...toolbarProps}>
<Toolbar {...toolbarProps} clearAllFilters={clearFilters}>
<ToolbarContent>
<FilterToolbar {...filterToolbarProps} />
<ToolbarItem {...paginationToolbarItemProps}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const AffectedApplications: React.FC = () => {
columnNames: {
name: "Name",
description: "Description",
businessService: "Business serice",
businessService: "Business service",
effort: "Effort",
incidents: "Incidents",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ export const IssueAffectedFilesTable: React.FC<
item={fileReport}
rowIndex={rowIndex}
>
<Td width={70} {...getTdProps({ columnKey: "file" })}>
<Td
width={70}
{...getTdProps({ columnKey: "file" })}
modifier="truncate"
>
<Button
variant="link"
isInline
Expand Down
14 changes: 5 additions & 9 deletions client/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import "@patternfly/patternfly/patternfly.css";
import "@patternfly/patternfly/patternfly-addons.css";

import React from "react";
import ReactDOM from "react-dom";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
Expand All @@ -7,16 +10,9 @@ import ENV from "@app/env";
import App from "@app/App";
import reportWebVitals from "@app/reportWebVitals";
import { KeycloakProvider } from "@app/components/KeycloakProvider";
import dayjs from "dayjs";
import isSameOrBefore from "dayjs/plugin/isSameOrBefore";
import utc from "dayjs/plugin/utc";
import timezone from "dayjs/plugin/timezone";
import customParseFormat from "dayjs/plugin/customParseFormat";

dayjs.extend(utc);
dayjs.extend(timezone);
dayjs.extend(customParseFormat);
dayjs.extend(isSameOrBefore);
import "@app/dayjs";
import "@app/i18n";

const queryClient = new QueryClient();

Expand Down

0 comments on commit 6e2dd05

Please sign in to comment.