Skip to content

Commit

Permalink
Merge branch 'main' into talya-t-table
Browse files Browse the repository at this point in the history
  • Loading branch information
rszwajko authored Oct 29, 2024
2 parents d37a868 + 1b4a17b commit 68035c1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# - https://github.com/konveyor/tackle2-ui/pull/1781

# Builder image
FROM registry.access.redhat.com/ubi9/nodejs-20:1-59 as builder
FROM registry.access.redhat.com/ubi9/nodejs-20:1-59.1726663413 as builder

USER 1001
COPY --chown=1001 . .
Expand Down
54 changes: 52 additions & 2 deletions client/src/app/pages/applications/analysis-wizard/set-targets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { useLocalTableControls } from "@app/hooks/table-controls";
import { useSetting } from "@app/queries/settings";
import { AppPlaceholder } from "@app/components/AppPlaceholder";
import { StateError } from "@app/components/StateError";
import { universalComparator } from "@app/utils/utils";
import { toLabelValue } from "@app/utils/rules-utils";

interface SetTargetsProps {
applications: Application[];
Expand Down Expand Up @@ -177,9 +179,12 @@ const SetTargetsInternal: React.FC<SetTargetsInternalProps> = ({
tableName: "target-cards",
items: targets,
idProperty: "name",
initialFilterValues: { name: applicationProviders },
initialFilterValues: { provider: applicationProviders },
columnNames: {
name: "name",
provider: "provider",
custom: "custom",
labels: "labels",
},
isFilterEnabled: true,
isPaginationEnabled: false,
Expand All @@ -200,11 +205,56 @@ const SetTargetsInternal: React.FC<SetTargetsInternalProps> = ({
value: language,
})),
placeholderText: "Filter by language...",
categoryKey: "name",
categoryKey: "provider",
title: "Languages",
type: FilterType.multiselect,
matcher: (filter, target) => !!target.provider?.includes(filter),
},
{
placeholderText: "Filter by name...",
categoryKey: "name",
title: "Name",
type: FilterType.search,
matcher: (filter, target) =>
!!target.name?.toLowerCase().includes(filter.toLowerCase()),
},
{
placeholderText: "Filter by custom target...",
categoryKey: "custom",
title: "Custom target",
type: FilterType.select,
selectOptions: [
{ value: "true", label: "Yes" },
{ value: "false", label: "No" },
],
matcher: (filter, target) => String(!!target.custom) === filter,
},
{
selectOptions: unique(
targets
.flatMap(({ labels }) => labels ?? [])
.map(({ name, label }) => ({
name,
label: toLabelValue(label),
})),
({ label }) => label
)
.map(({ label, name }) => ({
value: label,
label: name,
chipLabel: label,
}))
.sort((a, b) => universalComparator(a.label, b.label)),

placeholderText: "Filter by labels...",
categoryKey: "labels",
title: "Labels",
type: FilterType.multiselect,
matcher: (filter, target) =>
(target.labels ?? [])
.map(({ label }) => toLabelValue(label))
.includes(filter),
},
],
});

Expand Down
24 changes: 13 additions & 11 deletions client/src/app/pages/archetypes/archetypes-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ToolbarContent,
ToolbarGroup,
ToolbarItem,
Tooltip,
} from "@patternfly/react-core";
import {
Table,
Expand All @@ -27,8 +28,7 @@ import {
Td,
ActionsColumn,
} from "@patternfly/react-table";
import { CubesIcon } from "@patternfly/react-icons";

import { CubesIcon, PencilAltIcon } from "@patternfly/react-icons";
import { AppPlaceholder } from "@app/components/AppPlaceholder";
import { ConditionalRender } from "@app/components/ConditionalRender";
import { FilterToolbar, FilterType } from "@app/components/FilterToolbar";
Expand Down Expand Up @@ -473,6 +473,17 @@ const Archetypes: React.FC = () => {
}
/>
</Td>
{archetypeWriteAccess && (
<Td isActionCell id="pencil-action">
<Tooltip content={t("actions.edit")}>
<Button
variant="plain"
icon={<PencilAltIcon />}
onClick={() => setArchetypeToEdit(archetype)}
/>
</Tooltip>
</Td>
)}
<Td isActionCell>
{(archetypeWriteAccess ||
assessmentWriteAccess ||
Expand Down Expand Up @@ -509,15 +520,6 @@ const Archetypes: React.FC = () => {
},
]
: []),
...(archetypeWriteAccess
? [
{
title: t("actions.edit"),
onClick: () =>
setArchetypeToEdit(archetype),
},
]
: []),
...(archetype?.assessments?.length &&
assessmentWriteAccess
? [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import {
} from "@app/queries/stakeholdergroups";
import { NotificationsContext } from "@app/components/NotificationsContext";
import { StakeholderGroupForm } from "./components/stakeholder-group-form";
import { AppTableActionButtons } from "@app/components/AppTableActionButtons";
import { ConditionalRender } from "@app/components/ConditionalRender";
import { AppPlaceholder } from "@app/components/AppPlaceholder";
import { ConfirmDialog } from "@app/components/ConfirmDialog";
Expand All @@ -52,6 +51,7 @@ import {
import { useLocalTableControls } from "@app/hooks/table-controls";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import CubesIcon from "@patternfly/react-icons/dist/js/icons/cubes-icon";
import { ControlTableActionButtons } from "../ControlTableActionButtons";

export const StakeholderGroups: React.FC = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -284,7 +284,7 @@ export const StakeholderGroups: React.FC = () => {
>
{stakeholderGroup.stakeholders?.length}
</Td>
<AppTableActionButtons
<ControlTableActionButtons
onEdit={() =>
setCreateUpdateModalState(stakeholderGroup)
}
Expand Down
4 changes: 3 additions & 1 deletion client/src/app/utils/rules-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ interface ParsedLabel {
labelValue: string;
}

export const toLabelValue = (label?: string) => label?.split("=").pop() ?? "";

export const getParsedLabel = (label: string | null): ParsedLabel => {
if (label === null) {
return {
Expand All @@ -116,7 +118,7 @@ export const getParsedLabel = (label: string | null): ParsedLabel => {
const char1 = label.indexOf("/") + 1;
const char2 = label.lastIndexOf("=");
const type = label.substring(char1, char2);
const value = label.split("=").pop();
const value = toLabelValue(label);

return {
labelType: type || "",
Expand Down

0 comments on commit 68035c1

Please sign in to comment.