Skip to content

Commit

Permalink
Import selected PF components only
Browse files Browse the repository at this point in the history
This does not currently make any difference for the dist/ size because
of patternfly/patternfly-react#10618. But we
do that in all other projects.
  • Loading branch information
martinpitt authored and jelly committed Jun 18, 2024
1 parent df549de commit 39ac14b
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 87 deletions.
11 changes: 6 additions & 5 deletions src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
*/

import cockpit from "cockpit";
import { superuser } from "superuser";
import React, { useContext, useEffect, useMemo, useState } from "react";

import { Page, PageSection } from "@patternfly/react-core/dist/esm/components/Page";
import { Sidebar, SidebarPanel, SidebarContent } from "@patternfly/react-core/dist/esm/components/Sidebar";
import {
Page, PageSection,
Sidebar, SidebarPanel, SidebarContent,
AlertGroup, Alert, AlertVariant, AlertActionCloseButton
} from "@patternfly/react-core";
} from "@patternfly/react-core/dist/esm/components/Alert";
import { ExclamationCircleIcon } from "@patternfly/react-icons";

import cockpit from "cockpit";
import { superuser } from "superuser";
import { WithDialogs } from "dialogs.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state.jsx";
import { FilesBreadcrumbs } from "./files-breadcrumbs";
Expand Down
14 changes: 7 additions & 7 deletions src/dialogs/mkdir.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useState } from 'react';
import {
Button,
Form, FormGroup,
FormSelect, FormSelectOption,
Modal, ModalVariant,
Stack, TextInput,
} from '@patternfly/react-core';

import { Button } from "@patternfly/react-core/dist/esm/components/Button";
import { Form, FormGroup } from "@patternfly/react-core/dist/esm/components/Form";
import { FormSelect, FormSelectOption } from "@patternfly/react-core/dist/esm/components/FormSelect";
import { Modal, ModalVariant } from "@patternfly/react-core/dist/esm/components/Modal";
import { Stack } from "@patternfly/react-core/dist/esm/layouts/Stack";
import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput";

import cockpit from 'cockpit';
import { useDialogs } from 'dialogs';
Expand Down
18 changes: 7 additions & 11 deletions src/fileActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
*/

import cockpit from "cockpit";
import React, { useState } from "react";
import {
Button,
Form, FormGroup,
FormSection,
FormSelect,
FormSelectOption,
Modal, ModalVariant,
Stack,
TextInput,
} from "@patternfly/react-core";
import { Button } from "@patternfly/react-core/dist/esm/components/Button";
import { Form, FormGroup, FormSection } from "@patternfly/react-core/dist/esm/components/Form";
import { FormSelect, FormSelectOption } from "@patternfly/react-core/dist/esm/components/FormSelect";
import { Modal, ModalVariant } from "@patternfly/react-core/dist/esm/components/Modal";
import { Stack } from "@patternfly/react-core/dist/esm/layouts/Stack";
import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput";

import cockpit from "cockpit";
import { useDialogs } from "dialogs.jsx";
import { InlineNotification } from "cockpit-components-inline-notification";
import { FormHelper } from 'cockpit-components-form-helper.jsx';
Expand Down
8 changes: 6 additions & 2 deletions src/files-breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
*/
import cockpit from "cockpit";
import React from "react";

import { CheckIcon, HddIcon, PencilAltIcon, TimesIcon } from "@patternfly/react-icons";
import { Button } from "@patternfly/react-core/dist/esm/components/Button";
import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex";
import { PageBreadcrumb } from "@patternfly/react-core/dist/esm/components/Page";
import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput";

import { Button, Flex, FlexItem, PageBreadcrumb, TextInput } from "@patternfly/react-core";
import cockpit from "cockpit";

import { SettingsDropdown } from "./settings-dropdown.jsx";

Expand Down
11 changes: 4 additions & 7 deletions src/files-card-body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
*/

import React, { useCallback, useEffect, useMemo, useState, useRef } from "react";
import {
Flex,
Spinner,
MenuItem,
MenuList,
Divider,
} from "@patternfly/react-core";
import { Divider } from "@patternfly/react-core/dist/esm/components/Divider";
import { Flex } from "@patternfly/react-core/dist/esm/layouts/Flex";
import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner";
import { MenuItem, MenuList } from "@patternfly/react-core/dist/esm/components/Menu";
import { Table, Thead, Tr, Th, Tbody, Td } from '@patternfly/react-table';

import cockpit from "cockpit";
Expand Down
3 changes: 2 additions & 1 deletion src/files-folder-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
*/

import React, { useState } from "react";
import { Card } from "@patternfly/react-core";

import { Card } from '@patternfly/react-core/dist/esm/components/Card';

import { FolderFileInfo } from "./app";
import { FilesCardBody } from "./files-card-body.jsx";
Expand Down
22 changes: 7 additions & 15 deletions src/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,13 @@
import cockpit from "cockpit";
import React, { useState } from "react";

import {
CardHeader,
CardTitle,
Divider,
Flex,
MenuToggle,
MenuToggleAction,
SearchInput,
Select,
SelectList,
SelectOption,
Text,
TextContent,
TextVariants
} from "@patternfly/react-core";
import { CardHeader, CardTitle } from "@patternfly/react-core/dist/esm/components/Card";
import { Divider } from "@patternfly/react-core/dist/esm/components/Divider";
import { Flex } from "@patternfly/react-core/dist/esm/layouts/Flex";
import { MenuToggle, MenuToggleAction } from "@patternfly/react-core/dist/esm/components/MenuToggle";
import { SearchInput } from "@patternfly/react-core/dist/esm/components/SearchInput";
import { Select, SelectList, SelectOption } from "@patternfly/react-core/dist/esm/components/Select";
import { Text, TextContent, TextVariants } from "@patternfly/react-core/dist/esm/components/Text";
import { SortByDirection } from '@patternfly/react-table';
import { GripVerticalIcon, ListIcon } from "@patternfly/react-icons";

Expand Down
16 changes: 5 additions & 11 deletions src/settings-dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,14 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
*/
import cockpit from "cockpit";
import React, { useState } from "react";
import { CheckIcon, EllipsisVIcon } from "@patternfly/react-icons";
import { Dropdown, DropdownItem, DropdownList } from "@patternfly/react-core/dist/esm/components/Dropdown";
import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex";
import { Icon } from "@patternfly/react-core/dist/esm/components/Icon";
import { MenuToggle } from "@patternfly/react-core/dist/esm/components/MenuToggle";

import {
Dropdown,
DropdownItem,
DropdownList,
Flex,
FlexItem,
Icon,
MenuToggle
} from "@patternfly/react-core";

import cockpit from "cockpit";
const _ = cockpit.gettext;

export const SettingsDropdown = ({ showHidden, setShowHidden }) => {
Expand Down
22 changes: 8 additions & 14 deletions src/sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,21 @@
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
*/

import cockpit from "cockpit";

import React, { useState, useEffect } from "react";

import { Button } from "@patternfly/react-core/dist/esm/components/Button";
import { Card, CardBody, CardHeader, CardTitle } from "@patternfly/react-core/dist/esm/components/Card";
import {
Button,
Card,
CardBody,
CardHeader,
CardTitle,
DescriptionList,
DescriptionListDescription,
DescriptionListGroup,
DescriptionListTerm,
Divider,
DropdownItem,
Text,
TextContent,
TextVariants,
} from "@patternfly/react-core";
DescriptionListTerm
} from "@patternfly/react-core/dist/esm/components/DescriptionList";
import { Divider } from "@patternfly/react-core/dist/esm/components/Divider";
import { DropdownItem } from "@patternfly/react-core/dist/esm/components/Dropdown";
import { Text, TextContent, TextVariants } from "@patternfly/react-core/dist/esm/components/Text";

import cockpit from "cockpit";
import * as timeformat from "timeformat";
import { useDialogs } from "dialogs.jsx";
import { KebabDropdown } from "cockpit-components-dropdown";
Expand Down
23 changes: 9 additions & 14 deletions src/upload-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,19 @@
* along with Cockpit; If not, see <http://www.gnu.org/licenses/>.
*/

import cockpit from "cockpit";
import React, { useState, useRef } from "react";

import {
AlertVariant,
Button,
Checkbox,
Divider,
Modal,
ModalVariant,
Popover,
PopoverPosition,
Progress,
Flex,
FlexItem,
} from "@patternfly/react-core";
import { AlertVariant } from "@patternfly/react-core/dist/esm/components/Alert";
import { Button } from "@patternfly/react-core/dist/esm/components/Button";
import { Checkbox } from "@patternfly/react-core/dist/esm/components/Checkbox";
import { Divider } from "@patternfly/react-core/dist/esm/components/Divider";
import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex";
import { Modal, ModalVariant } from "@patternfly/react-core/dist/esm/components/Modal";
import { Popover, PopoverPosition } from "@patternfly/react-core/dist/esm/components/Popover";
import { Progress } from "@patternfly/react-core/dist/esm/components/Progress";
import { TrashIcon } from "@patternfly/react-icons";

import cockpit from "cockpit";
import { upload } from "cockpit-upload-helper";
import { fmt_to_fragments } from "utils.jsx";
import { useDialogs } from "dialogs.jsx";
Expand Down

0 comments on commit 39ac14b

Please sign in to comment.