2020-05-11 18:47:53 +12:00
<?php
2020-07-15 15:38:57 +12:00
$fileLimit = $this->getParam('fileLimit', 0);
$fileLimitHuman = $this->getParam('fileLimitHuman', 0);
2020-05-11 18:47:53 +12:00
$events = array_keys($this->getParam('events', []));
2020-07-20 02:42:46 +12:00
$timeout = $this->getParam('timeout', 900);
2021-08-04 18:39:23 +12:00
$usageStatsEnabled = $this->getParam('usageStatsEnabled', true);
2020-05-11 18:47:53 +12:00
?>
2020-05-11 16:39:00 +12:00
< div
data-service="functions.get"
data-name="project-function"
2020-10-31 08:53:27 +13:00
data-event="load,functions.update,functions.createTag,functions.updateTag,functions.deleteTag"
2020-05-11 16:39:00 +12:00
data-param-function-id="{{router.params.id}}"
data-success="trigger"
data-success-param-trigger-events="functions.get">
< div class = "cover" >
< h1 class = "zone xl margin-bottom-large" >
2020-06-14 10:57:34 +12:00
< a data-ls-attrs = "href=/console/functions?project={{router.params.project}}" class = "back text-size-small link-return-animation--start" > < i class = "icon-left-open" > < / i > Functions< / a >
2020-05-11 16:39:00 +12:00
< br / >
2021-07-29 20:09:24 +12:00
< span data-ls-bind = "{{project-function.name}} " > < / span >
2020-05-11 16:39:00 +12:00
< / h1 >
< / div >
< div data-ui-modal class = "modal width-large box close" data-button-hide = "on" data-open-event = "open-json" >
2021-08-04 18:39:23 +12:00
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
2020-05-11 16:39:00 +12:00
< h2 > JSON View< / h2 >
< div class = "margin-bottom" >
< input type = "hidden" data-ls-bind = "{{project-function}}" data-forms-code / >
< / div >
< button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
< / div >
< div class = "zone xl" >
< ul class = "phases clear" data-ui-phases data-selected = "{{router.params.tab}}" >
< li data-state = "/console/functions/function?id={{router.params.id}}&project={{router.params.project}}" >
2021-08-04 18:39:23 +12:00
2020-05-13 10:00:48 +12:00
< h2 > Overview< / h2 >
2021-08-04 18:39:23 +12:00
2020-05-13 10:00:48 +12:00
< div class = "row responsive margin-top-negative" >
< div class = "col span-8 margin-bottom" >
< label > < / label >
< div class = "box margin-bottom-large" >
< div class = "text-align-center" >
2021-06-24 00:15:27 +12:00
< img src = "" data-ls-attrs = "src=/images/runtimes/{{project-function.runtime|runtimeLogo}}" alt = "Function Runtime" class = "avatar huge margin-top-negative-xxl" / >
2020-05-13 10:00:48 +12:00
2021-06-24 00:15:27 +12:00
< p class = "text-fade margin-bottom-small" data-ls-bind = "{{project-function.runtime|runtimeName}} {{project-function.runtime|runtimeVersion}}" >
2020-05-13 10:00:48 +12:00
< / p >
2021-03-12 01:39:06 +13:00
< div data-ls-if = "{{project-function.tag}} !== ''" class = "margin-top" >
< button data-ls-ui-trigger = "execute-now" > Execute Now< / button > < a data-ls-attrs = "href=/console/functions/function/logs?id={{router.params.id}}&project={{router.params.project}}" class = "button reverse" style = "vertical-align: top;" > View Logs< / a >
< / div >
2020-05-13 10:00:48 +12:00
< / div >
< / div >
< div class = "margin-bottom"
data-service="functions.listTags"
data-scope="sdk"
2020-07-17 00:04:06 +12:00
data-event="load,functions.createTag,functions.deleteTag,functions.updateTag"
2020-05-14 08:59:02 +12:00
data-name="project-function-tags"
2020-07-15 15:38:57 +12:00
data-param-function-id="{{router.params.id}}"
2020-07-19 09:15:02 +12:00
data-param-limit="<?php echo APP_PAGING_LIMIT ; ?> "
data-param-offset=""
2020-07-17 00:04:06 +12:00
data-param-order-type="DESC"
2020-05-13 10:00:48 +12:00
data-success="trigger"
2020-05-14 08:59:02 +12:00
data-success-param-trigger-events="functions.listTags">
2020-05-13 10:00:48 +12:00
2020-07-19 09:15:02 +12:00
< h3 > Tags < span class = "text-fade text-size-small pull-end margin-top-small" data-ls-bind = "{{project-function-tags.sum}} tags found" > < / span > < / h3 >
2020-07-19 01:49:20 +12:00
2020-05-14 08:59:02 +12:00
< div data-ls-if = "0 == {{project-function-tags.tags.length}} || undefined == {{project-function-tags.tags.length}}" class = "box margin-top margin-bottom" >
2020-05-13 10:00:48 +12:00
< h3 class = "margin-bottom-small text-bold" > No Tags Found< / h3 >
2020-05-14 08:59:02 +12:00
< p class = "margin-bottom-no" > You haven't deployed any tags for your function yet.< / p >
2020-05-13 10:00:48 +12:00
< / div >
2020-05-14 08:59:02 +12:00
< div data-ls-if = "(0 != {{project-function-tags.tags.length}}) && (undefined !== {{project-function-tags.tags.length}})" >
2020-05-13 10:00:48 +12:00
< div class = "box margin-bottom" >
2020-05-14 08:59:02 +12:00
< ul data-ls-loop = "project-function-tags.tags" data-ls-as = "tag" class = "list" >
2020-05-13 10:00:48 +12:00
< li class = "clear" >
2020-07-17 00:04:06 +12:00
< form data-ls-if = "{{tag.$id}} !== {{project-function.tag}}" name = "functions.updateTag" class = "pull-end"
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-07-16 07:09:46 +12:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Function Execution"
data-service="functions.updateTag"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-success="alert,trigger"
data-success-param-alert-text="Tag updated successfully"
data-success-param-trigger-events="functions.updateTag"
data-failure="alert"
data-failure-param-alert-text="Failed to update tag"
data-failure-param-alert-classname="error">
2020-07-17 00:04:06 +12:00
< input type = "hidden" name = "tag" data-ls-bind = "{{tag.$id}}" >
2020-07-18 18:16:34 +12:00
< button > Activate< / button >
2020-07-16 07:09:46 +12:00
< / form >
2021-08-04 18:39:23 +12:00
2020-07-19 09:15:02 +12:00
< b data-ls-bind = "{{tag.$id}}" > < / b >
2020-07-18 18:16:34 +12:00
< span class = "text-fade" data-ls-bind = "{{tag.command}}" > < / span >
2020-07-19 09:49:15 +12:00
< div class = "text-size-small margin-top-small clear" >
2021-02-24 05:17:45 +13:00
< span class = "pull-start" data-ls-bind = "Created {{tag.dateCreated|timeSince}} | {{tag.size|humanFileSize}}{{tag.size|humanFileUnit}}" > < / span >
2020-07-19 09:49:15 +12:00
2020-07-20 02:42:46 +12:00
< form data-ls-if = "{{tag.$id}} !== {{project-function.tag}}" name = "functions.deleteTag" class = "pull-start"
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-07-19 09:49:15 +12:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Delete Function Tag"
data-service="functions.deleteTag"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-confirm="Are you sure you want to delete this function tag?"
data-success="alert,trigger"
data-success-param-alert-text="Function tag deleted successfully"
data-success-param-trigger-events="functions.deleteTag"
data-failure="alert"
data-failure-param-alert-text="Failed to delete function tag"
data-failure-param-alert-classname="error">
< input type = "hidden" name = "tagId" data-ls-bind = "{{tag.$id}}" / >
2020-07-20 02:42:46 +12:00
| < button type = "submit" class = "link text-danger text-size-small" > Delete< / button >
2020-07-19 09:49:15 +12:00
< / form >
< / div >
2020-05-13 10:00:48 +12:00
< / li >
< / ul >
< / div >
< / div >
< / div >
< div class = "pull-start" >
2021-02-03 04:53:09 +13:00
< button data-ls-ui-trigger = "deploy-tag" > Deploy Tag< / button >
2020-05-13 10:00:48 +12:00
< / div >
< div class = "pull-end paging" >
< form
2020-07-19 09:15:02 +12:00
data-service="functions.listTags"
2020-05-13 10:00:48 +12:00
data-event="submit"
2020-07-19 09:15:02 +12:00
data-param-function-id="{{router.params.id}}"
2020-05-13 10:00:48 +12:00
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT ; ?> "
data-param-order-type="DESC"
data-scope="sdk"
2020-07-19 09:15:02 +12:00
data-name="project-function-tags"
2020-05-13 10:00:48 +12:00
data-success="state"
data-success-param-state-keys="search,offset">
2020-07-19 09:15:02 +12:00
< button name = "offset" data-paging-back data-offset = "{{router.params.offset}}" data-sum = "{{project-function-tags.sum}}" class = "margin-end round small" aria-label = "Back" > < i class = "icon-left-open" > < / i > < / button >
2020-05-13 10:00:48 +12:00
< / form >
2020-07-19 09:15:02 +12:00
< span data-ls-bind = "{{router.params.offset|pageCurrent}} / {{project-function-tags.sum|pageTotal}}" > < / span >
2020-05-13 10:00:48 +12:00
< form
2020-07-19 09:15:02 +12:00
data-service="functions.listTags"
2020-05-13 10:00:48 +12:00
data-event="submit"
2020-07-19 09:15:02 +12:00
data-param-function-id="{{router.params.id}}"
2020-05-13 10:00:48 +12:00
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT ; ?> "
data-param-order-type="DESC"
data-scope="sdk"
2020-07-19 09:15:02 +12:00
data-name="project-function-tags"
2020-05-13 10:00:48 +12:00
data-success="state"
data-success-param-state-keys="search,offset">
2020-07-19 09:15:02 +12:00
< button name = "offset" data-paging-next data-offset = "{{router.params.offset}}" data-sum = "{{project-function-tags.sum}}" class = "margin-start round small" aria-label = "Next" > < i class = "icon-right-open" > < / i > < / button >
2020-05-13 10:00:48 +12:00
< / form >
< / div >
< / div >
< div class = "col span-4 sticky-top margin-bottom" >
< label > Function ID< / label >
< div class = "input-copy margin-bottom" >
< input id = "uid" type = "text" autocomplete = "off" placeholder = "" data-ls-bind = "{{project-function.$id}}" disabled data-forms-copy >
< / div >
< ul class = "margin-bottom-large text-fade text-size-small" >
< li class = "margin-bottom-small" > < i class = "icon-angle-circled-right margin-start-tiny margin-end-tiny" > < / i > < button data-ls-ui-trigger = "open-json" class = "link text-size-small" > View as JSON< / button > < / li >
2020-07-15 23:22:38 +12:00
< li class = "margin-bottom-small" > < i class = "icon-angle-circled-right margin-start-tiny margin-end-tiny" > < / i > Last Updated: < span data-ls-bind = "{{project-function.dateUpdated|dateText}}" > < / span > < / li >
< li class = "margin-bottom-small" > < i class = "icon-angle-circled-right margin-start-tiny margin-end-tiny" > < / i > Created: < span data-ls-bind = "{{project-function.dateCreated|dateText}}" > < / span > < / li >
2020-05-13 10:00:48 +12:00
< / ul >
< form name = "functions.delete" class = "margin-bottom"
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-05-13 10:00:48 +12:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Delete Function"
data-service="functions.delete"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-confirm="Are you sure you want to delete this function?"
data-success="alert,trigger,redirect"
data-success-param-alert-text="Function deleted successfully"
data-success-param-trigger-events="functions.delete"
data-success-param-redirect-url="/console/functions?project={{router.params.project}}"
data-failure="alert"
data-failure-param-alert-text="Failed to delete function"
data-failure-param-alert-classname="error">
< button type = "submit" class = "danger fill" > Delete Function< / button >
< / form >
< / div >
< / div >
2020-05-11 16:39:00 +12:00
< / li >
2021-08-04 18:39:23 +12:00
<?php if ( $usageStatsEnabled ) : ?>
2020-10-31 08:53:27 +13:00
< li data-state = "/console/functions/function/monitors?id={{router.params.id}}&project={{router.params.project}}" >
2021-08-04 18:39:23 +12:00
2020-10-31 08:53:27 +13:00
< form class = "pull-end margin-start-small margin-top-small" data-ls-if = "{{usage.range}} !== '90d'"
data-service="functions.getUsage"
data-event="submit"
data-name="usage"
data-param-function-id="{{router.params.id}}"
data-param-range="90d">
< button class = "tick" > 90d< / button >
< / form >
< button class = "tick pull-end margin-start-small margin-top-small" data-ls-if = "{{usage.range}} === '90d'" disabled > 90d< / button >
< form class = "pull-end margin-start-small margin-top-small" data-ls-if = "{{usage.range}} !== '30d'"
data-service="functions.getUsage"
data-event="submit"
data-name="usage"
data-param-function-id="{{router.params.id}}">
< button class = "tick" > 30d< / button >
< / form >
< button class = "tick pull-end margin-start-small margin-top-small" data-ls-if = "{{usage.range}} === '30d'" disabled > 30d< / button >
< form class = "pull-end margin-start-small margin-top-small" data-ls-if = "{{usage.range}} !== '24h'"
data-service="functions.getUsage"
data-event="submit"
data-name="usage"
data-param-function-id="{{router.params.id}}"
data-param-range="24h">
< button class = "tick" > 24h< / button >
< / form >
< button class = "tick pull-end margin-start-small margin-top-small" data-ls-if = "{{usage.range}} === '24h'" disabled > 24h< / button >
< h2 > Monitors< / h2 >
2021-08-04 18:39:23 +12:00
< div
2020-10-31 08:53:27 +13:00
data-service="functions.getUsage"
data-event="load"
data-name="usage"
data-param-function-id="{{router.params.id}}">
< div class = "box margin-bottom-small" >
< div class = "margin-start-negative-small margin-end-negative-small margin-top-negative-small margin-bottom-negative-small" >
< div class = "chart margin-bottom-no" >
< input type = "hidden" data-ls-bind = "{{usage}}" data-forms-chart = "Executions=usage.executions.data" data-height = "140" / >
< / div >
< / div >
< / div >
< ul class = "chart-notes margin-bottom-large" >
< li > Executions < span data-ls-bind = "({{usage.executions.total}})" > < / span > < / li >
< / ul >
< div class = "box margin-bottom-small" >
< div class = "margin-start-negative-small margin-end-negative-small margin-top-negative-small margin-bottom-negative-small" >
< div class = "chart margin-bottom-no" >
< input type = "hidden" data-ls-bind = "{{usage}}" data-forms-chart = "CPU Time (seconds)=usage.compute.data" data-colors = "orange" data-height = "140" / >
< / div >
< / div >
< / div >
< ul class = "chart-notes margin-bottom-large" >
< li class = "orange" > CPU Time < span data-ls-bind = "({{usage.compute.total|seconds2hum}})" > < / span > < / li >
< / ul >
2020-06-14 08:26:45 +12:00
2020-10-31 08:53:27 +13:00
< div class = "box margin-bottom-small" >
< div class = "margin-start-negative-small margin-end-negative-small margin-top-negative-small margin-bottom-negative-small" >
< div class = "chart margin-bottom-no" >
< input type = "hidden" data-ls-bind = "{{usage}}" data-forms-chart = "Failures=usage.failures.data" data-colors = "red" data-height = "140" / >
< / div >
2020-06-14 08:26:45 +12:00
< / div >
< / div >
2020-10-31 08:53:27 +13:00
< ul class = "chart-notes margin-bottom-large" >
< li class = "red" > Errors < span data-ls-bind = "({{usage.failures.total}})" > < / span > < / li >
< / ul >
2020-06-14 08:26:45 +12:00
< / div >
2020-10-31 08:53:27 +13:00
< / li >
2021-08-04 18:39:23 +12:00
<?php endif ; ?>
2020-10-31 08:53:27 +13:00
< li data-state = "/console/functions/function/logs?id={{router.params.id}}&project={{router.params.project}}" >
2020-06-14 08:26:45 +12:00
2020-10-31 08:53:27 +13:00
< div class = "text-fade text-size-small pull-end margin-top" data-ls-bind = "{{project-function-executions.sum}} executions found" > < / div >
2020-06-14 08:26:45 +12:00
2020-10-31 08:53:27 +13:00
< h2 > Logs< / h2 >
2020-06-14 08:26:45 +12:00
2020-07-17 20:14:16 +12:00
< div
2020-07-17 09:51:26 +12:00
data-service="functions.listExecutions"
data-scope="sdk"
data-event="load,functions.createExecution"
data-name="project-function-executions"
data-param-function-id="{{router.params.id}}"
2020-07-19 09:15:02 +12:00
data-param-limit="<?php echo APP_PAGING_LIMIT ; ?> "
data-param-offset=""
2020-07-17 09:51:26 +12:00
data-param-order-type="DESC"
data-success="trigger"
data-success-param-trigger-events="functions.listExecutions">
2020-07-17 20:14:16 +12:00
2020-07-19 09:15:02 +12:00
< div data-ls-if = "0 < {{project-function-executions.executions.length}} && undefined !== {{project-function-executions.executions}}" >
< div class = "box margin-bottom" >
< table class = "vertical small" >
< thead >
< tr >
< th width = "30" > < / th >
2020-10-31 08:53:27 +13:00
< th width = "160" > Created< / th >
2020-07-19 09:15:02 +12:00
< th width = "150" > Status< / th >
2020-10-31 08:53:27 +13:00
< th width = "120" > Trigger< / th >
< th width = "80" > Runtime< / th >
2020-07-19 09:15:02 +12:00
< th > < / th >
< / tr >
< / thead >
< tbody data-ls-loop = "project-function-executions.executions" data-ls-as = "execution" >
< tr >
< td data-title = "" >
< i class = "dot danger" data-ls-if = "{{execution.status}} === 'failed'" > < / i >
< i class = "dot info" data-ls-if = "{{execution.status}} === 'waiting'" > < / i >
< i class = "dot info" data-ls-if = "{{execution.status}} === 'processing'" > < / i >
< i class = "dot success" data-ls-if = "{{execution.status}} === 'completed'" > < / i >
< / td >
2020-10-31 08:53:27 +13:00
< td data-title = "Date: " >
< span data-ls-bind = "{{execution.dateCreated|dateTime}}" > < / span >
< / td >
2020-07-19 09:15:02 +12:00
< td data-title = "Status: " >
< span data-ls-bind = "{{execution.status}}" > < / span >
< span class = "text-fade text-size-small" data-ls-if = "{{execution.exitCode}} !== 0" data-ls-bind = " exit code: {{execution.exitCode}}" > < / span >
< / td >
2020-10-31 08:53:27 +13:00
< td data-title = "Trigger: " >
< span data-ls-bind = "{{execution.trigger}}" > < / span >
2020-07-19 09:15:02 +12:00
< / td >
< td data-title = "Runtime: " >
< span data-ls-if = "{{execution.status}} === 'completed' || {{execution.status}} === 'failed'" data-ls-bind = "{{execution.time|seconds2hum}}" > < / span >
< span data-ls-if = "{{execution.status}} === 'waiting' || {{execution.status}} === 'processing'" > -< / span >
< / td >
2020-10-31 08:53:27 +13:00
< td data-title = "" >
2020-07-19 09:15:02 +12:00
< div data-ls-if = "{{execution.status}} === 'completed' || {{execution.status}} === 'failed'" data-title = "" >
2021-08-04 18:39:23 +12:00
2020-07-19 09:15:02 +12:00
< button class = "desktops-only pull-end link margin-start text-danger" data-ls-ui-trigger = "execution-stderr-{{execution.$id}}" > Errors< / button >
< button class = "desktops-only pull-end link margin-start" data-ls-ui-trigger = "execution-stdout-{{execution.$id}}" > Output< / button >
2020-10-31 08:53:27 +13:00
< button class = "phones-only-inline tablets-only-inline link margin-end-small" data-ls-ui-trigger = "execution-stdout-{{execution.$id}}" > Output< / button >
< button class = "phones-only-inline tablets-only-inline link text-danger" data-ls-ui-trigger = "execution-stderr-{{execution.$id}}" > Errors< / button >
2020-07-19 09:15:02 +12:00
< div data-ui-modal class = "modal width-large box close" data-button-alias = "none" data-open-event = "execution-stdout-{{execution.$id}}" >
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 > STDOUT< / h1 >
2020-10-31 08:53:27 +13:00
< div class = "margin-bottom ide" data-ls-if = "({{execution.stdout.length}})" >
< pre data-ls-bind = "{{execution.stdout}}" > < / pre >
<!-- <input type="hidden" data - ls - bind="{{execution.stdout}}" data - forms - code="bash" /> -->
2020-07-19 09:15:02 +12:00
< / div >
2020-07-18 18:16:34 +12:00
2020-10-31 08:53:27 +13:00
< div class = "margin-bottom" data-ls-if = "(!{{execution.stdout.length}})" >
< p > No output was logged.< / p >
< / div >
2020-07-19 09:15:02 +12:00
< / div >
2020-07-18 18:16:34 +12:00
2020-07-19 09:15:02 +12:00
< div data-ui-modal class = "modal width-large box close" data-button-alias = "none" data-open-event = "execution-stderr-{{execution.$id}}" >
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
2020-07-18 18:16:34 +12:00
2020-07-19 09:15:02 +12:00
< h1 > STDERR< / h1 >
2020-07-18 18:16:34 +12:00
2020-10-31 08:53:27 +13:00
< div class = "margin-bottom ide" data-ls-if = "({{execution.stderr.length}})" >
< pre data-ls-bind = "{{execution.stderr}}" > < / pre >
<!-- <input type="hidden" data - ls - bind="{{execution.stderr}}" data - forms - code="bash" /> -->
< / div >
< div class = "margin-bottom" data-ls-if = "(!{{execution.stderr.length}})" >
< p > No errors were logged.< / p >
2020-07-19 09:15:02 +12:00
< / div >
2020-07-18 18:16:34 +12:00
< / div >
< / div >
2020-07-19 09:15:02 +12:00
< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div class = "text-align-center paging" >
< form
data-service="functions.listExecutions"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT ; ?> "
data-param-order-type="DESC"
data-scope="sdk"
data-name="project-function-executions"
data-success="state"
data-success-param-state-keys="search,offset">
< button name = "offset" data-paging-back data-offset = "{{router.params.offset}}" data-sum = "{{project-function-executions.sum}}" class = "margin-end round small" aria-label = "Back" > < i class = "icon-left-open" > < / i > < / button >
< / form >
< span data-ls-bind = "{{router.params.offset|pageCurrent}} / {{project-function-executions.sum|pageTotal}}" > < / span >
< form
data-service="functions.listExecutions"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-param-search="{{router.params.search}}"
data-param-limit="<?php echo APP_PAGING_LIMIT ; ?> "
data-param-order-type="DESC"
data-scope="sdk"
data-name="project-function-executions"
data-success="state"
data-success-param-state-keys="search,offset">
< button name = "offset" data-paging-next data-offset = "{{router.params.offset}}" data-sum = "{{project-function-executions.sum}}" class = "margin-start round small" aria-label = "Next" > < i class = "icon-right-open" > < / i > < / button >
< / form >
< / div >
2020-07-17 20:14:16 +12:00
< / div >
< div data-ls-if = "(!{{project-function-executions.executions.length}})" class = "box dashboard margin-bottom" >
< div class = "margin-bottom-small margin-top-small margin-end margin-start" >
< h3 class = "margin-bottom-small text-bold" > No Logs Founds< / h3 >
< p class = "margin-bottom-no" > Execute your function to view execution logs.< / p >
< / div >
< / div >
2020-06-14 08:26:45 +12:00
< / div >
< / li >
2020-05-11 16:39:00 +12:00
< li data-state = "/console/functions/function/settings?id={{router.params.id}}&project={{router.params.project}}" >
< h2 > Settings< / h2 >
< div class = "row responsive margin-top-negative" >
2020-05-13 10:00:48 +12:00
< div class = "col span-8 margin-bottom" >
< label > < / label >
2020-05-11 16:39:00 +12:00
< form
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-05-11 16:39:00 +12:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Update Function"
data-service="functions.update"
data-scope="sdk"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-success="alert,trigger"
data-success-param-alert-text="Updated function successfully"
data-success-param-trigger-events="functions.update"
data-failure="alert"
data-failure-param-alert-text="Failed to update function"
data-failure-param-alert-classname="error">
< div class = "box" >
2020-07-17 20:14:16 +12:00
< section class = "margin-bottom-large" >
2021-07-29 20:09:24 +12:00
< label for = "name" > Name< / label >
< input name = "name" id = "function-name" type = "text" autocomplete = "off" data-ls-bind = "{{project-function.name}}" data-forms-text-direction required placeholder = "Function Name" maxlength = "128" / >
2021-02-02 11:34:54 +13:00
< label for = "execute" > Execute Access < span class = "tooltip small" data-tooltip = "Choose who can execute this function using the client API." > < i class = "icon-info-circled" > < / i > < / span > < span class = "text-size-small" > (< a data-ls-attrs = "href={{env.HOME}}/docs/permissions" target = "_blank" rel = "noopener" > Learn more< / a > )< / span > < / label >
2021-08-08 00:49:36 +12:00
< input type = "hidden" id = "execute" name = "execute" data-forms-tags data-cast-to = "json" data-ls-bind = "{{project-function.execute}}" placeholder = "User ID, Team ID or Role" / >
2021-08-09 17:47:05 +12:00
< div class = "text-fade text-size-xs margin-top-negative-small margin-bottom" > Add 'role:all' for wildcard access< / div >
2021-02-02 11:34:54 +13:00
2020-07-17 20:14:16 +12:00
< label for = "timeout" > Timeout (seconds) < span class = "tooltip small" data-tooltip = "Limit the execution time of your function." > < i class = "icon-info-circled" > < / i > < / span > < / label >
2021-02-02 11:34:54 +13:00
< input name = "timeout" id = "function-timeout" type = "number" autocomplete = "off" data-ls-bind = "{{project-function.timeout}}" min = "1" max = " <?php echo $this -> escape ( $timeout ); ?> " data-cast-to = "integer" />
2020-07-20 02:42:46 +12:00
< div class = "text-size-small text-fade margin-bottom margin-top-negative-small" > Max value is <?php echo $this -> escape ( number_format ( $timeout )); ?> seconds (<?php echo $this -> escape (( int ) ( $timeout / 60 )); ?> minutes)</ div >
2020-07-17 20:14:16 +12:00
< / section >
2020-10-31 08:53:27 +13:00
< section class = "margin-bottom" data-forms-select-all >
2020-07-17 20:14:16 +12:00
< label for = "events" class = "margin-bottom" > Events < span class = "tooltip small" data-tooltip = "Choose which events should trigger this function." > < i class = "icon-info-circled" > < / i > < / span > < / label >
< div class = "row responsive thin margin-top-small" >
2021-08-04 18:39:23 +12:00
<?php foreach ( $events as $i => $event ) : ?>
2020-10-31 08:53:27 +13:00
< div class = "col span-6 text-one-liner margin-bottom text-height-large text-size-small" title = " <?php echo $event ; ?> " >
2021-02-02 22:50:13 +13:00
< input type = "checkbox" name = "events" data-ls-bind = "{{project-function.events}}" id = " <?php echo $event ; ?> " value = " <?php echo $event ; ?> " />
< label class = "inline" for = " <?php echo $event ; ?> " > <?php echo $event ; ?> </ label >
2020-07-17 20:14:16 +12:00
< / div >
2021-08-04 18:39:23 +12:00
<?php if (( $i + 1 ) % 2 === 0 ) : ?>
2020-07-17 20:14:16 +12:00
< / div >
< div class = "row responsive thin" >
2021-08-04 18:39:23 +12:00
<?php endif ; ?>
2020-07-17 20:14:16 +12:00
2021-08-04 18:39:23 +12:00
<?php endforeach ; ?>
2020-07-17 20:14:16 +12:00
< / div >
< / section >
2021-02-02 11:34:54 +13:00
< label for = "schedule" > Schedule (CRON Syntax) < span class = "tooltip small" data-tooltip = "Set a CRON schedule to trigger this function." > < i class = "icon-info-circled" > < / i > < / span > < / label >
< input type = "text" id = "function-schedule" class = "full-width" name = "schedule" autocomplete = "off" data-ls-bind = "{{project-function.schedule}}" placeholder = "* * * * *" / >
< div class = "text-size-small text-fade margin-bottom margin-top-negative-small" > Leave blank for no schedule< / div >
2020-07-17 20:14:16 +12:00
< h3 class = "margin-bottom-small" > Variables < span class = "tooltip small" data-tooltip = "Set variables or secret keys that will be passed as env vars to your function at runtime." > < i class = "icon-info-circled" > < / i > < / span > < / h3 >
2020-05-11 16:39:00 +12:00
< div data-ls-if = "(!{{project-function.vars.length}})" >
< hr class = "margin-bottom margin-top-no" / >
< fieldset name = "vars" data-cast-to = "object" >
2021-01-19 06:12:02 +13:00
< div data-ls-loop = "project-function.vars" data-ls-as = "var" id = "project-vars" style = "visibility: visible;" >
2020-05-11 16:39:00 +12:00
< div class = "margin-bottom-small" >
< div data-forms-remove class = "row thin" >
< div class = "col span-10" >
2020-05-13 10:00:48 +12:00
< input type = "hidden" data-forms-key-value data-ls-attrs = "name={{$index}}" data-ls-bind = "{{var}}" / >
2020-05-11 16:39:00 +12:00
< / div >
< div class = "col span-2" >
< button type = "button" data-remove class = "reverse danger round pull-end" > < i class = "icon-cancel" > < / i > < / button >
< / div >
< / div >
< / div >
< / div >
2020-05-14 08:59:02 +12:00
< div data-forms-clone = "" data-target = "project-vars" data-label = "Add Variable" data-first = "0" >
2020-05-11 16:39:00 +12:00
< div class = "margin-bottom-small" >
< div data-forms-remove class = "row thin margin-bottom-small" >
< div class = "col span-10" >
< input type = "hidden" name = "" data-forms-key-value / >
< / div >
< div class = "col span-2" >
< button type = "button" data-remove class = "reverse danger round pull-end" > < i class = "icon-cancel" > < / i > < / button >
< / div >
< / div >
< / div >
< / div >
< / fieldset >
< hr class = "margin-bottom margin-top-small" / >
< / div >
< button > Update< / button >
< / div >
< / form >
< / div >
< div class = "col span-4 sticky-top" >
< label > Function ID< / label >
< div class = "input-copy margin-bottom" >
< input id = "uid" type = "text" autocomplete = "off" placeholder = "" data-ls-bind = "{{project-function.$id}}" disabled data-forms-copy >
< / div >
< ul class = "margin-bottom-large text-fade text-size-small" >
< li class = "margin-bottom-small" > < i class = "icon-angle-circled-right margin-start-tiny margin-end-tiny" > < / i > < button data-ls-ui-trigger = "open-json" class = "link text-size-small" > View as JSON< / button > < / li >
2020-07-15 23:22:38 +12:00
< li class = "margin-bottom-small" > < i class = "icon-angle-circled-right margin-start-tiny margin-end-tiny" > < / i > Last Updated: < span data-ls-bind = "{{project-function.dateUpdated|dateText}}" > < / span > < / li >
< li class = "margin-bottom-small" > < i class = "icon-angle-circled-right margin-start-tiny margin-end-tiny" > < / i > Created: < span data-ls-bind = "{{project-function.dateCreated|dateText}}" > < / span > < / li >
2020-05-11 16:39:00 +12:00
< / ul >
< form name = "functions.delete" class = "margin-bottom"
2021-01-18 19:29:26 +13:00
data-analytics
data-analytics-activity
2020-05-11 16:39:00 +12:00
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Delete Function"
data-service="functions.delete"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-confirm="Are you sure you want to delete this function?"
data-success="alert,trigger,redirect"
data-success-param-alert-text="Function deleted successfully"
data-success-param-trigger-events="functions.delete"
data-success-param-redirect-url="/console/functions?project={{router.params.project}}"
data-failure="alert"
data-failure-param-alert-text="Failed to delete function"
data-failure-param-alert-classname="error">
< button type = "submit" class = "danger fill" > Delete Function< / button >
< / form >
< / div >
< / div >
< / li >
< / ul >
< / div >
2021-02-03 04:53:09 +13:00
< / div >
2021-03-12 01:39:06 +13:00
< div data-ui-modal class = "modal close box sticky-footer" data-button-hide = "on" data-open-event = "execute-now" >
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 class = "margin-bottom" > Execute Function< / h1 >
< form data-ls-if = "{{project-function.tag}} !== ''" name = "functions.createExecution" class = "margin-top"
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Function Execution"
data-service="functions.createExecution"
data-event="submit"
data-param-function-id="{{router.params.id}}"
data-success="alert,trigger"
data-success-param-alert-text="Function executed successfully"
data-success-param-trigger-events="functions.createExecution"
data-failure="alert"
data-failure-param-alert-text="Failed to execute function"
data-failure-param-alert-classname="error">
2021-03-13 08:40:11 +13:00
< label for = "execution-data" > Custom Data< / label >
< textarea id = "execution-data" name = "data" autocomplete = "off" class = "margin-bottom" placeholder = "Data string (optional)" > < / textarea >
2021-03-12 01:39:06 +13:00
2021-03-12 02:02:18 +13:00
< button type = "submit" style = "vertical-align: top;" > Execute Now< / button >
2021-03-12 01:39:06 +13:00
< / form >
< / div >
2021-02-03 04:53:09 +13:00
< div data-ui-modal class = "modal close box sticky-footer" data-button-hide = "on" data-open-event = "deploy-tag" >
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 class = "margin-bottom-xl" > Deploy a New Tag< / h1 >
< ul class = "phases padding margin-top-negative-small" data-ui-phases >
< li >
< h2 style = "display: none" > CLI< / h2 >
2021-02-03 20:27:55 +13:00
< p > < b > Unix< / b > < / p >
2021-02-06 01:56:36 +13:00
< div class = "margin-bottom" >
< textarea type = "hidden" data-ls-bind = "appwrite functions createTag \
--functionId={{project-function.$id}} \
--command='mycommand' \
--code='/myrepo/myfunction'" data-forms-code="bash" data-lang="bash" data-lang-label="Bash">< / textarea >
2021-02-03 20:27:55 +13:00
< / div >
< p > < b > PowerShell< / b > < / p >
2021-02-06 01:56:36 +13:00
< div class = "margin-bottom" >
2021-02-17 23:44:31 +13:00
< textarea type = "hidden" data-ls-bind = "appwrite functions createTag `
--functionId={{project-function.$id}} `
--command='mycommand' `
2021-02-06 01:56:36 +13:00
--code='/myrepo/myfunction'" data-forms-code="powershell" data-lang="powershell" data-lang-label="PowerShell">< / textarea >
2021-02-03 20:27:55 +13:00
< / div >
2021-07-04 07:16:41 +12:00
< p > Learn more about < a href = "https://appwrite.io/docs/server/functions#functionsCreateTag" target = "_blank" > creating tags< / a > , installing and using the < a href = "https://appwrite.io/docs/command-line" target = "_blank" > Appwrite CLI< / a > .< / p >
2021-02-03 04:53:09 +13:00
< / li >
< li >
< h2 style = "display: none" > Manual< / h2 >
< form class = "margin-top-negative"
data-analytics
data-analytics-activity
data-analytics-event="submit"
data-analytics-category="console"
data-analytics-label="Create Function Tag"
data-service="functions.createTag"
data-scope="sdk"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Created function tag successfully"
data-success-param-trigger-events="functions.createTag"
data-failure="alert"
data-failure-param-alert-text="Failed to create function tag"
data-failure-param-alert-classname="error">
2021-08-04 18:39:23 +12:00
2021-02-03 04:53:09 +13:00
< input type = "hidden" name = "functionId" data-ls-bind = "{{router.params.id}}" / >
< label for = "tag-command" > Command< / label >
< input type = "text" id = "tag-command" name = "command" required autocomplete = "off" class = "margin-bottom" placeholder = "node main.js" / >
< label for = "tag-code" > Gzipped Code (tar.gz file)< / label >
< input type = "file" name = "code" id = "tag-code" size = "1" required accept = "application/x-gzip,.gz" >
< div class = "text-fade text-size-xs margin-top-negative-small margin-bottom-large" > (Max file size allowed: <?php echo $fileLimitHuman ; ?> )</ div >
< footer >
< button type = "submit" > Create< / button > < button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
< / footer >
< / form >
< / li >
< / ul >
2021-08-04 18:39:23 +12:00
2021-02-10 05:58:31 +13:00
< / div >