From e74fd0202e1ba49c048a4314aaf8f7aac5374af4 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 20 Jul 2021 16:09:59 -0400 Subject: [PATCH 1/6] feat: API: Load credential libraries associated to a target --- .../models/fragment-credential-library.js | 11 ++++++++ addons/api/addon/models/target.js | 22 ++++++++++++++++ .../fragment-credential-library.js | 16 ++++++++++++ addons/api/addon/serializers/target.js | 26 ++++++++++++++++++- .../app/models/fragment-credential-library.js | 1 + .../fragment-credential-library.js | 1 + addons/api/mirage/factories/target.js | 18 +++++++++---- addons/api/mirage/models/target.js | 1 + addons/api/mirage/scenarios/default.js | 2 +- addons/api/mirage/serializers/target.js | 3 +++ .../fragment-credential-library-test.js | 13 ++++++++++ .../fragment-credential-library-test.js | 23 ++++++++++++++++ 12 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 addons/api/addon/models/fragment-credential-library.js create mode 100644 addons/api/addon/serializers/fragment-credential-library.js create mode 100644 addons/api/app/models/fragment-credential-library.js create mode 100644 addons/api/app/serializers/fragment-credential-library.js create mode 100644 addons/api/tests/unit/models/fragment-credential-library-test.js create mode 100644 addons/api/tests/unit/serializers/fragment-credential-library-test.js diff --git a/addons/api/addon/models/fragment-credential-library.js b/addons/api/addon/models/fragment-credential-library.js new file mode 100644 index 000000000..384ffef1e --- /dev/null +++ b/addons/api/addon/models/fragment-credential-library.js @@ -0,0 +1,11 @@ +import Fragment from 'ember-data-model-fragments/fragment'; +import { attr } from '@ember-data/model'; + +export default class FragmentCredentialLibraryModel extends Fragment { + // =attributes + + @attr('string', { + description: 'ID of the related credential library', + }) + credential_library_id; +} diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index a00c3b182..3788e595f 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -20,6 +20,15 @@ export default class TargetModel extends GeneratedTargetModel { }) host_sets; + /** + * @type {[FragmentCredentialLibrary]} + */ + @fragmentArray('fragment-credential-library', { + readOnly: true, + emptyArrayIfMissing: true, + }) + credential_libraries; + /** * An array of resolved host set and host catalog instances. Model instances * must already be loaded into the store (this method will not load unloaded @@ -65,6 +74,19 @@ export default class TargetModel extends GeneratedTargetModel { return Boolean(pendingOrActiveSessions.length); } + /** + * An array of resolved credential library instances. Model instances + * must already be loaded into the store (this method will not load unloaded + * instances). Unresolvable instances are excluded from the array. + * @type {[CredentialLibraryModel]} + */ + @computed('credential_libraries.[]', 'store') + get credentialLibraries() { + return this.credential_libraries + .map((id) => this.store.peekRecord('credential-library', id)) + .filter(Boolean); + } + // =methods /** diff --git a/addons/api/addon/serializers/fragment-credential-library.js b/addons/api/addon/serializers/fragment-credential-library.js new file mode 100644 index 000000000..9f3d01c81 --- /dev/null +++ b/addons/api/addon/serializers/fragment-credential-library.js @@ -0,0 +1,16 @@ +import JSONSerializer from '@ember-data/serializer/json'; + +export default class FragmentCredentialLibrarySerializer extends JSONSerializer { + // =methods + + /** + * Renames `id` to `credential_library_id` because fragments may not have IDs. + * Otherwise normalizes as normal. + * @param {ModelClass} typeClass + * @param {object} resourceHash + * @return {object} + */ + normalize(typeClass, { id: credential_library_id, ...obj }) { + return super.normalize(typeClass, { credential_library_id, ...obj }); + } +} diff --git a/addons/api/addon/serializers/target.js b/addons/api/addon/serializers/target.js index 4c6745b89..c287aca46 100644 --- a/addons/api/addon/serializers/target.js +++ b/addons/api/addon/serializers/target.js @@ -6,7 +6,11 @@ export default class TargetSerializer extends ApplicationSerializer { /** * If `adapterOptions.hostSets` is set to an array of host set models, * the resulting target serialization should include **only host sets** - * and the version. Normally, host sets are not serialized. + * and the version. + * If `adapterOptions.credentialLibraries` is set to an array of + * credential library models, the resulting target serialization should + * include **only credential libraries** and the version. + * Normally, neither host sets or credential libraries are not serialized. * @override * @param {Snapshot} snapshot * @return {object} @@ -16,6 +20,12 @@ export default class TargetSerializer extends ApplicationSerializer { const hostSetIDs = snapshot?.adapterOptions?.hostSetIDs; if (hostSetIDs) serialized = this.serializeWithHostSets(snapshot, hostSetIDs); + const credentialLibraryIDs = snapshot?.adapterOptions?.credentialLibraryIDs; + if (credentialLibraryIDs) + serialized = this.serializeWithCredentialLibraries( + snapshot, + credentialLibraryIDs + ); return serialized; } @@ -32,4 +42,18 @@ export default class TargetSerializer extends ApplicationSerializer { host_set_ids: hostSetIDs, }; } + + /** + * Returns a payload containing only the credential_library_ids array using IDs + * passed into the function (rather than existing credential libraries on the model). + * @param {Snapshot} snapshot + * @param {[string]} credentialLibraryIDs + * @return {object} + */ + serializeWithCredentialLibraries(snapshot, credentialLibraryIDs) { + return { + version: snapshot.attr('version'), + application_credential_library_ids: credentialLibraryIDs, + }; + } } diff --git a/addons/api/app/models/fragment-credential-library.js b/addons/api/app/models/fragment-credential-library.js new file mode 100644 index 000000000..4cee0ae38 --- /dev/null +++ b/addons/api/app/models/fragment-credential-library.js @@ -0,0 +1 @@ +export { default } from 'api/models/fragment-credential-library'; diff --git a/addons/api/app/serializers/fragment-credential-library.js b/addons/api/app/serializers/fragment-credential-library.js new file mode 100644 index 000000000..b60ecfef5 --- /dev/null +++ b/addons/api/app/serializers/fragment-credential-library.js @@ -0,0 +1 @@ +export { default } from 'api/serializers/fragment-credential-library'; diff --git a/addons/api/mirage/factories/target.js b/addons/api/mirage/factories/target.js index dc1c97d00..8ae03edbe 100644 --- a/addons/api/mirage/factories/target.js +++ b/addons/api/mirage/factories/target.js @@ -7,7 +7,7 @@ const hostSetChance = 0.3; export default factory.extend({ /** - * -1 means "unlimited" and we want to generate these on occassion. + * -1 means "unlimited" and we want to generate these on occasion. */ session_connection_limit: () => random.arrayElement([-1, datatype.number()]), @@ -25,11 +25,11 @@ export default factory.extend({ }, /** - * Randomly selects existing host sets to assign to target. + * Randomly selects existing host sets and credential libraries to assign to target. */ - withRandomHostSets: trait({ + withAssociations: trait({ afterCreate(target, server) { - let randomlySelectedHostSets; + let randomlySelectedHostSets, randomlySelectedCredentialLibraries; randomlySelectedHostSets = server.schema.hostSets // BLERG: fun fact, for no reason at all, the element passed // into a where function is not a full model instance, as you might @@ -38,7 +38,15 @@ export default factory.extend({ // the result set of `where` _is a collection of model instances_. .where((hostSet) => hostSet.scopeId === target.scope.id) .models.filter(() => randomBoolean(hostSetChance)); - target.update({ hostSets: randomlySelectedHostSets }); + + randomlySelectedCredentialLibraries = server.schema.credentialLibraries + .where((credentialLibrary) => credentialLibrary.scopeId === target.scope.id) + .models.filter(() => randomBoolean()); + + target.update({ + hostSets: randomlySelectedHostSets, + credentialLibraries: randomlySelectedCredentialLibraries, + }); }, }), }); diff --git a/addons/api/mirage/models/target.js b/addons/api/mirage/models/target.js index 0f03cb6ef..389e255d2 100644 --- a/addons/api/mirage/models/target.js +++ b/addons/api/mirage/models/target.js @@ -3,4 +3,5 @@ import { Model, belongsTo, hasMany } from 'ember-cli-mirage'; export default Model.extend({ scope: belongsTo(), hostSets: hasMany(), + credentialLibraries: hasMany(), }); diff --git a/addons/api/mirage/scenarios/default.js b/addons/api/mirage/scenarios/default.js index fc5931908..d448a443b 100644 --- a/addons/api/mirage/scenarios/default.js +++ b/addons/api/mirage/scenarios/default.js @@ -47,8 +47,8 @@ export default function (server) { // Other resources server.schema.scopes.where({ type: 'project' }).models.forEach((scope) => { server.createList('host-catalog', 2, { scope }, 'withChildren'); - server.createList('target', 2, { scope }, 'withRandomHostSets'); server.createList('session', 4, { scope }, 'withAssociations'); server.createList('credential-store', 3, { scope }, 'withAssociations'); + server.createList('target', 2, { scope }, 'withAssociations'); }); } diff --git a/addons/api/mirage/serializers/target.js b/addons/api/mirage/serializers/target.js index 006388773..c23330189 100644 --- a/addons/api/mirage/serializers/target.js +++ b/addons/api/mirage/serializers/target.js @@ -23,6 +23,9 @@ export default ApplicationSerializer.extend({ return { id: host_set_id, host_catalog_id }; }); } + if (model.credentialLibraryIds?.length) { + json.credential_libraries = model.credentialLibraryIds; + } return json; }, }); diff --git a/addons/api/tests/unit/models/fragment-credential-library-test.js b/addons/api/tests/unit/models/fragment-credential-library-test.js new file mode 100644 index 000000000..f5014569e --- /dev/null +++ b/addons/api/tests/unit/models/fragment-credential-library-test.js @@ -0,0 +1,13 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Model | fragment credential library', function (hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function (assert) { + let store = this.owner.lookup('service:store'); + let model = store.createRecord('fragment-credential-library', {}); + assert.ok(model); + }); +}); diff --git a/addons/api/tests/unit/serializers/fragment-credential-library-test.js b/addons/api/tests/unit/serializers/fragment-credential-library-test.js new file mode 100644 index 000000000..719d97955 --- /dev/null +++ b/addons/api/tests/unit/serializers/fragment-credential-library-test.js @@ -0,0 +1,23 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'ember-qunit'; + +module('Unit | Serializer | fragment credential library', function (hooks) { + setupTest(hooks); + + // Replace this with your real tests. + test('it exists', function (assert) { + let store = this.owner.lookup('service:store'); + let serializer = store.serializerFor('fragment-credential-library'); + + assert.ok(serializer); + }); + + test('it serializes records', function (assert) { + let store = this.owner.lookup('service:store'); + let record = store.createRecord('fragment-credential-library', {}); + + let serializedRecord = record.serialize(); + + assert.ok(serializedRecord); + }); +}); From 28a4a7304e06d7d6aba520da611421958f1cb3ea Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Wed, 21 Jul 2021 15:45:45 -0400 Subject: [PATCH 2/6] feat: Add credential library add and remove methods to target --- .../models/fragment-credential-library.js | 11 -- addons/api/addon/models/target.js | 100 +++++++++-- .../fragment-credential-library.js | 16 -- .../app/models/fragment-credential-library.js | 1 - .../fragment-credential-library.js | 1 - addons/api/mirage/config.js | 20 ++- addons/api/mirage/factories/target.js | 4 +- addons/api/mirage/serializers/target.js | 2 +- .../fragment-credential-library-test.js | 13 -- addons/api/tests/unit/models/target-test.js | 158 ++++++++++++++++++ .../unit/serializers/application-test.js | 1 + .../fragment-credential-library-test.js | 23 --- .../api/tests/unit/serializers/target-test.js | 29 +++- ui/admin/tests/acceptance/sessions-test.js | 2 +- ui/desktop/tests/acceptance/origin-test.js | 2 +- ui/desktop/tests/acceptance/projects-test.js | 2 +- .../acceptance/projects/sessions-test.js | 2 +- .../tests/acceptance/projects/targets-test.js | 2 +- .../projects/targets/sessions-test.js | 2 +- ui/desktop/tests/acceptance/scopes-test.js | 2 +- ui/desktop/tests/acceptance/targets-test.js | 2 +- 21 files changed, 301 insertions(+), 94 deletions(-) delete mode 100644 addons/api/addon/models/fragment-credential-library.js delete mode 100644 addons/api/addon/serializers/fragment-credential-library.js delete mode 100644 addons/api/app/models/fragment-credential-library.js delete mode 100644 addons/api/app/serializers/fragment-credential-library.js delete mode 100644 addons/api/tests/unit/models/fragment-credential-library-test.js delete mode 100644 addons/api/tests/unit/serializers/fragment-credential-library-test.js diff --git a/addons/api/addon/models/fragment-credential-library.js b/addons/api/addon/models/fragment-credential-library.js deleted file mode 100644 index 384ffef1e..000000000 --- a/addons/api/addon/models/fragment-credential-library.js +++ /dev/null @@ -1,11 +0,0 @@ -import Fragment from 'ember-data-model-fragments/fragment'; -import { attr } from '@ember-data/model'; - -export default class FragmentCredentialLibraryModel extends Fragment { - // =attributes - - @attr('string', { - description: 'ID of the related credential library', - }) - credential_library_id; -} diff --git a/addons/api/addon/models/target.js b/addons/api/addon/models/target.js index 3788e595f..d60596465 100644 --- a/addons/api/addon/models/target.js +++ b/addons/api/addon/models/target.js @@ -21,13 +21,14 @@ export default class TargetModel extends GeneratedTargetModel { host_sets; /** - * @type {[FragmentCredentialLibrary]} + * Credential library ids are read only and can be + * persisted via a dedicated call to `addCredentialLibraries()`. */ - @fragmentArray('fragment-credential-library', { + @fragmentArray('fragment-string', { readOnly: true, emptyArrayIfMissing: true, }) - credential_libraries; + application_credential_library_ids; /** * An array of resolved host set and host catalog instances. Model instances @@ -45,6 +46,24 @@ export default class TargetModel extends GeneratedTargetModel { .filter((hostSetRef) => hostSetRef.model !== null); } + /** + * An array of resolved credential library instances. Model instances + * must already be loaded into the store (this method will not load unloaded + * instances). Unresolvable instances are excluded from the array. + * @type {[CredentialLibraryModel]} + */ + @computed('application_credential_library_ids.[]', 'store') + get credentialLibraries() { + return this.application_credential_library_ids + .map((credential_library_fragment) => + this.store.peekRecord( + 'credential-library', + credential_library_fragment.value + ) + ) + .filter(Boolean); + } + /** * Sessions associated with this target (but only already loaded sessions). * @type {SessionModel[]} @@ -74,19 +93,6 @@ export default class TargetModel extends GeneratedTargetModel { return Boolean(pendingOrActiveSessions.length); } - /** - * An array of resolved credential library instances. Model instances - * must already be loaded into the store (this method will not load unloaded - * instances). Unresolvable instances are excluded from the array. - * @type {[CredentialLibraryModel]} - */ - @computed('credential_libraries.[]', 'store') - get credentialLibraries() { - return this.credential_libraries - .map((id) => this.store.peekRecord('credential-library', id)) - .filter(Boolean); - } - // =methods /** @@ -144,4 +150,66 @@ export default class TargetModel extends GeneratedTargetModel { removeHostSet(hostSetID, options) { return this.removeHostSets([hostSetID], options); } + + /** + * Adds credential libraries via the `add-credential-libraries` method. + * See serializer and adapter for more information. + * @param {[string]} credentialLibraryIDs + * @param {object} options + * @param {object} options.adapterOptions + * @return {Promise} + */ + addCredentialLibraries( + credentialLibraryIDs, + options = { adapterOptions: {} } + ) { + const defaultAdapterOptions = { + method: 'add-credential-libraries', + credentialLibraryIDs, + }; + // There is no "deep merge" in ES. + return this.save({ + ...options, + adapterOptions: { + ...defaultAdapterOptions, + ...options.adapterOptions, + }, + }); + } + + /** + * Delete credential libraries via the `remove-credential-libraries` method. + * See serializer and adapter for more information. + * @param {[string]} credentialLibraryIDs + * @param {object} options + * @param {object} options.adapterOptions + * @return {Promise} + */ + removeCredentialLibraries( + credentialLibraryIDs, + options = { adapterOptions: {} } + ) { + const defaultAdapterOptions = { + method: 'remove-credential-libraries', + credentialLibraryIDs, + }; + // There is no "deep merge" in ES. + return this.save({ + ...options, + adapterOptions: { + ...defaultAdapterOptions, + ...options.adapterOptions, + }, + }); + } + + /** + * Delete a single credential library set via the `remove-credential-libraries` method. + * @param {number} credentialLibraryID + * @param {object} options + * @return {Promise} + */ + removeCredentialLibrary(credentialLibraryID, options) { + return this.removeCredentialLibraries([credentialLibraryID], options); + } } diff --git a/addons/api/addon/serializers/fragment-credential-library.js b/addons/api/addon/serializers/fragment-credential-library.js deleted file mode 100644 index 9f3d01c81..000000000 --- a/addons/api/addon/serializers/fragment-credential-library.js +++ /dev/null @@ -1,16 +0,0 @@ -import JSONSerializer from '@ember-data/serializer/json'; - -export default class FragmentCredentialLibrarySerializer extends JSONSerializer { - // =methods - - /** - * Renames `id` to `credential_library_id` because fragments may not have IDs. - * Otherwise normalizes as normal. - * @param {ModelClass} typeClass - * @param {object} resourceHash - * @return {object} - */ - normalize(typeClass, { id: credential_library_id, ...obj }) { - return super.normalize(typeClass, { credential_library_id, ...obj }); - } -} diff --git a/addons/api/app/models/fragment-credential-library.js b/addons/api/app/models/fragment-credential-library.js deleted file mode 100644 index 4cee0ae38..000000000 --- a/addons/api/app/models/fragment-credential-library.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'api/models/fragment-credential-library'; diff --git a/addons/api/app/serializers/fragment-credential-library.js b/addons/api/app/serializers/fragment-credential-library.js deleted file mode 100644 index b60ecfef5..000000000 --- a/addons/api/app/serializers/fragment-credential-library.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'api/serializers/fragment-credential-library'; diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index 1fd364182..9e09af76e 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -366,10 +366,10 @@ export default function () { const target = targets.find(id); const updatedAttrs = { version: attrs.version, - hostSetIds: target.hostSetIds, }; // If adding host sets, push them into the array if (method === 'add-host-sets') { + updatedAttrs.hostSetIds = target.hostSetIds; attrs.hostSetIds.forEach((id) => { if (!updatedAttrs.hostSetIds.includes(id)) { updatedAttrs.hostSetIds.push(id); @@ -378,10 +378,28 @@ export default function () { } // If deleting host sets, filter them out of the array if (method === 'remove-host-sets') { + updatedAttrs.hostSetIds = target.hostSetIds; updatedAttrs.hostSetIds = updatedAttrs.hostSetIds.filter((id) => { return !attrs.hostSetIds.includes(id); }); } + // If adding credential libraries, push them into the array + if (method === 'add-credential-libraries') { + updatedAttrs.credentialLibraryIds = target.credentialLibraryIds; + attrs.applicationCredentialLibraryIds.forEach((id) => { + if (!updatedAttrs.credentialLibraryIds.includes(id)) { + updatedAttrs.credentialLibraryIds.push(id); + } + }); + } + // If deleting credential libraries, filter them out of the array + if (method === 'remove-credential-libraries') { + updatedAttrs.credentialLibraryIds = target.credentialLibraryIds; + updatedAttrs.credentialLibraryIds = + updatedAttrs.credentialLibraryIds.filter((id) => { + return !attrs.applicationCredentialLibraryIds.includes(id); + }); + } return target.update(updatedAttrs); } ); diff --git a/addons/api/mirage/factories/target.js b/addons/api/mirage/factories/target.js index 8ae03edbe..e40df6abf 100644 --- a/addons/api/mirage/factories/target.js +++ b/addons/api/mirage/factories/target.js @@ -40,7 +40,9 @@ export default factory.extend({ .models.filter(() => randomBoolean(hostSetChance)); randomlySelectedCredentialLibraries = server.schema.credentialLibraries - .where((credentialLibrary) => credentialLibrary.scopeId === target.scope.id) + .where( + (credentialLibrary) => credentialLibrary.scopeId === target.scope.id + ) .models.filter(() => randomBoolean()); target.update({ diff --git a/addons/api/mirage/serializers/target.js b/addons/api/mirage/serializers/target.js index c23330189..b970f4853 100644 --- a/addons/api/mirage/serializers/target.js +++ b/addons/api/mirage/serializers/target.js @@ -24,7 +24,7 @@ export default ApplicationSerializer.extend({ }); } if (model.credentialLibraryIds?.length) { - json.credential_libraries = model.credentialLibraryIds; + json.application_credential_library_ids = model.credentialLibraryIds; } return json; }, diff --git a/addons/api/tests/unit/models/fragment-credential-library-test.js b/addons/api/tests/unit/models/fragment-credential-library-test.js deleted file mode 100644 index f5014569e..000000000 --- a/addons/api/tests/unit/models/fragment-credential-library-test.js +++ /dev/null @@ -1,13 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Model | fragment credential library', function (hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function (assert) { - let store = this.owner.lookup('service:store'); - let model = store.createRecord('fragment-credential-library', {}); - assert.ok(model); - }); -}); diff --git a/addons/api/tests/unit/models/target-test.js b/addons/api/tests/unit/models/target-test.js index 18be834bd..1c6fa2b22 100644 --- a/addons/api/tests/unit/models/target-test.js +++ b/addons/api/tests/unit/models/target-test.js @@ -223,4 +223,162 @@ module('Unit | Model | target', function (hooks) { 'Target has two associated sessions loaded in the store' ); }); + + test('it has a `credentialLibraries` array of resolved model instances (if those instances are already in the store)', function (assert) { + assert.expect(4); + const store = this.owner.lookup('service:store'); + store.push({ + data: { + id: '123abc', + type: 'target', + attributes: { + application_credential_library_ids: [{ value: '1' }, { value: '2' }], + }, + }, + }); + const target = store.peekRecord('target', '123abc'); + assert.equal( + target.application_credential_library_ids.length, + 2, + 'Target has two entires in application_credential_library_ids' + ); + assert.equal( + target.credentialLibraries.length, + 0, + 'Target has no resolved credentialLibraries because they are not loaded yet' + ); + store.push({ + data: { + id: '1', + type: 'credential-library', + attributes: {}, + }, + }); + store.push({ + data: { + id: '2', + type: 'credential-library', + attributes: {}, + }, + }); + // Since `credentialLibraries` is computed on `application_credential_library_ids`, + // not the store itself, it's necessary to do this assignment to kick-off the + // computed update. + /* eslint-disable no-self-assign */ + target.application_credential_library_ids = + target.application_credential_library_ids; + /* eslint-enable no-self-assign */ + assert.equal( + target.application_credential_library_ids.length, + 2, + 'Target has two entires in application_credential_library_ids' + ); + assert.equal( + target.credentialLibraries.length, + 2, + 'Target has two resolved credentialLibraries' + ); + }); + + test('it has an `addCredentialLibraries` method that targets a specific POST API endpoint and serialization', async function (assert) { + assert.expect(1); + this.server.post( + '/v1/targets/123abc:add-credential-libraries', + (schema, request) => { + const body = JSON.parse(request.requestBody); + assert.deepEqual(body, { + application_credential_library_ids: ['123_abc', 'foobar'], + version: 1, + }); + return { id: '123abc' }; + } + ); + const store = this.owner.lookup('service:store'); + store.push({ + data: { + id: '123abc', + type: 'target', + attributes: { + name: 'Target', + description: 'Description', + application_credential_library_ids: [{ value: '1' }, { value: '2' }], + version: 1, + scope: { + scope_id: 'o_1', + type: 'scope', + }, + }, + }, + }); + const model = store.peekRecord('target', '123abc'); + await model.addCredentialLibraries(['123_abc', 'foobar']); + }); + + test('it has a `removeCredentialLibraries` method that targets a specific POST API endpoint and serialization', async function (assert) { + assert.expect(1); + this.server.post( + '/v1/targets/123abc:remove-credential-libraries', + (schema, request) => { + const body = JSON.parse(request.requestBody); + assert.deepEqual(body, { + application_credential_library_ids: ['1', '2'], + version: 1, + }); + return { id: '123abc' }; + } + ); + const store = this.owner.lookup('service:store'); + store.push({ + data: { + id: '123abc', + type: 'target', + attributes: { + name: 'Target', + description: 'Description', + application_credential_library_ids: [{ value: '1' }, { value: '2' }], + version: 1, + scope: { + scope_id: 'o_1', + type: 'scope', + }, + }, + }, + }); + const model = store.peekRecord('target', '123abc'); + await model.removeCredentialLibraries(['1', '2']); + }); + + test('it has a `removeCredentialLibrary` method that deletes a single credential library using `removeCredentialLibraries` method', async function (assert) { + assert.expect(1); + this.server.post( + '/v1/targets/123abc:remove-credential-libraries', + (schema, request) => { + const body = JSON.parse(request.requestBody); + assert.deepEqual(body, { + application_credential_library_ids: ['2'], + version: 1, + }); + return { id: '123abc' }; + } + ); + const store = this.owner.lookup('service:store'); + store.push({ + data: { + id: '123abc', + type: 'target', + attributes: { + name: 'Target', + description: 'Description', + application_credential_library_ids: [{ value: '1' }, { value: '2' }], + version: 1, + scope: { + scope_id: 'o_1', + type: 'scope', + }, + }, + }, + }); + const model = store.peekRecord('target', '123abc'); + await model.removeCredentialLibrary('2'); + }); }); diff --git a/addons/api/tests/unit/serializers/application-test.js b/addons/api/tests/unit/serializers/application-test.js index a7040e876..c2fe164c9 100644 --- a/addons/api/tests/unit/serializers/application-test.js +++ b/addons/api/tests/unit/serializers/application-test.js @@ -203,6 +203,7 @@ module('Unit | Serializer | application', function (hooks) { name: 'Target 1', scope: { scope_id: 'o_123' }, host_sets: [], + application_credential_library_ids: [], }, relationships: {}, }, diff --git a/addons/api/tests/unit/serializers/fragment-credential-library-test.js b/addons/api/tests/unit/serializers/fragment-credential-library-test.js deleted file mode 100644 index 719d97955..000000000 --- a/addons/api/tests/unit/serializers/fragment-credential-library-test.js +++ /dev/null @@ -1,23 +0,0 @@ -import { module, test } from 'qunit'; -import { setupTest } from 'ember-qunit'; - -module('Unit | Serializer | fragment credential library', function (hooks) { - setupTest(hooks); - - // Replace this with your real tests. - test('it exists', function (assert) { - let store = this.owner.lookup('service:store'); - let serializer = store.serializerFor('fragment-credential-library'); - - assert.ok(serializer); - }); - - test('it serializes records', function (assert) { - let store = this.owner.lookup('service:store'); - let record = store.createRecord('fragment-credential-library', {}); - - let serializedRecord = record.serialize(); - - assert.ok(serializedRecord); - }); -}); diff --git a/addons/api/tests/unit/serializers/target-test.js b/addons/api/tests/unit/serializers/target-test.js index 255faa9ac..12dcacd4b 100644 --- a/addons/api/tests/unit/serializers/target-test.js +++ b/addons/api/tests/unit/serializers/target-test.js @@ -4,7 +4,7 @@ import { setupTest } from 'ember-qunit'; module('Unit | Serializer | target', function (hooks) { setupTest(hooks); - test('it serializes targets normally, without host sets', function (assert) { + test('it serializes targets normally, without host sets or credential libraries', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('target'); @@ -15,6 +15,7 @@ module('Unit | Serializer | target', function (hooks) { { host_set_id: '1', host_catalog_id: '2' }, { host_set_id: '3', host_catalog_id: '4' }, ], + application_credential_library_ids: [{ value: '1' }, { value: '2' }], scope: { scope_id: 'org_1', type: 'org', @@ -63,6 +64,27 @@ module('Unit | Serializer | target', function (hooks) { }); }); + test('it serializes only credential libraries and version when an `adapterOptions.credentialLibraryIDs` array is passed', function (assert) { + assert.expect(1); + const store = this.owner.lookup('service:store'); + const serializer = store.serializerFor('target'); + const record = store.createRecord('target', { + name: 'User', + description: 'Description', + application_credential_library_ids: [{ value: '1' }, { value: '2' }], + version: 1, + }); + const snapshot = record._createSnapshot(); + snapshot.adapterOptions = { + credentialLibraryIDs: ['4', '5'], + }; + const serializedRecord = serializer.serialize(snapshot); + assert.deepEqual(serializedRecord, { + application_credential_library_ids: ['4', '5'], + version: 1, + }); + }); + test('it normalizes records with array fields', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); @@ -75,6 +97,7 @@ module('Unit | Serializer | target', function (hooks) { { host_set_id: '1', host_catalog_id: '2' }, { host_set_id: '3', host_catalog_id: '4' }, ], + application_credential_library_ids: ['1'], }; const normalized = serializer.normalizeSingleResponse( store, @@ -92,13 +115,14 @@ module('Unit | Serializer | target', function (hooks) { { host_set_id: '1', host_catalog_id: '2' }, { host_set_id: '3', host_catalog_id: '4' }, ], + application_credential_library_ids: [{ value: '1' }], }, relationships: {}, }, }); }); - test('it normalizes missing host_sets to empty array', function (assert) { + test('it normalizes missing host_sets and credential libraries to empty array', function (assert) { assert.expect(1); const store = this.owner.lookup('service:store'); const serializer = store.serializerFor('target'); @@ -122,6 +146,7 @@ module('Unit | Serializer | target', function (hooks) { name: 'Target 1', scope: { scope_id: 'o_123' }, host_sets: [], + application_credential_library_ids: [], }, relationships: {}, }, diff --git a/ui/admin/tests/acceptance/sessions-test.js b/ui/admin/tests/acceptance/sessions-test.js index 15a263925..d5f68ffeb 100644 --- a/ui/admin/tests/acceptance/sessions-test.js +++ b/ui/admin/tests/acceptance/sessions-test.js @@ -55,7 +55,7 @@ module('Acceptance | sessions', function (hooks) { 'target', 1, { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); instances.sessions = this.server.createList( 'session', diff --git a/ui/desktop/tests/acceptance/origin-test.js b/ui/desktop/tests/acceptance/origin-test.js index eddad56bb..6eb0c5d22 100644 --- a/ui/desktop/tests/acceptance/origin-test.js +++ b/ui/desktop/tests/acceptance/origin-test.js @@ -97,7 +97,7 @@ module('Acceptance | origin', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); urls.scopes.global = `/scopes/${instances.scopes.global.id}`; diff --git a/ui/desktop/tests/acceptance/projects-test.js b/ui/desktop/tests/acceptance/projects-test.js index 38d54b480..3f6dd5506 100644 --- a/ui/desktop/tests/acceptance/projects-test.js +++ b/ui/desktop/tests/acceptance/projects-test.js @@ -92,7 +92,7 @@ module('Acceptance | projects', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); urls.scopes.global = `/scopes/${instances.scopes.global.id}`; diff --git a/ui/desktop/tests/acceptance/projects/sessions-test.js b/ui/desktop/tests/acceptance/projects/sessions-test.js index 2cdbafc16..2b31e5eaa 100644 --- a/ui/desktop/tests/acceptance/projects/sessions-test.js +++ b/ui/desktop/tests/acceptance/projects/sessions-test.js @@ -97,7 +97,7 @@ module('Acceptance | projects | sessions', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); instances.session = this.server.create( 'session', diff --git a/ui/desktop/tests/acceptance/projects/targets-test.js b/ui/desktop/tests/acceptance/projects/targets-test.js index 81dfbb22b..2fb027eec 100644 --- a/ui/desktop/tests/acceptance/projects/targets-test.js +++ b/ui/desktop/tests/acceptance/projects/targets-test.js @@ -101,7 +101,7 @@ module('Acceptance | projects | targets', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); instances.session = this.server.create( diff --git a/ui/desktop/tests/acceptance/projects/targets/sessions-test.js b/ui/desktop/tests/acceptance/projects/targets/sessions-test.js index 6bfe8bd89..f687be5d1 100644 --- a/ui/desktop/tests/acceptance/projects/targets/sessions-test.js +++ b/ui/desktop/tests/acceptance/projects/targets/sessions-test.js @@ -106,7 +106,7 @@ module('Acceptance | projects | targets | sessions', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); instances.session = this.server.create( diff --git a/ui/desktop/tests/acceptance/scopes-test.js b/ui/desktop/tests/acceptance/scopes-test.js index 93ec928bb..71907a984 100644 --- a/ui/desktop/tests/acceptance/scopes-test.js +++ b/ui/desktop/tests/acceptance/scopes-test.js @@ -110,7 +110,7 @@ module('Acceptance | scopes', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); instances.session = this.server.create( diff --git a/ui/desktop/tests/acceptance/targets-test.js b/ui/desktop/tests/acceptance/targets-test.js index 85881b7ec..f92168c3a 100644 --- a/ui/desktop/tests/acceptance/targets-test.js +++ b/ui/desktop/tests/acceptance/targets-test.js @@ -94,7 +94,7 @@ module('Acceptance | targets', function (hooks) { instances.target = this.server.create( 'target', { scope: instances.scopes.project }, - 'withRandomHostSets' + 'withAssociations' ); urls.scopes.global = `/scopes/${instances.scopes.global.id}`; From dad2d456d02f5b172fc888ed76828dd21accac10 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Thu, 22 Jul 2021 08:50:54 -0700 Subject: [PATCH 3/6] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20eslint=20d?= =?UTF-8?q?ependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/package.json | 2 +- addons/auth/package.json | 2 +- addons/core/package.json | 2 +- addons/rose/package.json | 2 +- ui/admin/package.json | 2 +- ui/desktop/package.json | 2 +- yarn.lock | 77 +++++++++++++++++++++++++++++++++++++++- 7 files changed, 82 insertions(+), 7 deletions(-) diff --git a/addons/api/package.json b/addons/api/package.json index 1bf61697c..a38301dec 100644 --- a/addons/api/package.json +++ b/addons/api/package.json @@ -59,7 +59,7 @@ "ember-source-channel-url": "^3.0.0", "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", - "eslint": "^7.17.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", diff --git a/addons/auth/package.json b/addons/auth/package.json index 9d27bee7c..44405d65b 100644 --- a/addons/auth/package.json +++ b/addons/auth/package.json @@ -53,7 +53,7 @@ "ember-source-channel-url": "^3.0.0", "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", - "eslint": "^7.17.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", diff --git a/addons/core/package.json b/addons/core/package.json index 1e3f3ef9a..3bdf0c75c 100644 --- a/addons/core/package.json +++ b/addons/core/package.json @@ -68,7 +68,7 @@ "ember-source-channel-url": "^3.0.0", "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", - "eslint": "^7.17.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", diff --git a/addons/rose/package.json b/addons/rose/package.json index dad7f51cb..04110e79e 100644 --- a/addons/rose/package.json +++ b/addons/rose/package.json @@ -73,7 +73,7 @@ "ember-source-channel-url": "^3.0.0", "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", - "eslint": "^7.17.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", diff --git a/ui/admin/package.json b/ui/admin/package.json index 0f7e95b19..2d1e8f9b0 100644 --- a/ui/admin/package.json +++ b/ui/admin/package.json @@ -77,7 +77,7 @@ "ember-source": "~3.24.0", "ember-template-lint": "^2.15.0", "ember-template-lint-plugin-prettier": "^2.0.0", - "eslint": "^7.17.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", diff --git a/ui/desktop/package.json b/ui/desktop/package.json index c22ee5143..046442e65 100755 --- a/ui/desktop/package.json +++ b/ui/desktop/package.json @@ -92,7 +92,7 @@ "ember-source": "~3.24.0", "ember-template-lint": "^2.15.0", "ember-template-lint-plugin-prettier": "^2.0.0", - "eslint": "^7.17.0", + "eslint": "^7.31.0", "eslint-config-prettier": "^7.1.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", diff --git a/yarn.lock b/yarn.lock index eeeb32795..82666df63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2060,6 +2060,21 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@eslint/eslintrc@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" + integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== + dependencies: + ajv "^6.12.4" + debug "^4.1.1" + espree "^7.3.0" + globals "^13.9.0" + ignore "^4.0.6" + import-fresh "^3.2.1" + js-yaml "^3.13.1" + minimatch "^3.0.4" + strip-json-comments "^3.1.1" + "@formatjs/ecma402-abstract@1.6.4": version "1.6.4" resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.6.4.tgz#cff5ef03837fb6bae70b16d04940213c17e87884" @@ -2284,6 +2299,20 @@ resolved "https://registry.yarnpkg.com/@hashicorp/structure-icons/-/structure-icons-1.9.1.tgz#eb294ef28e8192062f6c7c08459382ba31a8b4af" integrity sha512-uuncAHmehXk/WeNzE3NqS8z0YX/AU3Go8rDEUK2rNFdp1c0T1HiHO6RaBW5byB8KEBAPRdSsFSNqB4RaETarNA== +"@humanwhocodes/config-array@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" + integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== + dependencies: + "@humanwhocodes/object-schema" "^1.2.0" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/object-schema@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" + integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== + "@iarna/cli@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@iarna/cli/-/cli-1.2.0.tgz#0f7af5e851afe895104583c4ca07377a8094d641" @@ -10099,7 +10128,7 @@ eslint@^2.7.0: text-table "~0.2.0" user-home "^2.0.0" -eslint@^7.17.0, eslint@^7.27.0: +eslint@^7.27.0: version "7.28.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.28.0.tgz#435aa17a0b82c13bb2be9d51408b617e49c1e820" integrity sha512-UMfH0VSjP0G4p3EWirscJEQ/cHqnT/iuH6oNZOB94nBjWbMnhGEPxsZm1eyIW0C/9jLI0Fow4W5DXLjEI7mn1g== @@ -10144,6 +10173,52 @@ eslint@^7.17.0, eslint@^7.27.0: text-table "^0.2.0" v8-compile-cache "^2.0.3" +eslint@^7.31.0: + version "7.31.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.31.0.tgz#f972b539424bf2604907a970860732c5d99d3aca" + integrity sha512-vafgJpSh2ia8tnTkNUkwxGmnumgckLh5aAbLa1xRmIn9+owi8qBNGKL+B881kNKNTy7FFqTEkpNkUvmw0n6PkA== + dependencies: + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.3" + "@humanwhocodes/config-array" "^0.5.0" + ajv "^6.10.0" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.0.1" + doctrine "^3.0.0" + enquirer "^2.3.5" + escape-string-regexp "^4.0.0" + eslint-scope "^5.1.1" + eslint-utils "^2.1.0" + eslint-visitor-keys "^2.0.0" + espree "^7.3.1" + esquery "^1.4.0" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + functional-red-black-tree "^1.0.1" + glob-parent "^5.1.2" + globals "^13.6.0" + ignore "^4.0.6" + import-fresh "^3.0.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + js-yaml "^3.13.1" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.0.4" + natural-compare "^1.4.0" + optionator "^0.9.1" + progress "^2.0.0" + regexpp "^3.1.0" + semver "^7.2.1" + strip-ansi "^6.0.0" + strip-json-comments "^3.1.0" + table "^6.0.9" + text-table "^0.2.0" + v8-compile-cache "^2.0.3" + esm@^3.2.25, esm@^3.2.4: version "3.2.25" resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" From 90055ea14253412665648755541384aa086e2f99 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Thu, 22 Jul 2021 09:58:49 -0700 Subject: [PATCH 4/6] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20eslint-con?= =?UTF-8?q?fig-prettier=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/package.json | 2 +- addons/auth/package.json | 2 +- addons/core/package.json | 2 +- addons/rose/package.json | 2 +- ui/admin/package.json | 2 +- ui/desktop/package.json | 2 +- yarn.lock | 8 ++++---- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/api/package.json b/addons/api/package.json index 1bf61697c..670e3e111 100644 --- a/addons/api/package.json +++ b/addons/api/package.json @@ -60,7 +60,7 @@ "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", "eslint": "^7.17.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", diff --git a/addons/auth/package.json b/addons/auth/package.json index 9d27bee7c..bad492680 100644 --- a/addons/auth/package.json +++ b/addons/auth/package.json @@ -54,7 +54,7 @@ "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", "eslint": "^7.17.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", diff --git a/addons/core/package.json b/addons/core/package.json index 1e3f3ef9a..b1418ff28 100644 --- a/addons/core/package.json +++ b/addons/core/package.json @@ -69,7 +69,7 @@ "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", "eslint": "^7.17.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", diff --git a/addons/rose/package.json b/addons/rose/package.json index dad7f51cb..da14ad1aa 100644 --- a/addons/rose/package.json +++ b/addons/rose/package.json @@ -74,7 +74,7 @@ "ember-template-lint": "^2.15.0", "ember-try": "^1.4.0", "eslint": "^7.17.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", diff --git a/ui/admin/package.json b/ui/admin/package.json index 0f7e95b19..d3c989db5 100644 --- a/ui/admin/package.json +++ b/ui/admin/package.json @@ -78,7 +78,7 @@ "ember-template-lint": "^2.15.0", "ember-template-lint-plugin-prettier": "^2.0.0", "eslint": "^7.17.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", diff --git a/ui/desktop/package.json b/ui/desktop/package.json index c22ee5143..81be68f37 100755 --- a/ui/desktop/package.json +++ b/ui/desktop/package.json @@ -93,7 +93,7 @@ "ember-template-lint": "^2.15.0", "ember-template-lint-plugin-prettier": "^2.0.0", "eslint": "^7.17.0", - "eslint-config-prettier": "^7.1.0", + "eslint-config-prettier": "^8.3.0", "eslint-plugin-ember": "^10.1.1", "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.3.1", diff --git a/yarn.lock b/yarn.lock index eeeb32795..3b25ae477 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9975,10 +9975,10 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-prettier@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-7.2.0.tgz#f4a4bd2832e810e8cc7c1411ec85b3e85c0c53f9" - integrity sha512-rV4Qu0C3nfJKPOAhFujFxB7RMP+URFyQqqOZW9DMRD7ZDTFyjaIlETU3xzHELt++4ugC0+Jm084HQYkkJe+Ivg== +eslint-config-prettier@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" + integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== eslint-plugin-ember@^10.1.1: version "10.5.0" From 7f13365336ce4f74c3dd8cf42c64bea6cab8006b Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Fri, 23 Jul 2021 11:28:11 -0700 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Add=20credential=20s?= =?UTF-8?q?tores=20empty=20list=20message?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add credential stores empty list message with link to create a new one. --- addons/core/translations/resources/en-us.yaml | 5 +++- .../scopes/scope/credential-stores/index.hbs | 23 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 9d8564288..72f062f7b 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -270,7 +270,10 @@ target: credential-store: title: Credential Store title_plural: Credential Stores - description: A credential stores is a collection of credentials and credential libraries. + description: A credential store is a collection of credentials and credential libraries. + messages: + welcome: + title: Welcome to Credential Stores actions: delete: Delete Credential Store credential-library: diff --git a/ui/admin/app/templates/scopes/scope/credential-stores/index.hbs b/ui/admin/app/templates/scopes/scope/credential-stores/index.hbs index c8ff3b098..7b6e88c9e 100644 --- a/ui/admin/app/templates/scopes/scope/credential-stores/index.hbs +++ b/ui/admin/app/templates/scopes/scope/credential-stores/index.hbs @@ -8,7 +8,9 @@ {{t 'resources.credential-store.title_plural'}} -

{{t 'resources.credential-store.description'}}

+ {{#if @model}} +

{{t 'resources.credential-store.description'}}

+ {{/if}} @@ -61,6 +63,25 @@ {{/each}} + + {{else}} + + + + {{t 'resources.credential-store.description'}} + + + + {{t 'titles.new'}} + + + + {{/if}} + + \ No newline at end of file From dbfc21ace3da3cb63d1d44906452624084c7ebea Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Fri, 23 Jul 2021 15:00:07 -0700 Subject: [PATCH 6/6] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Update=20ember-cli-?= =?UTF-8?q?app-version=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/package.json | 2 +- ui/desktop/package.json | 2 +- yarn.lock | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/admin/package.json b/ui/admin/package.json index 666ddc101..6c2390fe6 100644 --- a/ui/admin/package.json +++ b/ui/admin/package.json @@ -51,7 +51,7 @@ "ember-auto-import": "^1.10.1", "ember-breadcrumbs": "^0.2.3", "ember-cli": "~3.27.0", - "ember-cli-app-version": "^4.0.0", + "ember-cli-app-version": "^5.0.0", "ember-cli-babel": "^7.23.0", "ember-cli-code-coverage": "^1.0.2", "ember-cli-content-security-policy": "^1.1.1", diff --git a/ui/desktop/package.json b/ui/desktop/package.json index dd0279831..6ed9cd93e 100755 --- a/ui/desktop/package.json +++ b/ui/desktop/package.json @@ -67,7 +67,7 @@ "ember-auto-import": "^1.10.1", "ember-autofocus-modifier": "^1.1.0", "ember-cli": "~3.27.0", - "ember-cli-app-version": "^4.0.0", + "ember-cli-app-version": "^5.0.0", "ember-cli-babel": "^7.23.0", "ember-cli-code-coverage": "^1.0.2", "ember-cli-dependency-checker": "^3.2.0", diff --git a/yarn.lock b/yarn.lock index 15234911f..1f136f3b5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8574,12 +8574,12 @@ ember-cli-addon-docs-yuidoc@^0.2.3: lodash "^4.17.5" yuidocjs "^0.10.2" -ember-cli-app-version@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/ember-cli-app-version/-/ember-cli-app-version-4.0.0.tgz#033057ec5fe4d3ecdf5ac5380d442e2dc9f7526a" - integrity sha512-YRH1r4vjA9ZIgTVJ38zWxhtt4SCzIHb0ppEsO/z+JV0ZTQlS3+2dT5RhJWz7O3dyw5FWnlIng+gPRoQEz1umHA== +ember-cli-app-version@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ember-cli-app-version/-/ember-cli-app-version-5.0.0.tgz#adad17c6f706f419b223707eec66dd1cd28530c3" + integrity sha512-afhx/CXDOMNXzoe4NDPy5WUfxWmYYHUzMCiTyvPBxCDBXYcMrtxNWxvgaSaeqcoHVEmqzeyBj8V82tzmT1dcyw== dependencies: - ember-cli-babel "^7.22.1" + ember-cli-babel "^7.23.1" git-repo-info "^2.1.1" ember-cli-babel-plugin-helpers@^1.0.0, ember-cli-babel-plugin-helpers@^1.1.0, ember-cli-babel-plugin-helpers@^1.1.1: