web/admin: default FlowStageBinding's order to 0
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
		| @ -87,7 +87,7 @@ export class FlowForm extends Form<Flow> { | ||||
|                 <p class="pf-c-form__helper-text">${t`Shown as the Title in Flow pages.`}</p> | ||||
|             </ak-form-element-horizontal> | ||||
|             <ak-form-element-horizontal | ||||
|                 label=${t`Name`} | ||||
|                 label=${t`Slug`} | ||||
|                 ?required=${true} | ||||
|                 name="slug"> | ||||
|                 <input type="text" value="${ifDefined(this.flow?.slug)}" class="pf-c-form-control" required> | ||||
|  | ||||
| @ -41,6 +41,7 @@ export class StageBindingForm extends Form<FlowStageBinding> { | ||||
|  | ||||
|     groupStages(stages: Stage[]): TemplateResult { | ||||
|         return html` | ||||
|             <option value="">---------</option> | ||||
|             ${groupBy<Stage>(stages, (s => s.verboseName || "")).map(([group, stages]) => { | ||||
|                 return html`<optgroup label=${group}> | ||||
|                     ${stages.map(stage => { | ||||
| @ -60,6 +61,9 @@ export class StageBindingForm extends Form<FlowStageBinding> { | ||||
|             target: this.targetPk || "", | ||||
|         }).then(bindings => { | ||||
|             const orders = bindings.results.map(binding => binding.order); | ||||
|             if (orders.length < 1) { | ||||
|                 return 0; | ||||
|             } | ||||
|             return Math.max(...orders) + 1; | ||||
|         }); | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Jens Langhammer
					Jens Langhammer