-
Notifications
You must be signed in to change notification settings - Fork 1.3k
UI: Keyboard label shortcut #5122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 61 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 72ade9e
Merge branch 'apache:master' into master
apurv-1 e02f0af
Merge branch 'apache:master' into master
apurv-1 cd75136
Merge branch 'apache:master' into master
apurv-1 51f7d96
initialized vue-shortkey, new mutation type
apurv-1 8994d50
fix: toggle showshortkey
apurv-1 98d61e7
toggle show shortkeys with 'f'
apurv-1 a820ec9
added more shortkeys
apurv-1 9fbf02b
new: shortkey on breadcrumb
apurv-1 5f8f1b7
added more shortkeys
apurv-1 c323e2d
fix: minor bugs
apurv-1 9e0bb11
Merge branch 'apache:main' into main
apurv-1 a74b904
fix: side menu collapsed shortkeys
apurv-1 6dec8c5
auto disable shortkeys on forms
apurv-1 dccd4fc
updated
apurv-1 2df05c5
added more shortkeys
apurv-1 8433191
Update .env.local.example
apurv-1 265d9b6
complete: shortkeys on s-menu
apurv-1 f27778b
Merge branch 'keyboard-label-shortcut' of https://github.com/apurv-1/…
apurv-1 d46b715
Update DeployVM.vue
apurv-1 384c41d
Merge branch 'keyboard-label-shortcut' of https://github.com/apurv-1/…
apurv-1 b48d951
ready for review
apurv-1 5de4c91
Update DeployVM.vue
apurv-1 23acfc5
Revert "Update DeployVM.vue"
apurv-1 23e62fd
Revert "Update DeployVM.vue"
apurv-1 153875d
revert deployVm.vue
apurv-1 b877b37
fix: replace alt with shift
apurv-1 a565739
uninstalled vue-shortkeys, added custom-event-polyfill & element-matches
apurv-1 8c671ef
new: shortkey lib with multiple character combination
apurv-1 0d79c1e
Merge branch 'apache:main' into main
apurv-1 9a9125f
new: shortkeys, updated keys
apurv-1 45c688f
Merge branch 'apache:main' into main
apurv-1 43d42b0
resolved conflicts
apurv-1 13ed9ed
fix: keypress bug, button styles
apurv-1 b317823
fix: Navigation duplicate error, duplicate shortkeys
apurv-1 ec1d09b
fix: sidemItem via shortkey without expanding submenu
apurv-1 0382f2b
Merge branch 'apache:main' into main
apurv-1 9dee13b
fix: hidden action button bug
apurv-1 5fc9342
Merge branch 'main' of https://github.com/apurv-1/cloudstack into key…
apurv-1 ac13f4f
new: shortkey for tools
apurv-1 78e90c7
new: shortkey for dashboard
apurv-1 11e2366
Merge branch 'apache:main' into main
apurv-1 7951227
fix: merge conflicts & shortkey buttons
apurv-1 c56f75c
feat: backspace
apurv-1 456bbcb
fix: duplicates removed
apurv-1 e2e9679
new: update shortkeys
apurv-1 8d275f0
fix: backspace to newtab
apurv-1 b326fe5
Merge branch 'apache:main' into main
apurv-1 af961e8
resolved merge conflicts
apurv-1 0b4092d
Merge branch 'apache:main' into main
apurv-1 29e4bae
Merge branch 'apache:main' into main
apurv-1 9db704d
fix: merge conflicts
apurv-1 a7e38a7
Merge branch 'main' into keyboard-label-shortcut
apurv-1 5e5fb14
Merge branch 'apache:main' into main
apurv-1 ddc15d9
new/fix: shortkeys, collapse menu
apurv-1 60d8288
fix: conflits
apurv-1 656ea2a
Merge branch 'main' into keyboard-label-shortcut
apurv-1 4fe95bf
Merge branch 'apache:main' into main
apurv-1 f21f7de
Merge branch 'apache:main' into main
apurv-1 f7d5565
Merge branch 'apache:main' into main
apurv-1 37b30ae
fix: conflicts
apurv-1 1536847
fix: build errors
apurv-1 7c7a0d2
Merge branch 'main' into keyboard-label-shortcut
shwstppr a358c8a
partial fix
shwstppr b39cd0d
fix menu shortkey
shwstppr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,270 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // 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' | ||
|
|
||
| const { Item, SubMenu } = Menu | ||
|
|
||
| export default { | ||
| name: 'SMenu', | ||
| props: { | ||
| menu: { | ||
| type: Array, | ||
| required: true | ||
| }, | ||
| theme: { | ||
| type: String, | ||
| required: false, | ||
| default: 'dark' | ||
| }, | ||
| mode: { | ||
| type: String, | ||
| required: false, | ||
| default: 'inline' | ||
| }, | ||
| collapsed: { | ||
| type: Boolean, | ||
| required: false, | ||
| default: false | ||
| } | ||
| }, | ||
| data () { | ||
| return { | ||
| openKeys: [], | ||
| selectedKeys: [], | ||
| cachedOpenKeys: [], | ||
| cachedPath: null | ||
| } | ||
| }, | ||
| computed: { | ||
| rootSubmenuKeys: vm => { | ||
| const keys = [] | ||
| vm.menu.forEach(item => keys.push(item.path)) | ||
| return keys | ||
| } | ||
| }, | ||
| created () { | ||
| this.updateMenu() | ||
| }, | ||
| watch: { | ||
| collapsed (val) { | ||
| if (val) { | ||
| this.cachedOpenKeys = this.openKeys.concat() | ||
| this.openKeys = [] | ||
| } else { | ||
| this.openKeys = this.cachedOpenKeys | ||
| } | ||
| }, | ||
| $route: function () { | ||
| this.updateMenu() | ||
| } | ||
| }, | ||
| methods: { | ||
| // select menu item | ||
| onOpenChange (openKeys) { | ||
| if (this.mode === 'horizontal') { | ||
| this.openKeys = openKeys | ||
| return | ||
| } | ||
| const latestOpenKey = openKeys.find(key => !this.openKeys.includes(key)) | ||
| if (!this.rootSubmenuKeys.includes(latestOpenKey)) { | ||
| this.openKeys = openKeys | ||
| } else { | ||
| this.openKeys = latestOpenKey ? [latestOpenKey] : [] | ||
| } | ||
| }, | ||
| updateMenu () { | ||
| const routes = this.$route.matched.concat() | ||
|
|
||
| if (routes.length >= 4 && this.$route.meta.hidden) { | ||
| routes.pop() | ||
| this.selectedKeys = [routes[2].path] | ||
| } else { | ||
| this.selectedKeys = [routes.pop().path] | ||
| } | ||
|
|
||
| const openKeys = [] | ||
| if (this.mode === 'inline') { | ||
| routes.forEach(item => { | ||
| openKeys.push(item.path) | ||
| }) | ||
| } | ||
|
|
||
| this.cachedPath = this.selectedKeys[0] | ||
| this.collapsed ? (this.cachedOpenKeys = openKeys) : (this.openKeys = openKeys) | ||
| }, | ||
|
|
||
| // render | ||
| renderItem (menu) { | ||
| if (!menu.hidden) { | ||
| return menu.children && !menu.hideChildrenInMenu ? this.renderSubMenu(menu) : this.renderMenuItem(menu) | ||
| } | ||
| return null | ||
| }, | ||
| renderMenuItem (menu) { | ||
| const target = menu.meta.target || null | ||
| const props = { | ||
| 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 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> | ||
| ) | ||
| }, | ||
| renderSubMenu (menu) { | ||
| const itemArr = [] | ||
| const on = { | ||
| click: () => { | ||
| this.handleClickParentMenu(menu) | ||
| }, | ||
| shortkey: () => { | ||
| this.handleClickParentMenu(menu) | ||
| } | ||
| } | ||
| if (!menu.hideChildrenInMenu) { | ||
| menu.children.forEach(item => itemArr.push(this.renderItem(item))) | ||
| } | ||
| return ( | ||
| <SubMenu {...{ key: menu.path }}> | ||
| <span slot="title"> | ||
| {this.renderIcon(menu.meta.icon, menu)} | ||
| <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> | ||
| ) | ||
| }, | ||
| renderIcon (icon, menuItem) { | ||
| if (icon === 'none' || icon === undefined) { | ||
| return null | ||
| } | ||
| const props = {} | ||
| const on = { | ||
| click: () => { | ||
| this.handleClickParentMenu(menuItem) | ||
| } | ||
| } | ||
| typeof (icon) === 'object' ? props.component = icon : props.type = icon | ||
| return ( | ||
| <Icon {... { props, on } } /> | ||
| ) | ||
| }, | ||
| handleClickParentMenu (menuItem) { | ||
| if (this.cachedPath === menuItem.redirect) { | ||
| return | ||
| } | ||
| if (menuItem.redirect) { | ||
| this.cachedPath = menuItem.redirect | ||
| setTimeout(() => this.$router.push({ path: menuItem.path })) | ||
| } | ||
| } | ||
| }, | ||
| render () { | ||
| const { mode, theme, menu } = this | ||
| const props = { | ||
| mode: mode, | ||
| theme: theme, | ||
| openKeys: this.openKeys | ||
| } | ||
| const on = { | ||
| select: obj => { | ||
| this.selectedKeys = obj.selectedKeys | ||
| this.$emit('select', obj) | ||
| }, | ||
| openChange: this.onOpenChange | ||
| } | ||
| const menuTree = menu.map(item => { | ||
| if (item.hidden) { | ||
| return null | ||
| } | ||
| return this.renderItem(item) | ||
| }) | ||
| // {...{ props, on: on }} | ||
| return ( | ||
| <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> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the move out of alphabetical order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will fix it, also the shortkeys aren't working. Looking for that as well