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

lib: Add types to pkg/lib/notifications #21445

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

mvollmer
Copy link
Member

No description provided.

@mvollmer mvollmer force-pushed the lib-type-notifications branch from 1635180 to 9f16dc4 Compare December 17, 2024 13:16
@mvollmer mvollmer changed the title lib: Add types to pkk/lib/notifications lib: Add types to pkg/lib/notifications Dec 18, 2024
@mvollmer mvollmer force-pushed the lib-type-notifications branch from 9f16dc4 to 78abdab Compare December 18, 2024 08:33
@mvollmer mvollmer requested a review from martinpitt December 18, 2024 13:31
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let's please double-check the PageStatus class.

pkg/lib/notifications.ts Show resolved Hide resolved
pkg/lib/notifications.ts Show resolved Hide resolved
@mvollmer mvollmer marked this pull request as draft December 18, 2024 14:08
@mvollmer mvollmer force-pushed the lib-type-notifications branch from 78abdab to 34f1448 Compare December 18, 2024 14:18
@mvollmer mvollmer requested a review from martinpitt December 18, 2024 14:24
@mvollmer mvollmer marked this pull request as ready for review December 18, 2024 14:24
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!

@@ -27,8 +27,9 @@ import { SearchInput } from "@patternfly/react-core/dist/esm/components/SearchIn
import { Tooltip, TooltipPosition } from "@patternfly/react-core/dist/esm/components/Tooltip/index.js";
import { ContainerNodeIcon, ExclamationCircleIcon, ExclamationTriangleIcon, InfoCircleIcon } from '@patternfly/react-icons';

import { Status } from "notifications";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a case where import type is preferable, as notifications.tsx isn't otherwise used in the shell. However, we recently talked about that, and

NODE_ENV=development ./build.js shell

indeed confirms that pkg/lib/notifications.tsx does not land in the dist/shell/shell.js shell bundle. So tree shaking does work for pure .js/.ts, just not for anything with CSS.

It may still be a good habit to learn, to not unnecessarily blow up our bundles.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point! I didn't think of that.

// Generate name for the status
const desc_parts = name.toLowerCase().split(" ");
desc_parts.push(status.type);
desc_parts.push(status.type || "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is not executed by any test.

@martinpitt martinpitt merged commit 11a740c into cockpit-project:main Dec 18, 2024
85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants