mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
remove isGroupCollection
This commit is contained in:
@@ -49,9 +49,10 @@ export default function NavDrawerItem({
|
||||
{tables
|
||||
.filter((x) => x)
|
||||
.map((table) => {
|
||||
const route = table.isCollectionGroup
|
||||
? `${routes.tableGroup}/${table.id}`
|
||||
: `${routes.table}/${table.id.replace(/\//g, "~2F")}`;
|
||||
const route =
|
||||
table.tableType === "collectionGroup"
|
||||
? `${routes.tableGroup}/${table.id}`
|
||||
: `${routes.table}/${table.id.replace(/\//g, "~2F")}`;
|
||||
|
||||
return (
|
||||
<li key={table.id}>
|
||||
|
||||
@@ -122,12 +122,9 @@ export default function WebhooksDialog({ open, handleClose }) {
|
||||
label={"Enable webhooks for this table"}
|
||||
labelPlacement="end"
|
||||
checked={state.enabled}
|
||||
onChange={
|
||||
() => {
|
||||
handleChange("enabled")(!state.enabled);
|
||||
}
|
||||
// handleChange("isCollectionGroup", !formState.isCollectionGroup)
|
||||
}
|
||||
onChange={() => {
|
||||
handleChange("enabled")(!state.enabled);
|
||||
}}
|
||||
// classes={{ root: classes.formControlLabel, label: classes.label }}
|
||||
/>
|
||||
<InputLabel htmlFor="webhook-type">Webhook Type</InputLabel>
|
||||
|
||||
@@ -32,7 +32,6 @@ const FORM_EMPTY_STATE = {
|
||||
collection: "",
|
||||
section: "",
|
||||
description: "",
|
||||
isCollectionGroup: false,
|
||||
roles: ["ADMIN"],
|
||||
};
|
||||
|
||||
@@ -92,7 +91,6 @@ export default function TableSettingsDialog({
|
||||
const handleSubmit = async (values) => {
|
||||
const data: any = {
|
||||
...values,
|
||||
isCollectionGroup: values.tableType === "collectionGroup",
|
||||
};
|
||||
|
||||
if (values.schemaSource)
|
||||
@@ -132,13 +130,15 @@ export default function TableSettingsDialog({
|
||||
const tablesDocRef = db.doc(SETTINGS);
|
||||
const tableData = (await tablesDocRef.get()).data();
|
||||
const updatedTables = tableData?.tables.filter(
|
||||
(table) =>
|
||||
table.id !== data?.id ||
|
||||
table.isCollectionGroup !== data?.isCollectionGroup
|
||||
(table) => table.id !== data?.id || table.tableType !== data?.tableType
|
||||
);
|
||||
await tablesDocRef.update({ tables: updatedTables });
|
||||
await db
|
||||
.collection(data?.isCollectionGroup ? TABLE_SCHEMAS : TABLE_GROUP_SCHEMAS)
|
||||
.collection(
|
||||
data?.tableType === "primaryCollection"
|
||||
? TABLE_SCHEMAS
|
||||
: TABLE_GROUP_SCHEMAS
|
||||
)
|
||||
.doc(data?.id)
|
||||
.delete();
|
||||
window.location.reload();
|
||||
@@ -160,9 +160,6 @@ export default function TableSettingsDialog({
|
||||
tables?.map((table) => ({ label: table.name, value: table.id }))
|
||||
)}
|
||||
values={{
|
||||
tableType: data?.isCollectionGroup
|
||||
? "collectionGroup"
|
||||
: "primaryCollection",
|
||||
...data,
|
||||
}}
|
||||
onSubmit={handleSubmit}
|
||||
|
||||
@@ -20,8 +20,7 @@ export type Table = {
|
||||
roles: string[];
|
||||
description: string;
|
||||
section: string;
|
||||
isCollectionGroup: boolean;
|
||||
tableType: string;
|
||||
tableType: "primaryCollection" | "collectionGroup";
|
||||
};
|
||||
|
||||
interface IProjectContext {
|
||||
|
||||
@@ -151,7 +151,7 @@ export default function HomePage() {
|
||||
|
||||
const getLink = (table: Table) =>
|
||||
`${
|
||||
table.isCollectionGroup ? routes.tableGroup : routes.table
|
||||
table.tableType === "primaryCollection" ? routes.table : routes.tableGroup
|
||||
}/${table.id.replace(/\//g, "~2F")}`;
|
||||
|
||||
const handleFavorite = (id: string) => (e: ChangeEvent<HTMLInputElement>) => {
|
||||
|
||||
Reference in New Issue
Block a user