Skip to content
Closed
Show file tree
Hide file tree
Changes from 57 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
8cf31ee
Merge pull request #1 from apache/master
apurv-1 Apr 21, 2021
72ade9e
Merge branch 'apache:master' into master
apurv-1 May 19, 2021
e02f0af
Merge branch 'apache:master' into master
apurv-1 May 31, 2021
cd75136
Merge branch 'apache:master' into master
apurv-1 Jun 7, 2021
51f7d96
initialized vue-shortkey, new mutation type
apurv-1 Jun 10, 2021
8994d50
fix: toggle showshortkey
apurv-1 Jun 11, 2021
98d61e7
toggle show shortkeys with 'f'
apurv-1 Jun 17, 2021
a820ec9
added more shortkeys
apurv-1 Jun 17, 2021
9fbf02b
new: shortkey on breadcrumb
apurv-1 Jun 21, 2021
5f8f1b7
added more shortkeys
apurv-1 Jun 22, 2021
c323e2d
fix: minor bugs
apurv-1 Jun 22, 2021
9e0bb11
Merge branch 'apache:main' into main
apurv-1 Jun 22, 2021
a74b904
fix: side menu collapsed shortkeys
apurv-1 Jun 23, 2021
6dec8c5
auto disable shortkeys on forms
apurv-1 Jun 25, 2021
dccd4fc
updated
apurv-1 Jun 29, 2021
2df05c5
added more shortkeys
apurv-1 Jun 30, 2021
8433191
Update .env.local.example
apurv-1 Jun 30, 2021
265d9b6
complete: shortkeys on s-menu
apurv-1 Jul 2, 2021
f27778b
Merge branch 'keyboard-label-shortcut' of https://github.com/apurv-1/…
apurv-1 Jul 2, 2021
d46b715
Update DeployVM.vue
apurv-1 Jul 2, 2021
384c41d
Merge branch 'keyboard-label-shortcut' of https://github.com/apurv-1/…
apurv-1 Jul 2, 2021
b48d951
ready for review
apurv-1 Jul 2, 2021
5de4c91
Update DeployVM.vue
apurv-1 Jul 2, 2021
23acfc5
Revert "Update DeployVM.vue"
apurv-1 Jul 2, 2021
23e62fd
Revert "Update DeployVM.vue"
apurv-1 Jul 2, 2021
153875d
revert deployVm.vue
apurv-1 Jul 2, 2021
b877b37
fix: replace alt with shift
apurv-1 Jul 7, 2021
a565739
uninstalled vue-shortkeys, added custom-event-polyfill & element-matches
apurv-1 Jul 16, 2021
8c671ef
new: shortkey lib with multiple character combination
apurv-1 Jul 16, 2021
0d79c1e
Merge branch 'apache:main' into main
apurv-1 Jul 17, 2021
9a9125f
new: shortkeys, updated keys
apurv-1 Jul 21, 2021
45c688f
Merge branch 'apache:main' into main
apurv-1 Jul 21, 2021
43d42b0
resolved conflicts
apurv-1 Jul 21, 2021
13ed9ed
fix: keypress bug, button styles
apurv-1 Jul 21, 2021
b317823
fix: Navigation duplicate error, duplicate shortkeys
apurv-1 Jul 27, 2021
ec1d09b
fix: sidemItem via shortkey without expanding submenu
apurv-1 Aug 2, 2021
0382f2b
Merge branch 'apache:main' into main
apurv-1 Aug 4, 2021
9dee13b
fix: hidden action button bug
apurv-1 Aug 4, 2021
5fc9342
Merge branch 'main' of https://github.com/apurv-1/cloudstack into key…
apurv-1 Aug 4, 2021
ac13f4f
new: shortkey for tools
apurv-1 Aug 4, 2021
78e90c7
new: shortkey for dashboard
apurv-1 Aug 16, 2021
11e2366
Merge branch 'apache:main' into main
apurv-1 Aug 16, 2021
7951227
fix: merge conflicts & shortkey buttons
apurv-1 Aug 16, 2021
c56f75c
feat: backspace
apurv-1 Aug 19, 2021
456bbcb
fix: duplicates removed
apurv-1 Aug 20, 2021
e2e9679
new: update shortkeys
apurv-1 Aug 20, 2021
8d275f0
fix: backspace to newtab
apurv-1 Aug 20, 2021
b326fe5
Merge branch 'apache:main' into main
apurv-1 Aug 31, 2021
af961e8
resolved merge conflicts
apurv-1 Aug 31, 2021
0b4092d
Merge branch 'apache:main' into main
apurv-1 Nov 9, 2021
29e4bae
Merge branch 'apache:main' into main
apurv-1 Nov 18, 2021
9db704d
fix: merge conflicts
apurv-1 Jan 4, 2022
a7e38a7
Merge branch 'main' into keyboard-label-shortcut
apurv-1 Jan 4, 2022
5e5fb14
Merge branch 'apache:main' into main
apurv-1 Feb 7, 2022
ddc15d9
new/fix: shortkeys, collapse menu
apurv-1 Feb 8, 2022
60d8288
fix: conflits
apurv-1 Feb 8, 2022
656ea2a
Merge branch 'main' into keyboard-label-shortcut
apurv-1 Mar 6, 2022
4fe95bf
Merge branch 'apache:main' into main
apurv-1 Mar 20, 2022
f21f7de
Merge branch 'apache:main' into main
apurv-1 Apr 5, 2022
f7d5565
Merge branch 'apache:main' into main
apurv-1 Jun 23, 2022
37b30ae
fix: conflicts
apurv-1 Jun 23, 2022
1536847
fix: build errors
apurv-1 Jun 23, 2022
7c7a0d2
Merge branch 'main' into keyboard-label-shortcut
shwstppr Apr 12, 2023
a358c8a
partial fix
shwstppr Apr 12, 2023
b39cd0d
fix menu shortkey
shwstppr Apr 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13,281 changes: 4,670 additions & 8,611 deletions ui/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"axios": "^0.21.1",
"babel-plugin-require-context-hook": "^1.0.0",
"core-js": "^3.6.5",
"custom-event-polyfill": "^1.0.7",
"element-matches": "^0.1.2",
"enquire.js": "^2.1.6",
"js-cookie": "^2.2.1",
"lodash": "^4.17.15",
Expand Down
1 change: 1 addition & 0 deletions ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@
"label.key": "Key",
"label.keyboard": "Keyboard language",
"label.keyboardtype": "Keyboard type",
"label.keyboard.show": "Show Shortkeys [F]",
"label.keypair": "SSH Key Pair",
"label.keypairs": "SSH Key Pair(s)",
"label.kubeconfig.cluster": "Kubernetes Cluster Config",
Expand Down
16 changes: 16 additions & 0 deletions ui/src/components/header/Logo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
height: $config.theme['@logo-height']
}"
:src="$config.logo"
v-shortkey="['f']"
@shortkey="toggleShowShortkey"
class="logo-image" />
<span class="none" v-shortkey="['backspace']" @shortkey="goBack"></span>
</div>
</template>

Expand All @@ -45,6 +48,16 @@ export default {
default: true,
required: false
}
},
methods: {
toggleShowShortkey () {
this.$store.dispatch('SetShowKeyboardShortkeys', !this.$store.getters.showshortkeys)
},
goBack () {
if (this.$route.path.includes('/')) {
this.$router.go(-1)
}
}
}
}
</script>
Expand All @@ -67,5 +80,8 @@ export default {
display: inline-block;
vertical-align: middle;
}
.none {
display: none;
}

</style>
19 changes: 14 additions & 5 deletions ui/src/components/header/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

<template>
<div class="user-menu">

<translation-menu class="action"/>
<header-notice class="action"/>
<label class="user-menu-server-info action" v-if="$config.multipleServer">
Expand All @@ -43,18 +42,25 @@
<a @click="toggleUseBrowserTimezone">
<a-icon class="user-menu-item-icon" type="clock-circle"/>
<span class="user-menu-item-name" style="margin-right: 5px">{{ $t('label.use.local.timezone') }}</span>
<a-switch
:checked="$store.getters.usebrowsertimezone" />
<a-switch :checked="$store.getters.usebrowsertimezone"/>
</a>
</a-menu-item>
<a-menu-item class="user-menu-item" key="2">
<a @click="toggleShowShortkey">
<a-icon v-if="$store.getters.showshortkeys" class="user-menu-item-icon" type="eye"/>
<a-icon v-else class="user-menu-item-icon" type="eye-invisible"/>
<span class="user-menu-item-name" style="margin-right: 5px">{{ $t('label.keyboard.show') }}</span>
<a-switch :checked="$store.getters.showshortkeys"/>
</a>
</a-menu-item>
<a-menu-item class="user-menu-item" key="2" disabled>
<a-menu-item class="user-menu-item" key="3" disabled>
<a :href="$config.docBase" target="_blank">
<a-icon class="user-menu-item-icon" type="question-circle-o"></a-icon>
<span class="user-menu-item-name">{{ $t('label.help') }}</span>
</a>
</a-menu-item>
<a-menu-divider/>
<a-menu-item class="user-menu-item" key="3">
<a-menu-item class="user-menu-item" key="4">
<a href="javascript:;" @click="handleLogout">
<a-icon class="user-menu-item-icon" type="logout"/>
<span class="user-menu-item-name">{{ $t('label.logout') }}</span>
Expand Down Expand Up @@ -116,6 +122,9 @@ export default {
toggleUseBrowserTimezone () {
this.$store.dispatch('SetUseBrowserTimezone', !this.$store.getters.usebrowsertimezone)
},
toggleShowShortkey () {
this.$store.dispatch('SetShowKeyboardShortkeys', !this.$store.getters.showshortkeys)
},
async getIcon () {
await this.fetchResourceIcon(this.$store.getters.userInfo.id)
},
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/menu/SideMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<template>
<a-layout-sider
:class="['sider', isDesktop() ? null : 'shadow', theme, fixSiderbar ? 'ant-fixed-sidemenu' : null ]"
width="256px"
width="265px"
:collapsible="collapsible"
v-model="collapsed"
:trigger="null">
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
// specific language governing permissions and limitations
// under the License.

import SMenu from './menu'
import SMenu from './menu.vue'
export default SMenu
71 changes: 67 additions & 4 deletions ui/src/components/menu/menu.js → ui/src/components/menu/menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
<script>

import Menu from 'ant-design-vue/es/menu'
import Icon from 'ant-design-vue/es/icon'
Expand Down Expand Up @@ -122,11 +123,41 @@ export default {
to: { name: menu.name },
target: target
}
const on = {
shortkey: () => {
const show = this.$store.getters.showshortkeys
if (this.cachedPath === menu.path) {
return
}

if (menu.path) {
this.cachedPath = menu.path
setTimeout(() => {
this.$store.dispatch('SetShowKeyboardShortkeys', false)
this.$router.push({ path: menu.path })
})
}
setTimeout(() => this.$store.dispatch('SetShowKeyboardShortkeys', show), 500)
}
}
return (
<Item {...{ key: menu.path }}>
<Item vShortkey={menu.meta.shortKey} {...{ key: menu.path, on: on }} >
<router-link {...{ props }}>
{this.renderIcon(menu.meta.icon, menu)}
<span>{this.$t(menu.meta.title)}</span>
{
this.$store.getters.showshortkeys ? (
menu.meta.shortKey ? (
<span class="show-shortkey">
{menu.meta.shortKey[0]}{menu.meta.shortKey[1] ? '+' + menu.meta.shortKey[1] : ''}
</span>
) : (
''
)
) : (
''
)
}
</router-link>
</Item>
)
Expand All @@ -136,6 +167,9 @@ export default {
const on = {
click: () => {
this.handleClickParentMenu(menu)
},
shortkey: () => {
this.handleClickParentMenu(menu)
}
}
if (!menu.hideChildrenInMenu) {
Expand All @@ -145,7 +179,20 @@ export default {
<SubMenu {...{ key: menu.path }}>
<span slot="title">
{this.renderIcon(menu.meta.icon, menu)}
<span {...{ on: on }}>{this.$t(menu.meta.title)}</span>
<span vShortkey={menu.meta.shortKey} {...{ on: on }}>{this.$t(menu.meta.title)}</span>
{
this.$store.getters.showshortkeys ? (
menu.meta.shortKey ? (
<span class="show-shortkey">
{menu.meta.shortKey[0]}{menu.meta.shortKey[1] ? '+' + menu.meta.shortKey[1] : ''}
</span>
) : (
''
)
) : (
''
)
}
</span>
{itemArr}
</SubMenu>
Expand Down Expand Up @@ -190,7 +237,6 @@ export default {
},
openChange: this.onOpenChange
}

const menuTree = menu.map(item => {
if (item.hidden) {
return null
Expand All @@ -199,9 +245,26 @@ export default {
})
// {...{ props, on: on }}
return (
<Menu vModel={this.selectedKeys} {...{ props, on: on }}>
<Menu vModel={this.selectedKeys} {...{ props, on }} >
{menuTree}
</Menu>
)
}
}
</script>
<style scoped>
.show-shortkey {
font-size: 10px;
background-color: rgba(0, 0, 0, 0.9);
padding: 2px 6px 2px 6px;
border-radius: 4px;
color: #e9e9e9;
margin: 5px;
border: solid .1em transparent;
text-shadow: 2px 2px 2px rgba(255,255,255,0.1);
box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.8), -1px -1px 1px rgba(0, 0, 0, 0.9);
}
.none {
display: none;
}
</style>
1 change: 1 addition & 0 deletions ui/src/components/page/GlobalHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default {
},
toggle () {
this.$emit('toggle')
this.$store.dispatch('SetShowKeyboardShortkeys', false)
}
}
}
Expand Down
19 changes: 18 additions & 1 deletion ui/src/components/view/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@
:shape="!dataView && action.icon === 'plus' ? 'round' : 'circle'"
style="margin-left: 5px"
:size="size"
v-shortkey="action.shortKey"
@shortkey="execAction(action)"
@click="execAction(action)">
<span v-if="!dataView && action.icon === 'plus'">
{{ $t(action.label) }}
</span>
<a-icon v-if="(typeof action.icon === 'string')" :type="action.icon" />
<font-awesome-icon v-else :icon="action.icon" />
<span class="view-shortkey" v-if="$store.getters.showshortkeys">{{ action.shortKey.length ? action.shortKey[0] : '' }}</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<span class="view-shortkey" v-if="$store.getters.showshortkeys">{{ action.shortKey.length ? action.shortKey[0] : '' }}</span>
<span class="view-shortkey" v-if="$store.getters.showshortkeys && action.shortKey">{{ action.shortKey.length ? action.shortKey[0] : '' }}</span>

</a-button>
</a-badge>
<a-button
Expand All @@ -65,12 +68,15 @@
:shape="!dataView && ['plus', 'user-add'].includes(action.icon) ? 'round' : 'circle'"
style="margin-left: 5px"
:size="size"
v-shortkey="action.shortKey"
@shortkey="execAction(action)"
@click="execAction(action)">
<span v-if="!dataView && ['plus', 'user-add'].includes(action.icon)">
{{ $t(action.label) }}
</span>
<a-icon v-if="(typeof action.icon === 'string')" :type="action.icon" />
<font-awesome-icon v-else :icon="action.icon" />
<span class="view-shortkey" v-if="$store.getters.showshortkeys">{{ action.shortKey.length ? action.shortKey[0] : '' }}</span>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<span class="view-shortkey" v-if="$store.getters.showshortkeys">{{ action.shortKey.length ? action.shortKey[0] : '' }}</span>
<span class="view-shortkey" v-if="$store.getters.showshortkeys && action.shortKey">{{ action.shortKey.length ? action.shortKey[0] : '' }}</span>

</a-button>
</a-tooltip>
</span>
Expand Down Expand Up @@ -200,7 +206,18 @@ export default {
.button-action-badge {
margin-left: 5px;
}

.view-shortkey {
position: absolute;
bottom: 20px;
right: 5px;
font-size: 10px;
background-color: rgba(0, 0, 0, 0.9);
padding: 2px 6px 2px 6px;
border-radius: 4px;
color: #e9e9e9;
margin: 5px;
box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.5), -1px 0px 3px rgba(0, 0, 0, 0.9);
}
/deep/.button-action-badge .ant-badge-count {
right: 10px;
z-index: 8;
Expand Down
5 changes: 5 additions & 0 deletions ui/src/config/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ function generateRouterMap (section) {
meta: {
title: section.title,
icon: section.icon,
shortKey: section.shortKey,
docHelp: Vue.prototype.$applyDocHelpMappings(section.docHelp),
searchFilters: section.searchFilters,
related: section.related
Expand All @@ -70,6 +71,7 @@ function generateRouterMap (section) {
title: child.title,
name: child.name,
icon: child.icon,
shortKey: child.shortKey,
docHelp: Vue.prototype.$applyDocHelpMappings(child.docHelp),
permission: child.permission,
resourceType: child.resourceType,
Expand All @@ -92,6 +94,7 @@ function generateRouterMap (section) {
title: child.title,
name: child.name,
icon: child.icon,
shortKey: child.shortKey,
docHelp: Vue.prototype.$applyDocHelpMappings(child.docHelp),
permission: child.permission,
resourceType: child.resourceType,
Expand Down Expand Up @@ -147,6 +150,7 @@ function generateRouterMap (section) {
title: section.title,
name: section.name,
icon: section.icon,
shortKey: section.shortKey,
docHelp: Vue.prototype.$applyDocHelpMappings(section.docHelp),
hidden: section.hidden,
permission: section.permission,
Expand Down Expand Up @@ -199,6 +203,7 @@ export function asyncRouterMap () {
meta: {
title: 'label.dashboard',
icon: 'dashboard',
shortKey: ['shift', 'd'],
tabs: [
{
name: 'dashboard',
Expand Down
1 change: 1 addition & 0 deletions ui/src/config/section/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default {
name: 'account',
title: 'label.accounts',
icon: 'team',
shortKey: ['shift', 'a'],
docHelp: 'adminguide/accounts.html',
permission: ['listAccounts'],
columns: ['name', 'state', 'rolename', 'roletype', 'domainpath'],
Expand Down
Loading