Skip to content

Commit

Permalink
add dast random version selection and fix wrong error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Yibaebi committed Dec 13, 2024
1 parent 909d300 commit 9bf1354
Show file tree
Hide file tree
Showing 21 changed files with 776 additions and 287 deletions.
1 change: 1 addition & 0 deletions app/components/file-details/dynamic-scan/action/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@

{{#if this.showDynamicScanDrawer}}
<FileDetails::DynamicScan::DrawerOld
@dpContext={{@dpContext}}
@onClose={{this.closeDynamicScanDrawer}}
@pollDynamicStatus={{this.pollDynamicStatus}}
@file={{@file}}
Expand Down
23 changes: 23 additions & 0 deletions app/components/file-details/dynamic-scan/action/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import triggerAnalytics from 'irene/utils/trigger-analytics';
import type FileModel from 'irene/models/file';
import type PollService from 'irene/services/poll';
import type DynamicscanModel from 'irene/models/dynamicscan';
import type { DevicePreferenceContext } from 'irene/components/project-preferences-old/provider';

export interface DynamicScanActionSignature {
Args: {
Expand All @@ -18,13 +19,15 @@ export interface DynamicScanActionSignature {
dynamicScanText: string;
isAutomatedScan?: boolean;
dynamicScan: DynamicscanModel | null;
dpContext: DevicePreferenceContext;
};
}

export default class DynamicScanActionComponent extends Component<DynamicScanActionSignature> {
@service declare ajax: any;
@service('notifications') declare notify: NotificationService;
@service declare poll: PollService;
@service('browser/window') declare window: Window;

@tracked showDynamicScanDrawer = false;

Expand Down Expand Up @@ -78,6 +81,26 @@ export default class DynamicScanActionComponent extends Component<DynamicScanAct
this.file
?.reload()
.then((f) => {
// Remove device preferences from local storage after start of dynamic scan
const { device_type, platform_version, file_id } = JSON.parse(
this.window.localStorage.getItem('actualDevicePrefData') ?? 'null'
) as {
device_type: string | number | undefined;
platform_version: string;
file_id: string;
};

if (file_id && f.id === file_id && f.isDynamicStatusInProgress) {
this.args.dpContext.updateDevicePref(
device_type,
platform_version,
true
);

this.window.localStorage.removeItem('actualDevicePrefData');
}

// Stop polling
if (
f.dynamicStatus === ENUMS.DYNAMIC_STATUS.NONE ||
f.dynamicStatus === ENUMS.DYNAMIC_STATUS.READY
Expand Down
Loading

0 comments on commit 9bf1354

Please sign in to comment.