Skip to content

Commit

Permalink
deprecation fixes for project, file-details & analysis sections
Browse files Browse the repository at this point in the history
  • Loading branch information
future-pirate-king committed Oct 17, 2024
1 parent c49e766 commit 78a7c5a
Show file tree
Hide file tree
Showing 35 changed files with 303 additions and 243 deletions.
1 change: 1 addition & 0 deletions app/components/ak-select/before-option/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ export default class AkSelectBeforeOptionComponent extends Component<AkSelectBef
declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'AkSelect::BeforeOption': typeof AkSelectBeforeOptionComponent;
'ak-select/before-option': typeof AkSelectBeforeOptionComponent;
}
}
2 changes: 1 addition & 1 deletion app/components/ak-select/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
@search={{@search}}
@beforeOptionsComponent={{or
@beforeOptionsComponent
'ak-select/before-option'
(component 'ak-select/before-option')
}}
data-test-power-select
as |option|
Expand Down
1 change: 0 additions & 1 deletion app/components/ak-select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ interface AkSelectNamedArgs<O> extends PowerSelectArgs {
renderInPlace?: boolean;
error?: boolean;
loadingMessage?: string;
selectedItemComponent?: string;
labelTypographyVariant?: AkSelectLabelTypographyVariant;
labelTypographyColor?: AkSelectLabelTypographyColor;
verticalPosition?: 'above' | 'below' | 'auto';
Expand Down
3 changes: 1 addition & 2 deletions app/components/file-details/compliance-insights/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ export default class FileDetailsComplianceInsightsComponent extends Component<Fi
const owaspsIds: string[] = [];
const owaspmobile2024s: string[] = [];

for (let item = 0; item < (this.analyses.length as number); item++) {
const analysis = this.analyses.objectAt(item);
for (const analysis of this.analyses.slice()) {
const analysisRisk = analysis?.get('risk');

const owasp2024 = await analysis?.get('owaspmobile2024');
Expand Down
62 changes: 28 additions & 34 deletions app/components/file-details/vulnerability-analysis-details/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ export default class FileDetailsVulnerabilityAnalysisDetailsComponent extends Co
}

get owaspMobile2024Exists() {
return !isEmpty(this.analysis.owaspmobile2024.toArray());
return !isEmpty(this.analysis.owaspmobile2024);
}

get pcidssExists() {
return !isEmpty(this.analysis.pcidss.toArray());
return !isEmpty(this.analysis.pcidss);
}

get regulatoryContent() {
Expand All @@ -85,121 +85,115 @@ export default class FileDetailsVulnerabilityAnalysisDetailsComponent extends Co
key: 'owasp',
heading: this.intl.t('owasp'),
title: this.intl.t('owaspExpansion'),
contents: this.analysis.owasp.toArray(),
contents: this.analysis.owasp,
hasContent:
!isEmpty(this.analysis.owasp.toArray()) &&
!this.owaspMobile2024Exists,
!isEmpty(this.analysis.owasp) && !this.owaspMobile2024Exists,
},
{
key: 'owaspmobile2024',
heading: this.intl.t('owaspmobile2024'),
title: this.intl.t('owaspMobile2024Expansion'),
contents: this.analysis.owaspmobile2024.toArray(),
contents: this.analysis.owaspmobile2024,
hasContent: this.owaspMobile2024Exists,
},
{
key: 'owaspapi2023',
heading: this.intl.t('owaspapi2023'),
title: this.intl.t('owaspApiTop10Expansion'),
contents: this.analysis.owaspapi2023.toArray(),
hasContent: !isEmpty(this.analysis.owaspapi2023.toArray()),
contents: this.analysis.owaspapi2023,
hasContent: !isEmpty(this.analysis.owaspapi2023),
},
{
key: 'cwe',
heading: this.intl.t('cwe'),
title: this.intl.t('cweExpansion'),
contents: this.analysis.cwe.toArray(),
hasContent: !isEmpty(this.analysis.cwe.toArray()),
contents: this.analysis.cwe,
hasContent: !isEmpty(this.analysis.cwe),
component:
'file-details/vulnerability-analysis-details/regulatory-content/cwe' as const,
},
{
key: 'asvs',
heading: this.intl.t('asvs'),
title: this.intl.t('asvsExpansion'),
contents: this.analysis.asvs.toArray(),
hasContent: !isEmpty(this.analysis.asvs.toArray()),
contents: this.analysis.asvs,
hasContent: !isEmpty(this.analysis.asvs),
},
{
key: 'masvs',
heading: this.intl.t('masvs'),
title: this.intl.t('masvsExpansion'),
contents: this.analysis.masvs.toArray(),
hasContent: !isEmpty(this.analysis.masvs.toArray()),
contents: this.analysis.masvs,
hasContent: !isEmpty(this.analysis.masvs),
},
{
key: 'mstg',
heading: this.intl.t('mstg'),
title: this.intl.t('mstgExpansion'),
contents: this.analysis.mstg.toArray(),
hasContent: !isEmpty(this.analysis.mstg.toArray()),
contents: this.analysis.mstg,
hasContent: !isEmpty(this.analysis.mstg),
},
{
key: 'pcidss',
heading: this.intl.t('pcidss'),
title: this.intl.t('pcidssExpansion'),
contents: this.analysis.pcidss.toArray(),
contents: this.analysis.pcidss,
hasContent: this.analysis.showPcidss && this.pcidssExists,
hasMoreDetails: true,
},
{
key: 'pcidss4',
heading: this.intl.t('pcidss4'),
title: this.intl.t('pcidssExpansion'),
contents: this.analysis.pcidss4.toArray(),
contents: this.analysis.pcidss4,
hasContent:
this.analysis.showPcidss &&
!isEmpty(this.analysis.pcidss4.toArray()) &&
!isEmpty(this.analysis.pcidss4) &&
!this.pcidssExists,
hasMoreDetails: true,
},
{
key: 'hipaa',
heading: this.intl.t('hipaa'),
title: this.intl.t('hipaaExpansion'),
contents: this.analysis.hipaa.toArray(),
hasContent:
this.analysis.showHipaa && !isEmpty(this.analysis.hipaa.toArray()),
contents: this.analysis.hipaa,
hasContent: this.analysis.showHipaa && !isEmpty(this.analysis.hipaa),
component:
'file-details/vulnerability-analysis-details/regulatory-content/hipaa' as const,
},
{
key: 'gdpr',
heading: this.intl.t('gdpr'),
title: this.intl.t('gdprExpansion'),
contents: this.analysis.gdpr.toArray(),
hasContent:
this.analysis.showGdpr && !isEmpty(this.analysis.gdpr.toArray()),
contents: this.analysis.gdpr,
hasContent: this.analysis.showGdpr && !isEmpty(this.analysis.gdpr),
},
{
key: 'nistsp80053',
heading: this.intl.t('nistsp80053'),
title: this.intl.t('nistsp80053'),
contents: this.analysis.nistsp80053.toArray(),
contents: this.analysis.nistsp80053,
hasContent:
this.analysis.showNist &&
!isEmpty(this.analysis.nistsp80053.toArray()),
this.analysis.showNist && !isEmpty(this.analysis.nistsp80053),
component:
'file-details/vulnerability-analysis-details/regulatory-content/nist' as const,
},
{
key: 'nistsp800171',
heading: this.intl.t('nistsp800171'),
title: this.intl.t('nistsp800171'),
contents: this.analysis.nistsp800171.toArray(),
contents: this.analysis.nistsp800171,
hasContent:
this.analysis.showNist &&
!isEmpty(this.analysis.nistsp800171.toArray()),
this.analysis.showNist && !isEmpty(this.analysis.nistsp800171),
component:
'file-details/vulnerability-analysis-details/regulatory-content/nist' as const,
},
{
key: 'sama',
heading: this.intl.t('sama'),
title: this.intl.t('samaExpansion'),
contents: this.analysis.sama.toArray(),
hasContent:
this.analysis.showSama && !isEmpty(this.analysis.sama.toArray()),
contents: this.analysis.sama,
hasContent: this.analysis.showSama && !isEmpty(this.analysis.sama),
hasMoreDetails: true,
},
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Component from '@glimmer/component';
import CweModel from 'irene/models/cwe';
import type { AsyncHasMany } from '@ember-data/model';
import type CweModel from 'irene/models/cwe';

export interface FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentCweSignature {
Args: {
contents: CweModel[];
contents: AsyncHasMany<CweModel>;
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Component from '@glimmer/component';
import HipaaModel from 'irene/models/hipaa';
import type { AsyncHasMany } from '@ember-data/model';
import type HipaaModel from 'irene/models/hipaa';

export interface FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentHipaaSignature {
Args: {
contents: HipaaModel[];
contents: AsyncHasMany<HipaaModel>;
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import type Model from '@ember-data/model';
import type { AsyncHasMany } from '@ember-data/model';

export interface FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentSignature<
T extends object,
T extends Model,
> {
Args: {
contents: T[];
contents: AsyncHasMany<T>;
hasMoreDetails?: boolean;
};
Blocks: {
Expand All @@ -20,7 +22,7 @@ export interface FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentSignatu
}

export default class FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentComponent<
T extends object,
T extends Model,
> extends Component<
FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentSignature<T>
> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { action } from '@ember/object';
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import type { AsyncHasMany } from '@ember-data/model';

import Nistsp800171Model from 'irene/models/nistsp800171';
import Nistsp80053Model from 'irene/models/nistsp80053';
import type Nistsp800171Model from 'irene/models/nistsp800171';
import type Nistsp80053Model from 'irene/models/nistsp80053';

export interface FileDetailsVulnerabilityAnalysisDetailsRegulatoryContentNistSignature {
Args: {
contents: (Nistsp800171Model | Nistsp80053Model)[];
contents: AsyncHasMany<Nistsp800171Model | Nistsp80053Model>;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default class FileDetailsVulnerabilityAnalysisTableComponent extends Comp
const vulnerabilityType = parseInt(String(type));

if (vulnerabilityType === ENUMS.VULNERABILITY_TYPE.UNKNOWN) {
return this.analyses.toArray();
return this.analyses.slice();
}

const filteredAnalysis = this.analyses?.filter((a) =>
Expand Down
4 changes: 2 additions & 2 deletions app/components/file/report-drawer/va-reports/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ export default class FileReportDrawerVaReportsComponent extends Component<FileRe
}

get latestReport() {
return this.reports?.firstObject;
return this.reports?.slice()?.[0];
}

get previousReport() {
return this.reports?.objectAt(1);
return this.reports?.slice()?.[1];
}

get latestReportIsGenerating() {
Expand Down
1 change: 1 addition & 0 deletions app/components/project-list/filter-selected-item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export default class ProjectListFilterSelectedItemComponent extends Component<Pr
declare module '@glint/environment-ember-loose/registry' {
export default interface Registry {
'ProjectList::FilterSelectedItem': typeof ProjectListFilterSelectedItemComponent;
'project-list/filter-selected-item': typeof ProjectListFilterSelectedItemComponent;
}
}
10 changes: 7 additions & 3 deletions app/components/project-list/header/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
showLabel=true
iconName='filter-list'
}}
@selectedItemComponent='project-list/filter-selected-item'
@selectedItemComponent={{component
'project-list/filter-selected-item'
}}
{{style width='auto'}}
class='select-platform-class'
data-test-select-platform-container
Expand Down Expand Up @@ -104,7 +106,9 @@
showLabel=true
iconName='filter-list'
}}
@selectedItemComponent='project-list/filter-selected-item'
@selectedItemComponent={{component
'project-list/filter-selected-item'
}}
class='select-team-class'
local-class='select-team-class'
data-test-select-team-container
Expand Down Expand Up @@ -160,7 +164,7 @@
showLabel=false
iconName='sort'
}}
@selectedItemComponent='project-list/filter-selected-item'
@selectedItemComponent={{component 'project-list/filter-selected-item'}}
{{style width='auto'}}
class='select-sort-class'
data-test-project-sort-property
Expand Down
2 changes: 1 addition & 1 deletion app/components/project-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class ProjectListComponent extends Component {
}

get projects() {
return this.projectService.projectQueryResponse?.toArray() || [];
return this.projectService.projectQueryResponse?.slice() || [];
}

get hasProjects() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default class SbomScanReportDrawerReportListComponent extends Component<S
}

get sbomReports() {
return this.scanReportQueryResponse?.toArray() || [];
return this.scanReportQueryResponse?.slice() || [];
}

get totalSbomScanReportCount() {
Expand Down
35 changes: 0 additions & 35 deletions app/helpers/body-class.js

This file was deleted.

Loading

0 comments on commit 78a7c5a

Please sign in to comment.