import { createResource, onMount } from "solid-js"; import List from "../../components/list"; import RemotesService from "../../services/remotes-service"; import CreateCommandModal from "../../modals/create-command-modal"; import DeleteCommandModal from "../../modals/delete-command-modal"; function CommandsList(props) { const [commands, { refetch: refetchCommands }] = createResource( RemotesService.getCommands ); onMount(() => { refetchCommands(); }); CreateCommandModal.onCommandCreated(() => { refetchCommands(); }); DeleteCommandModal.onCommandDeleted(() => { refetchCommands(); }); function handleNewCommand() { refetchCommands(); CreateCommandModal.Handler.show(); } function handleDeleteCommand(command) { DeleteCommandModal.setCommand(command); DeleteCommandModal.Handler.show(); } return ( <>
{props.navigation ? props.navigation : null}
({ id: { html: {command.getId()}, }, title: { text: command.getTitle(), }, protocol: { text: command.getProtocol(), }, type: { text: command.getCommandType(), }, options: { html: ( <> ), }, command, }))} > ); } export default CommandsList;