From 667a154b734da070ae12851bb27672c5fc19d4e8 Mon Sep 17 00:00:00 2001 From: Fred Baguelin Date: Thu, 25 Jan 2024 01:06:08 +0100 Subject: [PATCH] Forward to path directly --- src/components/NewObject.vue | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/components/NewObject.vue b/src/components/NewObject.vue index f30f9fc..1ff45ea 100644 --- a/src/components/NewObject.vue +++ b/src/components/NewObject.vue @@ -51,6 +51,11 @@ export default { entity: "entities", observable: "observables/extended", indicator: "indicators" + }, + typeToSavedObjectPath: { + entity: "entities", + observable: "observables", + indicator: "indicators" } }; }, @@ -75,23 +80,7 @@ export default { }) .then(response => { this.$eventBus.emit("displayMessage", { message: `New ${this.objectType} created`, status: "success" }); - let _name = ""; - if (response.data.root_type == "entity") - { - _name = "EntityDetails"; - } - else if (response.data.root_type == "indicator") - { - _name = "IndicatorDetails"; - } - else if (response.data.root_type == "observable") - { - _name = "ObservableDetails"; - } - this.$router.push({ - name: _name, - params: { id: response.data.id, type: response.data.type } - }); + this.$router.push({ path: `/${this.typeToSavedObjectPath[this.newObject.root_type]}/${response.data.id}` }); }) .catch(error => { console.log(error); @@ -134,7 +123,6 @@ export default { { return "unknown"; } -// return ENTITY_TYPES.find(t => t.type === this.objectType) ? "entity" : "indicator"; } } };