Display driver attributes without the superfluous driver and driver name section

This commit is contained in:
Michael Lange
2018-05-12 20:22:45 -07:00
parent 37a235c2af
commit c875d1490f
3 changed files with 19 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
import Fragment from 'ember-data-model-fragments/fragment';
import { computed } from '@ember/object';
import { computed, get } from '@ember/object';
import attr from 'ember-data/attr';
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
import { fragment } from 'ember-data-model-fragments/attributes';
@@ -8,6 +8,12 @@ export default Fragment.extend({
node: fragmentOwner(),
attributes: fragment('node-attributes'),
attributesShort: computed('name', 'attributes.attributesStructured', function() {
const attributes = this.get('attributes.attributesStructured');
return get(attributes, `driver.${this.get('name')}`);
}),
name: attr('string'),
detected: attr('boolean', { defaultValue: false }),
healthy: attr('boolean', { defaultValue: false }),

View File

@@ -163,7 +163,7 @@
{{#if a.item.attributes.attributesStructured}}
<div class="boxed-section-body is-full-bleed">
{{attributes-table
attributes=a.item.attributes.attributesStructured
attributes=a.item.attributesShort
class="attributes-table"}}
</div>
{{else}}

View File

@@ -87,14 +87,14 @@ export default Factory.extend({
});
function makeDrivers() {
const generate = () => {
const generate = name => {
const detected = Math.random() > 0.3;
const healthy = detected && Math.random() > 0.3;
const attributes = {
'driver.name.version': '1.0.0',
'driver.name.status': 'awesome',
'driver.name.more.details': 'yeah',
'driver.name.more.again': 'we got that',
[`driver.${name}.version`]: '1.0.0',
[`driver.${name}.status`]: 'awesome',
[`driver.${name}.more.details`]: 'yeah',
[`driver.${name}.more.again`]: 'we got that',
};
return {
Detected: detected,
@@ -106,11 +106,11 @@ function makeDrivers() {
};
return {
docker: generate(),
rkt: generate(),
qemu: generate(),
exec: generate(),
raw_exec: generate(),
java: generate(),
docker: generate('docker'),
rkt: generate('rkt'),
qemu: generate('qemu'),
exec: generate('exec'),
raw_exec: generate('raw_exec'),
java: generate('java'),
};
}