Skip to content

A platform for community discussion. Free, open, simple.

FIX: Broken quota table layout on LLM edit form (#38822)

Rafael dos Santos Silva204d47fd47e2
diff --git a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
index 6711cd448ba..d96f8f99191 100644
--- a/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
+++ b/plugins/discourse-ai/admin/assets/javascripts/discourse/components/ai-llm-editor-form.gjs
@@ -595,58 +595,64 @@ export default class AiLlmEditorForm extends Component {
<tbody class="ai-llm-quotas__table-body">
<form.Collection
@name="llm_quotas"
- @tagName="tr"
- class="ai-llm-quotas__row"
as |collection index collectionData|
>
- <td
- class="ai-llm-quotas__cell"
- >{{collectionData.group_name}}</td>
- <td class="ai-llm-quotas__cell">
- <collection.Field
- @name="max_tokens"
- @title="max_tokens"
- @showTitle={{false}}
- @type="input-number"
- as |field|
- >
- <field.Control class="ai-llm-quotas__input" min="1" />
- </collection.Field>
- </td>
- <td class="ai-llm-quotas__cell">
- <collection.Field
- @name="max_usages"
- @title="max_usages"
- @showTitle={{false}}
- @type="input-number"
- as |field|
- >
- <field.Control class="ai-llm-quotas__input" min="1" />
- </collection.Field>
- </td>
- <td class="ai-llm-quotas__cell">
- <collection.Field
- @name="duration_seconds"
- @title="duration_seconds"
- @showTitle={{false}}
- @type="custom"
- as |field|
- >
- <field.Control>
- <DurationSelector
- @value={{collectionData.duration_seconds}}
- @onChange={{field.set}}
+ <tr class="ai-llm-quotas__row">
+ <td
+ class="ai-llm-quotas__cell"
+ >{{collectionData.group_name}}</td>
+ <td class="ai-llm-quotas__cell">
+ <collection.Field
+ @name="max_tokens"
+ @title="max_tokens"
+ @showTitle={{false}}
+ @type="input-number"
+ as |field|
+ >
+ <field.Control
+ class="ai-llm-quotas__input ai-llm-quotas__input--tokens"
+ min="1"
/>
- </field.Control>
- </collection.Field>
- </td>
- <td>
- <form.Button
- @icon="trash-can"
- @action={{fn collection.remove index}}
- class="btn-danger ai-llm-quotas__delete-btn"
- />
- </td>
+ </collection.Field>
+ </td>
+ <td class="ai-llm-quotas__cell">
+ <collection.Field
+ @name="max_usages"
+ @title="max_usages"
+ @showTitle={{false}}
+ @type="input-number"
+ as |field|
+ >
+ <field.Control
+ class="ai-llm-quotas__input ai-llm-quotas__input--usages"
+ min="1"
+ />
+ </collection.Field>
+ </td>
+ <td class="ai-llm-quotas__cell">
+ <collection.Field
+ @name="duration_seconds"
+ @title="duration_seconds"
+ @showTitle={{false}}
+ @type="custom"
+ as |field|
+ >
+ <field.Control>
+ <DurationSelector
+ @value={{collectionData.duration_seconds}}
+ @onChange={{field.set}}
+ />
+ </field.Control>
+ </collection.Field>
+ </td>
+ <td>
+ <form.Button
+ @icon="trash-can"
+ @action={{fn collection.remove index}}
+ class="btn-danger ai-llm-quotas__delete-btn"
+ />
+ </td>
+ </tr>
</form.Collection>
</tbody>
</table>
diff --git a/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llm-quotas.scss b/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llm-quotas.scss
index 30e1e592116..a8f7aa1ae98 100644
--- a/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llm-quotas.scss
+++ b/plugins/discourse-ai/assets/stylesheets/modules/llms/common/ai-llm-quotas.scss
@@ -2,23 +2,24 @@
margin: 1em 0;
&__table {
- width: 100%;
border-collapse: collapse;
margin-bottom: 1em;
+
+ .form-kit__collection {
+ display: contents;
+ }
}
- &__table-head {
- background-color: var(--primary-very-low);
+ > .form-kit__container {
+ align-items: stretch;
}
- .duration-selector {
- .select-kit {
- width: 150px;
- }
+ .form-kit__container-content {
+ width: 100%;
}
- .duration-selector__custom {
- margin-top: 8px;
+ &__table-head {
+ background-color: var(--primary-very-low);
}
&__header {
@@ -38,7 +39,13 @@
&__cell {
vertical-align: middle;
- align-items: center;
+ padding: var(--space-2);
+ white-space: nowrap;
+ width: 1%;
+
+ .form-kit__container {
+ align-items: stretch;
+ }
&--actions {
text-align: center;
@@ -46,15 +53,10 @@
}
&__input[type="number"] {
- width: 200px;
padding: 0.5em;
margin-bottom: 0;
}
- &__group-select {
- width: 200px;
- }
-
&__delete-btn {
padding: 0.3em 0.5em;
}