From 011a4f346695e3161e69eb5caa3a8fc8173199d8 Mon Sep 17 00:00:00 2001 From: Avi Shah Date: Wed, 10 Jul 2024 14:29:17 +0530 Subject: [PATCH] Dast Final Changes --- app/components/dynamic-scan/expiry/index.hbs | 40 - app/components/dynamic-scan/index.hbs | 124 -- app/components/dynamic-scan/index.ts | 106 -- app/components/dynamic-scan/modal/index.hbs | 217 --- app/components/dynamic-scan/modal/index.scss | 29 - app/components/file-chart/index.hbs | 8 +- app/components/file-details/api-scan/index.ts | 4 +- .../file-details/api-scan/results/index.hbs | 1 + .../dynamic-scan/action/drawer/index.hbs | 6 +- .../dynamic-scan/action/drawer/index.scss | 6 +- .../dynamic-scan/action/expiry/index.scss | 30 +- .../dynamic-scan/action/index.hbs | 29 +- .../file-details/dynamic-scan/action/index.ts | 25 +- .../dynamic-scan/automated/index.hbs | 1 + .../dynamic-scan/automated/index.scss | 2 +- .../dynamic-scan/drawer-old/index.hbs | 241 ++++ .../dynamic-scan/drawer-old/index.scss | 37 + .../dynamic-scan/drawer-old}/index.ts | 6 +- .../drawer-old}/proxy-settings-view/index.hbs | 0 .../proxy-settings-view/index.scss | 3 +- .../drawer-old/proxy-settings-view/index.ts | 85 ++ .../dynamic-scan/expiry-old/index.hbs | 69 + .../dynamic-scan/expiry-old/index.scss | 26 + .../dynamic-scan/expiry-old}/index.ts | 95 +- .../file-details/dynamic-scan/header/index.ts | 14 +- .../dynamic-scan/manual/index.hbs | 102 +- .../dynamic-scan/manual/index.scss | 35 + .../file-details/dynamic-scan/manual/index.ts | 25 +- .../dynamic-scan/results/index.hbs | 1 + .../dynamic-scan/status-chip/index.hbs | 59 +- .../dynamic-scan/status-chip/index.scss | 3 + .../dynamic-scan/status-chip/index.ts | 76 +- app/components/file-details/index.hbs | 42 +- .../file-details/manual-scan/index.ts | 4 +- .../request-form/basic-info/index.hbs | 4 +- .../request-form/login-details/index.ts | 2 +- .../manual-scan/results/index.hbs | 1 + .../file-details/proxy-settings/index.ts | 2 +- .../api-scan/captured-apis/index.hbs | 88 -- .../api-scan/captured-apis/index.scss | 17 - .../api-scan/captured-apis/index.ts | 139 -- .../api-scan/captured-apis/overview/index.hbs | 24 - .../captured-apis/overview/index.scss | 8 - .../api-scan/captured-apis/overview/index.ts | 22 - .../scan-actions-old/api-scan/index.hbs | 114 -- .../scan-actions-old/api-scan/index.scss | 9 - .../scan-actions-old/api-scan/index.ts | 131 -- .../file-details/scan-actions-old/index.hbs | 92 -- .../file-details/scan-actions-old/index.scss | 10 - .../file-details/scan-actions-old/index.ts | 29 - .../manual-scan/basic-info/index.hbs | 91 -- .../manual-scan/basic-info/index.scss | 17 - .../manual-scan/basic-info/index.ts | 53 - .../scan-actions-old/manual-scan/index.hbs | 123 -- .../scan-actions-old/manual-scan/index.ts | 248 ---- .../manual-scan/login-details/index.hbs | 110 -- .../manual-scan/login-details/index.scss | 17 - .../manual-scan/login-details/index.ts | 122 -- .../login-details/user-role-action/index.hbs | 7 - .../login-details/user-role-action/index.ts | 15 - .../manual-scan/vpn-details/index.hbs | 65 - .../manual-scan/vpn-details/index.scss | 17 - .../manual-scan/vpn-details/index.ts | 29 - .../scan-actions-old/static-scan/index.hbs | 48 - .../scan-actions-old/static-scan/index.ts | 59 - .../api-scan/captured-apis/index.hbs | 88 -- .../api-scan/captured-apis/index.scss | 17 - .../api-scan/captured-apis/index.ts | 139 -- .../api-scan/captured-apis/overview/index.hbs | 24 - .../captured-apis/overview/index.scss | 8 - .../api-scan/captured-apis/overview/index.ts | 22 - .../scan-actions/api-scan/index.hbs | 3 + .../scan-actions/dynamic-scan/index.hbs | 12 +- .../scan-actions/dynamic-scan/index.scss | 4 - .../scan-actions/dynamic-scan/index.ts | 6 +- .../file-details/scan-actions/index.scss | 4 +- .../manual-scan/basic-info/index.hbs | 91 -- .../manual-scan/basic-info/index.scss | 17 - .../manual-scan/basic-info/index.ts | 53 - .../scan-actions/manual-scan/index.hbs | 3 + .../manual-scan/login-details/index.hbs | 110 -- .../manual-scan/login-details/index.scss | 17 - .../manual-scan/login-details/index.ts | 122 -- .../login-details/user-role-action/index.hbs | 7 - .../login-details/user-role-action/index.ts | 15 - .../manual-scan/vpn-details/index.hbs | 65 - .../manual-scan/vpn-details/index.scss | 17 - .../manual-scan/vpn-details/index.ts | 29 - .../scan-actions/static-scan/index.hbs | 3 + .../file-details/severity-level/index.hbs | 8 +- .../file-details/skeleton-loader/index.hbs | 70 +- .../file-details/skeleton-loader/index.scss | 11 + .../file-details/static-scan/index.hbs | 1 + .../summary-old/app-platform/index.hbs | 6 - .../summary-old/app-platform/index.scss | 12 - .../summary-old/app-platform/index.ts | 21 - .../summary-old/file-tags/index.hbs | 55 - .../summary-old/file-tags/index.scss | 7 - .../summary-old/file-tags/index.ts | 135 -- .../file-details/summary-old/index.hbs | 196 --- .../file-details/summary-old/index.scss | 39 - .../file-details/summary-old/index.ts | 101 -- app/components/file-details/summary/index.hbs | 1 + .../vulnerability-analysis-details/index.ts | 36 +- .../vulnerability-analysis/table/index.scss | 2 +- .../vulnerability-analysis/table/index.ts | 13 +- .../dynamicscan-automation-settings/index.hbs | 5 + .../dynamicscan-automation-settings/index.ts | 1 + .../scripts-archived/index.hbs | 174 --- .../scripts-archived/index.scss | 23 - .../scripts-archived/index.ts | 188 --- .../general-settings/index.hbs | 29 +- .../general-settings/index.ts | 4 + app/components/proxy-settings-view/index.ts | 91 -- app/components/vnc-viewer-old/index.hbs | 83 -- app/components/vnc-viewer-old/index.scss | 37 - app/components/vnc-viewer-old/index.ts | 145 -- app/components/vnc-viewer/index.hbs | 19 +- app/components/vnc-viewer/index.scss | 20 +- app/components/vnc-viewer/index.ts | 3 + .../authenticated/dashboard/file/analysis.ts | 5 + app/router.ts | 2 +- app/styles/_component-variables.scss | 56 +- app/styles/_icons.scss | 4 + .../dashboard/file/index-loading.hbs | 2 +- .../authenticated/dashboard/file/index.hbs | 10 +- tests/acceptance/file-details-test.js | 45 + .../acceptance/file-details/api-scan-test.js | 4 +- .../file-details/dynamic-scan-test.js | 189 ++- .../file-details/manual-scan-test.js | 4 +- .../components/dynamic-scan-test.js | 1115 -------------- .../file-details/dynamic-scan/manual-test.js | 1283 +++++++++++++++++ .../dynamic-scan/status-chip-test.js | 17 +- .../file-details/scan-actions-old-test.js | 313 ---- .../scan-actions-old/api-scan-test.js | 496 ------- .../scan-actions-old/manual-scan-test.js | 620 -------- .../file-details/summary-old-test.js | 392 ----- .../index-test.js | 4 +- .../scripts-archived-test.js | 381 ----- .../components/vnc-viewer-old-test.js | 253 ---- translations/en.json | 9 +- translations/ja.json | 9 +- types/global.d.ts | 7 + 143 files changed, 2579 insertions(+), 8317 deletions(-) delete mode 100644 app/components/dynamic-scan/expiry/index.hbs delete mode 100644 app/components/dynamic-scan/index.hbs delete mode 100644 app/components/dynamic-scan/index.ts delete mode 100644 app/components/dynamic-scan/modal/index.hbs delete mode 100644 app/components/dynamic-scan/modal/index.scss create mode 100644 app/components/file-details/dynamic-scan/drawer-old/index.hbs create mode 100644 app/components/file-details/dynamic-scan/drawer-old/index.scss rename app/components/{dynamic-scan/modal => file-details/dynamic-scan/drawer-old}/index.ts (94%) rename app/components/{ => file-details/dynamic-scan/drawer-old}/proxy-settings-view/index.hbs (100%) rename app/components/{ => file-details/dynamic-scan/drawer-old}/proxy-settings-view/index.scss (54%) create mode 100644 app/components/file-details/dynamic-scan/drawer-old/proxy-settings-view/index.ts create mode 100644 app/components/file-details/dynamic-scan/expiry-old/index.hbs create mode 100644 app/components/file-details/dynamic-scan/expiry-old/index.scss rename app/components/{dynamic-scan/expiry => file-details/dynamic-scan/expiry-old}/index.ts (60%) create mode 100644 app/components/file-details/dynamic-scan/status-chip/index.scss delete mode 100644 app/components/file-details/scan-actions-old/api-scan/captured-apis/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/api-scan/captured-apis/index.scss delete mode 100644 app/components/file-details/scan-actions-old/api-scan/captured-apis/index.ts delete mode 100644 app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.scss delete mode 100644 app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.ts delete mode 100644 app/components/file-details/scan-actions-old/api-scan/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/api-scan/index.scss delete mode 100644 app/components/file-details/scan-actions-old/api-scan/index.ts delete mode 100644 app/components/file-details/scan-actions-old/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/index.scss delete mode 100644 app/components/file-details/scan-actions-old/index.ts delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/basic-info/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/basic-info/index.scss delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/basic-info/index.ts delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/index.ts delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/login-details/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/login-details/index.scss delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/login-details/index.ts delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/login-details/user-role-action/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/login-details/user-role-action/index.ts delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/vpn-details/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/vpn-details/index.scss delete mode 100644 app/components/file-details/scan-actions-old/manual-scan/vpn-details/index.ts delete mode 100644 app/components/file-details/scan-actions-old/static-scan/index.hbs delete mode 100644 app/components/file-details/scan-actions-old/static-scan/index.ts delete mode 100644 app/components/file-details/scan-actions/api-scan/captured-apis/index.hbs delete mode 100644 app/components/file-details/scan-actions/api-scan/captured-apis/index.scss delete mode 100644 app/components/file-details/scan-actions/api-scan/captured-apis/index.ts delete mode 100644 app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.hbs delete mode 100644 app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.scss delete mode 100644 app/components/file-details/scan-actions/api-scan/captured-apis/overview/index.ts delete mode 100644 app/components/file-details/scan-actions/manual-scan/basic-info/index.hbs delete mode 100644 app/components/file-details/scan-actions/manual-scan/basic-info/index.scss delete mode 100644 app/components/file-details/scan-actions/manual-scan/basic-info/index.ts delete mode 100644 app/components/file-details/scan-actions/manual-scan/login-details/index.hbs delete mode 100644 app/components/file-details/scan-actions/manual-scan/login-details/index.scss delete mode 100644 app/components/file-details/scan-actions/manual-scan/login-details/index.ts delete mode 100644 app/components/file-details/scan-actions/manual-scan/login-details/user-role-action/index.hbs delete mode 100644 app/components/file-details/scan-actions/manual-scan/login-details/user-role-action/index.ts delete mode 100644 app/components/file-details/scan-actions/manual-scan/vpn-details/index.hbs delete mode 100644 app/components/file-details/scan-actions/manual-scan/vpn-details/index.scss delete mode 100644 app/components/file-details/scan-actions/manual-scan/vpn-details/index.ts delete mode 100644 app/components/file-details/summary-old/app-platform/index.hbs delete mode 100644 app/components/file-details/summary-old/app-platform/index.scss delete mode 100644 app/components/file-details/summary-old/app-platform/index.ts delete mode 100644 app/components/file-details/summary-old/file-tags/index.hbs delete mode 100644 app/components/file-details/summary-old/file-tags/index.scss delete mode 100644 app/components/file-details/summary-old/file-tags/index.ts delete mode 100644 app/components/file-details/summary-old/index.hbs delete mode 100644 app/components/file-details/summary-old/index.scss delete mode 100644 app/components/file-details/summary-old/index.ts delete mode 100644 app/components/project-settings/general-settings/dynamicscan-automation-settings/scripts-archived/index.hbs delete mode 100644 app/components/project-settings/general-settings/dynamicscan-automation-settings/scripts-archived/index.scss delete mode 100644 app/components/project-settings/general-settings/dynamicscan-automation-settings/scripts-archived/index.ts delete mode 100644 app/components/proxy-settings-view/index.ts delete mode 100644 app/components/vnc-viewer-old/index.hbs delete mode 100644 app/components/vnc-viewer-old/index.scss delete mode 100644 app/components/vnc-viewer-old/index.ts create mode 100644 app/controllers/authenticated/dashboard/file/analysis.ts delete mode 100644 tests/integration/components/dynamic-scan-test.js create mode 100644 tests/integration/components/file-details/dynamic-scan/manual-test.js delete mode 100644 tests/integration/components/file-details/scan-actions-old-test.js delete mode 100644 tests/integration/components/file-details/scan-actions-old/api-scan-test.js delete mode 100644 tests/integration/components/file-details/scan-actions-old/manual-scan-test.js delete mode 100644 tests/integration/components/file-details/summary-old-test.js delete mode 100644 tests/integration/components/project-settings/general-settings/dynamicscan-automation-settings/scripts-archived-test.js delete mode 100644 tests/integration/components/vnc-viewer-old-test.js diff --git a/app/components/dynamic-scan/expiry/index.hbs b/app/components/dynamic-scan/expiry/index.hbs deleted file mode 100644 index 17c7fc4fa7..0000000000 --- a/app/components/dynamic-scan/expiry/index.hbs +++ /dev/null @@ -1,40 +0,0 @@ -
- - - {{this.timeRemaining.minutes}}:{{this.timeRemaining.seconds}} - - - {{#if this.extendtime.isRunning}} - - {{else}} - - - - - - {{/if}} - - - - {{#each this.extendTimeOptions as |time|}} - - - - {{/each}} - -
\ No newline at end of file diff --git a/app/components/dynamic-scan/index.hbs b/app/components/dynamic-scan/index.hbs deleted file mode 100644 index df945a7d03..0000000000 --- a/app/components/dynamic-scan/index.hbs +++ /dev/null @@ -1,124 +0,0 @@ - - {{#if @file.isDynamicStatusNotReady}} - - {{#if @file.isDynamicStatusNeitherNoneNorReadyNorError}} - - <:leftIcon> - - - - <:default>{{@file.statusText}} - - - {{#if @file.isDynamicStatusQueueAndHasAutomation}} - - - - {{/if}} - {{/if}} - - {{#if @file.isDynamicStatusNoneOrError}} - {{#if @file.isDynamicStatusError}} - - <:leftIcon> - - - - <:default>{{t 'errored'}} - - - - - - {{else if @file.isDynamicDone}} - - <:leftIcon> - - - - <:default>{{t 'completed'}} - - - - - - {{else}} - - <:leftIcon> - - - - <:default>{{@dynamicScanText}} - - {{/if}} - {{/if}} - - {{/if}} - - {{#if @file.isDynamicStatusReady}} - - <:leftIcon> - {{#if this.dynamicShutdown.isRunning}} - - {{else}} - - {{/if}} - - - <:default>{{t 'stop'}} - - {{/if}} - - {{#if (and @vncViewer @file.isDynamicStatusStarting)}} -
- {{t 'dynamicScanText'}} -
- {{/if}} -
- -{{#if this.showDynamicScanModal}} - -{{/if}} \ No newline at end of file diff --git a/app/components/dynamic-scan/index.ts b/app/components/dynamic-scan/index.ts deleted file mode 100644 index ba0fed9ed7..0000000000 --- a/app/components/dynamic-scan/index.ts +++ /dev/null @@ -1,106 +0,0 @@ -import Component from '@glimmer/component'; -import { inject as service } from '@ember/service'; -import { task } from 'ember-concurrency'; -import { action } from '@ember/object'; -import ENV from 'irene/config/environment'; -import ENUMS from 'irene/enums'; -import triggerAnalytics from 'irene/utils/trigger-analytics'; -import { tracked } from '@glimmer/tracking'; -import FileModel from 'irene/models/file'; -import PollService from 'irene/services/poll'; - -export interface DynamicScanSignature { - Args: { - vncViewer?: boolean; - onScanShutdown?: () => void; - file: FileModel; - dynamicScanText: string; - }; -} - -export default class DynamicScanComponent extends Component { - @service declare ajax: any; - @service('notifications') declare notify: NotificationService; - @service declare poll: PollService; - - @tracked showDynamicScanModal = false; - - constructor(owner: unknown, args: DynamicScanSignature['Args']) { - super(owner, args); - - this.pollDynamicStatus(); - } - - @action - openDynamicScanModal() { - triggerAnalytics( - 'feature', - ENV.csb['dynamicScanBtnClick'] as CsbAnalyticsFeatureData - ); - - this.showDynamicScanModal = true; - } - - @action - closeDynamicScanModal() { - this.showDynamicScanModal = false; - } - - @action - pollDynamicStatus() { - const file = this.args.file; - const isDynamicReady = file.isDynamicStatusReady; - - if (isDynamicReady) { - return; - } - - if (!file.id) { - return; - } - - const stopPoll = this.poll.startPolling( - () => - file - .reload() - .then((f) => { - if ( - f.dynamicStatus === ENUMS.DYNAMIC_STATUS.NONE || - f.dynamicStatus === ENUMS.DYNAMIC_STATUS.READY - ) { - stopPoll(); - } - }) - .catch(() => stopPoll()), - 5000 - ); - } - - dynamicShutdown = task({ drop: true }, async () => { - const file = this.args.file; - - file.setShuttingDown(); - - const dynamicUrl = [ENV.endpoints['dynamic'], file.id].join('/'); - - try { - await this.ajax.delete(dynamicUrl); - - this.args.onScanShutdown?.(); - - if (!this.isDestroyed) { - this.pollDynamicStatus(); - } - } catch (error) { - file.setNone(); - - this.notify.error((error as AdapterError).payload.error); - } - }); -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - DynamicScan: typeof DynamicScanComponent; - } -} diff --git a/app/components/dynamic-scan/modal/index.hbs b/app/components/dynamic-scan/modal/index.hbs deleted file mode 100644 index 29da606b33..0000000000 --- a/app/components/dynamic-scan/modal/index.hbs +++ /dev/null @@ -1,217 +0,0 @@ - - - <:default> -
- - - - - {{t 'modalCard.dynamicScan.warning'}} - - - - {{#if @file.minOsVersion}} -
- - {{t 'modalCard.dynamicScan.deviceRequirements'}} - - - - {{#each this.deviceRequirements as |dr|}} - - - {{dr.type}} - - - - - {{dr.boldValue}} - - - {{dr.value}} - - - {{/each}} - -
- {{/if}} - -
- -
- - {{#unless @file.showScheduleAutomatedDynamicScan}} - - {{t 'note'}}: - {{t 'modalCard.dynamicScan.deviceSettingsWarning'}} - - {{/unless}} - -
- -
- -
- - - - - - - {{#if this.showApiScanSettings}} -
- - {{t 'modalCard.dynamicScan.apiScanDescription' htmlSafe=true}} - - - - - -
- {{/if}} - - {{#if @file.showScheduleAutomatedDynamicScan}} -
- - - {{t 'dynamicScanAutomation'}} - - - - <:icon> - - - - - - - {{t 'scheduleDynamicscanDesc'}} - - - - - <:leftIcon> - {{#if this.scheduleDynamicScan.isRunning}} - - {{else}} - - {{/if}} - - - <:default> - {{t 'scheduleDynamicscan'}} - - - -
- {{/if}} -
-
- - - <:footer> - - - - - {{t 'cancel'}} - - - - {{t 'modalCard.dynamicScan.start'}} - - - -
-
\ No newline at end of file diff --git a/app/components/dynamic-scan/modal/index.scss b/app/components/dynamic-scan/modal/index.scss deleted file mode 100644 index fc5079e21e..0000000000 --- a/app/components/dynamic-scan/modal/index.scss +++ /dev/null @@ -1,29 +0,0 @@ -.dynamic-scan-modal-body { - width: 650px; -} - -.dynamic-scan-modal-alert { - background-color: var(--dynamic-scan-modal-alert-background-color); - color: var(--dynamic-scan-modal-alert-text-color); - border: 1px solid var(--dynamic-scan-modal-alert-border-color); - border-radius: var(--dynamic-scan-modal-border-radius); -} - -.device-settings-warning { - color: var(--dynamic-scan-modal-device-settings-warning-text-color); - line-height: 1.3; -} - -.bordered-box { - border: 1px solid var(--dynamic-scan-modal-border-color); - border-radius: var(--dynamic-scan-modal-border-radius); - box-sizing: border-box; - - .bordered-box-item { - padding: 0.5em 1em; - - &:not(:last-child) { - border-bottom: 1px solid var(--dynamic-scan-modal-border-color); - } - } -} diff --git a/app/components/file-chart/index.hbs b/app/components/file-chart/index.hbs index 040e160d17..efdae918ee 100644 --- a/app/components/file-chart/index.hbs +++ b/app/components/file-chart/index.hbs @@ -1,5 +1,11 @@ {{#if this.fetchUnknownAnalysisStatus.isRunning}} - + diff --git a/app/components/file-details/api-scan/index.ts b/app/components/file-details/api-scan/index.ts index 8a78df6863..6b7b43d8f2 100644 --- a/app/components/file-details/api-scan/index.ts +++ b/app/components/file-details/api-scan/index.ts @@ -31,7 +31,7 @@ export default class FileDetailsApiScanComponent extends Component \ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/action/drawer/index.hbs b/app/components/file-details/dynamic-scan/action/drawer/index.hbs index f5e737a5f6..2c6934ea02 100644 --- a/app/components/file-details/dynamic-scan/action/drawer/index.hbs +++ b/app/components/file-details/dynamic-scan/action/drawer/index.hbs @@ -9,7 +9,7 @@ {{#if @isAutomatedScan}} @@ -68,7 +68,7 @@ @justifyContent={{if @isAutomatedScan 'space-between' 'flex-start'}} @spacing='1.5' class='px-3 py-2' - local-class='dynamic-scan-modal-cta' + local-class='dynamic-scan-drawer-cta' > - {{#if @dynamicScan.isReadyOrRunning}} + {{! TODO: Logic should be replaced by comments when full DAST feature is ready }} + {{!-- {{#if @dynamicScan.isReadyOrRunning}} --}} + {{#if (or @file.isDynamicStatusReady @file.isDynamicStatusInProgress)}} {{#if @isAutomatedScan}} <:leftIcon> {{#if this.dynamicShutdown.isRunning}} @@ -21,16 +23,16 @@ {{else}} <:leftIcon> {{#if this.dynamicShutdown.isRunning}} {{else}} - + {{/if}} @@ -38,10 +40,11 @@ {{/if}} - {{else if (or @file.isDynamicDone @dynamicScan.isDynamicStatusError)}} + {{!-- {{else if (or @file.isDynamicDone @dynamicScan.isDynamicStatusError)}} --}} + {{else if (or @file.isDynamicDone @file.isDynamicStatusError)}} @@ -69,6 +72,14 @@ {{#if this.showDynamicScanDrawer}} + +{{/if}} + +{{!-- {{#if this.showDynamicScanDrawer}} -{{/if}} \ No newline at end of file +{{/if}} --}} \ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/action/index.ts b/app/components/file-details/dynamic-scan/action/index.ts index 3f80d275ef..9e848a3d63 100644 --- a/app/components/file-details/dynamic-scan/action/index.ts +++ b/app/components/file-details/dynamic-scan/action/index.ts @@ -63,7 +63,7 @@ export default class DynamicScanActionComponent extends Component - this.args.dynamicScan + this.file ?.reload() - .then((ds) => { + .then((f) => { if ( - ds.status === ENUMS.DYNAMIC_STATUS.NONE || - ds.status === ENUMS.DYNAMIC_STATUS.READY + f.dynamicStatus === ENUMS.DYNAMIC_STATUS.NONE || + f.dynamicStatus === ENUMS.DYNAMIC_STATUS.READY ) { stopPoll(); } @@ -90,23 +90,24 @@ export default class DynamicScanActionComponent extends Component { - this.args.dynamicScan?.setShuttingDown(); + this.file.setShuttingDown(); - const dynamicUrl = [ENV.endpoints['dynamicscans'], this.profileId].join( - '/' - ); + const dynamicUrl = [ENV.endpoints['dynamic'], this.file.id].join('/'); try { await this.ajax.delete(dynamicUrl); - this.args.onScanShutdown?.(); - if (!this.isDestroyed) { this.pollDynamicStatus(); } } catch (error) { - this.args.dynamicScan?.setNone(); + this.file.setNone(); this.notify.error((error as AdapterError).payload.error); } diff --git a/app/components/file-details/dynamic-scan/automated/index.hbs b/app/components/file-details/dynamic-scan/automated/index.hbs index e8c5b6b6d6..b93d06ea1e 100644 --- a/app/components/file-details/dynamic-scan/automated/index.hbs +++ b/app/components/file-details/dynamic-scan/automated/index.hbs @@ -6,6 +6,7 @@ @spacing='1.5' > + {{t 'loading'}}... diff --git a/app/components/file-details/dynamic-scan/automated/index.scss b/app/components/file-details/dynamic-scan/automated/index.scss index 135a4eaa87..6d18820cf1 100644 --- a/app/components/file-details/dynamic-scan/automated/index.scss +++ b/app/components/file-details/dynamic-scan/automated/index.scss @@ -29,4 +29,4 @@ .loading-text { font-style: italic; } -} \ No newline at end of file +} diff --git a/app/components/file-details/dynamic-scan/drawer-old/index.hbs b/app/components/file-details/dynamic-scan/drawer-old/index.hbs new file mode 100644 index 0000000000..4f6c3635e8 --- /dev/null +++ b/app/components/file-details/dynamic-scan/drawer-old/index.hbs @@ -0,0 +1,241 @@ + + + + + + + {{t 'modalCard.dynamicScan.title'}} + + + + + + + +
+ + + + + {{t 'modalCard.dynamicScan.warning'}} + + + + {{#if @file.minOsVersion}} +
+ + {{t 'modalCard.dynamicScan.deviceRequirements'}} + + + + {{#each this.deviceRequirements as |dr|}} + + + {{dr.type}} + + + + + {{dr.boldValue}} + + + {{dr.value}} + + + {{/each}} + +
+ {{/if}} + +
+ +
+ + {{#unless @file.showScheduleAutomatedDynamicScan}} + + {{t 'note'}}: + {{t 'modalCard.dynamicScan.deviceSettingsWarning'}} + + {{/unless}} + +
+ +
+ +
+ + + + + + + {{#if this.showApiScanSettings}} +
+ + {{t 'modalCard.dynamicScan.apiScanDescription' htmlSafe=true}} + + + + + +
+ {{/if}} + + {{#if @file.showScheduleAutomatedDynamicScan}} +
+ + + {{t 'dynamicScanAutomation'}} + + + + <:icon> + + + + + + + {{t 'scheduleDynamicscanDesc'}} + + + + + <:leftIcon> + {{#if this.scheduleDynamicScan.isRunning}} + + {{else}} + + {{/if}} + + + <:default> + {{t 'scheduleDynamicscan'}} + + + +
+ {{/if}} +
+
+
+ + + + {{t 'cancel'}} + + + + {{t 'modalCard.dynamicScan.start'}} + + +
+
+
\ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/drawer-old/index.scss b/app/components/file-details/dynamic-scan/drawer-old/index.scss new file mode 100644 index 0000000000..8f439f4933 --- /dev/null +++ b/app/components/file-details/dynamic-scan/drawer-old/index.scss @@ -0,0 +1,37 @@ +.dynamic-scan-drawer-alert { + background-color: var( + --file-details-dynamic-scan-drawer-old-alert-background-color + ); + color: var(--file-details-dynamic-scan-drawer-old-alert-text-color); + border: 1px solid + var(--file-details-dynamic-scan-drawer-old-alert-border-color); + border-radius: var(--file-details-dynamic-scan-drawer-old-border-radius); +} + +.device-settings-warning { + color: var( + --file-details-dynamic-scan-drawer-old-device-settings-warning-text-color + ); + line-height: 1.3; +} + +.bordered-box { + border: 1px solid var(--file-details-dynamic-scan-drawer-old-border-color); + border-radius: var(--file-details-dynamic-scan-drawer-old-border-radius); + box-sizing: border-box; + + .bordered-box-item { + padding: 0.5em 1em; + + &:not(:last-child) { + border-bottom: 1px solid + var(--file-details-dynamic-scan-drawer-old-border-color); + } + } +} + +.dynamic-scan-drawer-cta { + border-top: 1px solid var(--file-details-dynamic-scan-drawer-border-color); + background-color: var(--file-details-dynamic-scan-drawer-background-main); + box-shadow: var(--file-details-dynamic-scan-drawer-cta-box-shadow); +} diff --git a/app/components/dynamic-scan/modal/index.ts b/app/components/file-details/dynamic-scan/drawer-old/index.ts similarity index 94% rename from app/components/dynamic-scan/modal/index.ts rename to app/components/file-details/dynamic-scan/drawer-old/index.ts index bca12fca66..2c756ccb3e 100644 --- a/app/components/dynamic-scan/modal/index.ts +++ b/app/components/file-details/dynamic-scan/drawer-old/index.ts @@ -9,7 +9,7 @@ import Store from '@ember-data/store'; import { tracked } from '@glimmer/tracking'; import FileModel from 'irene/models/file'; -export interface DynamicScanModalSignature { +export interface FileDetailsDynamicScanDrawerOldSignature { Args: { onClose: () => void; pollDynamicStatus: () => void; @@ -17,7 +17,7 @@ export interface DynamicScanModalSignature { }; } -export default class DynamicScanModalComponent extends Component { +export default class FileDetailsDynamicScanDrawerOldComponent extends Component { @service declare intl: IntlService; @service declare ajax: any; @service declare store: Store; @@ -169,6 +169,6 @@ export default class DynamicScanModalComponent extends Component; + project: AsyncBelongsTo; + }; +} + +export default class FileDetailsDynamicScanDrawerOldProxySettingsViewComponent extends Component { + @service declare intl: IntlService; + @service('notifications') declare notify: NotificationService; + @service declare store: Store; + + @tracked proxy?: ProxySettingModel; + + constructor( + owner: unknown, + args: FileDetailsDynamicScanDrawerOldProxySettingsViewSignature['Args'] + ) { + super(owner, args); + + this.fetchProxySetting.perform(); + } + + get projectId() { + return this.args.project.get('id'); + } + + fetchProxySetting = task(async () => { + try { + const profileId = this.args.profile.get('id'); + + if (profileId) { + this.proxy = await this.store.findRecord('proxy-setting', profileId); + } + } catch (error) { + this.notify.error(parseError(error, this.intl.t('somethingWentWrong'))); + } + }); + + /* Proxy enable or disable */ + toggleProxy = task(async (event) => { + try { + const enabled = event.target.checked; + + this.proxy?.set('enabled', enabled); + + await this.proxy?.save(); + + const statusText = enabled ? this.intl.t('on') : this.intl.t('off'); + + this.notify.info( + `${this.intl.t('proxyTurned')} ${statusText.toUpperCase()}` + ); + + const analyticsData = enabled + ? ENV.csb['enableProxy'] + : ENV.csb['disableProxy']; + + triggerAnalytics('feature', analyticsData as CsbAnalyticsFeatureData); + } catch (error) { + this.notify.error(parseError(error, this.intl.t('pleaseTryAgain'))); + } + }); +} + +declare module '@glint/environment-ember-loose/registry' { + export default interface Registry { + 'FileDetails::DynamicScan::DrawerOld::ProxySettingsView': typeof FileDetailsDynamicScanDrawerOldProxySettingsViewComponent; + } +} diff --git a/app/components/file-details/dynamic-scan/expiry-old/index.hbs b/app/components/file-details/dynamic-scan/expiry-old/index.hbs new file mode 100644 index 0000000000..922b7627b3 --- /dev/null +++ b/app/components/file-details/dynamic-scan/expiry-old/index.hbs @@ -0,0 +1,69 @@ +
+ + + + + + + + + {{this.timeRemaining.minutes}}:{{this.timeRemaining.seconds}} + + + {{#if this.extendtime.isRunning}} + + {{else}} + + + + + + {{/if}} + + + + {{#each this.extendTimeOptions as |time|}} + + + + {{/each}} + +
\ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/expiry-old/index.scss b/app/components/file-details/dynamic-scan/expiry-old/index.scss new file mode 100644 index 0000000000..0cc114d6eb --- /dev/null +++ b/app/components/file-details/dynamic-scan/expiry-old/index.scss @@ -0,0 +1,26 @@ +.extend-time-btn { + border-radius: 50%; + background-color: var( + --file-details-dynamic-scan-action-expiry-extend-btn-background + ) !important; + padding: 0 !important; + + :global(.ak-icon) { + color: var( + --file-details-dynamic-scan-action-expiry-extend-btn-icon-color + ) !important; + } +} + +.dynamic-scan-expiry-container { + background-color: var( + --file-details-dynamic-scan-action-expiry-container-background-color + ); + padding: 0.3em 1em; + border-radius: 200px; +} + +.info-btn { + border-radius: 50%; + margin-right: 0.5em; +} diff --git a/app/components/dynamic-scan/expiry/index.ts b/app/components/file-details/dynamic-scan/expiry-old/index.ts similarity index 60% rename from app/components/dynamic-scan/expiry/index.ts rename to app/components/file-details/dynamic-scan/expiry-old/index.ts index ac7f979c89..6f362a13e7 100644 --- a/app/components/dynamic-scan/expiry/index.ts +++ b/app/components/file-details/dynamic-scan/expiry-old/index.ts @@ -1,66 +1,66 @@ -/* eslint-disable ember/no-observers */ import Component from '@glimmer/component'; import { action } from '@ember/object'; import { tracked } from '@glimmer/tracking'; import { inject as service } from '@ember/service'; -import { later } from '@ember/runloop'; -import { task } from 'ember-concurrency'; +import { task, timeout } from 'ember-concurrency'; import dayjs from 'dayjs'; -import { addObserver, removeObserver } from '@ember/object/observers'; import Store from '@ember-data/store'; import FileModel from 'irene/models/file'; import DatetimeService from 'irene/services/datetime'; import { Duration } from 'dayjs/plugin/duration'; -import { EmberRunTimer } from '@ember/runloop/types'; -import DynamicscanModal from 'irene/models/dynamicscan-old'; +import DynamicscanOldModel from 'irene/models/dynamicscan-old'; import ENV from 'irene/config/environment'; +import parseError from 'irene/utils/parse-error'; -export interface DynamicScanExpirySignature { +export interface FileDetailsDynamicScanExpiryOldSignature { Args: { file: FileModel; }; } -export default class DynamicScanExpiryComponent extends Component { +export default class FileDetailsDynamicScanExpiryOldComponent extends Component { @service('notifications') declare notify: NotificationService; @service declare store: Store; @service declare datetime: DatetimeService; - @tracked dynamicscan: DynamicscanModal | null = null; + @tracked dynamicscan: DynamicscanOldModel | null = null; @tracked durationRemaining: null | Duration = null; @tracked clockStop = false; @tracked extendBtnAnchorRef: HTMLElement | null = null; - constructor(owner: unknown, args: DynamicScanExpirySignature['Args']) { + constructor( + owner: unknown, + args: FileDetailsDynamicScanExpiryOldSignature['Args'] + ) { super(owner, args); - this.fetchDynaminscan.perform(); - - this.clock(); - - addObserver(this.args.file, 'isReady', this.observeDeviceState); + this.fetchDynamicscan.perform(); } willDestroy() { super.willDestroy(); this.clockStop = true; - - removeObserver(this.args.file, 'isReady', this.observeDeviceState); } get extendTimeOptions() { return [5, 15, 30]; } - fetchDynaminscan = task(async () => { - const id = this.args.file.id; - this.dynamicscan = await this.store.findRecord('dynamicscan-old', id); - }); + fetchDynamicscan = task(async () => { + try { + const id = this.args.file.id; + const dynamicscan = await this.store.findRecord('dynamicscan-old', id); + const expiresOn = dynamicscan ? dynamicscan.expiresOn : null; - observeDeviceState() { - this.fetchDynaminscan.perform(); - } + this.dynamicscan = dynamicscan; + + this.setScanDuration(expiresOn); + this.clock.perform(); + } catch (error) { + this.notify.error(parseError(error)); + } + }); get canExtend() { const duration = this.durationRemaining; @@ -88,25 +88,19 @@ export default class DynamicScanExpiryComponent extends Component { + while (Number(this.durationRemaining?.asSeconds()) > -1) { + if (ENV.environment === 'test') { + break; + } - const mExpiresOn = dayjs(expiresOn); - const mNow = dayjs(); - const duration = this.datetime.duration(mExpiresOn.diff(mNow)); + const expiresOn = this.dynamicscan ? this.dynamicscan.expiresOn : null; - this.durationRemaining = duration; + this.setScanDuration(expiresOn); - later(this, this.clock, 1000); - } + await timeout(1000); + } + }); extendtime = task(async (time: number) => { const dynamicscan = this.dynamicscan; @@ -115,6 +109,8 @@ export default class DynamicScanExpiryComponent extends Component {{/if}} - - - + {{#if (and @file.isReady (not this.isFullscreenView))}} + + + + {{/if}}
- {{#if this.isFullscreenView}} - - + {{#if this.isFullscreenView}} + \ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/manual/index.scss b/app/components/file-details/dynamic-scan/manual/index.scss index de9a79dbab..2642134883 100644 --- a/app/components/file-details/dynamic-scan/manual/index.scss +++ b/app/components/file-details/dynamic-scan/manual/index.scss @@ -6,4 +6,39 @@ .manual-dast-header { border-bottom: 1px solid var(--file-details-dynamic-scan-manual-border-color); padding: 0.5em 1.5em; + min-height: 48px; +} + +.vnc-viewer-fullscreen { + position: fixed; + inset: 0px; + z-index: var(--vnc-viewer-modal-zIndex); + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.vnc-viewer-backdrop { + position: fixed; + display: flex; + align-items: center; + justify-content: center; + inset: 0px; + background-color: var(--vnc-viewer-modal-backdrop-overlay-background); + z-index: -1; +} + +.vnc-viewer-fullscreen-container { + width: 450px; + background-color: var(--vnc-viewer-modal-background); + color: var(--vnc-viewer-modal-text-color); + overflow-y: auto; + display: flex; + flex-direction: column; + height: calc(100% - 64px); + flex: 1 0 auto; + z-index: var(--vnc-viewer-modal-zIndex); + position: fixed; + outline: 0px; } diff --git a/app/components/file-details/dynamic-scan/manual/index.ts b/app/components/file-details/dynamic-scan/manual/index.ts index 984ed1058b..e7845491cc 100644 --- a/app/components/file-details/dynamic-scan/manual/index.ts +++ b/app/components/file-details/dynamic-scan/manual/index.ts @@ -28,15 +28,20 @@ export default class FileDetailsDastManual extends Component \ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/status-chip/index.hbs b/app/components/file-details/dynamic-scan/status-chip/index.hbs index 3daef12c82..3c3cc5ecde 100644 --- a/app/components/file-details/dynamic-scan/status-chip/index.hbs +++ b/app/components/file-details/dynamic-scan/status-chip/index.hbs @@ -1,44 +1,35 @@ -{{#if @dynamicScan.isDynamicStatusError}} +{{#if (or this.chipDetails.icon this.chipDetails.loaderColor)}} <:icon> - - - - -{{else if @file.isDynamicDone}} - + {{#if this.chipDetails.icon}} + + {{/if}} -{{else if @dynamicScan.isDynamicStatusInProgress}} - - <:icon> - + {{#if this.chipDetails.loaderColor}} + + {{/if}} - {{else}} {{/if}} \ No newline at end of file diff --git a/app/components/file-details/dynamic-scan/status-chip/index.scss b/app/components/file-details/dynamic-scan/status-chip/index.scss new file mode 100644 index 0000000000..38a6161d65 --- /dev/null +++ b/app/components/file-details/dynamic-scan/status-chip/index.scss @@ -0,0 +1,3 @@ +.chips-uppercase { + text-transform: uppercase; +} diff --git a/app/components/file-details/dynamic-scan/status-chip/index.ts b/app/components/file-details/dynamic-scan/status-chip/index.ts index 78a209f392..e873375804 100644 --- a/app/components/file-details/dynamic-scan/status-chip/index.ts +++ b/app/components/file-details/dynamic-scan/status-chip/index.ts @@ -1,41 +1,83 @@ import Component from '@glimmer/component'; +import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; +import IntlService from 'ember-intl/services/intl'; import ENUMS from 'irene/enums'; + +import { type AkLoaderColor } from 'irene/components/ak-loader'; +import { type AkChipColor } from 'irene/components/ak-chip'; import type DynamicscanModel from 'irene/models/dynamicscan'; import type FileModel from 'irene/models/file'; export interface DynamicScanStatusChipSignature { + Element: HTMLElement; Args: { file: FileModel; - dynamicScan: DynamicscanModel | null; + dynamicScan?: DynamicscanModel | null; + uppercase?: boolean; + chipStatusText?: string; isAutomatedScan?: boolean; }; } export default class DynamicScanStatusChipComponent extends Component { - getColor(status: string | number | undefined, isDark: boolean) { - if ( - this.args.dynamicScan?.isDynamicStatusInProgress && - !this.args.dynamicScan?.isRunning - ) { - return isDark ? 'warn-dark' : 'warn'; + @service declare intl: IntlService; + + get file() { + return this.args.file; + } + + get chipColor() { + return this.getColor(this.file?.dynamicStatus, false) as AkChipColor; + } + + get loaderColor() { + return this.getColor(this.file?.dynamicStatus, true) as AkLoaderColor; + } + + get chipDetails() { + if (this.file.isDynamicStatusError) { + return { + label: this.intl.t('errored'), + color: 'error' as const, + icon: 'warning', + }; + } else if (this.file.isDynamicStatusInProgress) { + return { + label: this.file.statusText, + color: this.chipColor, + loaderColor: this.loaderColor, + }; + } else if (this.file.isDynamicDone) { + return { + label: this.intl.t('completed'), + color: 'success' as const, + }; + } + + return { + label: this.intl.t('notStarted'), + color: 'secondary' as const, + }; + } + + @action + getColor( + status: string | number | undefined, + isLoader: boolean + ): AkChipColor | AkLoaderColor { + if (this.file?.isDynamicStatusInProgress) { + return isLoader ? 'warn-dark' : 'warn'; } else if (status === ENUMS.DYNAMIC_STATUS.COMPLETED) { return 'success'; } else if (status === ENUMS.DYNAMIC_STATUS.NONE) { return 'secondary'; } else if (status === ENUMS.DYNAMIC_STATUS.RUNNING) { - return isDark ? 'info-dark' : 'info'; + return isLoader ? 'info-dark' : 'info'; } else { - return isDark ? 'warn-dark' : 'warn'; + return isLoader ? 'warn-dark' : 'warn'; } } - - get chipColor() { - return this.getColor(this.args.dynamicScan?.status, false); - } - - get loaderColor() { - return this.getColor(this.args.dynamicScan?.status, true); - } } declare module '@glint/environment-ember-loose/registry' { diff --git a/app/components/file-details/index.hbs b/app/components/file-details/index.hbs index a67a384178..3f8431f266 100644 --- a/app/components/file-details/index.hbs +++ b/app/components/file-details/index.hbs @@ -1,25 +1,27 @@ -
- - {{#each this.breadcrumbItems as |item|}} - - {{/each}} - +
+
+ + {{#each this.breadcrumbItems as |item|}} + + {{/each}} + - - + + - + - - + + - + +
\ No newline at end of file diff --git a/app/components/file-details/manual-scan/index.ts b/app/components/file-details/manual-scan/index.ts index edb87ad4b1..8c47a71f31 100644 --- a/app/components/file-details/manual-scan/index.ts +++ b/app/components/file-details/manual-scan/index.ts @@ -49,7 +49,7 @@ export default class FileDetailsManualScanComponent extends Component - {{t 'modalCard.manual.minOSVersion'}} + {{t 'minOSVersion'}}
diff --git a/app/components/file-details/manual-scan/request-form/login-details/index.ts b/app/components/file-details/manual-scan/request-form/login-details/index.ts index b0cf19ecca..b838a6dfc6 100644 --- a/app/components/file-details/manual-scan/request-form/login-details/index.ts +++ b/app/components/file-details/manual-scan/request-form/login-details/index.ts @@ -38,7 +38,7 @@ export default class FileDetailsManualScanRequestFormLoginDetailsComponent exten { name: this.intl.t('action'), component: - 'file-details/scan-actions/manual-scan/login-details/user-role-action' as const, + 'file-details/manual-scan/request-form/login-details/user-role-action' as const, textAlign: 'center', }, ]; diff --git a/app/components/file-details/manual-scan/results/index.hbs b/app/components/file-details/manual-scan/results/index.hbs index 71a9138655..2b0315cbef 100644 --- a/app/components/file-details/manual-scan/results/index.hbs +++ b/app/components/file-details/manual-scan/results/index.hbs @@ -27,6 +27,7 @@ @filterVulnerabilityType={{this.filterVulnerabilityType}} @sorts={{this.sorts}} @updateAnalysesSorts={{this.updateAnalysesSorts}} + @pageReferrer='manual' />
\ No newline at end of file diff --git a/app/components/file-details/proxy-settings/index.ts b/app/components/file-details/proxy-settings/index.ts index e971a456d6..1e54f8ec3e 100644 --- a/app/components/file-details/proxy-settings/index.ts +++ b/app/components/file-details/proxy-settings/index.ts @@ -72,7 +72,7 @@ export default class FileDetailsProxySettingsComponent extends Component - {{#if this.fetchCapturedApis.isRunning}} - - - - - {{t 'loading'}}... - - - - {{else if this.hasNoCapturedApi}} - - - -
- - {{t 'capturedApiEmptyTitle'}} - - - - {{t 'capturedApiEmptyDesc' htmlSafe=true}} - -
-
- {{else}} -
- - - {{t 'capturedApiTitle'}} - - - {{#if this.totalCapturedApiCount}} - - {{t 'selected'}} - ({{this.selectedCount}}/{{this.totalCapturedApiCount}}) - - {{/if}} - - - - {{#each pgc.currentPageResults as |ca|}} - - {{/each}} - -
- - - {{/if}} - \ No newline at end of file diff --git a/app/components/file-details/scan-actions-old/api-scan/captured-apis/index.scss b/app/components/file-details/scan-actions-old/api-scan/captured-apis/index.scss deleted file mode 100644 index 4b2ffae709..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/captured-apis/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.bordered-box { - padding: 1.25em; - border: 1px solid - var(--file-details-scan-actions-api-scan-captured-apis-border-color); - box-sizing: border-box; -} - -.loading-container { - padding: 1.5em; - height: 150px; - border-radius: var( - --file-details-scan-actions-api-scan-captured-apis-border-radius - ); - border: 1px solid - var(--file-details-scan-actions-api-scan-captured-apis-border-color); - box-sizing: border-box; -} diff --git a/app/components/file-details/scan-actions-old/api-scan/captured-apis/index.ts b/app/components/file-details/scan-actions-old/api-scan/captured-apis/index.ts deleted file mode 100644 index 8f9d79a5f9..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/captured-apis/index.ts +++ /dev/null @@ -1,139 +0,0 @@ -import Component from '@glimmer/component'; -import { inject as service } from '@ember/service'; -import { tracked } from '@glimmer/tracking'; -import { task } from 'ember-concurrency'; -import FileModel from 'irene/models/file'; -import IntlService from 'ember-intl/services/intl'; -import Store from '@ember-data/store'; -import CapturedApiModel from 'irene/models/capturedapi'; -import ENV from 'irene/config/environment'; - -// eslint-disable-next-line ember/use-ember-data-rfc-395-imports -import { DS } from 'ember-data'; -import { PaginationProviderActionsArgs } from 'irene/components/ak-pagination-provider'; -import { action } from '@ember/object'; - -export interface FileDetailsScanActionsOldApiScanCapturedApisSignature { - Args: { - file: FileModel; - }; -} - -type CapturedApiQueryResponse = - DS.AdapterPopulatedRecordArray & { - meta: { count: number }; - }; - -export default class FileDetailsScanActionsOldApiScanCapturedApisComponent extends Component { - @service declare intl: IntlService; - @service declare ajax: any; - @service declare store: Store; - @service('notifications') declare notify: NotificationService; - - @tracked selectedCount = 0; - @tracked capturedApiResponse: CapturedApiQueryResponse | null = null; - @tracked limit = 5; - @tracked offset = 0; - - constructor( - owner: unknown, - args: FileDetailsScanActionsOldApiScanCapturedApisSignature['Args'] - ) { - super(owner, args); - - this.setSelectedCount.perform(); - this.fetchCapturedApis.perform(this.limit, this.offset); - } - - get capturedApiList() { - return this.capturedApiResponse?.toArray() || []; - } - - get totalCapturedApiCount() { - return this.capturedApiResponse?.meta?.count || 0; - } - - get hasNoCapturedApi() { - return this.totalCapturedApiCount === 0; - } - - @action - handlePrevNextAction({ limit, offset }: PaginationProviderActionsArgs) { - this.limit = limit; - this.offset = offset; - - this.fetchCapturedApis.perform(limit, offset); - } - - @action - handleItemPerPageChange({ limit }: PaginationProviderActionsArgs) { - this.offset = 0; - - this.fetchCapturedApis.perform(limit, this.offset); - } - - getSelectedApis = task(async () => { - const url = [ - ENV.endpoints['files'], - this.args.file.id, - 'capturedapis', - ].join('/'); - - const data = { fileId: this.args.file.id, is_active: true }; - - return await this.ajax.request(url, { namespace: ENV.namespace_v2, data }); - }); - - setSelectedCount = task(async () => { - try { - const selectedApis = await this.getSelectedApis.perform(); - - this.selectedCount = selectedApis.count; - } catch (error) { - const err = error as AdapterError; - this.notify.error(err.toString()); - } - }); - - toggleApi = task(async (capturedApi: CapturedApiModel) => { - try { - capturedApi.set('isActive', !capturedApi.isActive); - - await capturedApi.save(); - - this.notify.success(this.intl.t('capturedApiSaveSuccessMsg')); - - this.setSelectedCount.perform(); - } catch (err) { - const error = err as AdapterError; - let errMsg = this.intl.t('tPleaseTryAgain'); - - if (error.errors && error.errors.length) { - errMsg = error.errors[0]?.detail || errMsg; - } else if (error.message) { - errMsg = error.message; - } - - this.notify.error(errMsg); - } - }); - - fetchCapturedApis = task(async (limit: number, offset: number) => { - try { - this.capturedApiResponse = (await this.store.query('capturedapi', { - limit, - offset, - fileId: this.args.file.id, - })) as CapturedApiQueryResponse; - } catch (error) { - const err = error as AdapterError; - this.notify.error(err.toString()); - } - }); -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - 'FileDetails::ScanActionsOld::ApiScan::CapturedApis': typeof FileDetailsScanActionsOldApiScanCapturedApisComponent; - } -} diff --git a/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.hbs b/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.hbs deleted file mode 100644 index 7b5e5ee028..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.hbs +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - {{request-to-url @capturedApi.request}} - - {{#if this.handleToggleApi.isRunning}} - - {{/if}} - - - \ No newline at end of file diff --git a/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.scss b/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.scss deleted file mode 100644 index ec7b5e5d52..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.scss +++ /dev/null @@ -1,8 +0,0 @@ -.api-endpoint-container { - margin-top: 0.4em; - - .api-endpoint { - word-break: break-all; - white-space: normal; - } -} diff --git a/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.ts b/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.ts deleted file mode 100644 index 69535547de..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/captured-apis/overview/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Component from '@glimmer/component'; -import { task } from 'ember-concurrency'; -import CapturedApiModel from 'irene/models/capturedapi'; - -export interface FileDetailsScanActionsOldApiScanCapturedApiOverviewSignature { - Args: { - capturedApi: CapturedApiModel; - toggleApi: () => Promise; - }; -} - -export default class FileDetailsScanActionsOldApiScanCapturedApiOverviewComponent extends Component { - handleToggleApi = task(async () => { - await this.args.toggleApi(); - }); -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - 'FileDetails::ScanActionsOld::ApiScan::CapturedApis::Overview': typeof FileDetailsScanActionsOldApiScanCapturedApiOverviewComponent; - } -} diff --git a/app/components/file-details/scan-actions-old/api-scan/index.hbs b/app/components/file-details/scan-actions-old/api-scan/index.hbs deleted file mode 100644 index 69fd69a92d..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/index.hbs +++ /dev/null @@ -1,114 +0,0 @@ -{{#if @file.isRunningApiScan}} - - {{t 'scanning'}} - : - {{@file.apiScanProgress}}% - -{{else if @file.isApiDone}} - - <:leftIcon> - - - - <:default>{{t 'completed'}} - -{{else if @file.isApiNotDone}} - - <:leftIcon> - {{#if this.openApiScanModal.isRunning}} - - {{else}} - - {{/if}} - - - <:default>{{t 'start'}} - -{{/if}} - -{{#if this.showApiScanModal}} - - <:default> -
- {{#if this.hasDynamicScanDone}} - {{#if this.capturedApisCount}} - - - - - {{t 'modalCard.apiScan.warning' htmlSafe=true}} - - - -
- - {{t 'modalCard.apiScan.description'}} - -
- {{/if}} - -
- -
- -
- -
- {{else}} - - - - - {{t 'modalCard.apiScan.noDynamicScan'}} - - - {{/if}} -
- - - <:footer> - - - - {{#if this.capturedApisCount}} - - {{t 'modalCard.apiScan.start'}} - - {{else}} - - {{t 'close'}} - - {{/if}} - - -
-{{/if}} \ No newline at end of file diff --git a/app/components/file-details/scan-actions-old/api-scan/index.scss b/app/components/file-details/scan-actions-old/api-scan/index.scss deleted file mode 100644 index 021ee4b3b9..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/index.scss +++ /dev/null @@ -1,9 +0,0 @@ -.api-scan-modal-alert { - padding: 1em; - background-color: var( - --file-details-scan-actions-api-scan-alert-background-color - ); - color: var(--file-details-scan-actions-api-scan-alert-text-color); - border: 1px solid var(--file-details-scan-actions-api-scan-alert-border-color); - border-radius: var(--file-details-scan-actions-api-scan-border-radius); -} diff --git a/app/components/file-details/scan-actions-old/api-scan/index.ts b/app/components/file-details/scan-actions-old/api-scan/index.ts deleted file mode 100644 index cd1292d47f..0000000000 --- a/app/components/file-details/scan-actions-old/api-scan/index.ts +++ /dev/null @@ -1,131 +0,0 @@ -import Component from '@glimmer/component'; -import { inject as service } from '@ember/service'; -import { action } from '@ember/object'; -import ENV from 'irene/config/environment'; -import triggerAnalytics from 'irene/utils/trigger-analytics'; -import { task } from 'ember-concurrency'; -import IntlService from 'ember-intl/services/intl'; -import { tracked } from '@glimmer/tracking'; - -import FileModel from 'irene/models/file'; -import RealtimeService from 'irene/services/realtime'; -import TrailService from 'irene/services/trial'; - -export interface FileDetailsScanActionsOldApiScanSignature { - Args: { - file: FileModel; - }; -} - -export default class FileDetailsScanActionsOldApiScanComponent extends Component { - @service declare intl: IntlService; - @service declare trial: TrailService; - @service declare ajax: any; - @service('notifications') declare notify: NotificationService; - @service declare realtime: RealtimeService; - - @tracked capturedApisCount = 0; - @tracked showApiScanModal = false; - - get tStartingApiScan() { - return this.intl.t('startingApiScan'); - } - - get tPleaseTryAgain() { - return this.intl.t('pleaseTryAgain'); - } - - get hasDynamicScanDone() { - return this.args.file.isDynamicDone; - } - - /* fetch captured apis count */ - setCapturedApisCount = task(async () => { - const url = [ - ENV.endpoints['files'], - this.args.file.id, - 'capturedapis', - ].join('/'); - - const data = { fileId: this.args.file.id }; - - const apis = await this.ajax.request(url, { - namespace: ENV.namespace_v2, - data, - }); - - this.realtime.incrementProperty('CapturedApiCounter'); - - try { - this.capturedApisCount = apis.count; - } catch (error) { - this.notify.error((error as Error).toString()); - } - }); - - /* API scan modal actions */ - openApiScanModal = task({ drop: true }, async () => { - if (this.hasDynamicScanDone) { - await this.setCapturedApisCount.perform(); - } - - triggerAnalytics( - 'feature', - ENV.csb['apiScanBtnClick'] as CsbAnalyticsFeatureData - ); - - this.showApiScanModal = true; - }); - - @action - closeApiScanModal() { - this.showApiScanModal = false; - } - - /* init API scan */ - startApiScan = task(async () => { - const dynamicUrl = [ - ENV.endpoints['files'], - this.args.file.id, - ENV.endpoints['capturedApiScanStart'], - ].join('/'); - - return await this.ajax.post(dynamicUrl, { namespace: ENV.namespace_v2 }); - }); - - runApiScan = task(async () => { - try { - this.showApiScanModal = false; - - await this.startApiScan.perform(); - - triggerAnalytics( - 'feature', - ENV.csb['runAPIScan'] as CsbAnalyticsFeatureData - ); - - this.notify.success(this.tStartingApiScan); - } catch (e) { - const err = e as AdapterError; - - let errMsg = this.tPleaseTryAgain; - - if (err.errors && err.errors.length) { - errMsg = err.errors[0]?.detail || errMsg; - } else if (err.payload && err.payload.detail) { - errMsg = err.payload.detail; - } else if (err.message) { - errMsg = err.message; - } - - this.notify.error(errMsg); - } - }); -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - 'FileDetails::ScanActionsOld::ApiScan': typeof FileDetailsScanActionsOldApiScanComponent; - 'file-details/scan-actions-old/api-scan': typeof FileDetailsScanActionsOldApiScanComponent; - } -} diff --git a/app/components/file-details/scan-actions-old/index.hbs b/app/components/file-details/scan-actions-old/index.hbs deleted file mode 100644 index 81692b8021..0000000000 --- a/app/components/file-details/scan-actions-old/index.hbs +++ /dev/null @@ -1,92 +0,0 @@ -
- - - {{t 'scanTypes'}} - - - {{#unless @file.isActive}} - - - - {{/unless}} - - - - - - - - {{t 'staticScan'}} - - - - - - - - {{t 'dynamicScan'}} - - - - - - {{#if this.isAPIScanEnabled}} - - - {{t 'apiScan'}} - - - - - {{/if}} - - {{#unless this.isManualScanDisabled}} - - - {{t 'manualScan'}} - - - - - {{/unless}} - -
\ No newline at end of file diff --git a/app/components/file-details/scan-actions-old/index.scss b/app/components/file-details/scan-actions-old/index.scss deleted file mode 100644 index 4b990614dc..0000000000 --- a/app/components/file-details/scan-actions-old/index.scss +++ /dev/null @@ -1,10 +0,0 @@ -.scan-actions-root { - width: 100%; - border: 1px solid var(--file-details-scan-actions-old-border-color); - background-color: var(--file-details-scan-actions-old-background-color); - box-sizing: border-box; - - .scan-actions-header { - padding: 0.75em 1.5em; - } -} diff --git a/app/components/file-details/scan-actions-old/index.ts b/app/components/file-details/scan-actions-old/index.ts deleted file mode 100644 index 373791352d..0000000000 --- a/app/components/file-details/scan-actions-old/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { inject as service } from '@ember/service'; -import Component from '@glimmer/component'; - -import FileModel from 'irene/models/file'; -import OrganizationService from 'irene/services/organization'; - -export interface FileDetailsScanActionsOldSignature { - Args: { - file: FileModel; - }; -} - -export default class FileDetailsScanActionsOldComponent extends Component { - @service declare organization: OrganizationService; - - get isManualScanDisabled() { - return !this.args.file.project.get('isManualScanAvailable'); - } - - get isAPIScanEnabled() { - return this.args.file.project.get('isAPIScanEnabled'); - } -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - 'FileDetails::ScanActionsOld': typeof FileDetailsScanActionsOldComponent; - } -} diff --git a/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.hbs b/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.hbs deleted file mode 100644 index 5fca30eb5b..0000000000 --- a/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.hbs +++ /dev/null @@ -1,91 +0,0 @@ - -
- - {{t 'modalCard.manual.appEnv'}} - - -
- - {{t (app-environment aks.value)}} - -
-
- -
- - {{t 'minOSVersion'}} - - -
- -
-
- -
- - {{t 'modalCard.manual.appQuestion1'}} - - -
- - {{t (app-action aks.value)}} - -
-
- -
- - {{t 'modalCard.manual.poc'}} - - -
- - - -
-
-
\ No newline at end of file diff --git a/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.scss b/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.scss deleted file mode 100644 index 1bada3b3a6..0000000000 --- a/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.scss +++ /dev/null @@ -1,17 +0,0 @@ -.basic-info-group { - width: 100%; - display: flex; - align-items: center; - justify-content: space-between; - gap: 1.5em; - box-sizing: border-box; - - .basic-info-label { - flex: 1; - } - - .basic-info-input-container { - flex: 1; - max-width: 200px; - } -} diff --git a/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.ts b/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.ts deleted file mode 100644 index a9c1a132b9..0000000000 --- a/app/components/file-details/scan-actions-old/manual-scan/basic-info/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -import Component from '@glimmer/component'; -import FileModel from 'irene/models/file'; -import ENUMS from 'irene/enums'; -import ManualscanModel from 'irene/models/manualscan'; -import { action } from '@ember/object'; - -export interface FileDetailsScanActionsOldManualScanBasicInfoSignature { - Args: { - file: FileModel; - manualscan: ManualscanModel | null; - }; -} - -export default class FileDetailsScanActionsOldManualScanBasicInfoComponent extends Component { - get environments() { - return ENUMS.APP_ENV.CHOICES.slice(0, -1); - } - - get selectedAppEnvironment() { - return this.environments.find( - (it) => it.value === this.args.manualscan?.filteredAppEnv - ); - } - - get appActions() { - return ENUMS.APP_ACTION.CHOICES.slice(0, -1); - } - - get selectedAppAction() { - return this.appActions.find( - (it) => it.value === this.args.manualscan?.filteredAppAction - ); - } - - @action - selectAppEnvironment({ value }: { value: string }) { - this.args.manualscan?.set('appEnv', value); - } - - @action - handleAppActionChange({ value }: { value: string }) { - const appAction = parseInt(value); - - this.args.manualscan?.set('appAction', appAction); - } -} - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - 'FileDetails::ScanActionsOld::ManualScan::BasicInfo': typeof FileDetailsScanActionsOldManualScanBasicInfoComponent; - 'file-details/scan-actions-old/manual-scan/basic-info': typeof FileDetailsScanActionsOldManualScanBasicInfoComponent; - } -} diff --git a/app/components/file-details/scan-actions-old/manual-scan/index.hbs b/app/components/file-details/scan-actions-old/manual-scan/index.hbs deleted file mode 100644 index b9deb24fe1..0000000000 --- a/app/components/file-details/scan-actions-old/manual-scan/index.hbs +++ /dev/null @@ -1,123 +0,0 @@ -
- {{#if @file.isManualRequested}} - - <:leftIcon> - - - - <:default> - {{this.manualScanStatusText}} - - - {{else}} - - <:leftIcon> - - - - <:default>{{t 'start'}} - - {{/if}} - - {{#if this.showManualScanModal}} - - <:default> -
- - {{t 'modalCard.manual.description'}} - - - - {{#each this.manualScanFormSections as |msf|}} - - <:content> - {{#let (component msf.contentComponent) as |Component|}} - - {{/let}} - - - {{/each}} - - -
- - {{t 'modalCard.manual.additionalComments'}} - - -