github.com/outbrain/consul@v1.4.5/ui-v2/app/models/kv.js (about) 1 import Model from 'ember-data/model'; 2 import attr from 'ember-data/attr'; 3 import { computed, get } from '@ember/object'; 4 import isFolder from 'consul-ui/utils/isFolder'; 5 6 export const PRIMARY_KEY = 'uid'; 7 // not really a slug as it contains slashes but all intents and purposes 8 // its my 'slug' 9 export const SLUG_KEY = 'Key'; 10 11 export default Model.extend({ 12 [PRIMARY_KEY]: attr('string'), 13 [SLUG_KEY]: attr('string'), 14 LockIndex: attr('number'), 15 Flags: attr('number'), 16 // TODO: Consider defaulting all strings to '' because `typeof null !== 'string'` 17 // look into what other transformers do with `null` also 18 // preferably removeNull would be done in this layer also as if a property is `null` 19 // default Values don't kick in, which also explains `Tags` elsewhere 20 Value: attr('string'), //, {defaultValue: function() {return '';}} 21 CreateIndex: attr('number'), 22 ModifyIndex: attr('number'), 23 Session: attr('string'), 24 Datacenter: attr('string'), 25 26 isFolder: computed('Key', function() { 27 return isFolder(get(this, 'Key') || ''); 28 }), 29 });