Skip to content

Commit

Permalink
polish form
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
julien-nc committed Aug 3, 2023
1 parent 080b03b commit a64066b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/assistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ async function addAssistantMenuEntry() {
view.$on('click', () => {
openAssistantForm('textprocessing_assistant')
.then(r => {
console.debug('scheduled task', r.data.ocs.data.task)
console.debug('scheduled task', r)
})
})
}
Expand Down
14 changes: 12 additions & 2 deletions src/components/AssistantForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
:placeholder="t('textprocessing_assistant', 'Type some text')"
:link-autocomplete="false" />
<NcRichContenteditable
v-if="myOutput"
:value.sync="myOutput"
class="editable-output"
:multiline="true"
:disabled="loading"
:placeholder="t('textprocessing_assistant', 'Result')"
:link-autocomplete="false" />
<NcButton v-if="selectedTaskType"
<NcButton
v-if="showSubmit"
class="submit-button"
:disabled="!canSubmit"
:aria-label="t('textprocessing_assistant', 'Submit assistant task')"
:title="t('textprocessing_assistant', 'Submit')"
@click="onSubmit">
Expand Down Expand Up @@ -95,6 +98,12 @@ export default {
}
return this.taskTypes.find(tt => tt.id === this.mySelectedTaskTypeId)
},
showSubmit() {
return this.selectedTaskType && this.myOutput.trim() === ''
},
canSubmit() {
return this.selectedTaskType && !!this.myInput.trim()
},
},
mounted() {
this.getTaskTypes()
Expand Down Expand Up @@ -138,7 +147,8 @@ export default {
.editable-input,
.editable-output {
width: 100%;
min-height: 150px;
min-height: unset !important;
max-height: 200px !important;
}
.assistant-bubble {
Expand Down

0 comments on commit a64066b

Please sign in to comment.