Skip to content

Commit 2287be3

Browse files
committed
feat(fe): return to view from template
1 parent 2159899 commit 2287be3

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

api/tasks/runner_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ func TestTaskGetPlaybookArgs(t *testing.T) {
118118
}
119119

120120
res := strings.Join(args, " ")
121-
if res != "-i /tmp/inventory_0 --private-key=/tmp/access_key_12345 --extra-vars {} test.yml" {
121+
if res != "-i /tmp/inventory_0 --private-key=/tmp/access_key_0 --extra-vars {} test.yml" {
122122
t.Fatal("incorrect result")
123123
}
124124
}
@@ -155,7 +155,7 @@ func TestTaskGetPlaybookArgs2(t *testing.T) {
155155
}
156156

157157
res := strings.Join(args, " ")
158-
if res != "-i /tmp/inventory_0 --extra-vars=@/tmp/access_key_12345 --extra-vars {} test.yml" {
158+
if res != "-i /tmp/inventory_0 --extra-vars=@/tmp/access_key_0 --extra-vars {} test.yml" {
159159
t.Fatal("incorrect result")
160160
}
161161
}
@@ -192,7 +192,7 @@ func TestTaskGetPlaybookArgs3(t *testing.T) {
192192
}
193193

194194
res := strings.Join(args, " ")
195-
if res != "-i /tmp/inventory_0 --extra-vars=@/tmp/access_key_12345 --extra-vars {} test.yml" {
195+
if res != "-i /tmp/inventory_0 --extra-vars=@/tmp/access_key_0 --extra-vars {} test.yml" {
196196
t.Fatal("incorrect result")
197197
}
198198
}

web2/src/router/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ const routes = [
4949
path: '/project/:projectId/templates/:templateId',
5050
component: TemplateView,
5151
},
52+
{
53+
path: '/project/:projectId/views/:viewId/templates/:templateId',
54+
component: TemplateView,
55+
},
5256
{
5357
path: '/project/:projectId/environment',
5458
component: Environment,

web2/src/views/project/TemplateView.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@
5757
<v-toolbar-title class="breadcrumbs">
5858
<router-link
5959
class="breadcrumbs__item breadcrumbs__item--link"
60-
:to="`/project/${projectId}/templates/`"
61-
>Task Templates
62-
</router-link>
60+
:to="viewId
61+
? `/project/${projectId}/views/${viewId}/templates/`
62+
: `/project/${projectId}/templates/`"
63+
>Task Templates</router-link>
6364
<v-icon>mdi-chevron-right</v-icon>
6465
<span class="breadcrumbs__item">{{ item.alias }}</span>
6566
</v-toolbar-title>
@@ -220,6 +221,13 @@ export default {
220221
},
221222
222223
computed: {
224+
viewId() {
225+
if (/^-?\d+$/.test(this.$route.params.viewId)) {
226+
return parseInt(this.$route.params.viewId, 10);
227+
}
228+
return this.$route.params.viewId;
229+
},
230+
223231
itemId() {
224232
if (/^-?\d+$/.test(this.$route.params.templateId)) {
225233
return parseInt(this.$route.params.templateId, 10);

web2/src/views/project/Templates.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@
122122
{{ TEMPLATE_TYPE_ICONS[item.type] }}
123123
</v-icon>
124124
<router-link
125-
:to="`/project/${projectId}/templates/${item.id}`">{{ item.alias }}
126-
</router-link>
125+
:to="viewId
126+
? `/project/${projectId}/views/${viewId}/templates/${item.id}`
127+
: `/project/${projectId}/templates/${item.id}`"
128+
>{{ item.alias }}</router-link>
127129
</template>
128130

129131
<template v-slot:item.version="{ item }">

0 commit comments

Comments
 (0)