From 8b962b5c30309bddca90f685727d47e399f035c4 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 5 Oct 2022 12:44:26 +0200 Subject: [PATCH] Transition to exported/imported based on peer type --- .../app/controllers/dc/peers/edit/index.js | 15 +++++++++++++++ .../app/templates/dc/peers/edit/index.hbs | 9 +++------ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js diff --git a/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js b/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js new file mode 100644 index 0000000000..d262ef02be --- /dev/null +++ b/ui/packages/consul-peerings/app/controllers/dc/peers/edit/index.js @@ -0,0 +1,15 @@ +import Controller from "@ember/controller"; +import { inject as service } from "@ember/service"; +import { action } from "@ember/object"; + +export default class DcPeersEditIndexController extends Controller { + @service router; + + @action transitionToStartSubRouteByType(peerModel) { + if (peerModel.isDialer) { + this.router.replaceWith("dc.peers.edit.exported"); + } else { + this.router.replaceWith("dc.peers.edit.imported"); + } + } +} diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs index 40663165a2..75042b4395 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/edit/index.hbs @@ -1,6 +1,3 @@ - - {{did-insert (route-action 'replaceWith' 'dc.peers.edit.addresses')}} - - + + {{did-insert (fn this.transitionToStartSubRouteByType route.model.peer)}} + \ No newline at end of file