generated from SAP/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 9
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
5ef6ba9
commit 912ee2a
Showing
4 changed files
with
183 additions
and
0 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.html
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,58 @@ | ||
<div> | ||
<h1>Decoys list 🗒️</h1> | ||
<!-- <div class="search"> | ||
</div> --> | ||
<div class="wrapper"> | ||
<table class="list-container"> | ||
<thead> | ||
<tr> | ||
<th class="decoy-head">Decoy</th> | ||
<th>inject</th> | ||
<th>Detect</th> | ||
<th>Action</th> | ||
<th class="row-options"></th> | ||
</tr> | ||
<tr class="tr-separator"><td class="row-separator" colspan="5"><hr class="head-separator"/></td></tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let decoy of decoys"> | ||
<td> | ||
<p>{{ displayDecoy(decoy) }}</p> | ||
<p [ngClass]="{ 'sub-text': displayDecoy(decoy) }">{{ decoy.decoy.string && decoy.decoy.string }}</p> | ||
</td> | ||
<td> | ||
<ng-container *ngIf="decoy.inject; else noInject"> | ||
<p>{{ decoy.inject.store.as }}</p> | ||
<p class="sub-text">{{ decoy.inject.store.inRequest || decoy.inject.store.inResponse }}</p> | ||
</ng-container> | ||
<ng-template #noInject> | ||
<p class="sub-text">/</p> | ||
</ng-template> | ||
</td> | ||
<td> | ||
<ng-container *ngIf="decoy.detect; else noDetect"> | ||
<p>{{ decoy.detect.seek.in }}</p> | ||
<p class="sub-text">{{ decoy.detect.seek.inRequest || decoy.detect.seek.inResponse }}</p> | ||
</ng-container> | ||
<ng-template #noDetect> | ||
<p class="sub-text">/</p> | ||
</ng-template> | ||
</td> | ||
<td> | ||
<ng-container *ngIf="decoy.detect?.respond?.length; else noRespond"> | ||
<p>{{ decoy.detect?.respond![0].behavior }}</p> | ||
<p class="sub-text">{{ decoy.detect?.respond![0].source }}</p> | ||
</ng-container> | ||
<ng-template #noRespond> | ||
<p class="sub-text">/</p> | ||
</ng-template> | ||
</td> | ||
<td class="options"> | ||
<button class="option-btn"><img src="edit.svg" alt=""></button> | ||
<button class="option-btn"><img src="delete.svg" alt=""></button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
56 changes: 56 additions & 0 deletions
56
controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.scss
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,56 @@ | ||
@import '../../../styles/variables.scss'; | ||
.wrapper { | ||
width: 100%; | ||
padding: 0 4%; | ||
.list-container { | ||
width: 100%; | ||
border-radius: 20px; | ||
background-color: white; | ||
box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 3px -2px, | ||
rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, | ||
rgba(0, 0, 0, 0.12) 0px 1px 8px 0px; | ||
table-layout: fixed; | ||
border-collapse: collapse; | ||
thead { | ||
.head-separator { | ||
width: 100%; | ||
} | ||
th { | ||
text-align: start; | ||
padding: 1rem 1rem; | ||
width: 20%; | ||
} | ||
.decoy-head { | ||
width: 35%; | ||
} | ||
.row-options { | ||
width: 15%; | ||
} | ||
} | ||
tbody { | ||
tr { | ||
td { | ||
padding: 0.8rem 1rem; | ||
.sub-text { | ||
color: gray; | ||
} | ||
} | ||
.options { | ||
text-align: center; | ||
.option-btn { | ||
border: 0; | ||
background-color: transparent; | ||
margin: 0 0.5rem; | ||
cursor: pointer; | ||
img { | ||
width: 2rem; | ||
} | ||
} | ||
} | ||
} | ||
tr:nth-child(odd){ | ||
background-color: #E8E8E8; | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.spec.ts
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,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ListDecoyComponent } from './list-decoy.component'; | ||
|
||
describe('ListDecoyComponent', () => { | ||
let component: ListDecoyComponent; | ||
let fixture: ComponentFixture<ListDecoyComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ListDecoyComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ListDecoyComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
controlpanel/cad/src/app/pages/list-decoy/list-decoy.component.ts
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,46 @@ | ||
import { Component } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { Decoy } from '../../models/decoy'; | ||
|
||
@Component({ | ||
selector: 'app-list-decoy', | ||
standalone: true, | ||
imports: [CommonModule], | ||
templateUrl: './list-decoy.component.html', | ||
styleUrl: './list-decoy.component.scss' | ||
}) | ||
export class ListDecoyComponent { | ||
decoys: Decoy[] = [{ | ||
"decoy": { | ||
"key": "x-cloud-active-defense", | ||
"separator": ":", | ||
"value": "ACTIVE", | ||
string: "qwertyuiop" | ||
}, | ||
"inject": { | ||
"store": { | ||
"inResponse": ".*", | ||
"as": "header" | ||
} | ||
} | ||
},{ | ||
"decoy": { | ||
"key": "x-cloud-active-defense", | ||
"separator": "=", | ||
"value": "ACTIVE", | ||
string: "qwertyuiop" | ||
}, | ||
"inject": { | ||
"store": { | ||
"inResponse": ".*", | ||
"as": "header" | ||
} | ||
} | ||
} ]; | ||
|
||
displayDecoy(decoy: Decoy): string { | ||
let key = decoy.decoy.dynamicKey || decoy.decoy.key || ''; | ||
let value = decoy.decoy.dynamicValue || decoy.decoy.value || ''; | ||
return `${key}${value ? decoy.decoy.separator ? decoy.decoy.separator : '=' : ''}${value}`; | ||
} | ||
} |