synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
90 lines (89 loc) • 2.5 kB
JavaScript
import { entityTypeToFriendlyName as t } from "../../utils/functions/EntityTypeUtils.js";
import { EntityType as e } from "@sage-bionetworks/synapse-client";
function _(s, i) {
switch (s) {
case "CHOOSE_TABLE_TYPE":
return "Create Table or View";
case "CHOOSE_VIEW_TYPE":
return "Create View";
case "ENTITY_VIEW_SCOPE":
case "SUBMISSION_VIEW_SCOPE":
return `Define ${t(i)} Scope`;
case "TABLE_SQL":
return "Create a SQL-Defined View";
case "TABLE_COLUMNS":
return `Add Columns to ${t(i)}`;
case "TABLE_NAME":
return `Create the ${t(i)}`;
}
}
function u(s, i) {
switch (s) {
case "CHOOSE_TABLE_TYPE":
break;
case "CHOOSE_VIEW_TYPE":
return "CHOOSE_TABLE_TYPE";
case "ENTITY_VIEW_SCOPE":
case "SUBMISSION_VIEW_SCOPE":
case "TABLE_SQL":
return "CHOOSE_VIEW_TYPE";
case "TABLE_COLUMNS":
if (i === e.table)
return "CHOOSE_TABLE_TYPE";
if (i === e.entityview)
return "ENTITY_VIEW_SCOPE";
if (i === e.submissionview)
return "SUBMISSION_VIEW_SCOPE";
break;
case "TABLE_NAME":
if (i === e.table || i === e.entityview || i === e.submissionview)
return "TABLE_COLUMNS";
if (i === e.materializedview || i === e.virtualtable)
return "TABLE_SQL";
break;
}
return console.warn(`Unknown previous step at ${s} for type ${i}`), "CHOOSE_TABLE_TYPE";
}
function o(s) {
return s === "TABLE_NAME";
}
function c(s) {
return s === e.table ? "TABLE_COLUMNS" : s === e.entityview ? "ENTITY_VIEW_SCOPE" : s === e.submissionview ? "SUBMISSION_VIEW_SCOPE" : s === e.materializedview || s === e.virtualtable ? "TABLE_SQL" : "CHOOSE_TABLE_TYPE";
}
function O(s, i, n) {
[
e.table,
e.entityview,
e.submissionview,
e.dataset,
e.datasetcollection
].includes(i) && n.length > 0 && (s.columnIds = n.map(
(E) => E.id
));
}
function T(s, i, n) {
[
e.entityview,
e.submissionview
].includes(i) && n.length > 0 && (s.scopeIds = n);
}
function f(s, i, n) {
i === e.entityview && (s.viewTypeMask = n);
}
function L(s, i, n) {
[
e.materializedview,
e.virtualtable
].includes(i) && (s.definingSQL = n);
}
export {
_ as getModalTitle,
u as getPreviousStep,
c as getStepAfterTypeSelection,
o as isLastStep,
O as maybeSetColumnIds,
L as maybeSetDefiningSQL,
T as maybeSetScopeIds,
f as maybeSetViewTypeMask
};
//# sourceMappingURL=CreateTableViewWizardUtils.js.map