Skip to content

Commit 9f8533e

Browse files
RodrigoDLopezLopez
andauthored
Gives the possibility to redirect to external links when the property is defined (#6505)
Co-authored-by: Lopez <rodrigo@scclouds.com.br>
1 parent 0fe2e69 commit 9f8533e

File tree

5 files changed

+69
-8
lines changed

5 files changed

+69
-8
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,6 +1420,7 @@
14201420
"label.reboot": "Reboot",
14211421
"label.receivedbytes": "Bytes received",
14221422
"label.recover.vm": "Recover VM",
1423+
"label.redirect": "Redirect to:",
14231424
"label.redundantrouter": "Redundant router",
14241425
"label.redundantstate": "Redundant state",
14251426
"label.redundantvpcrouter": "Redundant VPC",

ui/public/locales/pt_BR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1297,7 +1297,9 @@
12971297
"label.reboot": "Reiniciar",
12981298
"label.receivedbytes": "Bytes recebidos",
12991299
"label.recover.vm": "Recuperar VM",
1300-
"label.redundantrouter": "Roteador redundantee",
1300+
"label.redirect": "Clique para acessar:",
1301+
"label.redundantrouter": "Roteador Redundante",
1302+
"label.redundantrouterstate": "Estado redundante",
13011303
"label.redundantstate": "Estado redundante",
13021304
"label.redundantvpcrouter": "VPC redundante",
13031305
"label.refresh": "Atualizar",
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
<template>
19+
<span v-if="$config.plugins.some(item => item.path && item.isExternalLink)">
20+
<span class="action" v-if="$config.plugins.length == 1">
21+
<a-tooltip placement="bottom">
22+
<template #title>
23+
{{ $t('label.redirect') + ' ' + ( $config.plugins[0].name || $config.plugins[0].path) }}
24+
</template>
25+
<a-button shape="circle" >
26+
<a :href=" $config.plugins[0].path" target="_blank">
27+
<img v-if="$config.plugins[0].icon" :src="$config.plugins[0].icon" :style="{height: '24px', padding: '2px', align: 'center'}"/>
28+
<link-outlined v-else/>
29+
</a>
30+
</a-button>
31+
</a-tooltip>
32+
</span>
33+
<a-dropdown v-else-if="$config.plugins.length > 1 && $config.plugins.some(item => item.path && item.isExternalLink)">
34+
<span class="action ant-dropdown-link">
35+
<a-button shape="circle" >
36+
<link-outlined/>
37+
</a-button>
38+
</span>
39+
<template #overlay>
40+
<a-menu class="user-menu-wrapper">
41+
<span v-for="external in $config.plugins" :key="external.isExternalLink">
42+
<a-menu-item v-if="external.path && external.isExternalLink=='true'" :key="external.isExternalLink">
43+
<a :href="external.path" target="_blank">
44+
<img v-if="external.icon" :src="external.icon" :style="{ height: '18px', width: '18px', align: 'center' }"/>
45+
<link-outlined v-else/>
46+
{{ external.name || external.path }}
47+
</a>
48+
</a-menu-item>
49+
</span>
50+
</a-menu>
51+
</template>
52+
</a-dropdown>
53+
</span>
54+
</template>

ui/src/components/header/UserMenu.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
<template>
1919
<div class="user-menu">
20-
20+
<external-link class="action"/>
2121
<translation-menu class="action"/>
2222
<header-notice class="action"/>
2323
<label class="user-menu-server-info action" v-if="$config.multipleServer">
@@ -73,6 +73,7 @@
7373

7474
<script>
7575
import { api } from '@/api'
76+
import ExternalLink from './ExternalLink'
7677
import HeaderNotice from './HeaderNotice'
7778
import TranslationMenu from './TranslationMenu'
7879
import { mapActions, mapGetters } from 'vuex'
@@ -83,6 +84,7 @@ import { SERVER_MANAGER } from '@/store/mutation-types'
8384
export default {
8485
name: 'UserMenu',
8586
components: {
87+
ExternalLink,
8688
TranslationMenu,
8789
HeaderNotice,
8890
ResourceIcon

ui/src/config/router.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,14 @@ export function asyncRouterMap () {
281281
const plugins = vueProps.$config.plugins
282282
if (plugins && plugins.length > 0) {
283283
plugins.map(plugin => {
284-
routerMap[0].children.push({
285-
path: '/plugins/' + plugin.name,
286-
name: plugin.name,
287-
component: IFramePlugin,
288-
meta: { title: plugin.name, icon: plugin.icon, path: plugin.path }
289-
})
284+
if (!plugin.isExternalLink && plugin.path) {
285+
routerMap[0].children.push({
286+
path: '/plugins/' + plugin.name,
287+
name: plugin.name,
288+
component: IFramePlugin,
289+
meta: { title: plugin.name, icon: plugin.icon, path: plugin.path }
290+
})
291+
}
290292
})
291293
}
292294

0 commit comments

Comments
 (0)