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

remove usage of deprecated Dropdown and Selector components #2225

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public long getActionLogCount(int testId, int level) {
public void deleteActionLogs(int testId, Long from, Long to) {
Instant fromTs = from == null ? EPOCH_START : Instant.ofEpochMilli(from);
Instant toTs = to == null ? FAR_FUTURE : Instant.ofEpochMilli(to);
long deleted = ActionLogDAO.delete("test.id = ?1 AND timestamp >= ?2 AND timestamp < ?3", testId, fromTs, toTs);
long deleted = ActionLogDAO.delete("testId = ?1 AND timestamp >= ?2 AND timestamp < ?3", testId, fromTs, toTs);
log.debugf("Deleted %d logs for test %d", deleted, testId);
}

Expand Down
101 changes: 47 additions & 54 deletions horreum-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions horreum-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"type": "module",
"dependencies": {
"@monaco-editor/react": "4.6.0",
"@patternfly/patternfly": "5.2.1",
"@patternfly/react-core": "5.2.3",
"@patternfly/react-table": "5.4.0",
"@patternfly/patternfly": "5.4.2",
"@patternfly/react-core": "5.4.12",
"@patternfly/react-table": "5.4.13",
"@patternfly/react-templates": "1.1.13",
"@types/jsonpath": "0.2.4",
"@types/luxon": "3.2.0",
"@types/react": "17.0.74",
Expand Down
53 changes: 27 additions & 26 deletions horreum-web/src/About.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import { useState, useEffect } from "react"
import {useState, useEffect, Ref} from "react"
import {
Bullseye,
Button,
Bullseye,
Button,
DescriptionList,
DescriptionListDescription,
DescriptionListGroup,
DescriptionListTerm,
MenuToggle,
Modal,
Spinner
Dropdown,
DropdownItem,
DropdownList,
MenuToggle,
MenuToggleElement,
Modal,
Spinner
} from '@patternfly/react-core';
import {
Dropdown,
DropdownItem,
DropdownToggle
} from '@patternfly/react-core/deprecated';
import { QuestionCircleIcon } from "@patternfly/react-icons"

import MoonIcon from '@patternfly/react-icons/dist/esm/icons/moon-icon';
Expand Down Expand Up @@ -60,18 +59,20 @@ export default function About() {
{ isDarkTheme ? <SunIcon style={{ color: '#FC0' }} /> : <MoonIcon style={{ color: '#FEC' }} /> }
</MenuToggle>
<Dropdown
style={{ marginLeft: "16px" }}
position="right"
menuAppendTo="parent"
onSelect={() => setDropdownOpen(false)}
toggle={
<DropdownToggle toggleIndicator={null} onToggle={(_event, val) => setDropdownOpen(val)} id="toggle-icon-only">
<QuestionCircleIcon style={{ fill: "#ffffff" }} />
</DropdownToggle>
}
isOpen={isDropdownOpen}
isPlain
dropdownItems={[
onSelect={() => setDropdownOpen(false)}
popperProps={{preventOverflow: true, position: "end"}}
toggle={(toggleRef: Ref<MenuToggleElement>) => (
<MenuToggle
id="toggle-icon-only"
ref={toggleRef}
variant="plain"
onClick={() => setDropdownOpen(!isDropdownOpen)}>
<QuestionCircleIcon color="white"/>
</MenuToggle>
)}
>
<DropdownList>
<DropdownItem
key="docs"
onClick={() => {
Expand All @@ -80,12 +81,12 @@ export default function About() {
}}
>
Project documentation
</DropdownItem>,
</DropdownItem>
<DropdownItem key="version info" onClick={() => setModalOpen(true)}>
Version info
</DropdownItem>,
]}
/>
</DropdownItem>
</DropdownList>
</Dropdown>
<Modal
variant="small"
title="About Horreum"
Expand Down
10 changes: 6 additions & 4 deletions horreum-web/src/components/ConditionComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Alert, FormGroup, Switch,
FormHelperText } from "@patternfly/react-core"
import { ConditionComponent as ConditionComponentDef } from "../api"
import LogSlider from "./LogSlider"
import EnumSelect from "./EnumSelect"
import NumberBound from "./NumberBound"
import {SimpleSelect} from "@patternfly/react-templates";

type ConditionComponentProps = {
value: any
Expand Down Expand Up @@ -35,10 +35,12 @@ export default function ConditionComponent({ value, onChange, properties, isTest
break
case "ENUM":
component = (
<EnumSelect
options={(properties as any).options}
<SimpleSelect
initialOptions={Object.entries((properties as any).options).map(([name, title]) => (
{value: name, content: title, selected: name === value}
))}
selected={value}
onSelect={onChange}
onSelect={(_, item) => onChange(item as string)}
isDisabled={!isTester}
/>
)
Expand Down
36 changes: 0 additions & 36 deletions horreum-web/src/components/EnumSelect.tsx

This file was deleted.

Loading
Loading