Skip to content

Commit

Permalink
Merge branch 'main' into mta-1693
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Nov 22, 2023
2 parents c951d77 + 6e9f95b commit 7ec982c
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 35 deletions.
15 changes: 11 additions & 4 deletions client/src/app/components/SimpleSelectTypeahead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export interface ISimpleSelectBasicProps {
toggleId?: string;
toggleAriaLabel?: string;
selectMultiple?: boolean;
width?: number;
noResultsFoundText?: string;
hideClearButton?: boolean;
}

export const SimpleSelectTypeahead: React.FC<ISimpleSelectBasicProps> = ({
Expand All @@ -37,7 +39,9 @@ export const SimpleSelectTypeahead: React.FC<ISimpleSelectBasicProps> = ({
toggleId,
toggleAriaLabel,
selectMultiple = false,
width,
noResultsFoundText,
hideClearButton = false,
}) => {
const [isOpen, setIsOpen] = React.useState(false);
const [selected, setSelected] = React.useState<string | string[]>(
Expand Down Expand Up @@ -190,7 +194,8 @@ export const SimpleSelectTypeahead: React.FC<ISimpleSelectBasicProps> = ({
variant="typeahead"
onClick={onToggleClick}
isExpanded={isOpen}
isFullWidth
isFullWidth={!width}
style={{ width: width && width + "px" }}
>
<TextInputGroup isPlain>
<TextInputGroupMain
Expand All @@ -199,7 +204,9 @@ export const SimpleSelectTypeahead: React.FC<ISimpleSelectBasicProps> = ({
onChange={onTextInputChange}
onKeyDown={onInputKeyDown}
onBlur={() => {
setInputValue("");
selectMultiple
? setInputValue("")
: setInputValue(selected.toString());
}}
id="typeahead-select-input"
autoComplete="off"
Expand Down Expand Up @@ -243,7 +250,7 @@ export const SimpleSelectTypeahead: React.FC<ISimpleSelectBasicProps> = ({
<TimesIcon aria-hidden />
</Button>
)}
{!selectMultiple && !!inputValue && (
{!hideClearButton && !selectMultiple && !!inputValue && (
<Button
variant="plain"
onClick={() => {
Expand All @@ -264,13 +271,13 @@ export const SimpleSelectTypeahead: React.FC<ISimpleSelectBasicProps> = ({
);
return (
<>
<div>selected: {[selected].join(",")}</div>
<Select
id={id}
isOpen={isOpen}
selected={selected}
onSelect={onSelect}
onOpenChange={() => {
setFilterValue("");
setIsOpen(false);
}}
toggle={toggle}
Expand Down
37 changes: 22 additions & 15 deletions client/src/app/pages/applications/analysis-wizard/set-targets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { AnalysisWizardFormValues } from "./schema";
import { useSetting } from "@app/queries/settings";
import { useFetchTargets } from "@app/queries/targets";
import { Target } from "@app/api/models";
import { SimpleSelect } from "@app/components/SimpleSelect";
import { SimpleSelectTypeahead } from "@app/components/SimpleSelectTypeahead";

export const SetTargets: React.FC = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -135,20 +135,28 @@ export const SetTargets: React.FC = () => {
{t("wizard.terms.setTargets")}
</Title>
<Text>{t("wizard.label.setTargets")}</Text>
<SimpleSelect
width={200}
variant="typeahead"
id="action-select"
toggleId="action-select-toggle"
toggleAriaLabel="Action select dropdown toggle"
aria-label={"Select provider"}
value={provider}
options={["Java", "Go"]}
onChange={(selection) => {
setProvider(selection as string);
}}
/>
</TextContent>
<SimpleSelectTypeahead
width={200}
value={provider}
toggleAriaLabel="Action select dropdown toggle"
toggleId="action-select-toggle"
hideClearButton
id="action-select"
options={[
{
value: "Java",
children: "Java",
},
{
value: "Go",
children: "Go",
},
]}
onChange={(selection) => {
setProvider(selection as string);
}}
/>
{values.selectedTargets.length === 0 &&
values.customRulesFiles.length === 0 &&
!values.sourceRepository && (
Expand All @@ -158,7 +166,6 @@ export const SetTargets: React.FC = () => {
title={t("wizard.label.skipTargets")}
/>
)}

<Gallery hasGutter>
{targetOrderSetting.isSuccess
? targetOrderSetting.data.map((id, index) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,12 @@ export const ApplicationsTable: React.FC = () => {
getItemValue: (item) => item?.name || "",
},
{
key: "archetype",
title: t("terms.archetype"),
key: "archetypes",
title: t("terms.archetypes"),
type: FilterType.multiselect,
placeholderText:
t("actions.filterBy", {
what: t("terms.archetype").toLowerCase(),
what: t("terms.archetypes").toLowerCase(),
}) + "...",
getItemValue: (item) => {
const archetypeNames = item?.archetypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ export const StakeholderGroups: React.FC = () => {
<EmptyStateIcon icon={CubesIcon} />
<Title headingLevel="h2" size="lg">
{t("composed.noDataStateTitle", {
what: t("terms.stakeholder").toLowerCase(),
what: t("terms.stakeholderGroup").toLowerCase(),
})}
</Title>
<EmptyStateBody>
{t("composed.noDataStateBody", {
what: t("terms.stakeholder").toLowerCase(),
what: t("terms.stakeholderGroup").toLowerCase(),
})}
</EmptyStateBody>
</EmptyState>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
Tabs,
TabTitleText,
Tab,
Truncate,
} from "@patternfly/react-core";
import spacing from "@patternfly/react-styles/css/utilities/Spacing/spacing";
import { IssueAffectedFilesTable } from "./issue-affected-files-table";
Expand Down Expand Up @@ -50,21 +49,23 @@ export const IssueDetailDrawer: React.FC<IIssueDetailDrawerProps> = ({
focusKey={issueId || ""}
pageKey="affected-applications"
drawerPanelContentProps={{ defaultSize: "600px" }}
header={
<TextContent>
<Text component="small" className={spacing.mb_0}>
Issue
</Text>
<Title headingLevel="h2" size="lg" className={spacing.mtXs}>
{issue ? getIssueTitle(issue) : ""}
</Title>
</TextContent>
}
>
{isFetching ? (
<AppPlaceholder />
) : !issue ? (
<StateNoData />
) : (
<>
<TextContent>
<Text component="small" className={spacing.mb_0}>
{applicationName}
</Text>
<Title headingLevel="h2" size="lg" className={spacing.mtXs}>
<Truncate content={getIssueTitle(issue)} />
</Title>
</TextContent>
<div>
<Tabs
activeKey={activeTabKey}
onSelect={(_event, tabKey) => setActiveTabKey(tabKey as TabKey)}
Expand All @@ -77,7 +78,7 @@ export const IssueDetailDrawer: React.FC<IIssueDetailDrawerProps> = ({
<IssueAffectedFilesTable issue={issue} />
</Tab>
</Tabs>
</>
</div>
)}
</PageDrawerContent>
);
Expand Down

0 comments on commit 7ec982c

Please sign in to comment.