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

Group tasks and update generated source #27

Merged
merged 5 commits into from
Mar 20, 2023
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
29 changes: 23 additions & 6 deletions lib/assets/task_cell/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ export async function init(ctx, payload) {
options: {
type: Array,
default: [],
required: true,
required: false,
},
optionGroups: {
type: Array,
default: [],
required: false,
},
required: {
type: Boolean,
Expand Down Expand Up @@ -67,6 +72,14 @@ export async function init(ctx, payload) {
:key="option"
:selected="option.value === modelValue"
>{{ option.label }}</option>
<optgroup v-for="optionGroup in optionGroups" :label="optionGroup.label">
<option
v-for="option in optionGroup.options"
:value="option.value || ''"
:key="option"
:selected="option.value === modelValue"
>{{ option.label }}</option>
</optgroup>
</select>
</div>
`,
Expand Down Expand Up @@ -138,7 +151,7 @@ export async function init(ctx, payload) {
:value="fields.task_id"
selectClass="input"
:inline
:options="taskOptions"
:optionGroups="taskOptionGroups"
/>
<div class="variant-container">
<BaseSelect
Expand Down Expand Up @@ -229,9 +242,13 @@ export async function init(ctx, payload) {
isBinaryBackend: payload.is_binary_backend,
missingDep: payload.missing_dep,
fields: payload.fields,
taskOptions: payload.tasks.map((task) => ({
value: task.id,
label: task.label,
tasks: payload.task_groups.flatMap((taskGroup) => taskGroup.tasks),
taskOptionGroups: payload.task_groups.map(({ label, tasks }) => ({
label,
options: tasks.map((task) => ({
value: task.id,
label: task.label,
})),
})),
compilerOptions: [
{ value: "", label: "None" },
Expand All @@ -242,7 +259,7 @@ export async function init(ctx, payload) {

computed: {
selectedTask() {
return payload.tasks.find((task) => task.id === this.fields.task_id);
return this.tasks.find((task) => task.id === this.fields.task_id);
},

selectedVariant() {
Expand Down
Loading