Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show all task types inline #109

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/components/AssistantTextProcessingForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<TaskTypeSelect
:value.sync="mySelectedTaskTypeId"
class="task-custom-select"
:inline="5"
:options="sortedTaskTypes"
@update:value="onTaskTypeUserChange" />
<div v-if="showHistory"
Expand Down Expand Up @@ -38,14 +37,6 @@
@load-task="onHistoryLoadTask" />
</div>
<div v-else class="task-input-output-form">
<!--h2 v-if="selectedTaskType"
class="task-name">
{{ selectedTaskType.name }}
</h2>
<span v-if="selectedTaskType"
class="task-description">
{{ selectedTaskType.description }}
</span-->
<AssistantFormInputs v-if="selectedTaskType"
:inputs.sync="myInputs"
:selected-task-id="selectedTaskId"
Expand Down
19 changes: 16 additions & 3 deletions src/components/TaskTypeSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@click="onTaskSelected(t)">
{{ t.name }}
</NcButton>
<NcActions v-if="actionTypes.length > 0"
<NcActions v-if="!onlyInline && actionTypes.length > 0"
:force-menu="true"
:container="$refs.taskTypeSelect">
<NcActionButton v-for="(t, i) in actionTypes"
Expand Down Expand Up @@ -49,9 +49,13 @@ export default {
type: Array,
required: true,
},
/**
* Number of inline elements
* All elements are inline if this prop is null
*/
inline: {
type: Number,
default: 3,
type: [Number, null],
default: null,
},
},

Expand All @@ -66,7 +70,13 @@ export default {
},

computed: {
onlyInline() {
return this.inline === null
},
buttonTypes() {
if (this.onlyInline) {
return this.options
}
// extra button replaces the last one
if (this.extraButtonType !== null) {
const types = this.options.slice(0, this.inline - 1)
Expand Down Expand Up @@ -104,6 +114,9 @@ export default {

methods: {
moveSelectedIfInMenu() {
if (this.onlyInline) {
return
}
// if the initially selected value is in the dropdown, get it out
const selectedAction = this.actionTypes.find(a => a.id === this.value)
if (this.actionTypes.find(a => a.id === this.value)) {
Expand Down
Loading