chore: 🤖 fix deprecation warning for firstobject usage (#1844)

This commit is contained in:
Dharini Jeeva authored and GitHub committed 2023-08-15 13:20:08 -07:00
1 parent 40673c180c
commit bf343c0b8c
10 files changed
+11 -14

No files matched your search

+1 -4
View File
@@ -26,10 +26,7 @@ module('Unit | Model | scope', function (hooks) {
}));
const scopes = await store.findAll('scope');
// check integrity of scope relationships
assert.notOk(
await scopes.firstObject.get('scope'),
'Global scope has no parent'
);
assert.notOk(await scopes[0].get('scope'), 'Global scope has no parent');
assert.strictEqual(
await scopes.objectAt(1).get('scope.scope_id'),
'global',
+1 -1
View File
@@ -83,7 +83,7 @@ export default class ApplicationRoute extends Route {
*/
@action
error(e) {
const isUnauthenticated = A(e?.errors)?.firstObject?.isUnauthenticated;
const isUnauthenticated = A(e?.errors)?.[0]?.isUnauthenticated;
if (isUnauthenticated) {
this.session.invalidate();
return false;
+1 -1
View File
@@ -19,7 +19,7 @@ export default class ScopesIndexRoute extends Route {
* If authenticated, redirects to the scope route of the authenticted scope.
* If unauthenticated, redirects to the first scope that was loaded (if any).
* @param {[ScopeModel]} model
* @param {?ScopeModel} model.firstObject
* @param {?ScopeModel} model[0]
*/
redirect() {
const authenticatedScopeID = get(
@@ -20,7 +20,7 @@ export default class ScopesScopeAuthenticateIndexRoute extends Route {
* @param {[AuthMethodModel]} model.authMethods
*/
redirect({ authMethods }) {
const firstAuthMethod = authMethods.firstObject;
const firstAuthMethod = authMethods[0];
if (firstAuthMethod) {
this.router.transitionTo(
'scopes.scope.authenticate.method',
@@ -24,7 +24,7 @@
<page.body>
{{#if @model.accounts}}
{{! OIDC accounts display more fields }}
{{#if @model.accounts.firstObject.isOIDC}}
{{#if (get @model.accounts '0.isOIDC')}}
<Hds::Table
@model={{@model.accounts}}
@columns={{array
@@ -80,7 +80,7 @@
</B.Tr>
</:body>
</Hds::Table>
{{else if @model.accounts.firstObject.isLDAP}}
{{else if (get @model.accounts '0.isLDAP')}}
<Hds::Table
@model={{@model.accounts}}
@columns={{array
@@ -23,7 +23,7 @@
<page.body>
{{#if @model.managedGroups}}
{{#if @model.managedGroups.firstObject.isOIDC}}
{{#if (get @model.managedGroups '0.isOIDC')}}
<Hds::Table
@model={{@model.managedGroups}}
@columns={{array
@@ -31,7 +31,7 @@
<page.body>
{{#if @model.members}}
{{#if @model.members.firstObject.isOIDC}}
{{#if (get @model.members '0.isOIDC')}}
<Hds::Table
@model={{@model.members}}
@columns={{array
+1 -1
View File
@@ -89,7 +89,7 @@ export default class ApplicationRoute extends Route {
*/
@action
error(e) {
const isUnauthenticated = A(e?.errors)?.firstObject?.isUnauthenticated;
const isUnauthenticated = A(e?.errors)?.[0]?.isUnauthenticated;
if (isUnauthenticated) {
this.session.invalidate();
return false;
+1 -1
View File
@@ -19,7 +19,7 @@ export default class ScopesIndexRoute extends Route {
* If authenticated, redirects to the scope route of the authenticted scope.
* If unauthenticated, redirects to the first scope that was loaded (if any).
* @param {[ScopeModel]} model
* @param {?ScopeModel} model.firstObject
* @param {?ScopeModel} model[0]
*/
redirect() {
const authenticatedScopeID = get(
@@ -20,7 +20,7 @@ export default class ScopesScopeAuthenticateIndexRoute extends Route {
* @param {[AuthMethodModel]} model.authMethods
*/
redirect({ authMethods }) {
const firstAuthMethod = authMethods.firstObject;
const firstAuthMethod = authMethods[0];
if (firstAuthMethod) {
this.router.replaceWith(
'scopes.scope.authenticate.method',