ui: Adds unique-id helper (#9676)

This commit is contained in:
John Cowen 2021-02-02 10:03:46 +00:00 committed by GitHub
parent d94c3b9342
commit e0ff7080ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 265 additions and 261 deletions

View File

@ -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}}

View File

@ -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() {

View File

@ -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({});
}
}