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

shell: More types than ever #21426

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

mvollmer
Copy link
Member

@mvollmer mvollmer commented Dec 12, 2024

A manifest is now just a JsonObject, and users are expected to
type-cast it (or parts) of it to more concrete types, like the new
ShellManifest and ManifestParentSection.
The cockpit.spawn function takes only two arguments (unlike
cockpit.script).

Location.reload() doesn't take any arguments, the "force_reload"
argument is a Firefox extension.
A CockpitNav component wants the "filtering" function to put a keyword
on each item, but the the item can be anything otherwise. CockpitHosts
uses it with Machine objects, and PageNav with ManifestItems.
It doesn't happen anymore, yay!
@mvollmer mvollmer added the blocked Don't land until something else happens first (see task list) label Dec 12, 2024
@mvollmer
Copy link
Member Author

This is still another approach, just rename everything (almost) and get it relaxed green.

current: string;
}

export class CockpitNav<T> extends React.Component {

Check warning

Code scanning / CodeQL

Unused or undefined state property Warning

Component state property 'current' is
written
, but it is never read.
Comment on lines +228 to +233
if (col && typeof col == "object") {
const props = col as ListingTableRowColumnProps;
if (props.sortKey)
return props.sortKey;
if (typeof props.title == "string")
return props.title;
Copy link
Contributor

Choose a reason for hiding this comment

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

These 6 added lines are not executed by any test.

if (typeof props.title == "string")
return props.title;
}
return "";
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.

{typeof cell == 'object' ? cell.title : cell}
<Th key={key || `row_${rowKey}_cell_${colKey}`} dataLabel={dataLabel}
{...cellProps as ThProps}>
{typeof cell == 'object' ? cell_as_props.title : cell}
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.

@@ -215,7 +116,7 @@ const PublicKey = ({ currentKey }) => {

const KeyPassword = ({ currentKey, change, setDialogError }) => {
const [confirmPassword, setConfirmPassword] = useState('');
const [inProgress, setInProgress] = useState(undefined);
const [inProgress, setInProgress] = useState<boolean | undefined>(undefined);
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.

@@ -245,8 +146,7 @@
const changePasswordBtn = (
<Button variant="primary"
id={(currentKey.name || currentKey.comment) + "-change-password"}
isDisabled={inProgress}
isLoading={inProgress}
{... inProgress !== undefined ? { isDisabled: inProgress, isLoading: inProgress } : {} }
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.

.filter(key => !searchInput || manifest.locales[key].toLowerCase().includes(searchInput.toString().toLowerCase()));
const locales = manifest.locales || {};
const filteredLocales = Object.keys(locales)
.filter(key => !searchInput || locales[key].toLowerCase().includes(searchInput.toString().toLowerCase()));
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.

Comment on lines +183 to +184
arg.then(function(...args) { console.log(...args) },
function(...args) { console.error(...args) });
Copy link
Contributor

Choose a reason for hiding this comment

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

These 2 added lines are not executed by any test.

if (typeof arg.stream == "function")
arg.stream(function() { console.log.apply(console, arguments) });
arg.stream(function(...args) { console.log(...args) });
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.

{cockpit.format(_("$0 documentation"), this.state.osRelease.NAME)}
</DropdownItem>);

const shell_manifest = (cockpit.manifests.shell || {}) as ShellManifest;
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.

// global documentation for cockpit as a whole
(cockpit.manifests.shell?.docs ?? []).forEach(doc => {
(shell_manifest.docs ?? []).forEach(doc => {
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 removed the blocked Don't land until something else happens first (see task list) label Dec 18, 2024
@martinpitt
Copy link
Member

@mvollmer unblocked!

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