Skip to content

Commit

Permalink
Variables-specific keyboard commands (#14165)
Browse files Browse the repository at this point in the history
* Variables-specific keyboard commands

* Auto-focus the edit button when landing on a variable page, if its available
  • Loading branch information
philrenaud authored Aug 17, 2022
1 parent 3bf5633 commit fd148aa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
11 changes: 10 additions & 1 deletion ui/app/components/variable-paths.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
<tbody>
{{#each this.folders as |folder|}}
<tr data-test-folder-row {{on "click" (fn this.handleFolderClick folder.data.absolutePath)}}>
<td colspan="3">
<td colspan="3"
{{keyboard-shortcut
enumerated=true
action=(fn this.handleFolderClick folder.data.absolutePath)
}}
>
<span>
<FlightIcon @name="folder" />
<LinkTo @route="variables.path" @model={{folder.data.absolutePath}} @query={{hash namespace="*"}}>
Expand All @@ -29,6 +34,10 @@
data-test-file-row
{{on "click" (fn this.handleFileClick file)}}
class={{if (can "read variable" path=file.absoluteFilePath namespace=file.variable.namespace) "" "inaccessible"}}
{{keyboard-shortcut
enumerated=true
action=(fn this.handleFileClick file)
}}
>
<td>
<FlightIcon @name="file-text" />
Expand Down
5 changes: 5 additions & 0 deletions ui/app/services/keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class KeyboardService extends Service {
defaultPatterns = {
'Go to Jobs': ['g', 'j'],
'Go to Storage': ['g', 'r'],
'Go to Variables': ['g', 'v'],
'Go to Servers': ['g', 's'],
'Go to Clients': ['g', 'c'],
'Go to Topology': ['g', 't'],
Expand Down Expand Up @@ -100,6 +101,10 @@ export default class KeyboardService extends Service {
action: () => this.router.transitionTo('csi.volumes'),
rebindable: true,
},
{
label: 'Go to Variables',
action: () => this.router.transitionTo('variables'),
},
{
label: 'Go to Servers',
action: () => this.router.transitionTo('servers'),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/templates/components/gutter-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</LinkTo>
</li>
{{#if (can "list variables")}}
<li>
<li {{keyboard-shortcut menuLevel=true pattern=(array "g" "v") }}>
<LinkTo
@route="variables"
@activeClass="is-active"
Expand Down
12 changes: 12 additions & 0 deletions ui/app/templates/variables/variable/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
<FlightIcon @name="file-text" />
{{this.model.path}}
<Toggle
{{keyboard-shortcut
label="Toggle View (JSON/List)"
pattern=(array "j")
action=(action this.toggleView)
}}
data-test-memory-toggle
@isActive={{eq this.view "json"}}
@onToggle={{action this.toggleView}}
Expand All @@ -14,6 +19,7 @@
{{#if (can "write variable" path=this.model.path namespace=this.model.namespace)}}
<div class="two-step-button">
<LinkTo
{{autofocus}}
data-test-edit-button
class="button is-info is-inverted is-small"
@model={{this.model}}
Expand Down Expand Up @@ -87,6 +93,12 @@
class="show-hide-values button is-borderless is-compact"
type="button"
{{on "click" (action this.toggleRowVisibility row.model)}}
{{keyboard-shortcut
label="Toggle Variable Visibility"
pattern=(array "v")
action=(action this.toggleRowVisibility row.model)
}}

>
<FlightIcon
@name={{if row.model.isVisible "eye" "eye-off"}}
Expand Down

0 comments on commit fd148aa

Please sign in to comment.