ui: Adds unique-id helper (#9676)
This commit is contained in:
parent
e29c9d2f52
commit
8b58d81d64
|
@ -1,3 +1,4 @@
|
|||
{{#let (unique-id) as |guid|}}
|
||||
<App
|
||||
class="hashicorp-consul"
|
||||
...attributes
|
||||
|
@ -272,3 +273,4 @@
|
|||
{{{concat '<!-- ' (env 'CONSUL_GIT_SHA') '-->'}}}
|
||||
</:content-info>
|
||||
</App>
|
||||
{{/let}}
|
|
@ -1,15 +1,7 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
|
||||
export default class HashiCorpConsul extends Component {
|
||||
@service('dom') dom;
|
||||
|
||||
constructor(args, owner) {
|
||||
super(...arguments);
|
||||
this.guid = this.dom.guid(this);
|
||||
}
|
||||
|
||||
// TODO: Right now this is the only place where we need permissions
|
||||
// but we are likely to need it elsewhere, so probably need a nice helper
|
||||
get canManageNspaces() {
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import Helper from '@ember/component/helper';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class UniqueIdHelper extends Helper {
|
||||
@service('dom') dom;
|
||||
|
||||
compute(params, hash) {
|
||||
return this.dom.guid({});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue