2019-08-05 16:47:52 +12:00
<?php
use Utopia\Locale\Locale;
?>
2019-08-05 17:51:02 +12:00
< div class = "cover margin-bottom-large" >
< h1 class = "zone xl margin-bottom-large margin-top" >
<?php echo Locale :: getText ( 'console.tasks.title' ); ?>
< / h1 >
< / div >
2019-08-08 17:09:49 +12:00
< div class = "zone xl"
data-service="projects.listTasks"
data-scope="console"
data-event="load,task-create,task-update,task-delete"
data-name="console-tasks"
data-param-project-id="{{router.params.project}}"
data-success="trigger"
data-success-param-trigger-events="project-load">
2019-08-05 16:47:52 +12:00
< div data-ls-if = "0 === {{console-tasks.length}} || undefined === {{console-tasks.length}}" class = "box margin-top margin-bottom" style = "display: none;" >
2019-08-05 17:51:02 +12:00
< h3 class = "margin-bottom-small" > No Tasks Found< / h3 >
2019-08-05 16:47:52 +12:00
< p class = "margin-bottom-no" > You haven't created any tasks for your project yet.< / p >
< / div >
< div class = "box y-scroll margin-bottom" data-ls-if = "0 != {{console-tasks.length}}" style = "display: none;" >
< table class = "full" >
< thead >
< tr >
< th width = "220" > Name< / th >
< th > < / th >
< th width = "140" > Next Run< / th >
< th width = "140" > Prev. Run< / th >
< th > < / th >
< / tr >
< / thead >
< tbody data-ls-loop = "console-tasks" data-ls-as = "task" class = "list" >
< tr >
< td >
< div class = "margin-bottom-tiny text-one-liner" >
< span data-ls-bind = "{{task.name}}" > < / span >
< span data-ls-if = "0 === {{task.security}}" style = "display: none;" >
< span class = "text-danger" > SSL/TLS Disabled< / span >
< / span >
< span data-ls-if = "0 !== {{task.failures}}" style = "display: none;" >
< span class = "text-danger" data-ls-bind = "({{task.failures}} errors)" > < / span >
< / span >
< / div >
< a data-ls-attrs = "href={{task.httpUrl}}" data-ls-bind = "{{task.httpUrl}}" target = "_blank" class = "text-one-liner" > < / a >
< / td >
< td style = "vertical-align: middle" >
< span data-ls-if = "'play' === {{task.status}}" style = "display: none;" >
< span class = "tag green" > < i class = "icon-play" > < / i > Running < / span >
< / span >
< span data-ls-if = "'play' !== {{task.status}}" style = "display: none;" >
< span class = "tag red" > < i class = "icon-pause" > < / i > Paused < / span >
< / span >
< / td >
< td style = "vertical-align: middle" >
2019-08-24 07:07:17 +12:00
< small data-ls-bind = "{{task.next|date-time}}" > < / small >
2019-08-05 16:47:52 +12:00
< / td >
< td style = "vertical-align: middle" >
2019-08-24 07:07:17 +12:00
< div data-ls-if = "undefined !== {{task.previous}}" >
< small data-ls-bind = "{{task.previous|date-time}}" > < / small >
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< div data-ls-if = "undefined !== {{task.delay}} && 59 < {{task.delay}}" class = "text-danger margin-top-tiny" >
< small data-ls-bind = "({{task.delay|ms2hum}} Delay)" > < / small >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
2019-08-24 07:07:17 +12:00
< small data-ls-if = "undefined === {{task.previous}}" >
2019-08-05 16:47:52 +12:00
None.
2019-08-24 07:07:17 +12:00
< / small >
2019-08-05 16:47:52 +12:00
< / td >
< td >
2019-08-09 18:05:45 +12:00
< div data-ui-modal class = "modal box close" data-button-text = "" data-button-class = "pull-end reverse round" data-button-icon = "icon-cog" >
2019-08-05 16:47:52 +12:00
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 > Update Task< / h1 >
2019-08-08 17:09:49 +12:00
< form
data-service="projects.updateTask"
data-scope="console"
data-event="submit"
data-success="alert,trigger"
data-success-param-alert-text="Updated task successfully"
data-success-param-trigger-events="task-update,modal-close"
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to update task"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< input type = "hidden" name = "projectId" data-ls-bind = "{{router.params.project}}" / >
< input type = "hidden" name = "taskId" data-ls-bind = "{{task.$uid}}" / >
2019-08-05 16:47:52 +12:00
< label data-ls-attrs = "for=name-{{task.$uid}}" > Name< / label >
< input type = "text" class = "full-width" data-ls-attrs = "id=name-{{task.$uid}}" name = "name" required autocomplete = "off" data-ls-bind = "{{task.name}}" / >
< label data-ls-attrs = "for=status-{{task.$uid}}" class = "margin-bottom" > Status
< div class = "margin-top-small" >
2019-08-08 08:35:20 +12:00
< input name = "status" type = "radio" checked = "checked" required data-ls-bind = "{{task.status}}" value = "play" / > < span > Play< / span >
< input name = "status" type = "radio" required data-ls-bind = "{{task.status}}" value = "pause" / > < span > Pause< / span >
2019-08-05 16:47:52 +12:00
< / div >
< / label >
< label data-ls-attrs = "for=schedule-{{task.$uid}}" > Schedule (CRON Syntax)< / label >
2019-08-09 18:05:45 +12:00
< input type = "text" class = "full-width" data-ls-attrs = "id=schedule-{{task.$uid}}" name = "schedule" required autocomplete = "off" data-ls-bind = "{{task.schedule}}" placeholder = "* * * * *" / >
2019-08-05 16:47:52 +12:00
< div class = "row thin" >
< div class = "col span-4" >
< label data-ls-attrs = "for=httpMethod-{{task.$uid}}" > HTTP Method< / label >
< select data-ls-attrs = "id=httpMethod-{{task.$uid}}" name = "httpMethod" required data-ls-bind = "{{task.httpMethod}}" >
< option value = "POST" > POST< / option >
< option value = "GET" > GET< / option >
< option value = "PUT" > PUT< / option >
< option value = "PATCH" > PATCH< / option >
< option value = "DELETE" > DELETE< / option >
< option value = "CONNECT" > CONNECT< / option >
< option value = "HEAD" > HEAD< / option >
< option value = "TRACE" > TRACE< / option >
< option value = "OPTIONS" > OPTIONS< / option >
< / select >
< / div >
< div class = "col span-8" >
< label data-ls-attrs = "for=httpUrl-{{task.$uid}}" > HTTP URL< / label >
< input type = "url" class = "full-width" data-ls-attrs = "id=httpUrl-{{task.$uid}}" name = "httpUrl" required autocomplete = "off" placeholder = "https://example.com/callback" data-ls-bind = "{{task.httpUrl}}" / >
< / div >
< / div >
2019-08-09 18:28:16 +12:00
< div class = "margin-bottom toggle" data-ls-ui-open >
< i class = "icon-plus pull-end margin-top-tiny" > < / i >
< i class = "icon-minus pull-end margin-top-tiny" > < / i >
< h2 class = "margin-bottom" >
Advanced Options
2019-08-24 07:07:17 +12:00
< small class = "text-size-small" > (optional)< / small >
2019-08-09 18:28:16 +12:00
< / h2 >
< label for = "httpHeaders" > HTTP Headers< / label >
< div class = "margin-bottom-small" >
< div data-ls-loop = "task.httpHeaders" data-ls-as = "header" style = "overflow: hidden" >
< div class = "margin-bottom-small" >
< div data-forms-remove class = "row thin" >
< div class = "col span-10" >
< input type = "hidden" name = "httpHeaders" data-forms-headers data-ls-bind = "{{header}}" data-cast-to = "array" / >
< / div >
< div class = "col span-2" >
< button type = "button" data-remove class = "reverse danger round pull-end" > < i class = "icon-cancel" > < / i > < / button >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
< / div >
2019-08-09 18:28:16 +12:00
< div data-forms-clone = "" data-label = "Add Header" data-first = "0" >
< div class = "" >
< div data-forms-remove class = "row thin margin-bottom-small" >
< div class = "col span-10" >
< input type = "hidden" name = "httpHeaders" data-forms-headers data-cast-to = "array" / >
< / div >
< div class = "col span-2" >
< button type = "button" data-remove class = "reverse danger round pull-end" > < i class = "icon-cancel" > < / i > < / button >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
< / div >
< / div >
2019-08-24 07:07:17 +12:00
< label data-ls-attrs = "for=security-{{task.$uid}}" class = "margin-bottom" >
< div class = "margin-bottom-small" > SSL / TLS (Certificate verification)< / div >
2019-08-09 18:28:16 +12:00
< input name = "security" type = "radio" required data-ls-bind = "{{task.security}}" value = "1" / > < span > Enabled< / span >
< input name = "security" type = "radio" required data-ls-bind = "{{task.security}}" value = "0" / > < span > Disabled< / span >
< / label >
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< p class = "margin-bottom text-size-small" > < span class = "tag red" > Warning< / span > Untrusted or self-signed certificates may not be secure.
2019-08-09 18:28:16 +12:00
< a href = "https://en.wikipedia.org/wiki/Self-signed_certificate" target = "_blank" rel = "noopener" > Learn more< i class = "icon-link-ext" > < / i > < / a >
< / p >
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< label > HTTP Authentication < span class = "tooltip" data-tooltip = "Use to secure your endpoint from untrusted sources" > < i class = "icon-question" > < / i > < / span > < small > (optional)< / small > < / label >
2019-08-05 16:47:52 +12:00
2019-08-09 18:28:16 +12:00
< div class = "row thin" >
< div class = "col span-6" >
< label data-ls-attrs = "for=httpUser-{{task.$uid}}" > User< / label >
< input type = "text" class = "full-width" data-ls-attrs = "id=httpUser-{{task.$uid}}" name = "httpUser" autocomplete = "off" data-ls-bind = "{{task.httpUser}}" / >
< / div >
< div class = "col span-6" >
< label data-ls-attrs = "for=httpPass-{{task.$uid}}" > Password< / label >
< input type = "password" class = "full-width" data-ls-attrs = "id=httpPass-{{task.$uid}}" name = "httpPass" autocomplete = "off" data-ls-bind = "{{task.httpPass}}" / >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
2019-08-09 18:05:45 +12:00
< button type = "submit" > Update< / button > < button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
2019-08-05 16:47:52 +12:00
< / form >
2019-08-08 17:09:49 +12:00
< form class = "margin-top"
data-service="projects.deleteTask"
data-scope="console"
data-event="submit"
data-confirm="Are you sure you want to delete this task?"
data-success="alert,trigger"
data-success-param-alert-text="Deleted task successfully"
data-success-param-trigger-events="task-delete,modal-close"
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to delete task"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< input type = "hidden" name = "projectId" data-ls-bind = "{{router.params.project}}" / >
< input type = "hidden" name = "taskId" data-ls-bind = "{{task.$uid}}" / >
2019-08-05 16:47:52 +12:00
< button class = "danger fill" > Delete< / button >
< / form >
< / div >
< / td >
< / tr >
< / tbody >
< / table >
< / div >
< div class = "clear" >
2019-08-12 17:33:02 +12:00
< div data-ui-modal class = "modal box close" data-button-text = "Add Task" >
2019-08-05 16:47:52 +12:00
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 > Add Task< / h1 >
2019-08-08 17:09:49 +12:00
< form
data-service="projects.createTask"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Created task successfully"
data-success-param-trigger-events="task-create,modal-close"
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to create task"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< input type = "hidden" name = "projectId" data-ls-bind = "{{router.params.project}}" / >
2019-08-05 16:47:52 +12:00
< label for = "name" > Name< / label >
< input type = "text" class = "full-width" id = "name" name = "name" required autocomplete = "off" / >
< label data-ls-attrs = "for=status" class = "margin-bottom" > Status
< div class = "margin-top-small" >
< input name = "status" type = "radio" value = "play" checked = "checked" required / > < span > Play< / span >
< input name = "status" type = "radio" value = "pause" required / > < span > Pause< / span >
< / div >
< / label >
< label for = "schedule" > Schedule (CRON Syntax)< / label >
2019-08-09 18:05:45 +12:00
< input type = "text" class = "full-width" id = "schedule" name = "schedule" required autocomplete = "off" placeholder = "* * * * *" / >
2019-08-05 16:47:52 +12:00
< div class = "row thin" >
< div class = "col span-4" >
< label for = "httpMethod" > HTTP Method< / label >
< select id = "httpMethod" name = "httpMethod" required >
< option value = "POST" > POST< / option >
< option value = "GET" > GET< / option >
< option value = "PUT" > PUT< / option >
< option value = "PATCH" > PATCH< / option >
< option value = "DELETE" > DELETE< / option >
< option value = "CONNECT" > CONNECT< / option >
< option value = "HEAD" > HEAD< / option >
< option value = "TRACE" > TRACE< / option >
< option value = "OPTIONS" > OPTIONS< / option >
< / select >
< / div >
< div class = "col span-8" >
< label for = "httpUrl" > HTTP URL< / label >
< input type = "url" class = "full-width" id = "httpUrl" name = "httpUrl" required autocomplete = "off" placeholder = "https://example.com/callback" / >
< / div >
< / div >
2019-08-09 18:28:16 +12:00
< div class = "margin-bottom toggle" data-ls-ui-open >
< i class = "icon-plus pull-end margin-top-tiny" > < / i >
< i class = "icon-minus pull-end margin-top-tiny" > < / i >
< h2 class = "margin-bottom" >
Advanced Options
2019-08-24 07:07:17 +12:00
< small class = "text-size-small" > (optional)< / small >
2019-08-09 18:28:16 +12:00
< / h2 >
< label for = "httpHeaders" > HTTP Headers< / label >
< div class = "margin-bottom-small" >
< div data-forms-clone = "" data-label = "Add Header" data-first = "0" >
< div class = "" >
< div data-forms-remove class = "row thin margin-bottom-small" >
< div class = "col span-10" >
< input type = "hidden" name = "httpHeaders" data-forms-headers data-cast-to = "array" / >
< / div >
< div class = "col span-2" >
< button type = "button" data-remove class = "reverse danger round pull-end" > < i class = "icon-cancel" > < / i > < / button >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
< / div >
< / div >
2019-08-24 07:07:17 +12:00
< label for = "secure" class = "margin-bottom-small" >
< div class = "margin-bottom-small" > SSL / TLS (Certificate verification)< / div >
2019-08-09 18:28:16 +12:00
< input name = "security" data-ls-attrs = "id=secure-yes" type = "radio" value = "1" checked = "checked" required / > < span > Enabled< / span >
< input name = "security" data-ls-attrs = "id=secure-no" type = "radio" value = "0" required / > < span > Disabled< / span >
< / label >
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< p class = "margin-bottom text-size-small" > < span class = "tag red" > Warning< / span > Untrusted or self-signed certificates may not be secure.
2019-08-09 18:28:16 +12:00
< a href = "https://en.wikipedia.org/wiki/Self-signed_certificate" target = "_blank" rel = "noopener" > Learn more< i class = "icon-link-ext" > < / i > < / a >
< / p >
2019-08-05 16:47:52 +12:00
2019-08-24 07:07:17 +12:00
< label > HTTP Authentication < span class = "tooltip" data-tooltip = "Use to secure your endpoint from untrusted sources" > < i class = "icon-question" > < / i > < / span > < small > (optional)< / small > < / label >
2019-08-05 16:47:52 +12:00
2019-08-09 18:28:16 +12:00
< div class = "row thin" >
< div class = "col span-6" >
< label for = "httpUser" > User< / label >
< input type = "text" class = "full-width" id = "httpUser" name = "httpUser" autocomplete = "off" / >
< / div >
< div class = "col span-6" >
< label for = "httpPass" > Password< / label >
< input type = "password" class = "full-width" id = "httpPass" name = "httpPass" autocomplete = "off" / >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
2019-08-09 18:05:45 +12:00
< button type = "submit" > Create< / button > < button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
2019-08-05 16:47:52 +12:00
< / form >
< / div >
< / div >
< / div >