2020-05-11 18:47:53 +12:00
<?php
$events = array_keys($this->getParam('events', []));
?>
2020-05-11 16:39:00 +12:00
< div
data-service="functions.get"
data-name="project-function"
data-event="load,functions.update"
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 / >
2020-05-11 18:47:53 +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" >
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< 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}}" >
2020-05-13 10:00:48 +12:00
< h2 > Overview< / h2 >
< 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" >
2020-07-15 06:55:44 +12:00
< img src = "" data-ls-attrs = "src=/images/environments/{{project-function.env|envLogo}}" alt = "Function Env." class = "avatar huge margin-top-negative-xxl" / >
2020-05-13 10:00:48 +12:00
2020-07-15 06:55:44 +12:00
< p class = "text-fade margin-bottom" data-ls-bind = "{{project-function.env|envName}} {{project-function.env|envVersion}}" >
2020-05-13 10:00:48 +12:00
< / p >
< button class = "margin-bottom-small" > Execute Now< / button > < button class = "reverse" > View Logs< / button >
< / div >
< / div >
< h3 > Tags< / h3 >
< div class = "margin-bottom"
data-service="functions.listTags"
data-scope="sdk"
data-event="load,functions.createTag,functions.deleteTag"
2020-05-14 08:59:02 +12:00
data-name="project-function-tags"
2020-05-13 10:00:48 +12:00
data-param-project-id="{{router.params.project}}"
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-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" >
< a data-ls-attrs = "href=/console/functions/function?id={{function.$id}}&project={{router.params.project}}" class = "button pull-end" > Set Default< / a >
< span data-ls-bind = "{{function.name}}" > < / span >
< / li >
< / ul >
< / div >
< / div >
< / div >
< div class = "pull-start" >
2020-05-14 08:59:02 +12:00
< div data-ui-modal class = "modal close box sticky-footer" data-button-text = "Deploy Tag" >
2020-05-13 10:00:48 +12:00
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
2020-05-14 08:59:02 +12:00
< h1 > Deploy a New Tag< / h1 >
2020-07-15 08:33:52 +12:00
< form
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">
< 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< / label >
< input type = "file" name = "code" id = "tag-code" size = "1" required class = "margin-bottom-xl" >
< footer >
< button type = "submit" > Create< / button > < button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
< / footer >
< / form >
2020-05-13 10:00:48 +12:00
< / div >
< / div >
< div class = "pull-end paging" >
< form
data-service="users.list"
data-event="submit"
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-users"
data-success="state"
data-success-param-state-keys="search,offset">
< button name = "offset" data-paging-back data-offset = "{{router.params.offset}}" data-sum = "{{project-users.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-users.sum|pageTotal}}" > < / span >
< form
data-service="users.list"
data-event="submit"
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-users"
data-success="state"
data-success-param-state-keys="search,offset">
< button name = "offset" data-paging-next data-offset = "{{router.params.offset}}" data-sum = "{{project-users.sum}}" class = "margin-start round small" aria-label = "Next" > < i class = "icon-right-open" > < / i > < / button >
< / 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 >
< 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|date-text}}" > < / 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|date-text}}" > < / span > < / li >
< / ul >
< form name = "functions.delete" class = "margin-bottom"
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 >
2020-06-14 08:26:45 +12:00
< li data-state = "/console/functions/function/usage?id={{router.params.id}}&project={{router.params.project}}" >
< h2 > Activity & Usage< / h2 >
< 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" >
< div class = "content" data-forms-chart = "Requests=usage.requests.data,Network=usage.network.data" > < / div >
< / div >
< / div >
< / div >
< ul class = "chart-notes margin-bottom-large" >
< li > Invocations< / li >
< li > CPU Time< / li >
< / ul >
< h3 > Logs< / h3 >
< div class = "box" >
< table class = "vertical small" >
< thead >
< tr >
< th width = "140" > Date< / th >
< th width = "175" > Event< / th >
< th > Client< / th >
< th width = "90" > Location< / th >
< th width = "90" > IP< / th >
< / tr >
< / thead >
<!-- <tbody data - ls - loop="securityLogs" data - ls - as="log">
< tr >
< td data-title = "Date: " > < span data-ls-bind = "{{log.time|date-time}}" > < / span > < / td >
< td data-title = "Event: " > < span data-ls-bind = "{{log.event}}" > < / span > < / td >
< td data-title = "Client: " >
< img data-ls-attrs = "src={{env.API}}/avatars/browsers/{{log.client.short_name|lowercase}}?width=80&height=80&project={{env.PROJECT}},title={{log.client.name}},alt={{log.client.name}}" class = "avatar xxs inline margin-end-small" / >
< span data-ls-bind = "{{log.client.name}} {{log.client.version}} on {{log.model}} {{log.OS.name}} {{log.OS.version}}" > < / span >
< / td >
< td data-title = "Location: " >
< img data-ls-attrs = "src={{env.API}}/avatars/flags/{{log.geo.isoCode}}?width=80&height=80&project={{env.PROJECT}}" class = "avatar xxs inline margin-end-small" / >
< span data-ls-bind = "{{log.geo.country}}" > < / span >
< / td >
< td data-title = "IP: " > < span data-ls-bind = "{{log.ip}}" > < / span > < / td >
< / tr >
< / tbody > -->
< / table >
< / 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
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-05-11 18:47:53 +12:00
< label for = "name" > Name< / label >
2020-05-11 16:39:00 +12:00
< input name = "name" id = "function-name" type = "text" autocomplete = "off" data-ls-bind = "{{project-function.name}}" data-forms-text-direction required placeholder = "Function Name" / >
2020-06-14 06:44:50 +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 >
2020-05-14 08:59:02 +12:00
< input name = "timeout" id = "function-timeout" type = "number" autocomplete = "off" data-ls-bind = "{{project-function.timeout}}" min = "1" max = "900" / >
< div class = "text-size-small text-fade margin-bottom margin-top-negative-small" > Max value is 900 seconds (15 minutes)< / div >
2020-05-11 18:47:53 +12:00
2020-06-14 06:44:50 +12:00
< label for = "events" > Events < span class = "tooltip small" data-tooltip = "Choose which events should trigger this function." > < i class = "icon-info-circled" > < / i > < / span > < / label >
2020-05-13 10:00:48 +12:00
< div class = "row responsive thin" >
<?php foreach ( $events as $i => $event ) : ?>
< div class = "col span-6 text-one-liner margin-bottom text-height-large" >
< input type = "checkbox" name = "events" data-ls-bind = "{{project-function.events}}" value = " <?php echo $event ; ?> " /> <?php echo $event ; ?>
< / div >
<?php if (( $i + 1 ) % 2 === 0 ) : ?>
< / div >
< div class = "row responsive thin" >
<?php endif ; ?>
2020-05-11 18:47:53 +12:00
2020-05-13 10:00:48 +12:00
<?php endforeach ; ?>
< / div >
2020-05-11 18:47:53 +12:00
2020-06-14 06:44:50 +12: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 >
2020-05-13 10:00:48 +12:00
< input type = "text" 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-05-11 18:47:53 +12:00
2020-06-14 06:44:50 +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." > < 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" >
2020-05-14 08:59:02 +12:00
< div data-ls-loop = "project-function.vars" data-ls-as = "var" style = "overflow: hidden" id = "project-vars" >
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 >
< 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|date-text}}" > < / 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|date-text}}" > < / span > < / li >
< / ul >
< form name = "functions.delete" class = "margin-bottom"
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 >
2020-05-13 10:00:48 +12:00
< / div >