UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

45 lines (44 loc) 1.77 kB
import { jsx as o, Fragment as u } from "react/jsx-runtime"; import { getLinkToGridSession as g } from "../../../../utils/functions/getSynapseWebClientLink.js"; import { StickyNote2Outlined as k } from "@mui/icons-material"; import { Tooltip as f, Button as T } from "@mui/material"; import { useCallback as G } from "react"; import h from "../hooks/useGridSessionForCurationTask.js"; import { getGridSourceIdForTask as C } from "../utils/getGridSourceIdForTask.js"; import { useGetEntityPermissions as y } from "../../../../synapse-queries/entity/useEntity.js"; import { displayToast as w } from "../../../../components/ToastMessage/ToastMessage.js"; function P(d) { const { curationTask: t // canEdit } = d, { mutateAsync: i, isPending: n } = h(), e = C(t), { data: a, isLoading: s } = y(e), c = n || s || !a?.canView, l = a?.canView ? "Open Curator to edit metadata" : "You must have READ access to " + e + " to view the Working Copy", p = G(async () => { try { const r = await i({ curationTask: t }), m = g( r.sessionId, t.taskId ); window.open(m, "_blank", "noopener"); } catch (r) { console.error("Error opening Curator for curation task", r), w(r.message, "danger", { title: "An error occurred while trying to open Curator" }); } }, [t, i]); return /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(f, { title: l, children: /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o( T, { size: "small", startIcon: /* @__PURE__ */ o(k, {}), loading: n || s, disabled: c, onClick: () => { p(); }, children: "Open Curator" } ) }) }) }); } export { P as default }; //# sourceMappingURL=MetadataTaskTableActionCell.js.map