backport of commit 715764bfe448fc6a80ca3858377b4f760d39c611 (#18010)

This pull request was automerged via backport-assistant
This commit is contained in:
hc-github-team-nomad-core 2023-07-20 11:38:52 -05:00 committed by GitHub
parent 963b2d97b2
commit d3b1d58c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 0 deletions

3
.changelog/17932.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
ui: adds a keyboard shortcut for Create Variable
```

View File

@ -20,6 +20,10 @@ export default class VariablesIndexController extends Controller {
this.router.transitionTo('variables.variable', variable.path);
}
@action goToNewVariable() {
this.router.transitionTo('variables.new');
}
@controller variables;
@action

View File

@ -4,11 +4,14 @@
*/
import Controller, { inject as controller } from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
const ALL_NAMESPACE_WILDCARD = '*';
export default class VariablesPathController extends Controller {
@service router;
get absolutePath() {
return this.model?.absolutePath || '';
}
@ -28,6 +31,12 @@ export default class VariablesPathController extends Controller {
}
}
@action goToNewVariable() {
this.router.transitionTo('variables.new', {
queryParams: { path: `${this.absolutePath}/` },
});
}
@controller variables;
@action

View File

@ -22,6 +22,11 @@
@route="variables.new"
class="button is-primary"
data-test-create-var
{{keyboard-shortcut
pattern=(array "n" "v")
action=(action this.goToNewVariable)
label="Create Variable"
}}
>
Create Variable
</LinkTo>

View File

@ -25,6 +25,11 @@
@route="variables.new"
@query={{hash path=(concat this.absolutePath "/")}}
class="button is-primary"
{{keyboard-shortcut
pattern=(array "n" "v")
action=(action this.goToNewVariable)
label="Create Variable"
}}
>
Create Variable
</LinkTo>