Skip to content

Commit

Permalink
Merge pull request #1746 from akto-api-security/feature/add_delete_bu…
Browse files Browse the repository at this point in the history
…tton

adding delete button
  • Loading branch information
Ark2307 authored Nov 20, 2024
2 parents b5cf5ae + 2bd9cc4 commit 6086fe2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public String deleteAdvancedFilter(){
return SUCCESS.toUpperCase();
}

private boolean deleteAPIsInstantly;

public String syncTrafficFromFilters(){
FilterConfig filterConfig = new FilterConfig();
try {
Expand All @@ -119,7 +121,7 @@ public String syncTrafficFromFilters(){
public void run() {
Context.accountId.set(accountId);
try {
CleanInventory.cleanFilteredSampleDataFromAdvancedFilters(apiCollections,Arrays.asList(yamlTemplate),new ArrayList<>() , "", false, true);
CleanInventory.cleanFilteredSampleDataFromAdvancedFilters(apiCollections,Arrays.asList(yamlTemplate),new ArrayList<>() , "",deleteAPIsInstantly, true);
} catch (Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -151,5 +153,9 @@ public void setInactive(boolean inactive) {
this.inactive = inactive;
}

public void setDeleteAPIsInstantly(boolean deleteAPIsInstantly) {
this.deleteAPIsInstantly = deleteAPIsInstantly;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ function AdvancedTrafficFilters() {

}

const handleDryRun = async(content) => {
const handleDryRun = async(content, shouldDelete) => {
if(window.IS_SAAS !== "true" || window.USER_NAME.includes("akto")){
await trafficFiltersRequest.dryRunAdvancedFilters(content).then((res)=> {
await trafficFiltersRequest.dryRunAdvancedFilters(content, shouldDelete).then((res)=> {
window.open("/dashboard/settings/logs", "_blank")
})
}
Expand Down Expand Up @@ -184,7 +184,7 @@ function AdvancedTrafficFilters() {
open={modalActive}
onClose={() => setModalActive(false)}
primaryAction={{content: 'Save', onAction: () => {handleSave(currentTemplate); setModalActive(false)}}}
secondaryActions={(window.IS_SAAS !== "true" || window.USER_NAME.includes("akto"))? [{content: 'Dry run', onAction: () => handleDryRun(currentTemplate)}]: []}
secondaryActions={(window.IS_SAAS !== "true" || window.USER_NAME.includes("akto"))? [{content: 'Dry run', onAction: () => handleDryRun(currentTemplate, false)},{content: 'Delete APIs matched', onAction: ()=> handleDryRun(currentTemplate, true) }]: []}
title={"Add advanced filters"}
>
<Modal.Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ const trafficFiltersRequest = {
data: {templateId: id, inactive: inactive}
})
},
dryRunAdvancedFilters(yamlContent){
dryRunAdvancedFilters(yamlContent, deleteAPIsInstantly){
return request({
url: '/api/dryRunAdvancedFilters',
method: 'post',
data: {yamlContent}
data: {yamlContent, deleteAPIsInstantly}
})
},
getAdvancedFiltersPermissions(){
Expand Down

0 comments on commit 6086fe2

Please sign in to comment.