Skip to content

Commit

Permalink
fix: fixed alignment in tooltips of trend graphs, added default sort …
Browse files Browse the repository at this point in the history
…in compliance dashboard
  • Loading branch information
sidharthjain-zemoso committed Mar 6, 2023
1 parent e5b8106 commit 953bc58
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export class CreateStickyExceptionsComponent implements OnInit, OnDestroy {
this.state = 'open';
this.menuState = 'in';
this.selectedallPolicies = attributeDetail.allPolicies;
this.selectedRules = attributeDetail.rules;
this.selectedRules = attributeDetail.policies;
this.selectedIndex = index;

attributeDetail.rules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ export class ComplianceDashboardComponent implements OnInit {
ngOnInit() {
const state = this.tableStateService.getState("dashboard") || {};

this.headerColName = state.headerColName || '';
this.direction = state.direction || '';
this.headerColName = state.headerColName || 'Severity';
this.direction = state.direction || 'asc';
// this.bucketNumber = state.bucketNumber || 0;

this.displayedColumns = Object.keys(this.columnWidths);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ export class MultilineBrushZoomComponent implements OnInit, OnChanges {
Compliance: "#00B946", // Green
patching: "#00569D", // Dark blue(shade)
"other policies": "#F2425F", // Red
costOptimization: "#289cf7", // Light Blue
cost: "#289cf7", // Light Blue
certificate: "#289CF7", // Sky Blue
governance: "#26ba9d", // Green
operations: "#26ba9d", // Green
vulnerability: "#645EC5", // Purple
high: "#F75C03", // Orange
low: "#FFE00D", // Green
Expand Down Expand Up @@ -1501,7 +1501,7 @@ export class MultilineBrushZoomComponent implements OnInit, OnChanges {
const rectData = {};
const dateData = {};
const yearData = {};
valueData["dx"] = mousePosition < axisRange / 4 ? "12.5em" : "-4.7em";
valueData["dx"] = mousePosition < axisRange / 4 ? "16.5em" : "-4.7em";
rectText["dx"] = mousePosition < axisRange / 4 ? "6.7em" : "-14.5em";
rectData["dx"] = mousePosition < axisRange / 4 ? "70" : "-140";
rectCoverData["dx"] = mousePosition < axisRange / 4 ? "180" : "-45";
Expand All @@ -1513,10 +1513,10 @@ export class MultilineBrushZoomComponent implements OnInit, OnChanges {
: "25";
dateData["dx"] =
mousePosition < axisRange / 4
? "1em"
? "2em"
: mousePosition > axisRange * 0.75
? "-16em"
: "2em";
? "-17em"
: "3em";
dateData["dy"] =
mousePosition < axisRange / 4
? ".35em"
Expand All @@ -1525,10 +1525,10 @@ export class MultilineBrushZoomComponent implements OnInit, OnChanges {
: ".35em";
yearData["dx"] =
mousePosition < axisRange / 4
? "1em"
? "2em"
: mousePosition > axisRange * 0.75
? "-16em"
: "2em";
? "-17em"
: "3em";
yearData["dy"] =
mousePosition < axisRange / 4
? "1.5em"
Expand Down Expand Up @@ -1570,7 +1570,7 @@ export class MultilineBrushZoomComponent implements OnInit, OnChanges {
)
.text(dobj["value" + m])
.attr("dx", valueData["dx"])
.attr("dy", 0.5 + m * 2.5 + "em");
.attr("dy", 0.3 + m * 2.8 + "em");
});

const legend = self.graphLinesData[numOfLines - m].key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,7 @@ export class MultilineZoomGraphComponent implements OnInit, AfterViewInit {
.attr("fill", "#fff")
// .attr("fill-opacity", "0.9")
.attr("height", "69px")
.attr("width", "149px")
.attr("width", "169px")
.attr("stroke", "#DFE6EE")
.attr("display", "none")
.attr("text-align", "middle")
Expand Down Expand Up @@ -1531,7 +1531,7 @@ export class MultilineZoomGraphComponent implements OnInit, AfterViewInit {
mousePosition < axisRange / 4
? "4em"
: mousePosition > axisRange * 0.75
? "-16em"
? "-14em"
: "5em";
// rectData["dx"] = mousePosition < axisRange / 4 ? "70" : "-140";
valueData["dx"] =
Expand All @@ -1550,7 +1550,7 @@ export class MultilineZoomGraphComponent implements OnInit, AfterViewInit {
mousePosition < axisRange / 4
? "2.1em"
: mousePosition > axisRange * 0.75
? "-7em"
? "-5em"
: "3.1em";
rectData["dy"] =
mousePosition < axisRange / 4
Expand All @@ -1567,7 +1567,7 @@ export class MultilineZoomGraphComponent implements OnInit, AfterViewInit {
mousePosition < axisRange / 4
? "15"
: mousePosition > axisRange * 0.75
? "-200"
? "-198"
: "25";
dateData["dx"] =
mousePosition < axisRange / 4
Expand All @@ -1585,7 +1585,7 @@ export class MultilineZoomGraphComponent implements OnInit, AfterViewInit {
mousePosition < axisRange / 4
? "1em"
: mousePosition > axisRange * 0.75
? "-16em"
? "-14em"
: "2em";
yearData["dy"] =
mousePosition < axisRange / 4
Expand Down
26 changes: 16 additions & 10 deletions webapp/src/app/shared/table/table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
}else{
this.allSelected=false;
}
if(this.doLocalSearch && this.dataSource?.data?.length){
this.customSearch();
}
if(this.onScrollDataLoader){
if (this.onScrollDataLoader) {
this.onScrollDataLoader.subscribe(data => {
this.isDataLoading = false;
if(data && data.length>0){
Expand Down Expand Up @@ -139,7 +136,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
})

if(this.doLocalSearch && this.dataSource?.data?.length){
this.customSearch();
this.filterAndSort();
}else{

this.chips = this.filteredArray.map(obj => {return {...obj}}); // cloning filteredArray
Expand All @@ -163,6 +160,15 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
}
}

filterAndSort(){
if(this.doLocalSearch && this.dataSource?.data?.length){
this.customSearch();
}
if(this.headerColName && this.direction && this.doLocalSort){
this.customSort(this.headerColName, this.direction);
}
}

scrollFilterModalToBottom(forceScroll?){
if(this.filtersContainer){
if(this.totalChips > 2 || forceScroll){
Expand Down Expand Up @@ -294,7 +300,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
this.filteredArray[currIdx].value = e;

if(this.doLocalFilter){
this.customSearch();
this.filterAndSort();
}else{
let event = {
index: currIdx,
Expand Down Expand Up @@ -342,7 +348,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {

if(this.doLocalFilter){
this.filteredArray.splice(i, 1);
this.customSearch();
this.filterAndSort();
return;
}
let event = {
Expand All @@ -354,7 +360,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
removeAllFilters(){
if(this.doLocalFilter){
this.filteredArray = [];
this.customSearch();
this.filterAndSort();
return;
}
let event = {
Expand Down Expand Up @@ -441,7 +447,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
// this.customTable.first.nativeElement.scrollTop = 0;
this.tableErrorMessage = '';
if(this.doLocalSearch){
this.customSearch();
this.filterAndSort();
}else{
this.searchCalledEventEmitter.emit(searchTxt);
}
Expand All @@ -452,7 +458,7 @@ export class TableComponent implements OnInit,AfterViewInit, OnChanges {
this.searchQuery = "";
if(this.tableErrorMessage == 'noSearchFound') this.tableErrorMessage = "";
if(this.doLocalSearch){
this.customSearch();
this.filterAndSort();
}else{
this.searchCalledEventEmitter.emit(this.searchQuery);
}
Expand Down

0 comments on commit 953bc58

Please sign in to comment.