Skip to content

Commit a8eb774

Browse files
authored
Move from labelString to selectedLabel (#2251)
1 parent 9b20b7c commit a8eb774

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

app/components/form/fields/ImageSelectField.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ export function toListboxItem(i: Image, includeProjectSiloIndicator = false): Li
5959
const formattedSize = `${bytesToGiB(size, 1)} GiB`
6060

6161
// filter out any undefined metadata and create a comma-separated list
62-
// for the selected listbox item (shown in labelString)
62+
// for the selected listbox item (shown in selectedLabel)
6363
const condensedImageMetadata = [os, version, formattedSize].filter((i) => !!i).join(', ')
64-
const metadataForLabelString = condensedImageMetadata.length
64+
const metadataForSelectedLabel = condensedImageMetadata.length
6565
? ` (${condensedImageMetadata})`
6666
: ''
6767

@@ -81,7 +81,7 @@ export function toListboxItem(i: Image, includeProjectSiloIndicator = false): Li
8181
))
8282
return {
8383
value: i.id,
84-
labelString: `${name}${metadataForLabelString}`,
84+
selectedLabel: `${name}${metadataForSelectedLabel}`,
8585
label: (
8686
<>
8787
<div>{name}</div>

app/forms/access-util.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export const actorToItem = (actor: Actor): ListboxItem => ({
4141
)}
4242
</>
4343
),
44-
labelString: actor.displayName,
44+
selectedLabel: actor.displayName,
4545
})
4646

4747
export type AddRoleModalProps = {

app/forms/disk-create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ const SnapshotSelectField = ({ control }: { control: Control<DiskCreate> }) => {
253253
const formattedSize = filesize(i.size, { base: 2, output: 'object' })
254254
return {
255255
value: i.id,
256-
labelString: `${i.name}`,
256+
selectedLabel: `${i.name}`,
257257
label: (
258258
<>
259259
<div>{i.name}</div>

app/forms/floating-ip-create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const toListboxItem = (p: SiloIpPool) => {
3535
// For the default pool, add a label to the dropdown
3636
return {
3737
value: p.name,
38-
labelString: p.name,
38+
selectedLabel: p.name,
3939
label: (
4040
<>
4141
{p.name}{' '}

app/pages/project/floating-ips/AttachFloatingIpModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const AttachFloatingIpModal = ({
7474
items={floatingIps.map((ip) => ({
7575
value: ip.id,
7676
label: <FloatingIpLabel fip={ip} />,
77-
labelString: ip.name,
77+
selectedLabel: ip.name,
7878
}))}
7979
required
8080
/>

app/ui/lib/Listbox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { TextInputHint } from './TextInput'
2626

2727
export type ListboxItem<Value extends string = string> = {
2828
value: Value
29-
} & { label?: string | ReactNode; labelString?: string }
29+
} & { label?: string | ReactNode; selectedLabel?: string }
3030

3131
export interface ListboxProps<Value extends string = string> {
3232
// null is allowed as a default empty value, but onChange will never be called with null
@@ -121,8 +121,8 @@ export const Listbox = <Value extends string = string>({
121121
>
122122
<div className="w-full overflow-hidden overflow-ellipsis whitespace-pre px-3 text-left">
123123
{selectedItem ? (
124-
// labelString is one line, which is what we need when label is a ReactNode
125-
selectedItem.labelString || selectedItem.label
124+
// selectedLabel is one line, which is what we need when label is a ReactNode
125+
selectedItem.selectedLabel || selectedItem.label
126126
) : (
127127
<span className="text-quaternary">
128128
{noItems ? 'No items' : placeholder}

0 commit comments

Comments
 (0)