Skip to content

Commit

Permalink
HCL syntax highlighting with ruby mode and vars example
Browse files Browse the repository at this point in the history
  • Loading branch information
philrenaud committed Dec 6, 2022
1 parent 57b9a74 commit 698068b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ui/app/components/policy-editor.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{{code-mirror
screenReaderLabel="Policy definition"
theme="hashi"
mode="terraform"
mode="ruby"
content=@policy.rules
onUpdate=this.updatePolicyRules
autofocus=(not @policy.isNew)
Expand Down
1 change: 1 addition & 0 deletions ui/app/modifiers/code-mirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'codemirror/addon/selection/active-line';
import 'codemirror/addon/lint/lint.js';
import 'codemirror/addon/lint/json-lint.js';
import 'codemirror/mode/javascript/javascript';
import 'codemirror/mode/ruby/ruby';

export default class CodeMirrorModifier extends Modifier {
get autofocus() {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/routes/policies.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default class PoliciesRoute extends Route.extend(
async model() {
return await hash({
policies: this.store.query('policy', { reload: true }),
tokens: this.store.query('token', { reload: true })
tokens: this.store.query('token', { reload: true }),
});
}
}
15 changes: 15 additions & 0 deletions ui/app/routes/policies/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ namespace "default" {
namespace "example-ns" {
policy = "deny"
capabilities = ["list-jobs", "read-job"]
variables {
# list access to variables in all paths, full access in nested/variables/*
path "*" {
capabilities = ["list"]
}
path "nested/variables/*" {
capabilities = ["write", "read", "destroy", "list"]
}
}
}
host_volume "example-volume" {
Expand Down Expand Up @@ -58,6 +67,12 @@ operator {
# * read-job-scaling
# * scale-job
# Possible Variables capabilities
# * write
# * read
# * destroy
# * list
# Possible Policies for "agent", "node", "quota", "operator", and "host_volume":
# * deny
# * read
Expand Down
2 changes: 1 addition & 1 deletion ui/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = function (defaults) {
},
},
codemirror: {
modes: ['javascript'],
modes: ['javascript', 'ruby'],
},
babel: {
include: ['proposal-optional-chaining'],
Expand Down

0 comments on commit 698068b

Please sign in to comment.