Skip to content

Commit

Permalink
fix project settings deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
future-pirate-king committed Oct 21, 2024
1 parent ba7ea17 commit f82bec3
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 37 deletions.
17 changes: 2 additions & 15 deletions app/components/file-compare/analysis-details/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { htmlSafe } from '@ember/template';
import IntlService from 'ember-intl/services/intl';
import type IntlService from 'ember-intl/services/intl';

import ENUMS from 'irene/enums';
import AnalysisModel from 'irene/models/analysis';
import type AnalysisModel from 'irene/models/analysis';

export interface FileCompareAnalysisDetailsSignature {
Element: HTMLElement;
Expand All @@ -29,19 +29,6 @@ export default class FileCompareAnalysisDetailsComponent extends Component<FileC
return this.isMarkedAsPassed || this.analysis?.isRisky;
}

get regulatoryContent() {
return {
owasp: this.analysis?.owasp.toArray(),
owaspmobile2024: this.analysis?.owaspmobile2024.toArray(),
cwe: this.analysis?.cwe.toArray(),
asvs: this.analysis?.asvs.toArray(),
mstg: this.analysis?.mstg.toArray(),
gdpr: this.analysis?.gdpr.toArray(),
pcidss: this.analysis?.pcidss.toArray(),
hipaa: this.analysis?.hipaa.toArray(),
};
}

get vulnerability() {
return this.analysis?.vulnerability || null;
}
Expand Down
4 changes: 2 additions & 2 deletions app/components/file-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class FileListComponent extends Component<FileListSignature> {
}

get files() {
return this.filesResponse?.toArray();
return this.filesResponse?.slice();
}

get totalFilesCount() {
Expand All @@ -94,7 +94,7 @@ export default class FileListComponent extends Component<FileListSignature> {
get sortedFiles() {
const sortProperties = ['createdOn:desc'];

return this.filesResponse?.sortBy(...sortProperties).toArray();
return this.filesResponse?.slice().sortBy(...sortProperties);
}

get hasFiles() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default class ProjectSettingsAnalysisSettingsVulnerabilityListComponent e
}

get vulnerabilityPreferences() {
return this.vulnerabilityListResponse?.toArray() || [];
return this.vulnerabilityListResponse?.slice() || [];
}

get vulnerability() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class ProjectSettingsGeneralSettingsCollaboratorsTableComponent e

get projectCollaborators() {
return (
this.projectCollaboratorsResponse?.toArray().sortBy('created:desc') || []
this.projectCollaboratorsResponse?.slice().sortBy('created:desc') || []
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class ProjectSettingsGeneralSettingsDyanmicscanAutomationSettings
}

get scenarioList() {
return this.projectScenarios?.toArray() || [];
return this.projectScenarios?.slice() || [];
}

@action reloadProjectScenarios() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default class ProjectSettingsGeneralSettingsJiraProjectComponent extends
}

get jiraProjects() {
return this.jiraProjectsResponse?.toArray() || [];
return this.jiraProjectsResponse?.slice() || [];
}

get hasJIRAProject() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion app/components/project-settings/view-scenario/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class ProjectSettingsViewScenarioComponent extends Component<Proj
})
);

this.parameterList = parameterList.toArray();
this.parameterList = parameterList.slice();
} catch (error) {
this.notify.error(parseError(error));
}
Expand Down
10 changes: 5 additions & 5 deletions app/models/dynamicscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class DynamicscanModel extends Model {
@service declare intl: IntlService;

// Generic dynamic scan info
@belongsTo('file', { async: true })
@belongsTo('file', { async: true, inverse: null })
declare file: AsyncBelongsTo<FileModel>;

@attr('number')
Expand All @@ -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<UserModel>;

@belongsTo('user', { async: true })
@belongsTo('user', { async: true, inverse: null })
declare stoppedByUser: AsyncBelongsTo<UserModel>;

// Scan user preferences
Expand All @@ -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<ScanParameterModel>;

@attr('boolean')
Expand Down Expand Up @@ -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<AvailableDeviceModel>;

async extendTime(time: number) {
Expand Down
2 changes: 1 addition & 1 deletion app/models/github-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProjectModel>;
}

Expand Down
2 changes: 1 addition & 1 deletion app/models/jira-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProjectModel>;
}

Expand Down
6 changes: 3 additions & 3 deletions app/models/scan-parameter-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ProjectModel>;

@belongsTo('user')
@belongsTo('user', { async: true, inverse: null })
declare lastUpdatedBy: AsyncBelongsTo<UserModel> | null;

@hasMany('scan-parameter', { inverse: 'scanParameterGroup' })
@hasMany('scan-parameter', { inverse: 'scanParameterGroup', async: true })
declare scanParameters: AsyncHasMany<ScanParameterModel>;
}

Expand Down
4 changes: 2 additions & 2 deletions app/models/scan-parameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<UserModel> | null;

@belongsTo('scan-parameter-group', { inverse: 'scanParameters' })
@belongsTo('scan-parameter-group', { inverse: 'scanParameters', async: true })
declare scanParameterGroup: AsyncBelongsTo<ScanParameterGroupModel>;
}

Expand Down

0 comments on commit f82bec3

Please sign in to comment.