Skip to content

Commit 9b5c0a8

Browse files
config: dynamic doc links for views
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 63e6173 commit 9b5c0a8

File tree

6 files changed

+34
-8
lines changed

6 files changed

+34
-8
lines changed

ui/src/components/header/UserMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</router-link>
4040
</a-menu-item>
4141
<a-menu-item class="user-menu-item" key="3" disabled>
42-
<a :href="helpUrl" target="_blank">
42+
<a :href="docBase" target="_blank">
4343
<a-icon class="user-menu-item-icon" type="question-circle-o"></a-icon>
4444
<span class="user-menu-item-name">Help</span>
4545
</a>
@@ -70,7 +70,7 @@ export default {
7070
},
7171
data () {
7272
return {
73-
helpUrl: config.helpUrl
73+
docBase: config.docBase
7474
}
7575
},
7676
methods: {

ui/src/components/widgets/Breadcrumb.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
<template>
1919
<a-breadcrumb class="breadcrumb">
2020
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
21+
<a
22+
v-if="item.meta.docHelp"
23+
style="margin-right: 5px"
24+
:href="docBase + '/' + item.meta.docHelp"
25+
target="_blank">
26+
<a-icon type="question-circle-o"></a-icon>
27+
</a>
2128
<router-link
2229
v-if="item && item.name"
2330
:to="{ path: item.path === '' ? '/' : item.path }"
@@ -51,15 +58,15 @@
5158
</template>
5259

5360
<script>
61+
import config from '@/config/settings'
5462
5563
export default {
5664
name: 'Breadcrumb',
57-
components: {
58-
},
5965
data () {
6066
return {
6167
name: '',
62-
breadList: []
68+
breadList: [],
69+
docBase: config.docBase
6370
}
6471
},
6572
created () {

ui/src/config/router.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function generateRouterMap (section) {
3636
name: section.name,
3737
path: '/' + section.name,
3838
hidden: section.hidden,
39-
meta: { title: section.title, keepAlive: true, icon: section.icon },
39+
meta: { title: section.title, keepAlive: true, icon: section.icon, docHelp: section.docHelp },
4040
component: RouteView
4141
}
4242

@@ -54,6 +54,7 @@ export function generateRouterMap (section) {
5454
name: child.name,
5555
keepAlive: true,
5656
icon: child.icon,
57+
docHelp: child.docHelp,
5758
permission: child.permission,
5859
resourceType: child.resourceType,
5960
params: child.params ? child.params : {},
@@ -117,6 +118,7 @@ export function generateRouterMap (section) {
117118
name: section.name,
118119
keepAlive: true,
119120
icon: section.icon,
121+
docHelp: section.docHelp,
120122
permission: section.permission,
121123
resourceType: section.resourceType,
122124
params: section.params ? section.params : {},

ui/src/config/section/compute.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
name: 'vm',
2525
title: 'Instances',
2626
icon: 'desktop',
27+
docHelp: 'adminguide/virtual_machines.html',
2728
permission: ['listVirtualMachinesMetrics', 'listVirtualMachines'],
2829
resourceType: 'UserVm',
2930
columns: [
@@ -76,6 +77,7 @@ export default {
7677
api: 'startVirtualMachine',
7778
icon: 'caret-right',
7879
label: 'Start VM',
80+
docHelp: 'adminguide/virtual_machines.html#stopping-and-starting-vms',
7981
dataView: true,
8082
groupAction: true,
8183
show: (record) => { return ['Stopped'].includes(record.state) },
@@ -85,6 +87,7 @@ export default {
8587
api: 'stopVirtualMachine',
8688
icon: 'stop',
8789
label: 'label.action.stop.instance',
90+
docHelp: 'adminguide/virtual_machines.html#stopping-and-starting-vms',
8891
dataView: true,
8992
groupAction: true,
9093
args: ['id', 'forced'],
@@ -235,6 +238,7 @@ export default {
235238
name: 'vmgroup',
236239
title: 'Instance Groups',
237240
icon: 'gold',
241+
docHelp: 'adminguide/virtual_machines.html#changing-the-vm-name-os-or-group',
238242
permission: ['listInstanceGroups'],
239243
columns: ['name', 'account', 'domain'],
240244
details: ['name', 'id', 'account', 'domain', 'created'],
@@ -271,6 +275,7 @@ export default {
271275
name: 'ssh',
272276
title: 'SSH Key Pairs',
273277
icon: 'key',
278+
docHelp: 'adminguide/virtual_machines.html#using-ssh-keys-for-authentication',
274279
permission: ['listSSHKeyPairs'],
275280
columns: ['name', 'fingerprint', 'account', 'domain'],
276281
details: ['name', 'fingerprint', 'account', 'domain'],
@@ -307,6 +312,7 @@ export default {
307312
name: 'affinitygroup',
308313
title: 'Affinity Groups',
309314
icon: 'swap',
315+
docHelp: 'adminguide/virtual_machines.html#affinity-groups',
310316
permission: ['listAffinityGroups'],
311317
columns: ['name', 'type', 'description', 'account', 'domain'],
312318
details: ['name', 'id', 'description', 'type', 'account', 'domain'],

ui/src/config/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default {
2727
multiTab: false, // enable to have tab/route history stuff
2828
// CloudStack options
2929
apiBase: '/client/api',
30-
helpUrl: 'http://docs.cloudstack.apache.org/en/latest/',
30+
docBase: 'http://docs.cloudstack.apache.org/en/latest',
3131
appTitle: 'CloudStack',
3232
// vue-ls options
3333
storageOptions: {

ui/src/views/AutogenView.vue

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
</keep-alive>
9797
<a-modal
9898
v-else
99-
:title="$t(currentAction.label)"
10099
:visible="showAction"
101100
:closable="true"
102101
style="top: 20px;"
@@ -105,6 +104,16 @@
105104
:confirmLoading="currentAction.loading"
106105
centered
107106
>
107+
<span slot="title">
108+
{{ $t(currentAction.label) }}
109+
<a
110+
v-if="currentAction.docHelp || $route.meta.docHelp"
111+
style="margin-left: 5px"
112+
:href="docBase + '/' + (currentAction.docHelp || $route.meta.docHelp)"
113+
target="_blank">
114+
<a-icon type="question-circle-o"></a-icon>
115+
</a>
116+
</span>
108117
<a-spin :spinning="currentAction.loading">
109118
<a-form
110119
:form="form"
@@ -195,6 +204,7 @@
195204
<script>
196205
import { api } from '@/api'
197206
import { mixinDevice } from '@/utils/mixin.js'
207+
import config from '@/config/settings'
198208
import store from '@/store'
199209
200210
import Breadcrumb from '@/components/widgets/Breadcrumb'
@@ -217,6 +227,7 @@ export default {
217227
data () {
218228
return {
219229
apiName: '',
230+
docBase: config.docBase,
220231
loading: false,
221232
columns: [],
222233
items: [],

0 commit comments

Comments
 (0)