Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop #1247

Merged
merged 4 commits into from
Jul 22, 2024
Merged

Develop #1247

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 29 additions & 9 deletions UI/src/app/dashboardv2/filter-v2/filter-new.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,14 @@ export class FilterNewComponent implements OnInit, OnDestroy {
} else {
stateFilters['primary_level'] = this.filterDataArr[this.selectedType][this.selectedLevel.emittedLevel].filter((f) => Object.values(this.colorObj).map(m => m['nodeId']).includes(f.nodeId));
}
this.handlePrimaryFilterChange(stateFilters['primary_level']);
this.helperService.setBackupOfFilterSelectionState({ 'primary_level': stateFilters['primary_level'] });
console.log(stateFilters);
Object.keys(stateFilters['additional_level']).forEach((level) => {
Object.keys(stateFilters['additional_level'][level]).forEach(key => {
stateFilters['additional_level'][level][key] = stateFilters['additional_level'][level][key].filter(addtnlFilter => stateFilters['primary_level'].map((primary) => primary.nodeId).includes(addtnlFilter.parentId));
})
});
this.handlePrimaryFilterChange(stateFilters);
this.helperService.setBackupOfFilterSelectionState(stateFilters);
}
}
}
Expand Down Expand Up @@ -328,11 +334,11 @@ export class FilterNewComponent implements OnInit, OnDestroy {
}

handlePrimaryFilterChange(event) {
/**TODO: resetting the date filter on filter change for now */
this.selectedDayType = 'Weeks';
this.selectedDateValue = this.dateRangeFilter?.counts?.[0];
this.selectedDateFilter = `${this.selectedDateValue} ${this.selectedDayType}`;
/** */
/**TODO: resetting the date filter on filter change for now */
this.selectedDayType = 'Weeks';
this.selectedDateValue = this.dateRangeFilter?.counts?.[0];
this.selectedDateFilter = `${this.selectedDateValue} ${this.selectedDayType}`;
/** */
if (event && !event['additional_level'] && event?.length) { // && Object.keys(event[0]).length) {
// set selected projects(trends)
if (typeof this.selectedLevel === 'string' || this.selectedLevel === null) {
Expand Down Expand Up @@ -434,6 +440,12 @@ export class FilterNewComponent implements OnInit, OnDestroy {
// });
}
} else if (event && event['additional_level']) {
if (typeof this.selectedLevel === 'string' || this.selectedLevel === null) {
this.service.setSelectedTrends(event['primary_level']);
} else {
this.service.setSelectedTrends(this.selectedLevel['fullNodeDetails'])
}
this.previousFilterEvent['additional_level'] = event['additional_level'];
if (this.selectedTab.toLowerCase() !== 'developer') {
setTimeout(() => {
this.additionalFiltersArr = [];
Expand All @@ -442,10 +454,14 @@ export class FilterNewComponent implements OnInit, OnDestroy {
}
Object.keys(event['additional_level']).forEach((key) => {
if (Array.isArray(event['additional_level'][key])) {
this.handleAdditionalChange(event['additional_level'][key]);
if (event['additional_level'][key]?.length) {
this.handleAdditionalChange(event['additional_level'][key]);
}
} else {
Object.keys(event['additional_level'][key]).forEach(subKey => {
this.handleAdditionalChange(event['additional_level'][key][subKey]);
if (event['additional_level'][key][subKey]?.length) {
this.handleAdditionalChange(event['additional_level'][key][subKey]);
}
});
}
});
Expand Down Expand Up @@ -490,6 +506,7 @@ export class FilterNewComponent implements OnInit, OnDestroy {
}

handleAdditionalChange(event) {
this.previousFilterEvent['additional_level'] = event;
if (event && event?.length) {
this.service.setSprintForRnR(event[event.length - 1])
}
Expand Down Expand Up @@ -664,6 +681,9 @@ export class FilterNewComponent implements OnInit, OnDestroy {
}

compileGAData(selectedFilterArray) {
if(selectedFilterArray['additional_level']) {
selectedFilterArray = selectedFilterArray['additional_level'].level[Object.keys(selectedFilterArray['additional_level'].level)[0]];
}
const gaArray = selectedFilterArray?.map((item) => {
const catArr = ['category1', 'category2', 'category3', 'category4', 'category5', 'category6'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ export class PrimaryFilterComponent implements OnChanges, OnInit {
@ViewChild('multiSelect') multiSelect: MultiSelect;

constructor(private service: SharedService, public helperService: HelperService) {
this.service.selectedTrendsEvent.subscribe(filters => {
if (filters?.length && this.primaryFilterConfig['type'] !== 'singleSelect') {
this.selectedFilters = filters;
}
});
}

ngOnChanges(changes: SimpleChanges): void {
Expand Down
3 changes: 3 additions & 0 deletions UI/src/app/services/shared.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export class SharedService {
sprintQueryParamSubject = new BehaviorSubject<any>('');
sprintQueryParamObs = this.sprintQueryParamSubject.asObservable();
processorTraceLogs = [];
selectedTrendsEvent;

public currentIssue = new BehaviorSubject({});
public currentData = this.currentIssue.asObservable();
Expand All @@ -123,6 +124,7 @@ export class SharedService {
// For additional filters
this.populateAdditionalFilters = new EventEmitter();
this.triggerAdditionalFilters = new EventEmitter();
this.selectedTrendsEvent = new EventEmitter();
}

// for DSV
Expand Down Expand Up @@ -362,6 +364,7 @@ export class SharedService {
}
setSelectedTrends(values) {
this.selectedTrends = values;
this.selectedTrendsEvent.emit(values);
}
getSelectedTrends() {
return this.selectedTrends;
Expand Down
Loading