diff --git a/app/config/collections.php b/app/config/collections.php index 5bc75ca0f..7e6363610 100644 --- a/app/config/collections.php +++ b/app/config/collections.php @@ -1334,9 +1334,18 @@ $collections = [ ], [ '$collection' => Database::SYSTEM_COLLECTION_RULES, - 'label' => 'Code', - 'key' => 'code', - 'type' => Database::SYSTEM_VAR_TYPE_KEY, + 'label' => 'Code Path', + 'key' => 'codePath', + 'type' => Database::SYSTEM_VAR_TYPE_TEXT, + 'default' => '', + 'required' => false, + 'array' => false, + ], + [ + '$collection' => Database::SYSTEM_COLLECTION_RULES, + 'label' => 'Code Size', + 'key' => 'codeSize', + 'type' => Database::SYSTEM_VAR_TYPE_NUMERIC, 'default' => '', 'required' => false, 'array' => false, diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 35027874b..f33df428a 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -220,8 +220,8 @@ App::post('/v1/functions/:functionId/tags') ->label('sdk.description', '/docs/references/functions/create-tag.md') ->param('functionId', '', function () { return new UID(); }, 'Function unique ID.') ->param('command', '', function () { return new Text('1028'); }, 'Code execution command.') - // ->param('code', '', function () { return new Text(128); }, 'Code package. Use the '.APP_NAME.' code packager to create a deployable package file.') ->param('code', [], function () { return new File(); }, 'Gzip file containing your code.', false) + // ->param('code', '', function () { return new Text(128); }, 'Code package. Use the '.APP_NAME.' code packager to create a deployable package file.') ->action(function ($functionId, $command, $code, $request, $response, $projectDB) { $function = $projectDB->getDocument($functionId); @@ -245,9 +245,9 @@ App::post('/v1/functions/:functionId/tags') $file['size'] = (\is_array($file['size']) && isset($file['size'][0])) ? $file['size'][0] : $file['size']; // Check if file type is allowed (feature for project settings?) - if (!$fileType->isValid($file['tmp_name'])) { - throw new Exception('File type not allowed', 400); - } + // if (!$fileType->isValid($file['tmp_name'])) { + // throw new Exception('File type not allowed', 400); + // } if (!$fileSize->isValid($file['size'])) { // Check if file size is exceeding allowed limit throw new Exception('File size not allowed', 400); diff --git a/app/controllers/web/console.php b/app/controllers/web/console.php index 79f685000..1e81c240b 100644 --- a/app/controllers/web/console.php +++ b/app/controllers/web/console.php @@ -366,6 +366,8 @@ App::get('/console/functions/function') $page ->setParam('events', Config::getParam('events', [])) + ->setParam('fileLimit', App::getEnv('_APP_STORAGE_LIMIT', 0)) + ->setParam('fileLimitHuman', Storage::human(App::getEnv('_APP_STORAGE_LIMIT', 0))) ; $layout diff --git a/app/views/console/functions/function.phtml b/app/views/console/functions/function.phtml index 238a4a4ea..6dd5ce7e9 100644 --- a/app/views/console/functions/function.phtml +++ b/app/views/console/functions/function.phtml @@ -1,5 +1,6 @@ getParam('fileLimit', 0); +$fileLimitHuman = $this->getParam('fileLimitHuman', 0); $events = array_keys($this->getParam('events', [])); ?> @@ -60,7 +61,7 @@ $events = array_keys($this->getParam('events', [])); data-scope="sdk" data-event="load,functions.createTag,functions.deleteTag" data-name="project-function-tags" - data-param-project-id="{{router.params.project}}" + data-param-function-id="{{router.params.id}}" data-success="trigger" data-success-param-trigger-events="functions.listTags"> @@ -77,7 +78,7 @@ $events = array_keys($this->getParam('events', [])); Set Default - + @@ -110,7 +111,8 @@ $events = array_keys($this->getParam('events', [])); - + +
(Max file size allowed: )