mirror of
https://github.com/rowyio/rowy.git
synced 2025-12-29 00:16:39 +01:00
requires cloud function setup before creating related columns
This commit is contained in:
@@ -73,7 +73,6 @@ export const rowyRunAtom = atom((get) => {
|
||||
handleNotSetUp,
|
||||
}: IRowyRunRequestProps): Promise<Response | any | false> => {
|
||||
if (!currentUser) {
|
||||
console.log("Rowy Run: Not signed in", route.path);
|
||||
if (handleNotSetUp) handleNotSetUp();
|
||||
return false;
|
||||
}
|
||||
@@ -85,7 +84,6 @@ export const rowyRunAtom = atom((get) => {
|
||||
? rowyRunServices?.[service]
|
||||
: rowyRunUrl;
|
||||
if (!serviceUrl) {
|
||||
console.log("Rowy Run: Not set up", route.path);
|
||||
if (handleNotSetUp) handleNotSetUp();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,20 @@ import { FIELDS } from "@src/components/fields";
|
||||
import { FieldType } from "@src/constants/fields";
|
||||
import { getFieldProp } from "@src/components/fields";
|
||||
|
||||
import { useSetAtom, useAtom } from "jotai";
|
||||
import {
|
||||
projectScope,
|
||||
projectSettingsAtom,
|
||||
rowyRunModalAtom,
|
||||
} from "@src/atoms/projectScope";
|
||||
|
||||
export interface IFieldsDropdownProps {
|
||||
value: FieldType | "";
|
||||
onChange: (value: FieldType) => void;
|
||||
hideLabel?: boolean;
|
||||
label?: string;
|
||||
options?: FieldType[];
|
||||
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@@ -25,13 +33,21 @@ export default function FieldsDropdown({
|
||||
options: optionsProp,
|
||||
...props
|
||||
}: IFieldsDropdownProps) {
|
||||
const [projectSettings] = useAtom(projectSettingsAtom, projectScope);
|
||||
const openRowyRunModal = useSetAtom(rowyRunModalAtom, projectScope);
|
||||
const fieldTypesToDisplay = optionsProp
|
||||
? FIELDS.filter((fieldConfig) => optionsProp.indexOf(fieldConfig.type) > -1)
|
||||
: FIELDS;
|
||||
const options = fieldTypesToDisplay.map((fieldConfig) => ({
|
||||
label: fieldConfig.name,
|
||||
value: fieldConfig.type,
|
||||
}));
|
||||
const options = fieldTypesToDisplay.map((fieldConfig) => {
|
||||
const requireCloudFunctionSetup =
|
||||
fieldConfig.requireCloudFunction && !projectSettings.rowyRunUrl;
|
||||
return {
|
||||
label: fieldConfig.name,
|
||||
value: fieldConfig.type,
|
||||
disabled: requireCloudFunctionSetup,
|
||||
requireCloudFunctionSetup,
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<MultiSelect
|
||||
@@ -51,7 +67,27 @@ export default function FieldsDropdown({
|
||||
<ListItemIcon style={{ minWidth: 40 }}>
|
||||
{getFieldProp("icon", option.value as FieldType)}
|
||||
</ListItemIcon>
|
||||
{option.label}
|
||||
{option.label}{" "}
|
||||
{option.requireCloudFunctionSetup && (
|
||||
<>
|
||||
(requires
|
||||
<span
|
||||
style={{
|
||||
marginLeft: "3px",
|
||||
cursor: "pointer",
|
||||
pointerEvents: "all",
|
||||
textDecoration: "underline",
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
openRowyRunModal({ feature: option.label });
|
||||
}}
|
||||
>
|
||||
Cloud Function
|
||||
</span>
|
||||
)
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
label={label || "Field type"}
|
||||
|
||||
@@ -30,6 +30,7 @@ export const config: IFieldConfig = {
|
||||
SideDrawerField,
|
||||
settings: Settings,
|
||||
requireConfiguration: true,
|
||||
requireCloudFunction: true,
|
||||
sortKey: "status",
|
||||
};
|
||||
export default config;
|
||||
|
||||
@@ -34,6 +34,7 @@ export const config: IFieldConfig = {
|
||||
}),
|
||||
SideDrawerField,
|
||||
requireConfiguration: true,
|
||||
requireCloudFunction: true,
|
||||
settings: Settings,
|
||||
};
|
||||
export default config;
|
||||
|
||||
@@ -21,5 +21,6 @@ export const config: IFieldConfig = {
|
||||
settings: Settings,
|
||||
settingsValidator,
|
||||
requireConfiguration: true,
|
||||
requireCloudFunction: true,
|
||||
};
|
||||
export default config;
|
||||
|
||||
@@ -19,6 +19,7 @@ export interface IFieldConfig {
|
||||
dataType: string;
|
||||
initializable?: boolean;
|
||||
requireConfiguration?: boolean;
|
||||
requireCloudFunction?: boolean;
|
||||
initialValue: any;
|
||||
icon?: React.ReactNode;
|
||||
description?: string;
|
||||
|
||||
Reference in New Issue
Block a user