Browse Source

ui: fix production build only empty role modal (#5806)

Adds the ability for multiple components to use the same dom buffer
pull/5812/head
John Cowen 6 years ago committed by GitHub
parent
commit
7e2c66ad12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      ui-v2/app/services/dom-buffer.js
  2. 4
      ui-v2/app/templates/components/role-selector.hbs

9
ui-v2/app/services/dom-buffer.js

@ -11,12 +11,17 @@ export default Service.extend(Evented, {
},
add: function(name, dom) {
this.trigger('add', dom);
buffer[name] = dom;
if (typeof buffer[name] === 'undefined') {
buffer[name] = [];
}
buffer[name].push(dom);
return dom;
},
remove: function(name) {
if (typeof buffer[name] !== 'undefined') {
buffer[name].remove();
buffer[name].forEach(function(item) {
item.remove();
});
delete buffer[name];
}
},

4
ui-v2/app/templates/components/role-selector.hbs

@ -8,7 +8,7 @@
{{/block-slot}}
{{#block-slot 'body'}}
<input id="{{name}}_state_role" type="radio" name="{{name}}[state]" value="role" checked={{eq state 'role'}} onchange={{action 'change'}} />
<input id="{{name}}_state_role" type="radio" name="{{name}}[state]" value="role" checked={{if (eq state 'role') 'checked'}} onchange={{action 'change'}} />
{{#role-form form=form dc=dc}}
{{#block-slot 'policy'}}
@ -23,7 +23,7 @@
{{/block-slot}}
{{/role-form}}
<input id="{{name}}_state_policy" type="radio" name="{{name}}[state]" value="policy" checked={{eq state 'policy'}} onchange={{action 'change'}} />
<input id="{{name}}_state_policy" type="radio" name="{{name}}[state]" value="policy" checked={{if (eq state 'policy') 'checked'}} onchange={{action 'change'}} />
{{policy-form data-test-policy-form name="role[policy]" form=policyForm dc=dc}}
{{/block-slot}}

Loading…
Cancel
Save