From 16e83b742840abd668734647b07a3eb39ff00fe2 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 8 Sep 2021 15:04:23 -0400 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20redirect=20to=20index?= =?UTF-8?q?=20on=20save=20in=20create-without-read=20case?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scope/host-catalogs/host-catalog/host-sets.js | 14 ++++++++++---- .../scope/host-catalogs/host-catalog/hosts.js | 12 ++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js index 36d341bc4..d70b5dab0 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/host-sets.js @@ -59,10 +59,16 @@ export default class ScopesScopeHostCatalogsHostCatalogHostSetsRoute extends Rou ) async save(hostSet) { await hostSet.save(); - await this.transitionTo( - 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set', - hostSet - ); + if (this.can.can('read model', hostSet)) { + await this.transitionTo( + 'scopes.scope.host-catalogs.host-catalog.host-sets.host-set', + hostSet + ); + } else { + await this.transitionTo( + 'scopes.scope.host-catalogs.host-catalog.host-sets' + ); + } this.refresh(); } diff --git a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js index 5969a8b67..cb91be6ed 100644 --- a/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js +++ b/ui/admin/app/routes/scopes/scope/host-catalogs/host-catalog/hosts.js @@ -58,10 +58,14 @@ export default class ScopesScopeHostCatalogsHostCatalogHostsRoute extends Route ) async save(host) { await host.save(); - await this.transitionTo( - 'scopes.scope.host-catalogs.host-catalog.hosts.host', - host - ); + if (this.can.can('read model', host)) { + await this.transitionTo( + 'scopes.scope.host-catalogs.host-catalog.hosts.host', + host + ); + } else { + await this.transitionTo('scopes.scope.host-catalogs.host-catalog.hosts'); + } this.refresh(); }