From cc20e5a076205e990abe8d14cde5d244ea4e4e5a Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Corvo Date: Fri, 14 Jan 2022 13:14:50 -0800 Subject: [PATCH] Use compositeType in isAws and isAzure --- addons/api/addon/models/host-catalog.js | 6 +++--- addons/api/tests/unit/models/host-catalog-test.js | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/api/addon/models/host-catalog.js b/addons/api/addon/models/host-catalog.js index 0c649ea4f..43f2800c9 100644 --- a/addons/api/addon/models/host-catalog.js +++ b/addons/api/addon/models/host-catalog.js @@ -22,7 +22,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { * @type {boolean} */ get isAWS() { - return this.plugin.name === 'aws'; + return this.compositeType === 'aws'; } /** @@ -30,7 +30,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { * @type {boolean} */ get isAzure() { - return this.plugin.name === 'azure'; + return this.compositeType === 'azure'; } /** If host-catalog is a plugins returns its name, @@ -49,7 +49,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel { this.type = 'static'; } else { this.type = 'plugin'; - this.plugin.name = type; + this.plugin = { name: type } } } } diff --git a/addons/api/tests/unit/models/host-catalog-test.js b/addons/api/tests/unit/models/host-catalog-test.js index 429e3f50b..cf1cc94d5 100644 --- a/addons/api/tests/unit/models/host-catalog-test.js +++ b/addons/api/tests/unit/models/host-catalog-test.js @@ -34,6 +34,7 @@ module('Unit | Model | host catalog', function (hooks) { assert.expect(3); const store = this.owner.lookup('service:store'); const modelAws = store.createRecord('host-catalog', { + type: 'plugin', plugin: { name: 'aws' }, }); const modelRandom = store.createRecord('host-catalog', { @@ -48,6 +49,7 @@ module('Unit | Model | host catalog', function (hooks) { assert.expect(3); const store = this.owner.lookup('service:store'); const modelAzure = store.createRecord('host-catalog', { + type: 'plugin', plugin: { name: 'azure' }, }); const modelRandom = store.createRecord('host-catalog', {