Follow up to b863ddc94b
Ruby:
* Validate `summary` (the column is `not null`)
* Fix `name` validation (the column has `max_length` 100)
* Fix table annotations
* Accept missing `parameter` attributes (`required, `enum`, `enum_values`)
JS:
* Use native classes
* Don't use ember's array extensions
* Add explicit service injections
* Correct class names
* Use `||=` operator
* Use `store` service to create records
* Remove unused service injections
* Extract consts
* Group actions together
* Use `async`/`await`
* Use `withEventValue`
* Sort html attributes
* Use DButtons `@label` arg
* Use `input` elements instead of Ember's `Input` component (same w/ textarea)
* Remove `btn-default` class (automatically applied by DButton)
* Don't mix `I18n.t` and `i18n` in the same template
* Don't track props that aren't used in a template
* Correct invalid `target.value` code
* Remove unused/invalid `this.parameter`/`onChange` code
* Whitespace
* Use the new service import `inject as service` -> `service`
* Use `Object.entries()`
* Add missing i18n strings
* Fix an error in `addEnumValue` (calling `pushObject` on `undefined`)
* Use `TrackedArray`/`TrackedObject`
* Transform tool `parameters` keys (`enumValues` -> `enum_values`)
47 lines
1.5 KiB
Plaintext
47 lines
1.5 KiB
Plaintext
import { LinkTo } from "@ember/routing";
|
|
import icon from "discourse-common/helpers/d-icon";
|
|
import I18n from "discourse-i18n";
|
|
|
|
<template>
|
|
<section class="ai-tool-list-editor__current admin-detail pull-left">
|
|
<div class="ai-tool-list-editor__header">
|
|
<h3>{{I18n.t "discourse_ai.tools.short_title"}}</h3>
|
|
<LinkTo
|
|
@route="adminPlugins.show.discourse-ai-tools.new"
|
|
class="btn btn-small btn-primary ai-tool-list-editor__new-button"
|
|
>
|
|
{{icon "plus"}}
|
|
<span>{{I18n.t "discourse_ai.tools.new"}}</span>
|
|
</LinkTo>
|
|
</div>
|
|
|
|
<table class="content-list ai-tool-list-editor">
|
|
<tbody>
|
|
{{#each @tools as |tool|}}
|
|
<tr data-tool-id={{tool.id}} class="ai-tool-list__row">
|
|
<td>
|
|
<div class="ai-tool-list__name-with-description">
|
|
<div class="ai-tool-list__name">
|
|
<strong>
|
|
{{tool.name}}
|
|
</strong>
|
|
</div>
|
|
<div class="ai-tool-list__description">
|
|
{{tool.description}}
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<LinkTo
|
|
@route="adminPlugins.show.discourse-ai-tools.show"
|
|
@model={{tool}}
|
|
class="btn btn-text btn-small"
|
|
>{{I18n.t "discourse_ai.tools.edit"}}</LinkTo>
|
|
</td>
|
|
</tr>
|
|
{{/each}}
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
</template>
|