From b2b28a37e831cca82a142d2c7d4bd985435ea125 Mon Sep 17 00:00:00 2001 From: Julien WITTOUCK Date: Thu, 19 Mar 2020 19:16:40 +0100 Subject: [PATCH] :recycle: : move stack creation route to stack pages --- .../client/app/pages/modules/modules-routes.js | 9 --------- src/main/client/app/pages/modules/modules.vue | 16 +++++++++++++++- .../client/app/pages/stacks/stack-creation.vue | 14 +++++++++++++- src/main/client/app/pages/stacks/stack.vue | 5 +---- .../client/app/pages/stacks/stacks-routes.js | 10 ++++++++++ 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/main/client/app/pages/modules/modules-routes.js b/src/main/client/app/pages/modules/modules-routes.js index 44a1232cb..864c495b8 100644 --- a/src/main/client/app/pages/modules/modules-routes.js +++ b/src/main/client/app/pages/modules/modules-routes.js @@ -35,15 +35,6 @@ const modulesRoutes = [ breadcrumb: [{ text: 'Modules', to: { name: 'modules' } }, { text: 'Module description' }], }, }, - { - path: '/modules/:moduleId/run', - name: 'module-run', - component: () => import(/* webpackChunkName: "chunk-modules" */ '@/pages/stacks/stack-creation.vue'), - meta: { - authorities: ['ROLE_USER'], - breadcrumb: [{ text: 'Modules', to: { name: 'modules' } }, { text: 'Stack creation' }], - }, - }, ]; export default modulesRoutes; diff --git a/src/main/client/app/pages/modules/modules.vue b/src/main/client/app/pages/modules/modules.vue index d96713392..4ab1548cb 100644 --- a/src/main/client/app/pages/modules/modules.vue +++ b/src/main/client/app/pages/modules/modules.vue @@ -50,10 +50,10 @@ @@ -66,6 +66,8 @@ import axios from 'axios'; import { AppCliBadge } from '@/shared/components'; + import { v4 as uuidv4 } from 'uuid'; + export default { name: 'AppModules', @@ -84,5 +86,17 @@ this.modules = response.data; }, + methods: { + async createStack(moduleId) { + await this.$router.push({ + name: 'stack_creation', + params: { + stackId: uuidv4(), + moduleId, + }, + }); + }, + }, + }; diff --git a/src/main/client/app/pages/stacks/stack-creation.vue b/src/main/client/app/pages/stacks/stack-creation.vue index 0691e2c5b..15f9fe4bf 100644 --- a/src/main/client/app/pages/stacks/stack-creation.vue +++ b/src/main/client/app/pages/stacks/stack-creation.vue @@ -101,6 +101,17 @@ AppStackVariable, }, + props: { + moduleId: { + type: String, + required: true, + }, + stackId: { + type: String, + required: true, + }, + }, + data() { return { module: null, @@ -116,10 +127,11 @@ }, async created() { - const result = await axios.get(`/api/modules/${this.$route.params.moduleId}`); + const result = await axios.get(`/api/modules/${this.moduleId}`); this.module = result.data; this.stack = {}; + this.stack.id = this.stackId; this.stack.moduleId = this.module.id; this.stack.variableValues = {}; this.stack.variables = this.module.variables.map((variable) => ({ diff --git a/src/main/client/app/pages/stacks/stack.vue b/src/main/client/app/pages/stacks/stack.vue index c03797c76..e1befda35 100644 --- a/src/main/client/app/pages/stacks/stack.vue +++ b/src/main/client/app/pages/stacks/stack.vue @@ -1,8 +1,5 @@