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

Update version #642

Merged
merged 4 commits into from
Jul 22, 2024
Merged
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
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
Loading