Files
nomad/ui/app/models/node-driver.js
Phil Renaud d34943435d [ui] Rework of node/job attributes/meta using PathTree (#23290)
* Rework of attributes using pathTree

* Pack meta reintroduced and made local

* attributes table test updated for new pathTree syntax

* removed flat import and extended the PathTree type signature to include prefix

* Slightly darken the is-faded text in tables
2024-06-12 14:28:17 -04:00

38 lines
1.0 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import classic from 'ember-classic-decorator';
import Fragment from 'ember-data-model-fragments/fragment';
import { computed } from '@ember/object';
import { attr } from '@ember-data/model';
import { fragmentOwner } from 'ember-data-model-fragments/attributes';
import { fragment } from 'ember-data-model-fragments/attributes';
@classic
export default class NodeDriver extends Fragment {
@fragmentOwner() node;
@fragment('structured-attributes') attributes;
@computed('name', 'attributes.structured')
get attributesShort() {
const attributes = this.get(
`attributes.structured.root.children.driver.children.${this.name}`
);
return attributes;
}
@attr('string') name;
@attr('boolean', { defaultValue: false }) detected;
@attr('boolean', { defaultValue: false }) healthy;
@attr('string') healthDescription;
@attr('date') updateTime;
@computed('healthy')
get healthClass() {
return this.healthy ? 'running' : 'failed';
}
}