-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to use <EuiSuperselect /> component to list docker registery i…
…n router deployment (#396) * switch to use euisuperselect to list docker registery * Address review comments - remove extra space, fix indentation
- Loading branch information
1 parent
39865c0
commit be214e9
Showing
2 changed files
with
10 additions
and
36 deletions.
There are no files selected for viewing
44 changes: 9 additions & 35 deletions
44
ui/src/components/form/docker_image_combo_box/DockerRegistryPopover.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,14 @@ | ||
import React, { useState } from "react"; | ||
import { EuiButtonEmpty, EuiContextMenu, EuiPopover } from "@elastic/eui"; | ||
import { flattenPanelTree } from "@caraml-dev/ui-lib"; | ||
import { EuiSuperSelect } from "@elastic/eui"; | ||
|
||
export const DockerRegistryPopover = ({ value, registryOptions, onChange }) => { | ||
const [isOpen, setOpen] = useState(false); | ||
|
||
const panels = flattenPanelTree({ | ||
id: 0, | ||
items: registryOptions.map((registry) => ({ | ||
name: registry.inputDisplay, | ||
value: registry.value, | ||
icon: "logoDocker", | ||
onClick: () => { | ||
togglePopover(); | ||
onChange(registry.value); | ||
}, | ||
})), | ||
}); | ||
|
||
const togglePopover = () => setOpen(!isOpen); | ||
|
||
return ( | ||
<EuiPopover | ||
button={ | ||
<EuiButtonEmpty | ||
size="xs" | ||
iconType="arrowDown" | ||
iconSide="right" | ||
onClick={togglePopover}> | ||
{(registryOptions.find((o) => o.value === value) || {}).inputDisplay} | ||
</EuiButtonEmpty> | ||
} | ||
isOpen={isOpen} | ||
closePopover={togglePopover} | ||
panelPaddingSize="s"> | ||
<EuiContextMenu initialPanelId={0} panels={panels} /> | ||
</EuiPopover> | ||
<EuiSuperSelect | ||
fullWidth | ||
options={registryOptions} | ||
valueOfSelected={value} | ||
itemLayoutAlign="top" | ||
onChange={onChange} | ||
/> | ||
); | ||
}; | ||
}; |
2 changes: 1 addition & 1 deletion
2
ui/src/components/form/docker_image_combo_box/SelectDockerImageComboBox.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters