diff --git a/addons/api/addon/generated/models/host-catalog.js b/addons/api/addon/generated/models/host-catalog.js index 5f4569e6a..553500cc3 100644 --- a/addons/api/addon/generated/models/host-catalog.js +++ b/addons/api/addon/generated/models/host-catalog.js @@ -48,4 +48,10 @@ export default class GeneratedHostCatalogModel extends BaseModel { description: 'Current version number of this resource.', }) version; + + @attr('string', { + description: 'Plugin information for this resource.', + readOnly: true, + }) + plugin; } diff --git a/addons/api/addon/models/host-catalog.js b/addons/api/addon/models/host-catalog.js index f9ae96493..b81493a77 100644 --- a/addons/api/addon/models/host-catalog.js +++ b/addons/api/addon/models/host-catalog.js @@ -2,9 +2,26 @@ import GeneratedHostCatalogModel from '../generated/models/host-catalog'; export default class HostCatalogModel extends GeneratedHostCatalogModel { /** + * Returns if the host-catalog is a plugin or not. * @type {boolean} */ - get isStatic() { - return this.type === 'static'; + get isPlugin() { + return this.type === 'plugin'; + } + + /** + * Returns if host-catalog plugin is AWS or not + * @type {boolean} + */ + get isAWS() { + return this.plugin.name === 'aws'; + } + + /** + * Return if host-catalog plugin is Azure or not. + * @type {boolean} + */ + get isAzure() { + return this.plugin.name === 'azure'; } } diff --git a/addons/api/tests/unit/models/host-catalog-test.js b/addons/api/tests/unit/models/host-catalog-test.js index 48b21051d..c377bee8b 100644 --- a/addons/api/tests/unit/models/host-catalog-test.js +++ b/addons/api/tests/unit/models/host-catalog-test.js @@ -10,13 +10,41 @@ module('Unit | Model | host catalog', function (hooks) { assert.ok(model); }); - test('it has isStatic function and returns the expected values', async function (assert) { + test('it has isPlugin function and returns the expected values', async function (assert) { assert.expect(3); const store = this.owner.lookup('service:store'); - const modelA = store.createRecord('host-catalog', { type: 'static' }); - const modelB = store.createRecord('host-catalog', { type: 'plugin' }); - assert.equal(typeof modelA.isStatic, 'boolean'); - assert.true(modelA.isStatic); - assert.false(modelB.isStatic); + const modelPlugin = store.createRecord('host-catalog', { type: 'plugin' }); + const modelStatic = store.createRecord('host-catalog', { type: 'static' }); + assert.equal(typeof modelPlugin.isPlugin, 'boolean'); + assert.true(modelPlugin.isPlugin); + assert.false(modelStatic.isPlugin); + }); + + test('it has isAWS function and returns the expected values', async function (assert) { + assert.expect(3); + const store = this.owner.lookup('service:store'); + const modelAws = store.createRecord('host-catalog', { + plugin: { name: 'aws' }, + }); + const modelRandom = store.createRecord('host-catalog', { + plugin: { name: 'random' }, + }); + assert.equal(typeof modelAws.isAWS, 'boolean'); + assert.true(modelAws.isAWS); + assert.false(modelRandom.isAWS); + }); + + test('it has isAzure function and return the expected values', async function (assert) { + assert.expect(3); + const store = this.owner.lookup('service:store'); + const modelAzure = store.createRecord('host-catalog', { + plugin: { name: 'azure' }, + }); + const modelRandom = store.createRecord('host-catalog', { + plugin: { name: 'random' }, + }); + assert.equal(typeof modelAzure.isAzure, 'boolean'); + assert.true(modelAzure.isAzure); + assert.false(modelRandom.isAzure); }); }); diff --git a/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs b/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs index b3900063f..94eb61309 100644 --- a/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs +++ b/ui/admin/app/templates/scopes/scope/host-catalogs/index.hbs @@ -41,39 +41,37 @@
{{hostCatalog.description}}
-{{hostCatalog.id}}
- {{hostCatalog.description}}
+ +{{hostCatalog.id}}
+