Skip to content

Commit

Permalink
Merge pull request #642 from sipcapture/devel
Browse files Browse the repository at this point in the history
Update version
  • Loading branch information
RFbkak37y3kIY authored Jul 22, 2024
2 parents e2e053d + 7246b75 commit 3b02833
Showing 1 changed file with 33 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import { FlowItemType } from '@app/models/flow-item-type.model';
import { Functions, setStorage } from '@app/helpers/functions';
import { TransactionFilterService } from './transaction-filter.service';
import { CallIDColor } from '@app/models/CallIDColor.model';
import { AlertMessage, AlertService } from '@app/services';
import { AlertMessage, AlertService, PreferenceAdvancedService } from '@app/services';
import { lastValueFrom } from 'rxjs';

interface FilterItem {
title: string;
Expand All @@ -33,8 +34,10 @@ export interface FlowFilter {
templateUrl: './transaction-filter.component.html',
styleUrls: ['./transaction-filter.component.scss'],
})
export class TransactionFilterComponent {
export class TransactionFilterComponent implements OnInit {
flowFilters;
isAdvancedDefaultFilter = false;
filterSettings: any = {};

isSimplify = true;
isSimplifyPort = true;
Expand Down Expand Up @@ -119,18 +122,23 @@ export class TransactionFilterComponent {
/**
* PayloadType
*/

this.checkboxListFilterPayloadType = Object.entries(filters.payload)
.filter((i) => i[1])
.map((record) => {
const [typeName] = record;
return {
title: typeName,
selected:
this.getPayloadFromLocalStorage(typeName) ||
(typeName !== FlowItemType.RTCP && typeName !== FlowItemType.RTP),
this.isAdvancedDefaultFilter ?
this.getPayloadFromAdvancedSettings(typeName) :
(this.getPayloadFromLocalStorage(typeName) || (
typeName !== FlowItemType.RTCP &&
typeName !== FlowItemType.RTP
)),
};
});

console.log('checkboxListFilterPayloadType', this.checkboxListFilterPayloadType);
/**
* Call-ID
*/
Expand Down Expand Up @@ -169,10 +177,24 @@ export class TransactionFilterComponent {
@ViewChild('filterContainer', { static: false }) filterContainer: ElementRef;
constructor(
private cdr: ChangeDetectorRef,
private _pas: PreferenceAdvancedService,
private transactionFilterService: TransactionFilterService,
private alertService: AlertService
) { }
async ngOnInit() {
const advanced = await lastValueFrom(this._pas.getAll());
const filterSettings = advanced?.data?.find(i =>
i.category == 'transaction' &&
i.param == "filter"
)?.data;

this.isAdvancedDefaultFilter = !!filterSettings;
this.filterSettings = filterSettings;
console.log({
filterSettings

});
}
doFilterMessages(type: string = null) {
setTimeout(() => {
if (this.combineType === '1none') {
Expand All @@ -199,7 +221,7 @@ export class TransactionFilterComponent {
});
this.cdr.detectChanges();
}
console.log(this.checkboxListFilterPayloadType)
console.log('this.checkboxListFilterPayloadType', this.checkboxListFilterPayloadType);
if (
this.checkboxListFilterPayloadType.every(
(type) => type.selected === false
Expand Down Expand Up @@ -267,6 +289,11 @@ export class TransactionFilterComponent {
});
localStorage.removeItem(ConstValue.LOCAL_FILTER_STATE);
}
getPayloadFromAdvancedSettings(type: string = 'RTP'): boolean {

return !!this.filterSettings[type];

}
getPayloadFromLocalStorage(type: string = 'RTP') {
const defaultReturn =
type === FlowItemType.SIP || type === FlowItemType.SDP;
Expand Down

0 comments on commit 3b02833

Please sign in to comment.