From 47eb3f76bc5cbbb3b229cabbbef6398f9a956122 Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Mon, 19 Nov 2018 15:48:24 -0600 Subject: [PATCH] return backend on the PKI model so that capabilities fetches work (#5824) --- ui/app/serializers/role.js | 14 +++++++++++++- .../acceptance/secrets/backend/pki/role-test.js | 3 +++ ui/tests/pages/secrets/backend/list.js | 7 ++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ui/app/serializers/role.js b/ui/app/serializers/role.js index 69ba365cf87e..38c1d5f52042 100644 --- a/ui/app/serializers/role.js +++ b/ui/app/serializers/role.js @@ -3,13 +3,25 @@ import ApplicationSerializer from './application'; export default ApplicationSerializer.extend({ extractLazyPaginatedData(payload) { let ret; + if (payload.zero_address_roles) { payload.zero_address_roles.forEach(role => { // mutate key_info object to add zero_address info payload.data.key_info[role].zero_address = true; }); } - if (!payload.data.key_info) return payload.data.keys; + if (!payload.data.key_info) { + return payload.data.keys.map(key => { + let model = { + id: key, + }; + if (payload.backend) { + model.backend = payload.backend; + } + return model; + }); + } + ret = payload.data.keys.map(key => { let model = { id: key, diff --git a/ui/tests/acceptance/secrets/backend/pki/role-test.js b/ui/tests/acceptance/secrets/backend/pki/role-test.js index d9b9a1cb57a2..85a23b38915b 100644 --- a/ui/tests/acceptance/secrets/backend/pki/role-test.js +++ b/ui/tests/acceptance/secrets/backend/pki/role-test.js @@ -47,6 +47,9 @@ module('Acceptance | secrets/pki/create', function(hooks) { await listPage.visitRoot({ backend: path }); assert.equal(listPage.secrets.length, 1, 'shows role in the list'); + let secret = listPage.secrets.objectAt(0); + await secret.menuToggle(); + assert.ok(listPage.menuItems.length > 0, 'shows links in the menu'); }); test('it deletes a role', async function(assert) { diff --git a/ui/tests/pages/secrets/backend/list.js b/ui/tests/pages/secrets/backend/list.js index dcbd2c1cc7e1..a436c791bf54 100644 --- a/ui/tests/pages/secrets/backend/list.js +++ b/ui/tests/pages/secrets/backend/list.js @@ -10,7 +10,12 @@ export default create({ configureIsPresent: isPresent('[data-test-secret-backend-configure]'), tabs: collection('[data-test-tab]'), - secrets: collection('[data-test-secret-link]'), + secrets: collection('[data-test-secret-link]', { + menuToggle: clickable('[data-test-popup-menu-trigger]'), + }), + menuItems: collection('.ember-basic-dropdown-content li', { + testContainer: '#ember-testing', + }), backendIsEmpty: getter(function() { return this.secrets.length === 0;