Skip to content

Commit 49d5c3a

Browse files
committed
fix: restore use of chip ui in ProfileExplorer
1 parent cc83582 commit 49d5c3a

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

Diff for: plugins/plugin-codeflare/src/components/ProfileExplorer.tsx

+20-13
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,23 @@ import React from "react"
1818
import { diff } from "json-diff"
1919
import { Icons, Loading, Tooltip } from "@kui-shell/plugin-client-common"
2020
import {
21+
Button,
2122
Card,
2223
CardActions,
2324
CardBody,
2425
CardHeader,
2526
CardTitle,
26-
KebabToggle,
27+
Chip,
28+
ChipGroup,
2729
Dropdown,
2830
DropdownItem,
2931
DropdownSeparator,
30-
Title,
31-
Button,
32+
KebabToggle,
3233
Select,
33-
SelectVariant,
3434
SelectOption,
35+
Title,
3536
TreeView,
3637
TreeViewDataItem,
37-
Chip,
38-
ChipGroup,
3938
} from "@patternfly/react-core"
4039

4140
import ProfileSelect from "./ProfileSelect"
@@ -329,7 +328,7 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
329328
return (
330329
<Select
331330
className="codeflare--profile-explorer--select-status"
332-
variant={SelectVariant.single}
331+
variant="single"
333332
placeholderText={<StatusTitle readiness={this.props.profileStatus?.readiness} />}
334333
label="Status select"
335334
onToggle={this._onToggle}
@@ -408,12 +407,20 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
408407
},
409408
}
410409

411-
private form(form: Record<string, string>) {
410+
/** Present a form using <Chip/> components */
411+
private chips(form: Record<string, string>) {
412412
return (
413413
<ChipGroup numChips={10}>
414414
{Object.entries(form).map(([title, name]) => (
415415
<Chip key={title} isReadOnly textMaxWidth="25ch">
416-
<span className="slightly-deemphasize">{title}</span> <span className="semi-bold color-base0D">{name}</span>
416+
<span className="slightly-deemphasize">
417+
{title
418+
.replace(/^Number of /, "")
419+
.replace(/(GPU|CPU)s/, "$1")
420+
.replace(/ per Worker$/, "")
421+
.replace(/Memory/, "Mem")}
422+
</span>{" "}
423+
<span className="semi-bold color-base0D">{name}</span>
417424
</Chip>
418425
))}
419426
</ChipGroup>
@@ -444,11 +451,11 @@ class ProfileCard extends React.PureComponent<ProfileCardProps, ProfileCardState
444451
return {
445452
id,
446453
title,
447-
//name: this.form(form),
448-
name: Array.isArray(form) ? form.join(" ║ ") : "",
449-
children: Array.isArray(form)
454+
// name: this.form(form),
455+
name: Array.isArray(form) ? form.join(" ║ ") : this.chips(form),
456+
/*children: Array.isArray(form)
450457
? undefined
451-
: Object.entries(form).map(([title, name]) => ({ title, name: this.leafFor(name) })),
458+
: Object.entries(form).map(([title, name]) => ({ title, name: this.leafFor(name) })),*/
452459
}
453460
} catch (err) {
454461
return {

0 commit comments

Comments
 (0)