Skip to content

Commit

Permalink
pkg: When importing from lib don't use file extension
Browse files Browse the repository at this point in the history
Unfortunately, scss imports with non relative paths still don't work
with esbuild-wasm if these are inside jsx files:
evanw/esbuild#3001

Use relative paths for importing scss from JS. Same for .sh and .py
files processed by the raw loader.

Replacement done with:
```
for file in $(ls pkg/lib); do echo 'Processing' $file; base=$(basename $file) find pkg/ -type f -exec sed -i "s/$base/${base%.*}/g" {} +; done
```

And fixed up the rest manually.
  • Loading branch information
KKoukiou authored and martinpitt committed Mar 22, 2023
1 parent 97f3dee commit 91364b4
Show file tree
Hide file tree
Showing 119 changed files with 230 additions and 230 deletions.
4 changes: 2 additions & 2 deletions pkg/apps/application-list.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ import { Page, PageSection, PageSectionVariants } from "@patternfly/react-core/d
import { RebootingIcon } from "@patternfly/react-icons";

import * as PackageKit from "./packagekit.js";
import { read_os_release } from "os-release.js";
import { read_os_release } from "os-release";
import { icon_url, show_error, launch, ProgressBar, CancelButton } from "./utils.jsx";
import { ActionButton } from "./application.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/apps/apps.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import cockpit from "cockpit";
import React, { useState } from "react";
import { createRoot } from 'react-dom/client';

import { EmptyStatePanel } from "cockpit-components-empty-state.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state";
import { ApplicationList } from "./application-list.jsx";
import { Application } from "./application.jsx";
import { get_metainfo_db } from "./appstream.js";
Expand Down
4 changes: 2 additions & 2 deletions pkg/apps/appstream.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
*/

import cockpit from "cockpit";
import * as python from "python.js";
import inotify_py from "inotify.py";
import * as python from "python";
import inotify_py from "../lib/inotify.py";
import watch_appstream_py from "./watch-appstream.py";

let metainfo_db = null;
Expand Down
2 changes: 1 addition & 1 deletion pkg/apps/packagekit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import cockpit from "cockpit";
import * as PK from "packagekit.js";
import * as PK from "packagekit";

class ProgressReporter {
constructor(base, range, callback) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apps/utils.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { Button } from "@patternfly/react-core/dist/esm/components/Button/index.
import { Progress } from "@patternfly/react-core/dist/esm/components/Progress/index.js";
import { Split, SplitItem } from "@patternfly/react-core/dist/esm/layouts/Split/index.js";
import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner/index.js";
import { show_modal_dialog } from "cockpit-components-dialog.jsx";
import { show_modal_dialog } from "cockpit-components-dialog";

const _ = cockpit.gettext;

Expand Down
6 changes: 3 additions & 3 deletions pkg/kdump/kdump-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ import { Title } from "@patternfly/react-core/dist/esm/components/Title/index.js
import { Tooltip, TooltipPosition } from "@patternfly/react-core/dist/esm/components/Tooltip/index.js";
import { OutlinedQuestionCircleIcon } from "@patternfly/react-icons";

import { useDialogs, DialogsContext } from "dialogs.jsx";
import { show_modal_dialog } from "cockpit-components-dialog.jsx";
import { ModalError } from 'cockpit-components-inline-notification.jsx';
import { useDialogs, DialogsContext } from "dialogs";
import { show_modal_dialog } from "cockpit-components-dialog";
import { ModalError } from 'cockpit-components-inline-notification';

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/kdump/kdump.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { createRoot } from "react-dom/client";
import { KdumpPage } from "./kdump-view.jsx";
import * as kdumpClient from "./kdump-client.js";
import { superuser } from "superuser";
import { WithDialogs } from "dialogs.jsx";
import { WithDialogs } from "dialogs";

import './kdump.scss';

Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-context-menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import cockpit from "cockpit";
import React from "react";
import PropTypes from "prop-types";

import "context-menu.css";
import "context-menu";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner/inde
import { Stack, StackItem } from "@patternfly/react-core/dist/esm/layouts/Stack/index.js";
import { HelpIcon, ExternalLinkAltIcon } from '@patternfly/react-icons';

import "cockpit-components-dialog.scss";
import "./cockpit-components-dialog.scss";

const _ = cockpit.gettext;

Expand Down
6 changes: 3 additions & 3 deletions pkg/lib/cockpit-components-install-dialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import React from "react";

import { WarningTriangleIcon } from "@patternfly/react-icons";

import { show_modal_dialog } from "cockpit-components-dialog.jsx";
import * as PK from "packagekit.js";
import { show_modal_dialog } from "cockpit-components-dialog";
import * as PK from "packagekit";

import "cockpit-components-install-dialog.css";
import "cockpit-components-install-dialog";

const _ = cockpit.gettext;

Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/cockpit-components-logs-panel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import { Card, CardActions, CardBody, CardHeader, CardTitle } from "@patternfly/
import { ExclamationTriangleIcon, TimesCircleIcon } from '@patternfly/react-icons';

import { journal } from "journal";
import "journal.css";
import "cockpit-components-logs-panel.scss";
import "./journal.css";
import "./cockpit-components-logs-panel.scss";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/cockpit-components-modifications.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { TextArea } from "@patternfly/react-core/dist/esm/components/TextArea/in
import { CheckIcon, CopyIcon, ExternalLinkAltIcon, OutlinedQuestionCircleIcon } from '@patternfly/react-icons';

import cockpit from "cockpit";
import 'cockpit-components-modifications.css';
import './cockpit-components-modifications.css';

const _ = cockpit.gettext;

Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/cockpit-components-plot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import cockpit from "cockpit";

import React, { useState, useRef, useLayoutEffect } from 'react';
import { useEvent } from "hooks.js";
import { useEvent } from "hooks";

import { Button } from "@patternfly/react-core/dist/esm/components/Button/index.js";
import { Dropdown, DropdownItem, DropdownSeparator, DropdownToggle } from "@patternfly/react-core/dist/esm/components/Dropdown/index.js";
Expand All @@ -29,7 +29,7 @@ import { AngleLeftIcon, AngleRightIcon, SearchMinusIcon } from '@patternfly/reac

import * as timeformat from "timeformat";
import '@patternfly/patternfly/patternfly-charts.scss';
import "cockpit-components-plot.scss";
import "cockpit-components-plot";

const _ = cockpit.gettext;

Expand Down
8 changes: 4 additions & 4 deletions pkg/lib/cockpit-components-shutdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import { TextArea } from "@patternfly/react-core/dist/esm/components/TextArea/in
import { DatePicker } from "@patternfly/react-core/dist/esm/components/DatePicker/index.js";
import { TimePicker } from "@patternfly/react-core/dist/esm/components/TimePicker/index.js";

import { ServerTime } from 'serverTime.js';
import * as timeformat from "timeformat.js";
import { DialogsContext } from "dialogs.jsx";
import { ServerTime } from 'serverTime';
import * as timeformat from "timeformat";
import { DialogsContext } from "dialogs";

import "cockpit-components-shutdown.scss";
import "./cockpit-components-shutdown.scss";

const _ = cockpit.gettext;

Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/cockpit-components-terminal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import { Button } from "@patternfly/react-core/dist/esm/components/Button/index.
import { Terminal as Term } from "xterm";
import { CanvasAddon } from 'xterm-addon-canvas';

import { ContextMenu } from "cockpit-components-context-menu.jsx";
import { ContextMenu } from "cockpit-components-context-menu";
import cockpit from "cockpit";

import "console.css";
import "console";

const _ = cockpit.gettext;

Expand Down
6 changes: 3 additions & 3 deletions pkg/lib/credentials-ssh-private-keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ cd "$1" || exit 0
# After that each .pub file gets its on set of blocks
for file in *.pub; do
printf "\v"
cat "$file"
printf "\v%s\v" "$file"
ssh-keygen -l -f "$file" || true
cat "${file%.*}"
printf "\v%s\v" "${file%.*}"
ssh-keygen -l -f "${file%.*}" || true
done
4 changes: 2 additions & 2 deletions pkg/lib/credentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

import cockpit from "cockpit";

import lister from "credentials-ssh-private-keys.sh";
import remove_key from "credentials-ssh-remove-key.sh";
import lister from "./credentials-ssh-private-keys.sh";
import remove_key from "./credentials-ssh-remove-key.sh";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/lib/ct-card.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use "_global-variables.scss" as *;
@use "_global-variables" as *;

/* Rely on the margin from the Card for spacing */
.ct-card.pf-c-card .table {
Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/dialogs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*
* Example:
*
* import { WithDialogs, useDialogs } from "dialogs.jsx";
* import { WithDialogs, useDialogs } from "dialogs";
*
* const App = () =>
* <WithDialogs>
Expand Down Expand Up @@ -71,7 +71,7 @@
* A class component can declare a static context type and then use
* "this.context" to find the Dialogs object:
*
* import { DialogsContext } from "dialogs.jsx";
* import { DialogsContext } from "dialogs";
*
* class ExampleButton extends React.Component {
* static contextType = DialogsContext;
Expand Down
14 changes: 7 additions & 7 deletions pkg/lib/serverTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@ import { Select, SelectOption, SelectVariant } from "@patternfly/react-core/dist
import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner/index.js";
import { TimePicker } from "@patternfly/react-core/dist/esm/components/TimePicker/index.js";
import { CloseIcon, ExclamationCircleIcon, InfoCircleIcon, PlusIcon } from "@patternfly/react-icons";
import { show_modal_dialog } from "cockpit-components-dialog.jsx";
import { useObject, useEvent } from "hooks.js";
import { show_modal_dialog } from "cockpit-components-dialog";
import { useObject, useEvent } from "hooks";

import * as service from "service.js";
import * as timeformat from "timeformat.js";
import * as python from "python.js";
import * as service from "service";
import * as timeformat from "timeformat";
import * as python from "python";
import get_timesync_backend_py from "./get-timesync-backend.py";

import { superuser } from "superuser.js";
import { superuser } from "superuser";

import "serverTime.scss";
import "serverTime";

const _ = cockpit.gettext;

Expand Down
17 changes: 8 additions & 9 deletions pkg/metrics/metrics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,21 @@ import {

import cockpit from 'cockpit';
import * as machine_info from "../lib/machine-info.js";
import * as packagekit from "packagekit.js";
import * as packagekit from "packagekit";
import * as service from "service";
import * as timeformat from "timeformat";
import { superuser } from "superuser";
import { journal } from "journal";
import { useObject, useEvent, useInit } from "hooks.js";
import { WithDialogs, useDialogs } from "dialogs.jsx";
import { useObject, useEvent, useInit } from "hooks";
import { WithDialogs, useDialogs } from "dialogs";

import { EmptyStatePanel } from "../lib/cockpit-components-empty-state.jsx";
import { JournalOutput } from "cockpit-components-logs-panel.jsx";
import { install_dialog } from "cockpit-components-install-dialog.jsx";
import { ModalError } from "cockpit-components-inline-notification.jsx";
import { FirewalldRequest } from "cockpit-components-firewalld-request.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state";
import { JournalOutput } from "cockpit-components-logs-panel";
import { install_dialog } from "cockpit-components-install-dialog";
import { ModalError } from "cockpit-components-inline-notification";
import { FirewalldRequest } from "cockpit-components-firewalld-request";

import "./metrics.scss";
import "journal.css";

const MSEC_PER_H = 3600000;
const INTERVAL = 5000;
Expand Down
2 changes: 2 additions & 0 deletions pkg/metrics/metrics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// utilities for `pf-u...` classes
@import "@patternfly/patternfly/utilities/Spacing/spacing.css";

@import "../lib/journal.css";

#app {
section.pf-c-page__main-breadcrumb {
padding-bottom: var(--pf-c-page__main-breadcrumb--PaddingTop);
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/bond.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ExternalLinkSquareAltIcon, HelpIcon } from '@patternfly/react-icons';

import { MacMenu, MemberInterfaceChoices, NetworkModal, Name, dialogSave } from './dialogs-common.jsx';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

import { v4 as uuidv4 } from 'uuid';
import {
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/bridge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput/

import { MemberInterfaceChoices, NetworkModal, Name, dialogSave } from './dialogs-common.jsx';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

import { v4 as uuidv4 } from 'uuid';
import {
Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/bridgeport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput/

import { NetworkModal, dialogSave } from './dialogs-common.jsx';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

const _ = cockpit.gettext;

Expand Down
4 changes: 2 additions & 2 deletions pkg/networkmanager/dialogs-common.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ import { TeamPortDialog } from './teamport.jsx';
import { VlanDialog, getGhostSettings as getVlanGhostSettings } from './vlan.jsx';
import { MtuDialog } from './mtu.jsx';
import { MacDialog } from './mac.jsx';
import { ModalError } from 'cockpit-components-inline-notification.jsx';
import { ModalError } from 'cockpit-components-inline-notification';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

import {
apply_group_member,
Expand Down
8 changes: 4 additions & 4 deletions pkg/networkmanager/firewall.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ import { Modal } from "@patternfly/react-core/dist/esm/components/Modal/index.js
import { ExclamationCircleIcon } from '@patternfly/react-icons';

import firewall from "./firewall-client.js";
import { ListingTable } from 'cockpit-components-table.jsx';
import { ModalError } from "cockpit-components-inline-notification.jsx";
import { EmptyStatePanel } from "cockpit-components-empty-state.jsx";
import { ListingTable } from 'cockpit-components-table';
import { ModalError } from "cockpit-components-inline-notification";
import { EmptyStatePanel } from "cockpit-components-empty-state";
import { FirewallSwitch } from "./firewall-switch.jsx";

import { superuser } from "superuser";
import { WithDialogs, DialogsContext } from "dialogs.jsx";
import { WithDialogs, DialogsContext } from "dialogs";

import "./networking.scss";

Expand Down
4 changes: 2 additions & 2 deletions pkg/networkmanager/interfaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ import cockpit from 'cockpit';

import { Button } from "@patternfly/react-core/dist/esm/components/Button/index.js";

import { fmt_to_fragments } from 'utils.jsx';
import { fmt_to_fragments } from 'utils';
import * as utils from './utils.js';
import { v4 as uuidv4 } from 'uuid';

import "./networking.scss";

import { show_modal_dialog } from "cockpit-components-dialog.jsx";
import { show_modal_dialog } from "cockpit-components-dialog";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/ip-settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { MinusIcon, PlusIcon } from '@patternfly/react-icons';

import { NetworkModal, dialogSave } from './dialogs-common.jsx';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/mac.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { FormGroup } from "@patternfly/react-core/dist/esm/components/Form/index

import { MacMenu, NetworkModal, dialogSave } from './dialogs-common.jsx';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

const _ = cockpit.gettext;

Expand Down
2 changes: 1 addition & 1 deletion pkg/networkmanager/mtu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput/

import { NetworkModal, dialogSave } from './dialogs-common.jsx';
import { ModelContext } from './model-context.jsx';
import { useDialogs } from "dialogs.jsx";
import { useDialogs } from "dialogs";

const _ = cockpit.gettext;

Expand Down
Loading

0 comments on commit 91364b4

Please sign in to comment.