resolve a batch of router deprecations
Dieser Commit ist enthalten in:
Ursprung
31f917ec80
Commit
e6f44b7dfc
10 geänderte Dateien mit 42 neuen und 15 gelöschten Zeilen
|
@ -1,7 +1,10 @@
|
|||
import CustomWizardApi from "../models/custom-wizard-api";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model(params) {
|
||||
if (params.name === "create") {
|
||||
return CustomWizardApi.create({ isNew: true });
|
||||
|
@ -12,7 +15,7 @@ export default DiscourseRoute.extend({
|
|||
|
||||
afterModel(model) {
|
||||
if (model === null) {
|
||||
return this.transitionTo("adminWizardsApi");
|
||||
return this.router.transitionTo("adminWizardsApi");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import CustomWizardApi from "../models/custom-wizard-api";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model() {
|
||||
return CustomWizardApi.list();
|
||||
},
|
||||
|
@ -25,11 +28,11 @@ export default DiscourseRoute.extend({
|
|||
actions: {
|
||||
changeApi(apiName) {
|
||||
this.controllerFor("adminWizardsApi").set("apiName", apiName);
|
||||
this.transitionTo("adminWizardsApiShow", apiName);
|
||||
this.router.transitionTo("adminWizardsApiShow", apiName);
|
||||
},
|
||||
|
||||
afterDestroy() {
|
||||
this.transitionTo("adminWizardsApi").then(() => this.refresh());
|
||||
this.router.transitionTo("adminWizardsApi").then(() => this.refresh());
|
||||
},
|
||||
|
||||
afterSave(apiName) {
|
||||
|
@ -38,7 +41,7 @@ export default DiscourseRoute.extend({
|
|||
|
||||
createApi() {
|
||||
this.controllerFor("adminWizardsApi").set("apiName", "create");
|
||||
this.transitionTo("adminWizardsApiShow", "create");
|
||||
this.router.transitionTo("adminWizardsApiShow", "create");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import CustomWizardLogs from "../models/custom-wizard-logs";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { A } from "@ember/array";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model(params) {
|
||||
return CustomWizardLogs.list(params.wizardId);
|
||||
},
|
||||
|
||||
afterModel(model) {
|
||||
if (model === null) {
|
||||
return this.transitionTo("adminWizardsLogs");
|
||||
return this.router.transitionTo("adminWizardsLogs");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model() {
|
||||
return ajax(`/admin/wizards/wizard`);
|
||||
},
|
||||
|
@ -18,7 +21,7 @@ export default DiscourseRoute.extend({
|
|||
actions: {
|
||||
changeWizard(wizardId) {
|
||||
this.controllerFor("adminWizardsLogs").set("wizardId", wizardId);
|
||||
this.transitionTo("adminWizardsLogsShow", wizardId);
|
||||
this.router.transitionTo("adminWizardsLogsShow", wizardId);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,15 +2,18 @@ import { A } from "@ember/array";
|
|||
import CustomWizardAdmin from "../models/custom-wizard-admin";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { formatModel } from "../lib/wizard-submission";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model(params) {
|
||||
return CustomWizardAdmin.submissions(params.wizardId);
|
||||
},
|
||||
|
||||
afterModel(model) {
|
||||
if (model === null) {
|
||||
return this.transitionTo("adminWizardsSubmissions");
|
||||
return this.router.transitionTo("adminWizardsSubmissions");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model() {
|
||||
return ajax(`/admin/wizards/wizard`);
|
||||
},
|
||||
|
@ -18,7 +21,7 @@ export default DiscourseRoute.extend({
|
|||
actions: {
|
||||
changeWizard(wizardId) {
|
||||
this.controllerFor("adminWizardsSubmissions").set("wizardId", wizardId);
|
||||
this.transitionTo("adminWizardsSubmissionsShow", wizardId);
|
||||
this.router.transitionTo("adminWizardsSubmissionsShow", wizardId);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -2,8 +2,11 @@ import CustomWizardAdmin from "../models/custom-wizard-admin";
|
|||
import { ajax } from "discourse/lib/ajax";
|
||||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import I18n from "I18n";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model(params) {
|
||||
if (params.wizardId === "create") {
|
||||
return { create: true };
|
||||
|
@ -14,7 +17,7 @@ export default DiscourseRoute.extend({
|
|||
|
||||
afterModel(model) {
|
||||
if (model.none) {
|
||||
return this.transitionTo("adminWizardsWizard");
|
||||
return this.router.transitionTo("adminWizardsWizard");
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -4,8 +4,11 @@ import EmberObject, { set } from "@ember/object";
|
|||
import { A } from "@ember/array";
|
||||
import { all } from "rsvp";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model() {
|
||||
return ajax("/admin/wizards/wizard");
|
||||
},
|
||||
|
@ -80,14 +83,14 @@ export default DiscourseRoute.extend({
|
|||
this.controllerFor("adminWizardsWizard").set("wizardId", wizardId);
|
||||
|
||||
if (wizardId) {
|
||||
this.transitionTo("adminWizardsWizardShow", wizardId);
|
||||
this.router.transitionTo("adminWizardsWizardShow", wizardId);
|
||||
} else {
|
||||
this.transitionTo("adminWizardsWizard");
|
||||
this.router.transitionTo("adminWizardsWizard");
|
||||
}
|
||||
},
|
||||
|
||||
afterDestroy() {
|
||||
this.transitionTo("adminWizardsWizard").then(() => this.refresh());
|
||||
this.router.transitionTo("adminWizardsWizard").then(() => this.refresh());
|
||||
},
|
||||
|
||||
afterSave(wizardId) {
|
||||
|
@ -96,7 +99,7 @@ export default DiscourseRoute.extend({
|
|||
|
||||
createWizard() {
|
||||
this.controllerFor("adminWizardsWizard").set("wizardId", "create");
|
||||
this.transitionTo("adminWizardsWizardShow", "create");
|
||||
this.router.transitionTo("adminWizardsWizardShow", "create");
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import DiscourseRoute from "discourse/routes/discourse";
|
||||
import { ajax } from "discourse/lib/ajax";
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default DiscourseRoute.extend({
|
||||
router: service(),
|
||||
|
||||
model() {
|
||||
return ajax("/admin/wizards");
|
||||
},
|
||||
|
@ -17,7 +20,7 @@ export default DiscourseRoute.extend({
|
|||
|
||||
afterModel(model, transition) {
|
||||
if (transition.targetName === "adminWizards.index") {
|
||||
this.transitionTo("adminWizardsWizard");
|
||||
this.router.transitionTo("adminWizardsWizard");
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
@ -30,7 +30,7 @@ export default Route.extend({
|
|||
|
||||
afterModel(model) {
|
||||
if (model.completed) {
|
||||
return this.transitionTo("wizard.index");
|
||||
return this.router.transitionTo("wizard.index");
|
||||
}
|
||||
return model.set("wizardId", this.wizard.id);
|
||||
},
|
||||
|
|
Laden …
In neuem Issue referenzieren