Make variable naming consistent
This commit is contained in:
parent
1132edbbb3
commit
3ec93f42c6
@ -10,9 +10,9 @@ import {
|
|||||||
Action,
|
Action,
|
||||||
ObjectType,
|
ObjectType,
|
||||||
tableThemes,
|
tableThemes,
|
||||||
defaultTableTheme,
|
defaultBlue,
|
||||||
State,
|
State,
|
||||||
} from "../data/data";
|
} from "../data/constants";
|
||||||
import useLayout from "../hooks/useLayout";
|
import useLayout from "../hooks/useLayout";
|
||||||
import useSettings from "../hooks/useSettings";
|
import useSettings from "../hooks/useSettings";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
@ -143,7 +143,7 @@ export default function Area(props) {
|
|||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
updateArea(props.areaData.id, {
|
updateArea(props.areaData.id, {
|
||||||
color: defaultTableTheme,
|
color: defaultBlue,
|
||||||
});
|
});
|
||||||
setSaveState(State.SAVING);
|
setSaveState(State.SAVING);
|
||||||
}}
|
}}
|
||||||
@ -271,11 +271,10 @@ export default function Area(props) {
|
|||||||
...prev,
|
...prev,
|
||||||
element: ObjectType.AREA,
|
element: ObjectType.AREA,
|
||||||
id: props.areaData.id,
|
id: props.areaData.id,
|
||||||
currentTab: Tab.subject_areas,
|
currentTab: Tab.AREAS,
|
||||||
open: true,
|
open: true,
|
||||||
}));
|
}));
|
||||||
if (selectedElement.currentTab !== Tab.subject_areas)
|
if (selectedElement.currentTab !== Tab.AREAS) return;
|
||||||
return;
|
|
||||||
document
|
document
|
||||||
.getElementById(`scroll_area_${props.areaData.id}`)
|
.getElementById(`scroll_area_${props.areaData.id}`)
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
|
@ -20,12 +20,12 @@ import {
|
|||||||
IconDeleteStroked,
|
IconDeleteStroked,
|
||||||
} from "@douyinfe/semi-icons";
|
} from "@douyinfe/semi-icons";
|
||||||
import {
|
import {
|
||||||
defaultTableTheme,
|
defaultBlue,
|
||||||
tableThemes,
|
tableThemes,
|
||||||
Action,
|
Action,
|
||||||
ObjectType,
|
ObjectType,
|
||||||
State,
|
State,
|
||||||
} from "../data/data";
|
} from "../data/constants";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
import useAreas from "../hooks/useAreas";
|
import useAreas from "../hooks/useAreas";
|
||||||
import useSaveState from "../hooks/useSaveState";
|
import useSaveState from "../hooks/useSaveState";
|
||||||
@ -140,7 +140,7 @@ export default function AreaOverview() {
|
|||||||
type="tertiary"
|
type="tertiary"
|
||||||
size="small"
|
size="small"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
updateArea(i, { color: defaultTableTheme });
|
updateArea(i, { color: defaultBlue });
|
||||||
setSaveState(State.SAVING);
|
setSaveState(State.SAVING);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useRef, useState, useEffect } from "react";
|
import { useRef, useState, useEffect } from "react";
|
||||||
import Table from "./Table";
|
import Table from "./Table";
|
||||||
import { Action, Cardinality, Constraint, ObjectType } from "../data/data";
|
import { Action, Cardinality, Constraint, ObjectType } from "../data/constants";
|
||||||
import Area from "./Area";
|
import Area from "./Area";
|
||||||
import Relationship from "./Relationship";
|
import Relationship from "./Relationship";
|
||||||
import Note from "./Note";
|
import Note from "./Note";
|
||||||
@ -39,8 +39,8 @@ export default function Canvas() {
|
|||||||
endY: 0,
|
endY: 0,
|
||||||
name: "",
|
name: "",
|
||||||
cardinality: Cardinality.ONE_TO_ONE,
|
cardinality: Cardinality.ONE_TO_ONE,
|
||||||
updateConstraint: Constraint.none,
|
updateConstraint: Constraint.NONE,
|
||||||
deleteConstraint: Constraint.none,
|
deleteConstraint: Constraint.NONE,
|
||||||
mandatory: false,
|
mandatory: false,
|
||||||
});
|
});
|
||||||
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
const [offset, setOffset] = useState({ x: 0, y: 0 });
|
||||||
|
@ -44,7 +44,7 @@ import {
|
|||||||
jsonToSQLServer,
|
jsonToSQLServer,
|
||||||
} from "../utils/toSQL";
|
} from "../utils/toSQL";
|
||||||
import { IconAddTable, IconAddArea, IconAddNote } from "./CustomIcons";
|
import { IconAddTable, IconAddArea, IconAddNote } from "./CustomIcons";
|
||||||
import { ObjectType, Action, Tab, State, Cardinality } from "../data/data";
|
import { ObjectType, Action, Tab, State, Cardinality } from "../data/constants";
|
||||||
import jsPDF from "jspdf";
|
import jsPDF from "jspdf";
|
||||||
import { useHotkeys } from "react-hotkeys-hook";
|
import { useHotkeys } from "react-hotkeys-hook";
|
||||||
import { Validator } from "jsonschema";
|
import { Validator } from "jsonschema";
|
||||||
@ -581,9 +581,9 @@ export default function ControlPanel({
|
|||||||
setSelectedElement((prev) => ({
|
setSelectedElement((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
open: true,
|
open: true,
|
||||||
currentTab: Tab.tables,
|
currentTab: Tab.TABLES,
|
||||||
}));
|
}));
|
||||||
if (selectedElement.currentTab !== Tab.tables) return;
|
if (selectedElement.currentTab !== Tab.TABLES) return;
|
||||||
document
|
document
|
||||||
.getElementById(`scroll_table_${selectedElement.id}`)
|
.getElementById(`scroll_table_${selectedElement.id}`)
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
@ -592,9 +592,9 @@ export default function ControlPanel({
|
|||||||
if (layout.sidebar) {
|
if (layout.sidebar) {
|
||||||
setSelectedElement((prev) => ({
|
setSelectedElement((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
currentTab: Tab.subject_areas,
|
currentTab: Tab.AREAS,
|
||||||
}));
|
}));
|
||||||
if (selectedElement.currentTab !== Tab.subject_areas) return;
|
if (selectedElement.currentTab !== Tab.AREAS) return;
|
||||||
document
|
document
|
||||||
.getElementById(`scroll_area_${selectedElement.id}`)
|
.getElementById(`scroll_area_${selectedElement.id}`)
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
@ -609,10 +609,10 @@ export default function ControlPanel({
|
|||||||
if (layout.sidebar) {
|
if (layout.sidebar) {
|
||||||
setSelectedElement((prev) => ({
|
setSelectedElement((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
currentTab: Tab.notes,
|
currentTab: Tab.NOTES,
|
||||||
open: false,
|
open: false,
|
||||||
}));
|
}));
|
||||||
if (selectedElement.currentTab !== Tab.notes) return;
|
if (selectedElement.currentTab !== Tab.NOTES) return;
|
||||||
document
|
document
|
||||||
.getElementById(`scroll_note_${selectedElement.id}`)
|
.getElementById(`scroll_note_${selectedElement.id}`)
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Action, ObjectType, noteThemes, Tab, State } from "../data/data";
|
import { Action, ObjectType, noteThemes, Tab, State } from "../data/constants";
|
||||||
import { Input, Button, Popover, Toast } from "@douyinfe/semi-ui";
|
import { Input, Button, Popover, Toast } from "@douyinfe/semi-ui";
|
||||||
import {
|
import {
|
||||||
IconEdit,
|
IconEdit,
|
||||||
@ -257,9 +257,9 @@ export default function Note({ data, onMouseDown }) {
|
|||||||
if (layout.sidebar) {
|
if (layout.sidebar) {
|
||||||
setSelectedElement((prev) => ({
|
setSelectedElement((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
currentTab: Tab.notes,
|
currentTab: Tab.NOTES,
|
||||||
}));
|
}));
|
||||||
if (selectedElement.currentTab !== Tab.notes) return;
|
if (selectedElement.currentTab !== Tab.NOTES) return;
|
||||||
document
|
document
|
||||||
.getElementById(`scroll_note_${data.id}`)
|
.getElementById(`scroll_note_${data.id}`)
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
IconSearch,
|
IconSearch,
|
||||||
IconCheckboxTick,
|
IconCheckboxTick,
|
||||||
} from "@douyinfe/semi-icons";
|
} from "@douyinfe/semi-icons";
|
||||||
import { noteThemes, Action, ObjectType } from "../data/data";
|
import { noteThemes, Action, ObjectType } from "../data/constants";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
import useNotes from "../hooks/useNotes";
|
import useNotes from "../hooks/useNotes";
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
IllustrationNoContent,
|
IllustrationNoContent,
|
||||||
IllustrationNoContentDark,
|
IllustrationNoContentDark,
|
||||||
} from "@douyinfe/semi-illustrations";
|
} from "@douyinfe/semi-illustrations";
|
||||||
import { Cardinality, Constraint, Action, ObjectType } from "../data/data";
|
import { Cardinality, Constraint, Action, ObjectType } from "../data/constants";
|
||||||
import useTables from "../hooks/useTables";
|
import useTables from "../hooks/useTables";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { Cardinality } from "../data/data";
|
import { Cardinality } from "../data/constants";
|
||||||
import useSettings from "../hooks/useSettings";
|
import useSettings from "../hooks/useSettings";
|
||||||
import { calcPath } from "../utils/calcPath";
|
import { calcPath } from "../utils/calcPath";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Tabs } from "@douyinfe/semi-ui";
|
import { Tabs } from "@douyinfe/semi-ui";
|
||||||
import { Tab } from "../data/data";
|
import { Tab } from "../data/constants";
|
||||||
import TableOverview from "./TableOverview";
|
import TableOverview from "./TableOverview";
|
||||||
import ReferenceOverview from "./ReferenceOverview";
|
import ReferenceOverview from "./ReferenceOverview";
|
||||||
import AreaOverview from "./AreaOverview";
|
import AreaOverview from "./AreaOverview";
|
||||||
@ -14,11 +14,11 @@ export default function SidePanel({ width, resize, setResize }) {
|
|||||||
const { selectedElement, setSelectedElement } = useSelect();
|
const { selectedElement, setSelectedElement } = useSelect();
|
||||||
|
|
||||||
const tabList = [
|
const tabList = [
|
||||||
{ tab: "Tables", itemKey: Tab.tables },
|
{ tab: "Tables", itemKey: Tab.TABLES },
|
||||||
{ tab: "Relationships", itemKey: Tab.relationships },
|
{ tab: "Relationships", itemKey: Tab.RELATIONSHIPS },
|
||||||
{ tab: "Subject Areas", itemKey: Tab.subject_areas },
|
{ tab: "Subject Areas", itemKey: Tab.AREAS },
|
||||||
{ tab: "Notes", itemKey: Tab.notes },
|
{ tab: "Notes", itemKey: Tab.NOTES },
|
||||||
{ tab: "Types", itemKey: Tab.types },
|
{ tab: "Types", itemKey: Tab.TYPES },
|
||||||
];
|
];
|
||||||
const contentList = [
|
const contentList = [
|
||||||
<TableOverview key={1} />,
|
<TableOverview key={1} />,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useState, useRef } from "react";
|
||||||
import { Cardinality } from "../data/data";
|
import { Cardinality } from "../data/constants";
|
||||||
import { calcPath } from "../utils/calcPath";
|
import { calcPath } from "../utils/calcPath";
|
||||||
|
|
||||||
function Table({ table, grab }) {
|
function Table({ table, grab }) {
|
||||||
|
@ -2,11 +2,11 @@ import { useState } from "react";
|
|||||||
import {
|
import {
|
||||||
sqlDataTypes,
|
sqlDataTypes,
|
||||||
tableThemes,
|
tableThemes,
|
||||||
defaultTableTheme,
|
defaultBlue,
|
||||||
Tab,
|
Tab,
|
||||||
Action,
|
Action,
|
||||||
ObjectType,
|
ObjectType,
|
||||||
} from "../data/data";
|
} from "../data/constants";
|
||||||
import {
|
import {
|
||||||
IconEdit,
|
IconEdit,
|
||||||
IconMore,
|
IconMore,
|
||||||
@ -120,12 +120,12 @@ export default function Table(props) {
|
|||||||
} else {
|
} else {
|
||||||
setSelectedElement((prev) => ({
|
setSelectedElement((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
currentTab: Tab.tables,
|
currentTab: Tab.TABLES,
|
||||||
element: ObjectType.TABLE,
|
element: ObjectType.TABLE,
|
||||||
id: props.tableData.id,
|
id: props.tableData.id,
|
||||||
open: true,
|
open: true,
|
||||||
}));
|
}));
|
||||||
if (selectedElement.currentTab !== Tab.tables) return;
|
if (selectedElement.currentTab !== Tab.TABLES) return;
|
||||||
document
|
document
|
||||||
.getElementById(`scroll_table_${props.tableData.id}`)
|
.getElementById(`scroll_table_${props.tableData.id}`)
|
||||||
.scrollIntoView({ behavior: "smooth" });
|
.scrollIntoView({ behavior: "smooth" });
|
||||||
@ -1058,13 +1058,13 @@ export default function Table(props) {
|
|||||||
component: "self",
|
component: "self",
|
||||||
tid: props.tableData.id,
|
tid: props.tableData.id,
|
||||||
undo: { color: props.tableData.color },
|
undo: { color: props.tableData.color },
|
||||||
redo: { color: defaultTableTheme },
|
redo: { color: defaultBlue },
|
||||||
message: `Edit table color to default`,
|
message: `Edit table color to default`,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
setRedoStack([]);
|
setRedoStack([]);
|
||||||
updateTable(props.tableData.id, {
|
updateTable(props.tableData.id, {
|
||||||
color: defaultTableTheme,
|
color: defaultBlue,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -2,10 +2,10 @@ import { useState } from "react";
|
|||||||
import {
|
import {
|
||||||
Action,
|
Action,
|
||||||
ObjectType,
|
ObjectType,
|
||||||
defaultTableTheme,
|
defaultBlue,
|
||||||
sqlDataTypes,
|
sqlDataTypes,
|
||||||
tableThemes,
|
tableThemes,
|
||||||
} from "../data/data";
|
} from "../data/constants";
|
||||||
import {
|
import {
|
||||||
Collapse,
|
Collapse,
|
||||||
Row,
|
Row,
|
||||||
@ -946,12 +946,12 @@ export default function TableOverview() {
|
|||||||
component: "self",
|
component: "self",
|
||||||
tid: i,
|
tid: i,
|
||||||
undo: { color: t.color },
|
undo: { color: t.color },
|
||||||
redo: { color: defaultTableTheme },
|
redo: { color: defaultBlue },
|
||||||
message: `Edit table color to default`,
|
message: `Edit table color to default`,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
setRedoStack([]);
|
setRedoStack([]);
|
||||||
updateTable(i, { color: defaultTableTheme });
|
updateTable(i, { color: defaultBlue });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Clear
|
Clear
|
||||||
|
@ -19,7 +19,7 @@ import {
|
|||||||
IconDeleteStroked,
|
IconDeleteStroked,
|
||||||
IconCaretdown,
|
IconCaretdown,
|
||||||
} from "@douyinfe/semi-icons";
|
} from "@douyinfe/semi-icons";
|
||||||
import { State } from "../data/data";
|
import { State } from "../data/constants";
|
||||||
import useTasks from "../hooks/useTasks";
|
import useTasks from "../hooks/useTasks";
|
||||||
import useSaveState from "../hooks/useSaveState";
|
import useSaveState from "../hooks/useSaveState";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { Action, ObjectType, sqlDataTypes } from "../data/data";
|
import { Action, ObjectType, sqlDataTypes } from "../data/constants";
|
||||||
import {
|
import {
|
||||||
Collapse,
|
Collapse,
|
||||||
Row,
|
Row,
|
||||||
|
@ -2,7 +2,7 @@ import { useState, useEffect, useCallback } from "react";
|
|||||||
import ControlPanel from "../components/ControlPanel";
|
import ControlPanel from "../components/ControlPanel";
|
||||||
import Canvas from "../components/Canvas";
|
import Canvas from "../components/Canvas";
|
||||||
import SidePanel from "../components/SidePanel";
|
import SidePanel from "../components/SidePanel";
|
||||||
import { State } from "../data/data";
|
import { State } from "../data/constants";
|
||||||
import { db } from "../data/db";
|
import { db } from "../data/db";
|
||||||
import useLayout from "../hooks/useLayout";
|
import useLayout from "../hooks/useLayout";
|
||||||
import useSettings from "../hooks/useSettings";
|
import useSettings from "../hooks/useSettings";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createContext, useState } from "react";
|
import { createContext, useState } from "react";
|
||||||
import { Action, ObjectType, defaultTableTheme } from "../data/data";
|
import { Action, ObjectType, defaultBlue } from "../data/constants";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
import useTransform from "../hooks/useTransform";
|
import useTransform from "../hooks/useTransform";
|
||||||
import useSelect from "../hooks/useSelect";
|
import useSelect from "../hooks/useSelect";
|
||||||
@ -29,7 +29,7 @@ export default function AreasContextProvider({ children }) {
|
|||||||
y: -transform.pan.y,
|
y: -transform.pan.y,
|
||||||
width: 200,
|
width: 200,
|
||||||
height: 200,
|
height: 200,
|
||||||
color: defaultTableTheme,
|
color: defaultBlue,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { createContext, useState } from "react";
|
import { createContext, useState } from "react";
|
||||||
import useTransform from "../hooks/useTransform";
|
import useTransform from "../hooks/useTransform";
|
||||||
import { Action, ObjectType, defaultNoteTheme } from "../data/data";
|
import { Action, ObjectType, defaultNoteTheme } from "../data/constants";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
import useSelect from "../hooks/useSelect";
|
import useSelect from "../hooks/useSelect";
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createContext, useState } from "react";
|
import { createContext, useState } from "react";
|
||||||
import { State } from "../data/data";
|
import { State } from "../data/constants";
|
||||||
|
|
||||||
export const SaveStateContext = createContext(null);
|
export const SaveStateContext = createContext(null);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createContext, useState } from "react";
|
import { createContext, useState } from "react";
|
||||||
import { ObjectType, Tab } from "../data/data";
|
import { ObjectType, Tab } from "../data/constants";
|
||||||
|
|
||||||
export const SelectContext = createContext(null);
|
export const SelectContext = createContext(null);
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ export default function SelectContextProvider({ children }) {
|
|||||||
id: -1,
|
id: -1,
|
||||||
openDialogue: false,
|
openDialogue: false,
|
||||||
openCollapse: false,
|
openCollapse: false,
|
||||||
currentTab: Tab.tables,
|
currentTab: Tab.TABLES,
|
||||||
open: false, // open popover or sidesheet when sidebar is disabled
|
open: false, // open popover or sidesheet when sidebar is disabled
|
||||||
openFromToolbar: false, // this is to handle triggering onClickOutside when sidebar is disabled
|
openFromToolbar: false, // this is to handle triggering onClickOutside when sidebar is disabled
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createContext, useState } from "react";
|
import { createContext, useState } from "react";
|
||||||
import { Action, ObjectType, defaultTableTheme } from "../data/data";
|
import { Action, ObjectType, defaultBlue } from "../data/constants";
|
||||||
import useTransform from "../hooks/useTransform";
|
import useTransform from "../hooks/useTransform";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
import useSelect from "../hooks/useSelect";
|
import useSelect from "../hooks/useSelect";
|
||||||
@ -44,7 +44,7 @@ export default function TablesContextProvider({ children }) {
|
|||||||
],
|
],
|
||||||
comment: "",
|
comment: "",
|
||||||
indices: [],
|
indices: [],
|
||||||
color: defaultTableTheme,
|
color: defaultBlue,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { createContext, useState } from "react";
|
import { createContext, useState } from "react";
|
||||||
import { Action, ObjectType } from "../data/data";
|
import { Action, ObjectType } from "../data/constants";
|
||||||
import useUndoRedo from "../hooks/useUndoRedo";
|
import useUndoRedo from "../hooks/useUndoRedo";
|
||||||
|
|
||||||
export const TypesContext = createContext(null);
|
export const TypesContext = createContext(null);
|
||||||
|
98
src/data/constants.js
Normal file
98
src/data/constants.js
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
export const sqlDataTypes = [
|
||||||
|
"INT",
|
||||||
|
"SMALLINT",
|
||||||
|
"BIGINT",
|
||||||
|
"DECIMAL",
|
||||||
|
"NUMERIC",
|
||||||
|
"FLOAT",
|
||||||
|
"DOUBLE",
|
||||||
|
"REAL",
|
||||||
|
"CHAR",
|
||||||
|
"VARCHAR",
|
||||||
|
"TEXT",
|
||||||
|
"DATE",
|
||||||
|
"TIME",
|
||||||
|
"TIMESTAMP",
|
||||||
|
"DATETIME",
|
||||||
|
"BOOLEAN",
|
||||||
|
"BINARY",
|
||||||
|
"VARBINARY",
|
||||||
|
"BLOB",
|
||||||
|
"JSON",
|
||||||
|
"UUID",
|
||||||
|
"ENUM",
|
||||||
|
"SET",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const tableThemes = [
|
||||||
|
"#f03c3c",
|
||||||
|
"#ff4f81",
|
||||||
|
"#bc49c4",
|
||||||
|
"#a751e8",
|
||||||
|
"#7c4af0",
|
||||||
|
"#6360f7",
|
||||||
|
"#7d9dff",
|
||||||
|
"#32c9b0",
|
||||||
|
"#3cde7d",
|
||||||
|
"#89e667",
|
||||||
|
"#ffe159",
|
||||||
|
"#ff9159",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const noteThemes = [
|
||||||
|
"#ffdfd9",
|
||||||
|
"#fcf7ac",
|
||||||
|
"#cffcb1",
|
||||||
|
"#c7d2ff",
|
||||||
|
"#e7c7ff",
|
||||||
|
];
|
||||||
|
|
||||||
|
export const defaultBlue = "#175e7a";
|
||||||
|
export const defaultNoteTheme = "#fcf7ac";
|
||||||
|
|
||||||
|
export const Cardinality = {
|
||||||
|
ONE_TO_ONE: "One to one",
|
||||||
|
ONE_TO_MANY: "One to many",
|
||||||
|
MANY_TO_ONE: "Many to one",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Constraint = {
|
||||||
|
NONE: "No action",
|
||||||
|
RESTRICT: "Restrict",
|
||||||
|
CASCADE: "Cascade",
|
||||||
|
SET_NULL: "Set null",
|
||||||
|
SET_DEFAULT: "Set default",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Tab = {
|
||||||
|
TABLES: "1",
|
||||||
|
RELATIONSHIPS: "2",
|
||||||
|
AREAS: "3",
|
||||||
|
NOTES: "4",
|
||||||
|
TYPES: "5",
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ObjectType = {
|
||||||
|
NONE: 0,
|
||||||
|
TABLE: 1,
|
||||||
|
AREA: 2,
|
||||||
|
NOTE: 3,
|
||||||
|
RELATIONSHIP: 4,
|
||||||
|
TYPE: 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Action = {
|
||||||
|
ADD: 0,
|
||||||
|
MOVE: 1,
|
||||||
|
DELETE: 2,
|
||||||
|
EDIT: 3,
|
||||||
|
PAN: 4,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const State = {
|
||||||
|
NONE: 0,
|
||||||
|
SAVING: 1,
|
||||||
|
SAVED: 2,
|
||||||
|
LOADING: 3,
|
||||||
|
ERROR: 4,
|
||||||
|
};
|
128
src/data/data.js
128
src/data/data.js
@ -1,128 +0,0 @@
|
|||||||
const sqlDataTypes = [
|
|
||||||
"INT",
|
|
||||||
"SMALLINT",
|
|
||||||
"BIGINT",
|
|
||||||
"DECIMAL",
|
|
||||||
"NUMERIC",
|
|
||||||
"FLOAT",
|
|
||||||
"DOUBLE",
|
|
||||||
"REAL",
|
|
||||||
"CHAR",
|
|
||||||
"VARCHAR",
|
|
||||||
"TEXT",
|
|
||||||
"DATE",
|
|
||||||
"TIME",
|
|
||||||
"TIMESTAMP",
|
|
||||||
"DATETIME",
|
|
||||||
"BOOLEAN",
|
|
||||||
"BINARY",
|
|
||||||
"VARBINARY",
|
|
||||||
"BLOB",
|
|
||||||
"JSON",
|
|
||||||
"UUID",
|
|
||||||
"ENUM",
|
|
||||||
"SET",
|
|
||||||
];
|
|
||||||
|
|
||||||
const tableThemes = [
|
|
||||||
"#f03c3c",
|
|
||||||
"#ff4f81",
|
|
||||||
"#bc49c4",
|
|
||||||
"#a751e8",
|
|
||||||
"#7c4af0",
|
|
||||||
"#6360f7",
|
|
||||||
"#7d9dff",
|
|
||||||
"#32c9b0",
|
|
||||||
"#3cde7d",
|
|
||||||
"#89e667",
|
|
||||||
"#ffe159",
|
|
||||||
"#ff9159",
|
|
||||||
];
|
|
||||||
|
|
||||||
const noteThemes = ["#ffdfd9", "#fcf7ac", "#cffcb1", "#c7d2ff", "#e7c7ff"];
|
|
||||||
|
|
||||||
const avatarThemes = [
|
|
||||||
"amber",
|
|
||||||
"blue",
|
|
||||||
"cyan",
|
|
||||||
"green",
|
|
||||||
"grey",
|
|
||||||
"indigo",
|
|
||||||
"light-blue",
|
|
||||||
"light-green",
|
|
||||||
"lime",
|
|
||||||
"orange",
|
|
||||||
"pink",
|
|
||||||
"red",
|
|
||||||
"teal",
|
|
||||||
"violet",
|
|
||||||
"yellow",
|
|
||||||
"white",
|
|
||||||
];
|
|
||||||
|
|
||||||
const defaultTableTheme = "#175e7a";
|
|
||||||
const defaultNoteTheme = "#fcf7ac";
|
|
||||||
const bgBlue = "#124559";
|
|
||||||
|
|
||||||
const Cardinality = {
|
|
||||||
ONE_TO_ONE: "One to one",
|
|
||||||
ONE_TO_MANY: "One to many",
|
|
||||||
MANY_TO_ONE: "Many to one",
|
|
||||||
};
|
|
||||||
|
|
||||||
const Constraint = {
|
|
||||||
none: "No action",
|
|
||||||
restrict: "Restrict",
|
|
||||||
cascade: "Cascade",
|
|
||||||
setNull: "Set null",
|
|
||||||
setDefault: "Set default",
|
|
||||||
};
|
|
||||||
|
|
||||||
const Tab = {
|
|
||||||
tables: "1",
|
|
||||||
relationships: "2",
|
|
||||||
subject_areas: "3",
|
|
||||||
notes: "4",
|
|
||||||
types: "5",
|
|
||||||
};
|
|
||||||
|
|
||||||
const ObjectType = {
|
|
||||||
NONE: 0,
|
|
||||||
TABLE: 1,
|
|
||||||
AREA: 2,
|
|
||||||
NOTE: 3,
|
|
||||||
RELATIONSHIP: 4,
|
|
||||||
TYPE: 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
const Action = {
|
|
||||||
ADD: 0,
|
|
||||||
MOVE: 1,
|
|
||||||
DELETE: 2,
|
|
||||||
EDIT: 3,
|
|
||||||
PAN: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
const State = {
|
|
||||||
NONE: 0,
|
|
||||||
SAVING: 1,
|
|
||||||
SAVED: 2,
|
|
||||||
LOADING: 3,
|
|
||||||
ERROR: 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
export {
|
|
||||||
bgBlue,
|
|
||||||
sqlDataTypes,
|
|
||||||
tableThemes,
|
|
||||||
noteThemes,
|
|
||||||
defaultTableTheme,
|
|
||||||
defaultNoteTheme,
|
|
||||||
avatarThemes,
|
|
||||||
Cardinality,
|
|
||||||
Constraint,
|
|
||||||
Tab,
|
|
||||||
ObjectType,
|
|
||||||
Action,
|
|
||||||
State,
|
|
||||||
};
|
|
@ -1,4 +1,4 @@
|
|||||||
import { sqlDataTypes } from "../data/data";
|
import { sqlDataTypes } from "../data/constants";
|
||||||
|
|
||||||
function getJsonType(f) {
|
function getJsonType(f) {
|
||||||
if (!sqlDataTypes.includes(f.type)) {
|
if (!sqlDataTypes.includes(f.type)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user