-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e952fda
commit 1939149
Showing
48 changed files
with
845 additions
and
723 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class AvailableAutomatedDeviceAdapter extends CommondrfNestedAdapter { | ||
setNestedUrlNamespace(projectId: string) { | ||
this.namespace = `${this.namespace_v2}/projects/${projectId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'available-automated-device': AvailableAutomatedDeviceAdapter; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import CommonDRFAdapter from './commondrf'; | ||
import { underscore } from '@ember/string'; | ||
import type ModelRegistry from 'ember-data/types/registries/model'; | ||
|
||
export default class CommondrfNestedAdapter extends CommonDRFAdapter { | ||
namespace = ''; | ||
pathTypeName: keyof ModelRegistry | null = null; | ||
|
||
pathForType(type: keyof ModelRegistry) { | ||
return underscore(super.pathForType(this.pathTypeName || type)); | ||
} | ||
|
||
handleResponse( | ||
status: number, | ||
headers: object, | ||
payload: object, | ||
requestData: object | ||
) { | ||
if (status >= 400 && this.namespace === '') { | ||
throw new Error( | ||
'setNestUrlNamespace should be called before making a request' | ||
); | ||
} | ||
|
||
// reset namespace | ||
this.namespace = ''; | ||
|
||
return super.handleResponse(status, headers, payload, requestData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import CommondrfNestedAdapter from './commondrf-nested'; | ||
|
||
export default class DsAutomationPreferenceAdapter extends CommondrfNestedAdapter { | ||
_buildURL() { | ||
return this.buildURLFromBase(`${this.namespace}/automation_preference`); | ||
} | ||
|
||
setNestedUrlNamespace(profileId: string) { | ||
this.namespace = `${this.namespace_v2}/profiles/${profileId}`; | ||
} | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'ds-automation-preference': DsAutomationPreferenceAdapter; | ||
} | ||
} |
113 changes: 31 additions & 82 deletions
113
app/components/file-details/dynamic-scan/action/index.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,36 @@ | ||
<AkStack @direction='column' @alignItems='center' @spacing='1'> | ||
{{! TODO: Logic should be replaced by comments when full DAST feature is ready }} | ||
{{#if @dynamicScan.isReadyOrRunning}} | ||
{{#if @isAutomatedScan}} | ||
<AkButton | ||
local-class='dynamic-scan-btn' | ||
@variant='outlined' | ||
@color='neutral' | ||
@disabled={{not @file.isActive}} | ||
{{on 'click' (perform this.dynamicShutdown)}} | ||
data-test-fileDetails-dynamicScanAction-cancelBtn | ||
> | ||
<:leftIcon> | ||
{{#if this.dynamicShutdown.isRunning}} | ||
<AkLoader @color='secondary' @size={{13}} /> | ||
{{else}} | ||
<AkIcon @iconName='close' /> | ||
{{/if}} | ||
</:leftIcon> | ||
|
||
<:default>{{t 'cancelScan'}}</:default> | ||
</AkButton> | ||
{{else}} | ||
<AkButton | ||
data-test-fileDetails-dynamicScanAction-stopBtn | ||
local-class='dynamic-scan-btn' | ||
{{on 'click' (perform this.dynamicShutdown)}} | ||
@disabled={{not @file.isActive}} | ||
> | ||
<:leftIcon> | ||
{{#if this.dynamicShutdown.isRunning}} | ||
<AkLoader @size={{13}} /> | ||
{{else}} | ||
<AkIcon @iconName='stop-circle' /> | ||
{{/if}} | ||
</:leftIcon> | ||
|
||
<:default>{{t 'stop'}}</:default> | ||
</AkButton> | ||
{{/if}} | ||
<AkButton | ||
local-class='dynamic-scan-btn' | ||
data-test-fileDetails-dynamicScanAction='{{this.dynamicScanActionButton.testId}}' | ||
{{on 'click' this.dynamicScanActionButton.onClick}} | ||
@disabled={{or (not @file.isActive) this.dynamicScanActionButton.loading}} | ||
@variant={{this.dynamicScanActionButton.variant}} | ||
@color={{this.dynamicScanActionButton.color}} | ||
@loading={{this.dynamicScanActionButton.loading}} | ||
> | ||
<:leftIcon> | ||
<AkIcon @iconName={{this.dynamicScanActionButton.icon}} /> | ||
</:leftIcon> | ||
|
||
{{else if (or @file.isDynamicDone @dynamicScan.isDynamicStatusError)}} | ||
<AkButton | ||
local-class='dynamic-scan-btn' | ||
data-test-fileDetails-dynamicScanAction-restartBtn | ||
data-test-cy='dynamicScan-restartBtn' | ||
{{on 'click' this.openDynamicScanDrawer}} | ||
@disabled={{not @file.isActive}} | ||
> | ||
<:leftIcon> | ||
<AkIcon @iconName='refresh' /> | ||
</:leftIcon> | ||
<:default> | ||
{{this.dynamicScanActionButton.text}} | ||
</:default> | ||
</AkButton> | ||
|
||
<:default>{{@dynamicScanText}}</:default> | ||
</AkButton> | ||
{{else}} | ||
<AkButton | ||
local-class='dynamic-scan-btn' | ||
data-test-fileDetails-dynamicScanAction-startBtn | ||
{{on 'click' this.openDynamicScanDrawer}} | ||
@disabled={{not @file.isActive}} | ||
{{#if this.showDynamicScanDrawer}} | ||
<ProjectPreferences::Provider | ||
@profileId={{this.profileId}} | ||
@platform={{this.projectPlatform}} | ||
@project={{@file.project.content}} | ||
as |dpContext| | ||
> | ||
<:leftIcon> | ||
<AkIcon @iconName='play-arrow' /> | ||
</:leftIcon> | ||
|
||
<:default>{{@dynamicScanText}}</:default> | ||
</AkButton> | ||
<FileDetails::DynamicScan::Action::Drawer | ||
@onClose={{this.closeDynamicScanDrawer}} | ||
@file={{@file}} | ||
@dpContext={{dpContext}} | ||
@isAutomatedScan={{@isAutomatedScan}} | ||
@onScanStart={{@onScanStart}} | ||
/> | ||
</ProjectPreferences::Provider> | ||
{{/if}} | ||
</AkStack> | ||
|
||
{{#if this.showDynamicScanDrawer}} | ||
<ProjectPreferences::Provider | ||
@profileId={{this.profileId}} | ||
@platform={{this.projectPlatform}} | ||
@project={{@file.project.content}} | ||
as |dpContext| | ||
> | ||
<FileDetails::DynamicScan::Action::Drawer | ||
@onClose={{this.closeDynamicScanDrawer}} | ||
@file={{@file}} | ||
@dpContext={{dpContext}} | ||
@isAutomatedScan={{@isAutomatedScan}} | ||
@onScanStart={{@onScanStart}} | ||
/> | ||
</ProjectPreferences::Provider> | ||
{{/if}} | ||
</AkStack> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.