chore: 🤖 add computed displayName to fallback on id for models

This commit is contained in:
Randall Morey committed 2020-06-25 09:00:55 -04:00
1 parent f5d40ffe96
commit 8cb0e7bce7
8 files changed
+33 -6

No files matched your search

+10
View File
@@ -4,6 +4,16 @@ import { computed } from '@ember/object';
export default class BaseModel extends Model {
// =attributes
/**
* Names are optional on models in our API. Thus we need to fallback on ID
* for display purposes.
* @type {string}
*/
@computed('name', 'id')
get displayName() {
return this.name || this.id;
}
/**
* @type {boolean}
*/