synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
95 lines (94 loc) • 3.13 kB
JavaScript
import { jsx as o, jsxs as v, Fragment as E } from "react/jsx-runtime";
import "../../synapse-client/SynapseClient.js";
import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode";
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
import "@sage-bionetworks/synapse-client/util/SynapseClientError";
import "@sage-bionetworks/synapse-types";
import { convertToEntityType as T } from "../../utils/functions/EntityTypeUtils.js";
import "../../utils/SynapseConstants.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "@tanstack/react-query";
import "../../utils/PermissionLevelToAccessType.js";
import { useState as L, useEffect as h } from "react";
import "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Alert as x } from "@mui/material";
import "../../utils/hooks/useCookiePreferences.js";
import "../../utils/hooks/useSourceAppConfigs.js";
import "universal-cookie";
import "../../utils/AppUtils/session/ApplicationSessionContext.js";
import "../../utils/context/FullContextProvider.js";
import "../../utils/context/DocumentMetadataContext.js";
import { SynapseSpinner as b } from "../LoadingScreen/LoadingScreen.js";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import "react-router";
import "@sage-bionetworks/synapse-client";
import "../../utils/types/IsType.js";
import { useGetEntity as q, useUpdateEntity as C } from "../../synapse-queries/entity/useEntity.js";
import { ConfirmationDialog as U } from "../ConfirmationDialog/ConfirmationDialog.js";
import D from "./SqlDefinedTableEditor.js";
function at(p) {
const { open: a, entityId: s, onCancel: d, onUpdate: f } = p, {
data: t,
isLoading: c,
error: l
} = q(s, void 0, {
// Set the stale time to infinity because we don't want to refetch this in the middle of an edit
staleTime: 1 / 0
}), [r, e] = L("");
h(() => {
t && e(t.definingSQL);
}, [t]);
const y = t ? T(t.concreteType) : void 0, {
mutate: u,
isPending: i,
error: g
} = C({ onSuccess: f }), n = c || i, m = l || g;
return /* @__PURE__ */ o(
U,
{
open: a,
title: "Update SQL",
content: /* @__PURE__ */ v(E, { children: [
/* @__PURE__ */ o(
D,
{
value: r,
entityType: y,
onChange: (S) => e(S.target.value),
disabled: n
}
),
m && /* @__PURE__ */ o(
x,
{
sx: {
my: 1
},
severity: "error",
children: m.reason
}
)
] }),
confirmButtonProps: {
children: i ? "Saving..." : "Save",
disabled: n,
startIcon: i ? /* @__PURE__ */ o(b, {}) : void 0
},
onConfirm: () => {
t && u({ ...t, definingSQL: r });
},
onCancel: d,
maxWidth: "md"
}
);
}
export {
at as SqlDefinedTableEditorModal,
at as default
};
//# sourceMappingURL=SqlDefinedTableEditorModal.js.map