Skip to content

Commit

Permalink
Merge pull request #1333 from appknox/PD-1091-upgrade-ember-modal-dialog
Browse files Browse the repository at this point in the history
upgrade ember-modal-dialog & test refactor
  • Loading branch information
future-pirate-king authored Feb 6, 2024
2 parents 55cfaa5 + e4b4899 commit b561e74
Show file tree
Hide file tree
Showing 35 changed files with 2,060 additions and 1,826 deletions.
12 changes: 6 additions & 6 deletions app/components/file-chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,35 @@ export default class FileChartComponent extends Component<FileChartSignature> {

const severityCountObjects = [
{
value: file?.countRiskCritical,
value: file?.get('countRiskCritical'),
name: this.intl.t('critical'),
severityType: 'critical',
},
{
value: file?.countRiskHigh,
value: file?.get('countRiskHigh'),
name: this.intl.t('high'),
severityType: 'high',
},
{
value: file?.countRiskMedium,
value: file?.get('countRiskMedium'),
name: this.intl.t('medium'),
severityType: 'medium',
},
{
value: file?.countRiskLow,
value: file?.get('countRiskLow'),
name: this.intl.t('low'),
severityType: 'low',
},
{
value: file?.countRiskNone,
value: file?.get('countRiskNone'),
name: this.intl.t('passed'),
severityType: 'passed',
},
];

if (this.unknownAnalysisStatus?.status) {
severityCountObjects.push({
value: file?.countRiskUnknown,
value: file?.get('countRiskUnknown'),
name: this.intl.t('untested'),
severityType: 'none',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default class ProjectSettingsViewScenarioHeaderComponent extends Componen
const adapterOptions = { projectId: this.args.project?.id };

await this.scenario.destroyRecord({ adapterOptions });
this.scenario.unloadRecord();

this.notify.success(
this.intl.t('dastAutomation.scenarioDeleted', {
Expand Down
12 changes: 7 additions & 5 deletions app/models/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import {
attr,
belongsTo,
hasMany,
SyncHasMany,
} from '@ember-data/model';

import ComputedProperty, { sort } from '@ember/object/computed';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
Expand All @@ -25,7 +27,7 @@ import SbomFileModel from './sbom-file';
import SubmissionModel from './submission';

const _getAnalysesCount = (
analysis: AsyncHasMany<AnalysisModel>,
analysis: SyncHasMany<AnalysisModel>,
risk: number
) => {
return analysis.filter((analysis) => analysis.computedRisk === risk).length;
Expand Down Expand Up @@ -107,14 +109,14 @@ export default class FileModel extends ModelBaseMixin {
@attr('boolean')
declare canRunAutomatedDynamicscan: boolean;

@hasMany('tag')
declare tags: AsyncHasMany<TagModel>;
@hasMany('tag', { async: false })
declare tags: SyncHasMany<TagModel>;

@hasMany('file-report', { async: true })
declare reports: AsyncHasMany<FileReportModel>;

@hasMany('analysis', { inverse: 'file' })
declare analyses: AsyncHasMany<AnalysisModel>;
@hasMany('analysis', { inverse: 'file', async: false })
declare analyses: SyncHasMany<AnalysisModel>;

@belongsTo('project', { inverse: 'files' })
declare project: AsyncBelongsTo<ProjectModel>;
Expand Down
5 changes: 2 additions & 3 deletions app/serializers/file.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable prettier/prettier */
import DRFSerializer from './drf';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';

export default DRFSerializer.extend(EmbeddedRecordsMixin, {
attrs: {
analyses: { embedded: 'always' },
tags: { embedded: 'always'}
}
tags: { embedded: 'always' },
},
});
2 changes: 1 addition & 1 deletion mirage/factories/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default Factory.extend({

findings() {
let desc = [];
const uuid = faker.datatype.uuid();
const uuid = faker.string.uuid();

for (let i = 0; i < 3; i++) {
desc.push({
Expand Down
8 changes: 4 additions & 4 deletions mirage/factories/partner/registration-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ export default Factory.extend({
return `test${i}@example.test`;
},

createdOn() {
created_on() {
return dayjs(faker.date.past()).toISOString();
},

updatedOn() {
updated_on() {
return dayjs(faker.date.recent()).toISOString();
},

Expand All @@ -27,11 +27,11 @@ export default Factory.extend({
]);
},

isActivated() {
is_activated() {
return false;
},

approvalStatus() {
approval_status() {
return faker.helpers.arrayElement(['pending', 'rejected', 'approved']);
},

Expand Down
2 changes: 1 addition & 1 deletion mirage/factories/sbom-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default Factory.extend({
},

vulnerabilities_count() {
return faker.helpers.arrayElement([faker.datatype.number(1000), 0]);
return faker.helpers.arrayElement([faker.number.int(1000), 0]);
},

remediation: () => faker.lorem.paragraphs(),
Expand Down
Loading

0 comments on commit b561e74

Please sign in to comment.