FIX: The dialog service usage

This commit is contained in:
Jarek Radosz 2023-01-16 11:22:14 +01:00
parent eb3751bd83
commit a6260a5270
1 changed files with 14 additions and 13 deletions

View File

@ -2,8 +2,11 @@ import Repo from "discourse/plugins/docker_manager/discourse/models/repo";
import Controller from "@ember/controller";
import { equal } from "@ember/object/computed";
import { computed } from "@ember/object";
import { inject as service } from "@ember/service";
export default Controller.extend({
dialog: service(),
output: null,
init() {
@ -118,22 +121,20 @@ export default Controller.extend({
this.dialog.confirm({
message,
didConfirm: (result) => {
if (result) {
if (this.get("multiUpgrade")) {
return Repo.resetAll(
this.get("model").filter((repo) => !repo.get("upToDate"))
).finally(() => {
this.reset();
this.updateAttribute("upgrading", false);
});
}
const repo = this.get("model")[0];
repo.resetUpgrade().then(() => {
didConfirm: () => {
if (this.get("multiUpgrade")) {
return Repo.resetAll(
this.get("model").filter((repo) => !repo.get("upToDate"))
).finally(() => {
this.reset();
this.updateAttribute("upgrading", false);
});
}
const repo = this.get("model")[0];
repo.resetUpgrade().then(() => {
this.reset();
});
},
});
},