Path: blob/master/src/packages/frontend/compute/select-server-for-explorer.tsx
5857 views
/*1Dropdown for selecting compute server for the file explorer2*/34import type { CSSProperties } from "react";5import SelectServer from "./select-server";6import { redux, useTypedRedux } from "@cocalc/frontend/app-framework";78interface Props {9project_id: string;10style?: CSSProperties;11size?;12noLabel?: boolean;13}1415export default function SelectComputeServerForFileExplorer({16project_id,17style,18size,19noLabel,20}: Props) {21const compute_servers_enabled = useTypedRedux(22"customize",23"compute_servers_enabled",24);25const compute_server_id = useTypedRedux({ project_id }, "compute_server_id");26if (!compute_servers_enabled) {27return null;28}2930return (31<SelectServer32title={`Showing files ${33compute_server_id34? `on compute server ${compute_server_id}`35: "in the project"36}. When you create or open a file, it will by default open ${37compute_server_id38? `on compute server ${compute_server_id}`39: "in the project"40}.`}41size={size}42project_id={project_id}43style={style}44value={compute_server_id}45noLabel={noLabel}46setValue={(compute_server_id) => {47const actions = redux.getProjectActions(project_id);48actions.setComputeServerId(compute_server_id ?? 0);49}}50/>51);52}535455