diff --git a/app/components/report-row/component.js b/app/components/report-row/component.js index a117f90ae..2287894e6 100644 --- a/app/components/report-row/component.js +++ b/app/components/report-row/component.js @@ -1,6 +1,7 @@ import { action } from "@ember/object"; import { inject as service } from "@ember/service"; import Component from "@glimmer/component"; +import { dropTask } from "ember-concurrency"; import ReportValidations from "timed/validations/report"; export default class ReportRowComponent extends Component { @@ -26,9 +27,11 @@ export default class ReportRowComponent extends Component { * @method save * @public */ - @action - save(changeset) { - this.args.onSave(changeset); + @dropTask + *save(changeset) { + if (this.args.onSave) { + yield this.args.onSave(changeset); + } } /** * Delete the row diff --git a/app/components/report-row/template.hbs b/app/components/report-row/template.hbs index fd3e0df07..50039414b 100644 --- a/app/components/report-row/template.hbs +++ b/app/components/report-row/template.hbs @@ -109,8 +109,8 @@ type="submit" data-test-save-report class="btn btn-primary" - disabled={{and (not cs.isNew) (or (not cs.isDirty) (not cs.isValid))}} - {{on "click" (prevent-default (fn (optional @onSave) cs))}} + disabled={{or this.save.isRunning (and (not cs.isNew) (or (not cs.isDirty) (not cs.isValid)))}} + {{on "click" (prevent-default (perform this.save cs))}} > {{/if}}