diff --git a/frontend/src/components/select-server.tsx b/frontend/src/components/select-server.tsx index 8bcdb201..dc4884b9 100644 --- a/frontend/src/components/select-server.tsx +++ b/frontend/src/components/select-server.tsx @@ -5,6 +5,7 @@ import GetApiServerUri from './helpers'; import IsManager from './is_manager'; import TornjakApi from './tornjak-api-helpers'; import './style.css'; +import { Dropdown } from 'carbon-components-react'; import { serverSelectedFunc, @@ -112,15 +113,11 @@ class SelectServer extends Component { } } - onServerSelect(e: { target: { value: string; }; } | undefined) { - if (e === undefined) { - return; + onServerSelect = ({ selectedItem }: { selectedItem: string }) => { + if (selectedItem) { + this.props.serverSelectedFunc(selectedItem); } - const serverName = e.target.value; - if (serverName !== "") { - this.props.serverSelectedFunc(serverName); - } - } + }; getServer(serverName: string) { var i; @@ -135,25 +132,24 @@ class SelectServer extends Component { } render() { + const items = this.props.globalServersList + ? this.props.globalServersList.map((server) => server.name) + : []; + let managerServerSelector = ( -
- -
- -
-
- ) - return ( -
- {IsManager && managerServerSelector} -
- ) +
+ +
+ ); + return
{IsManager && managerServerSelector}
; } }