discourse/plugins/automation/assets/javascripts/discourse/templates/admin-plugins-discourse-automation-index.hbs
Osama Sayegh 3d4faf3272
FEATURE: Merge discourse-automation (#26432)
Automation (previously known as discourse-automation) is now a core plugin.
2024-04-03 18:20:43 +03:00

88 lines
2.9 KiB
Handlebars

{{#if model.length}}
<table class="automations">
<thead>
<tr>
<th></th>
<th>{{i18n "discourse_automation.models.automation.name.label"}}</th>
<th>{{i18n "discourse_automation.models.automation.trigger.label"}}</th>
<th>{{i18n "discourse_automation.models.automation.script.label"}}</th>
<th>{{i18n
"discourse_automation.models.automation.last_updated_by.label"
}}</th>
<th></th>
</tr>
</thead>
<tbody>
{{#each model as |automation|}}
<tr>
{{#if automation.script.not_found}}
<td colspan="5" class="alert alert-danger">
{{i18n
"discourse_automation.scriptables.not_found"
script=automation.script.id
automation=automation.name
}}
</td>
{{else if automation.trigger.not_found}}
<td colspan="5" class="alert alert-danger">
{{i18n
"discourse_automation.triggerables.not_found"
trigger=automation.trigger.id
automation=automation.name
}}
</td>
{{else}}
<td
role="button"
{{on "click" (fn this.editAutomation automation)}}
>{{format-enabled-automation
automation.enabled
automation.trigger
}}</td>
<td
tabindex="0"
role="button"
{{on "keypress" (fn this.editAutomation automation)}}
{{on "click" (fn this.editAutomation automation)}}
>{{automation.name}}</td>
<td
role="button"
{{on "click" (fn this.editAutomation automation)}}
>{{if automation.trigger.id automation.trigger.name "-"}}</td>
<td
role="button"
{{on "click" (fn this.editAutomation automation)}}
>{{automation.script.name}} (v{{automation.script.version}})</td>
<td>
<a
href={{automation.last_updated_by.userPath}}
data-user-card={{automation.last_updated_by.username}}
>
{{avatar automation.last_updated_by imageSize="small"}}
</a>
{{format-date automation.updated_at leaveAgo="true"}}
</td>
{{/if}}
<td>
<DButton
@icon="trash-alt"
@action={{action "destroyAutomation" automation}}
class="btn-danger"
/>
</td>
</tr>
{{/each}}
</tbody>
</table>
{{else}}
<div class="alert alert-info">
<p>{{i18n "discourse_automation.no_automation_yet"}}</p>
<DButton
@label="discourse_automation.create"
@icon="plus"
@action={{action "newAutomation"}}
class="btn-primary"
/>
</div>
{{/if}}