Serverless function UI (#6388)

https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=36235-120877

Did not do the file manager part. A Function is defined using one unique
file at the moment

Feature protected by featureFlag `IS_FUNCTION_SETTINGS_ENABLED`

## Demo


https://github.com/user-attachments/assets/0acb8291-47b4-4521-a6fa-a88b9198609b
This commit is contained in:
martmull
2024-07-29 13:03:09 +02:00
committed by GitHub
parent 936279f895
commit 00fea17920
100 changed files with 2283 additions and 121 deletions

View File

@ -23,13 +23,13 @@ import { RightDrawerHotkeyScope } from '@/ui/layout/right-drawer/types/RightDraw
import { usePreviousHotkeyScope } from '@/ui/utilities/hotkey/hooks/usePreviousHotkeyScope';
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
import { isNonTextWritingKey } from '@/ui/utilities/hotkey/utils/isNonTextWritingKey';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { FileFolder, useUploadFileMutation } from '~/generated/graphql';
import { isDefined } from '~/utils/isDefined';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
import { getFileType } from '../files/utils/getFileType';
import { getFileAbsoluteURI } from '~/utils/file/getFileAbsoluteURI';
import '@blocknote/core/fonts/inter.css';
import '@blocknote/mantine/style.css';
@ -127,9 +127,7 @@ export const ActivityBodyEditor = ({
if (!result?.data?.uploadFile) {
throw new Error("Couldn't upload Image");
}
const imageUrl =
REACT_APP_SERVER_BASE_URL + '/files/' + result?.data?.uploadFile;
return imageUrl;
return getFileAbsoluteURI(result.data.uploadFile);
};
const handlePersistBody = useCallback(

View File

@ -13,8 +13,8 @@ import {
FieldContext,
GenericFieldContextType,
} from '@/object-record/record-field/contexts/FieldContext';
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { formatToHumanReadableDate } from '~/utils/date-utils';
import { getFileAbsoluteURI } from '~/utils/file/getFileAbsoluteURI';
const StyledRow = styled.div`
align-items: center;
@ -76,7 +76,7 @@ export const AttachmentRow = ({ attachment }: { attachment: Attachment }) => {
<StyledLeftContent>
<AttachmentIcon attachmentType={attachment.type} />
<StyledLink
href={REACT_APP_SERVER_BASE_URL + '/files/' + attachment.fullPath}
href={getFileAbsoluteURI(attachment.fullPath)}
target="__blank"
>
{attachment.name}

View File

@ -1,7 +1,7 @@
import { REACT_APP_SERVER_BASE_URL } from '~/config';
import { getFileAbsoluteURI } from '~/utils/file/getFileAbsoluteURI';
export const downloadFile = (fullPath: string, fileName: string) => {
fetch(REACT_APP_SERVER_BASE_URL + '/files/' + fullPath)
fetch(getFileAbsoluteURI(fullPath))
.then((resp) =>
resp.status === 200
? resp.blob()