Upgrade api to ember 4.12 (#1833) (#1839)

* chore: 🤖 Upgrade API layer to ember 4.12

* chore: 🤖 Upgrade ember-data to 4.12

* fix: 🐛 Fix breaking change from usage of internal method

* chore: 🤖 Remove stylelint in API addon

* test: 💍 Fix broken API tests

* chore: 🤖 get rid of toArray

* test: 💍 Fix tests broken by ember data changes

---------

Co-authored-by: dharini <dharini@hashicorp.com>
This commit is contained in:
Zhihe Lianddharini authored and GitHub committed 2023-08-14 17:03:59 -04:00
1 parent 77b47e2cb3
commit 0e9042f588
21 files changed
+1338 -284

No files matched your search

@@ -22,7 +22,7 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
// =attributes
@resourceFilter({
allowed: (route) => route.store.peekAll('scope').toArray(),
allowed: (route) => route.store.peekAll('scope'),
serialize: ({ id }) => id,
findBySerialized: ({ id }, value) => id === value,
})
@@ -48,8 +48,7 @@ export default class ScopesScopeGroupsGroupAddMembersRoute extends Route {
// filter out projects, since the user resource exists only on org and above
const scopes = this.store
.peekAll('scope')
.filter((scope) => !scope.isProject)
.toArray();
.filter((scope) => !scope.isProject);
const scopeIDs = this.scope?.map((scope) => scope.id);
const users = scopeIDs?.length
? this.resourceFilterStore.queryBy(
@@ -23,7 +23,7 @@ export default class ScopesScopeRolesRoleAddPrincipalsRoute extends Route {
// =attributes
@resourceFilter({
allowed: (route) => route.store.peekAll('scope').toArray(),
allowed: (route) => route.store.peekAll('scope'),
serialize: ({ id }) => id,
findBySerialized: ({ id }, value) => id === value,
})
@@ -18,7 +18,6 @@ export default class ScopesScopeWorkersIndexRoute extends Route {
allowed: (route) => {
const configTags = route
.modelFor('scopes.scope.workers')
.toArray()
.flatMap((worker) => worker.getConfigTagList())
.filter(Boolean);
@@ -12,7 +12,6 @@ import {
find,
findAll,
getRootElement,
setupOnerror,
} from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
@@ -124,10 +123,7 @@ module('Acceptance | authentication', function (hooks) {
test('visiting auth method when the scope cannot be loaded is still allowed', async function (assert) {
assert.expect(1);
setupOnerror(() => {
// do nothing, otherwise an uncaught adapter error will fail the test
});
this.server.get('/scopes', () => {
this.server.get(authMethodAuthenticateURL, () => {
return new Response(404);
});
await visit(authMethodAuthenticateURL);