Revert "refrence field setup"

This reverts commit 530bea9150.
This commit is contained in:
Sidney Alcantara
2022-06-09 17:07:10 +10:00
parent 6ca30bb7d3
commit 103d48d898
6 changed files with 0 additions and 160 deletions

View File

@@ -1,34 +0,0 @@
import { IBasicCellProps } from "../types";
import { Stack, IconButton } from "@mui/material";
import LaunchIcon from "@mui/icons-material/Launch";
import { useAppContext } from "@src/contexts/AppContext";
export default function Reference({ value }: IBasicCellProps) {
const { projectId } = useAppContext();
if (!value) return <></>;
const { path } = value;
return path ? (
<Stack
direction="row"
alignItems="center"
justifyContent="space-between"
className="cell-collapse-padding"
sx={{ p: "var(--cell-padding)", pr: 0.5 }}
>
<div style={{ flexGrow: 1, overflow: "hidden" }}>{path}</div>
<IconButton
href={`https://console.firebase.google.com/u/0/project/${projectId}/firestore/data/~2F${encodeURIComponent(
path
)}`}
target="_blank"
rel="noopener noreferrer"
className="row-hover-iconButton"
size="small"
style={{ flexShrink: 0 }}
>
<LaunchIcon />
</IconButton>
</Stack>
) : (
<>Not Valid Ref</>
);
}

View File

@@ -1,28 +0,0 @@
import { IFilterOperator } from "../types";
export const filterOperators: IFilterOperator[] = [
{
label: "=",
value: "==",
},
{
label: "!=",
value: "!=",
},
{
label: ">",
value: ">",
},
{
label: ">=",
value: ">=",
},
{
label: "<",
value: "<",
},
{
label: "<=",
value: "<=",
},
];

View File

@@ -1,54 +0,0 @@
import { Controller } from "react-hook-form";
import { ISideDrawerFieldProps } from "../types";
import { Stack, TextField, IconButton } from "@mui/material";
import LaunchIcon from "@mui/icons-material/Launch";
import { useAppContext } from "@src/contexts/AppContext";
export default function Reference({
control,
column,
disabled,
}: ISideDrawerFieldProps) {
const { projectId } = useAppContext();
return (
<Controller
control={control}
name={column.key}
render={({ field: { onChange, onBlur, value } }) => {
const path = value ?? value.path;
return (
<Stack direction="row">
<TextField
variant="filled"
fullWidth
margin="none"
onChange={onChange}
onBlur={onBlur}
value={value}
id={`sidedrawer-field-${column.key}`}
label=""
hiddenLabel
disabled={disabled}
type="url"
/>
<IconButton
size="small"
href={`https://console.firebase.google.com/u/0/project/${projectId}/firestore/data/~2F${encodeURIComponent(
path
)}`}
target="_blank"
rel="noopener noreferrer"
disabled={true}
edge="end"
sx={{ ml: 1 }}
>
<LaunchIcon />
</IconButton>
</Stack>
);
}}
/>
);
}

View File

@@ -1,41 +0,0 @@
import { lazy } from "react";
import { IFieldConfig, FieldType } from "@src/components/fields/types";
import withBasicCell from "../_withTableCell/withBasicCell";
import NumberIcon from "@src/assets/icons/Number";
import BasicCell from "./BasicCell";
import TextEditor from "@src/components/Table/editors/TextEditor";
import { filterOperators } from "./Filter";
import { db } from "@src/firebase";
const SideDrawerField = lazy(
() =>
import(
"./SideDrawerField" /* webpackChunkName: "SideDrawerField-Reference" */
)
);
export const config: IFieldConfig = {
type: FieldType.reference,
name: "Refrence",
group: "Connection",
dataType: "Reference",
initialValue: 0,
initializable: true,
icon: <NumberIcon />,
description: "Firestore Document reference",
// contextMenuActions: BasicContextMenuActions,
TableCell: withBasicCell(BasicCell),
TableEditor: TextEditor,
SideDrawerField,
filter: {
operators: filterOperators,
},
csvImportParser: (v) => {
try {
return db.doc(v);
} catch (e) {
return null;
}
},
};
export default config;

View File

@@ -40,7 +40,6 @@ import User from "./User";
import Id from "./Id";
import Status from "./Status";
import Connector from "./Connector";
import Reference from "./Reference";
import { TableColumn } from "../Table";
// Export field configs in order for FieldsDropdown
@@ -74,7 +73,6 @@ export const FIELDS: IFieldConfig[] = [
SubTable,
ConnectTable,
ConnectService,
// Reference, TODO: fix Write functionality
// CODE
Json,
Code,

View File

@@ -29,7 +29,6 @@ export enum FieldType {
connector = "CONNECTOR",
connectTable = "DOCUMENT_SELECT",
connectService = "SERVICE_SELECT",
reference = "REFERENCE",
// CODE
json = "JSON",
code = "CODE",