From f87f410e3ab4ca8bd1c6ab6036c4bb842d131f5d Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 11 Jun 2018 17:49:22 +0100 Subject: [PATCH] Use defaultValue for making sure Name is at least '' --- ui-v2/app/models/acl.js | 7 ++++++- ui-v2/app/routes/dc/acls/create.js | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ui-v2/app/models/acl.js b/ui-v2/app/models/acl.js index e467b43772..7c55bb64ef 100644 --- a/ui-v2/app/models/acl.js +++ b/ui-v2/app/models/acl.js @@ -7,7 +7,12 @@ export const SLUG_KEY = 'ID'; export default Model.extend({ [PRIMARY_KEY]: attr('string'), [SLUG_KEY]: attr('string'), - Name: attr('string'), + Name: attr('string', { + // TODO: Why didn't I have to do this for KV's? + // this is to ensure that Name is '' and not null when creating + // maybe its due to the fact that `Key` is the primaryKey in Kv's + defaultValue: '', + }), Type: attr('string'), Rules: attr('string'), CreateIndex: attr('number'), diff --git a/ui-v2/app/routes/dc/acls/create.js b/ui-v2/app/routes/dc/acls/create.js index e71a805c1a..ee36d06030 100644 --- a/ui-v2/app/routes/dc/acls/create.js +++ b/ui-v2/app/routes/dc/acls/create.js @@ -13,8 +13,6 @@ export default Route.extend(WithAclActions, { }, model: function(params) { this.item = get(this, 'repo').create(); - // TODO: Why didn't I have to do this for KV's? - set(this.item, 'Name', ''); set(this.item, 'Datacenter', this.modelFor('dc').dc.Name); return hash({ create: true,