From 6d6bc6b5a68f4f90cbd3cea5ad99cdd5185c824f Mon Sep 17 00:00:00 2001 From: Sam David Date: Tue, 15 Oct 2024 16:24:52 +0530 Subject: [PATCH] fix project settings deprecation --- .../analysis-settings/vulnerability-list/index.ts | 2 +- .../add-project-collaborator/table/index.ts | 2 +- .../general-settings/add-project-team/table/index.ts | 2 +- .../general-settings/collaborators-table/index.ts | 2 +- .../dynamicscan-automation-settings/scenario/index.ts | 2 +- .../general-settings/jira-project/index.ts | 2 +- .../general-settings/project-team-table/index.ts | 2 +- app/components/project-settings/view-scenario/index.ts | 2 +- app/models/dynamicscan.ts | 10 +++++----- app/models/github-repo.ts | 2 +- app/models/jira-repo.ts | 2 +- app/models/scan-parameter-group.ts | 6 +++--- app/models/scan-parameter.ts | 4 ++-- 13 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/components/project-settings/analysis-settings/vulnerability-list/index.ts b/app/components/project-settings/analysis-settings/vulnerability-list/index.ts index 3e0bfa091c..5d355e36f1 100644 --- a/app/components/project-settings/analysis-settings/vulnerability-list/index.ts +++ b/app/components/project-settings/analysis-settings/vulnerability-list/index.ts @@ -79,7 +79,7 @@ export default class ProjectSettingsAnalysisSettingsVulnerabilityListComponent e } get vulnerabilityPreferences() { - return this.vulnerabilityListResponse?.toArray() || []; + return this.vulnerabilityListResponse?.slice() || []; } get vulnerability() { diff --git a/app/components/project-settings/general-settings/add-project-collaborator/table/index.ts b/app/components/project-settings/general-settings/add-project-collaborator/table/index.ts index 0c8b7c2c21..bc4afe7131 100644 --- a/app/components/project-settings/general-settings/add-project-collaborator/table/index.ts +++ b/app/components/project-settings/general-settings/add-project-collaborator/table/index.ts @@ -67,7 +67,7 @@ export default class ProjectSettingsGeneralSettingsAddProjectCollaboratorTableCo } get orgMembers() { - return this.orgMemberRecordResponse?.toArray().sortBy('created:desc') || []; + return this.orgMemberRecordResponse?.slice().sortBy('created:desc') || []; } get hasNoOrgMembers() { diff --git a/app/components/project-settings/general-settings/add-project-team/table/index.ts b/app/components/project-settings/general-settings/add-project-team/table/index.ts index ce6b302f37..0cc033f6cf 100644 --- a/app/components/project-settings/general-settings/add-project-team/table/index.ts +++ b/app/components/project-settings/general-settings/add-project-team/table/index.ts @@ -67,7 +67,7 @@ export default class ProjectSettingsGeneralSettingsAddProjectTeamTableComponent } get organizationTeams() { - return this.orgTeamRecordResponse?.toArray().sortBy('created:desc') || []; + return this.orgTeamRecordResponse?.slice().sortBy('created:desc') || []; } get hasNoOrgTeams() { diff --git a/app/components/project-settings/general-settings/collaborators-table/index.ts b/app/components/project-settings/general-settings/collaborators-table/index.ts index a705e21ec4..36a9a28135 100644 --- a/app/components/project-settings/general-settings/collaborators-table/index.ts +++ b/app/components/project-settings/general-settings/collaborators-table/index.ts @@ -59,7 +59,7 @@ export default class ProjectSettingsGeneralSettingsCollaboratorsTableComponent e get projectCollaborators() { return ( - this.projectCollaboratorsResponse?.toArray().sortBy('created:desc') || [] + this.projectCollaboratorsResponse?.slice().sortBy('created:desc') || [] ); } diff --git a/app/components/project-settings/general-settings/dynamicscan-automation-settings/scenario/index.ts b/app/components/project-settings/general-settings/dynamicscan-automation-settings/scenario/index.ts index 62be8bf54c..b925531823 100644 --- a/app/components/project-settings/general-settings/dynamicscan-automation-settings/scenario/index.ts +++ b/app/components/project-settings/general-settings/dynamicscan-automation-settings/scenario/index.ts @@ -56,7 +56,7 @@ export default class ProjectSettingsGeneralSettingsDyanmicscanAutomationSettings } get scenarioList() { - return this.projectScenarios?.toArray() || []; + return this.projectScenarios?.slice() || []; } @action reloadProjectScenarios() { diff --git a/app/components/project-settings/general-settings/jira-project/index.ts b/app/components/project-settings/general-settings/jira-project/index.ts index 90fac5389e..2617ec5bc2 100644 --- a/app/components/project-settings/general-settings/jira-project/index.ts +++ b/app/components/project-settings/general-settings/jira-project/index.ts @@ -89,7 +89,7 @@ export default class ProjectSettingsGeneralSettingsJiraProjectComponent extends } get jiraProjects() { - return this.jiraProjectsResponse?.toArray() || []; + return this.jiraProjectsResponse?.slice() || []; } get hasJIRAProject() { diff --git a/app/components/project-settings/general-settings/project-team-table/index.ts b/app/components/project-settings/general-settings/project-team-table/index.ts index 184f61f4a6..f85bde42c1 100644 --- a/app/components/project-settings/general-settings/project-team-table/index.ts +++ b/app/components/project-settings/general-settings/project-team-table/index.ts @@ -58,7 +58,7 @@ export default class ProjectSettingsGeneralSettingsProjectTeamTableComponent ext } get projectTeamList() { - return this.projectTeamListResponse?.toArray().sortBy('created:desc') || []; + return this.projectTeamListResponse?.slice().sortBy('created:desc') || []; } get hasNoProjectTeams() { diff --git a/app/components/project-settings/view-scenario/index.ts b/app/components/project-settings/view-scenario/index.ts index 94b52db969..77ce951f6d 100644 --- a/app/components/project-settings/view-scenario/index.ts +++ b/app/components/project-settings/view-scenario/index.ts @@ -56,7 +56,7 @@ export default class ProjectSettingsViewScenarioComponent extends Component; @attr('number') @@ -22,10 +22,10 @@ export default class DynamicscanModel extends Model { declare status: number; // User actions - @belongsTo('user', { async: true }) + @belongsTo('user', { async: true, inverse: null }) declare startedByUser: AsyncBelongsTo; - @belongsTo('user', { async: true }) + @belongsTo('user', { async: true, inverse: null }) declare stoppedByUser: AsyncBelongsTo; // Scan user preferences @@ -38,7 +38,7 @@ export default class DynamicscanModel extends Model { @attr('string') declare platformVersion: string; - @belongsTo('scan-parameter-group') + @belongsTo('scan-parameter-group', { async: true, inverse: null }) declare scanParameterGroups: AsyncBelongsTo; @attr('boolean') @@ -91,7 +91,7 @@ export default class DynamicscanModel extends Model { @attr('number') declare time: number; - @belongsTo('available-device') + @belongsTo('available-device', { async: true, inverse: null }) declare availableDevice: AsyncBelongsTo; async extendTime(time: number) { diff --git a/app/models/github-repo.ts b/app/models/github-repo.ts index bb39f7a9ad..7f9696f360 100644 --- a/app/models/github-repo.ts +++ b/app/models/github-repo.ts @@ -31,7 +31,7 @@ export default class GithubRepoModel extends Model { @attr() declare repoDetails: GithubRepoDetails; - @belongsTo('project') + @belongsTo('project', { async: true, inverse: null }) declare project: AsyncBelongsTo; } diff --git a/app/models/jira-repo.ts b/app/models/jira-repo.ts index 4806a96f7d..61b4420242 100644 --- a/app/models/jira-repo.ts +++ b/app/models/jira-repo.ts @@ -11,7 +11,7 @@ export default class JiraRepoModel extends Model { @attr('number') declare risk_threshold: number; - @belongsTo('project') + @belongsTo('project', { async: true, inverse: null }) declare project: AsyncBelongsTo; } diff --git a/app/models/scan-parameter-group.ts b/app/models/scan-parameter-group.ts index fe2c5c33a1..1cdf0c3bd5 100644 --- a/app/models/scan-parameter-group.ts +++ b/app/models/scan-parameter-group.ts @@ -29,13 +29,13 @@ export default class ScanParameterGroupModel extends Model { @attr('date') declare updatedOn: Date; - @belongsTo('project') + @belongsTo('project', { async: true, inverse: null }) declare project: AsyncBelongsTo; - @belongsTo('user') + @belongsTo('user', { async: true, inverse: null }) declare lastUpdatedBy: AsyncBelongsTo | null; - @hasMany('scan-parameter', { inverse: 'scanParameterGroup' }) + @hasMany('scan-parameter', { inverse: 'scanParameterGroup', async: true }) declare scanParameters: AsyncHasMany; } diff --git a/app/models/scan-parameter.ts b/app/models/scan-parameter.ts index 265ff94f09..fb20d7b517 100644 --- a/app/models/scan-parameter.ts +++ b/app/models/scan-parameter.ts @@ -19,10 +19,10 @@ export default class ScanParameterModel extends Model { @attr('date') declare updatedOn: Date; - @belongsTo('user') + @belongsTo('user', { async: true, inverse: null }) declare lastUpdatedBy: AsyncBelongsTo | null; - @belongsTo('scan-parameter-group', { inverse: 'scanParameters' }) + @belongsTo('scan-parameter-group', { inverse: 'scanParameters', async: true }) declare scanParameterGroup: AsyncBelongsTo; }