Skip to content

Commit

Permalink
fix(content/playlists): use baseEntryList instead of playlistList act…
Browse files Browse the repository at this point in the history
…ion to support eSearch queries SUP-31434 (#1027)
  • Loading branch information
amirch1 committed Aug 30, 2022
1 parent d4e0678 commit 60b8776
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,15 @@
import { Injectable, OnDestroy } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
import { Observable } from 'rxjs';
import { throwError } from 'rxjs';
import { ISubscription } from 'rxjs/Subscription';
import { KalturaClient, KalturaPlaylistType } from 'kaltura-ngx-client';
import { PlaylistListAction } from 'kaltura-ngx-client';
import { KalturaPlaylistFilter } from 'kaltura-ngx-client';
import { KalturaFilterPager } from 'kaltura-ngx-client';
import { KalturaDetachedResponseProfile } from 'kaltura-ngx-client';
import { KalturaResponseProfileType } from 'kaltura-ngx-client';
import { PlaylistDeleteAction } from 'kaltura-ngx-client';
import { KalturaPlaylist } from 'kaltura-ngx-client';
import { BrowserService } from 'app-shared/kmc-shell/providers/browser.service';
import { DatesRangeAdapter, DatesRangeType } from '@kaltura-ng/mc-shared';
import { FiltersStoreBase, TypeAdaptersMapping } from '@kaltura-ng/mc-shared';
import { KalturaLogger } from '@kaltura-ng/kaltura-logger';
import { KalturaSearchOperatorType } from 'kaltura-ngx-client';
import { KalturaSearchOperator } from 'kaltura-ngx-client';
import { StringTypeAdapter } from '@kaltura-ng/mc-shared';
import { NumberTypeAdapter } from '@kaltura-ng/mc-shared';
import { KalturaUtils } from '@kaltura-ng/kaltura-common';
import { ContentPlaylistsMainViewService } from 'app-shared/kmc-shared/kmc-views';
import { globalConfig } from 'config/global';
import { cancelOnDestroy, tag } from '@kaltura-ng/kaltura-common';
import { AppLocalization } from '@kaltura-ng/mc-shared';
import { KalturaPlaylistListResponse } from 'kaltura-ngx-client';
import {Injectable, OnDestroy} from '@angular/core';
import {BehaviorSubject, Observable, throwError} from 'rxjs';
import {ISubscription} from 'rxjs/Subscription';
import {BaseEntryListAction, KalturaBaseEntry, KalturaBaseEntryListResponse, KalturaClient, KalturaDetachedResponseProfile, KalturaEntryType, KalturaFilterPager, KalturaPlaylist, KalturaPlaylistFilter, KalturaPlaylistType, KalturaResponseProfileType, KalturaSearchOperator, KalturaSearchOperatorType, PlaylistDeleteAction} from 'kaltura-ngx-client';
import {BrowserService} from 'app-shared/kmc-shell/providers/browser.service';
import {AppLocalization, DatesRangeAdapter, DatesRangeType, FiltersStoreBase, NumberTypeAdapter, StringTypeAdapter, TypeAdaptersMapping} from '@kaltura-ng/mc-shared';
import {KalturaLogger} from '@kaltura-ng/kaltura-logger';
import {cancelOnDestroy, KalturaUtils} from '@kaltura-ng/kaltura-common';
import {ContentPlaylistsMainViewService} from 'app-shared/kmc-shared/kmc-views';
import {globalConfig} from 'config/global';
import {PlaylistsUtilsService} from "../../playlists-utils.service";
import { map } from 'rxjs/operators';
import {map} from 'rxjs/operators';

export enum SortDirection {
Desc = -1,
Expand All @@ -43,7 +26,7 @@ export interface PlaylistsFilters {
createdAt: DatesRangeType
}

export interface ExtendedPlaylist extends KalturaPlaylist {
export interface ExtendedPlaylist extends KalturaBaseEntry {
tooltip?: string;
isRapt?: boolean;
isPath?: boolean;
Expand Down Expand Up @@ -150,21 +133,21 @@ export class PlaylistsStore extends FiltersStoreBase<PlaylistsFilters> implement
private _extendPlaylistsWithTooltipAndRapt(playlists: ExtendedPlaylist[]): ExtendedPlaylist[] {
playlists.forEach(playlist => {
const tags = playlist.tags ? playlist.tags.split(',').filter(item => !!item).map(item => item.trim()).join('\n') : null;
playlist.isRapt = this._playlistsUtilsService.isRapt(playlist);
playlist.isPath = this._playlistsUtilsService.isPath(playlist);
playlist.isManual = this._playlistsUtilsService.isManual(playlist);
playlist.isRuleBased = this._playlistsUtilsService.isRuleBased(playlist);
playlist.isRapt = this._playlistsUtilsService.isRapt(playlist as KalturaPlaylist);
playlist.isPath = this._playlistsUtilsService.isPath(playlist as KalturaPlaylist);
playlist.isManual = this._playlistsUtilsService.isManual(playlist as KalturaPlaylist);
playlist.isRuleBased = this._playlistsUtilsService.isRuleBased(playlist as KalturaPlaylist);
playlist.tooltip = tags
? this._appLocalization.get('applications.content.table.nameTooltip', [playlist.name, tags])
: playlist.name;
});
return playlists;
}
private _buildQueryRequest(): Observable<KalturaPlaylistListResponse> {
private _buildQueryRequest(): Observable<KalturaBaseEntryListResponse> {
try {

// create request items
const filter = new KalturaPlaylistFilter({});
const filter = new KalturaPlaylistFilter({typeEqual: KalturaEntryType.playlist});
let responseProfile: KalturaDetachedResponseProfile = null;
let pager: KalturaFilterPager = null;

Expand Down Expand Up @@ -217,7 +200,7 @@ export class PlaylistsStore extends FiltersStoreBase<PlaylistsFilters> implement
);
}

let result: Observable<KalturaPlaylistListResponse> = null;
let result: Observable<KalturaBaseEntryListResponse> = null;
// build the request
if (filter.adminTagsMultiLikeOr) {
// create multirequest for interactive videos list since we need to list both rapt and path
Expand All @@ -227,10 +210,10 @@ export class PlaylistsStore extends FiltersStoreBase<PlaylistsFilters> implement
pathFilter.playListTypeEqual = KalturaPlaylistType.path;

result = this._kalturaServerClient.multiRequest([
new PlaylistListAction({filter: pathFilter, pager}).setRequestOptions({
new BaseEntryListAction({filter: pathFilter, pager}).setRequestOptions({
responseProfile
}),
new PlaylistListAction({filter, pager}).setRequestOptions({
new BaseEntryListAction({filter, pager}).setRequestOptions({
responseProfile
}),
]).pipe(map(responses => {
Expand All @@ -247,7 +230,7 @@ export class PlaylistsStore extends FiltersStoreBase<PlaylistsFilters> implement
} else {
// filter without interactive videos (dates or free text search)
result = this._kalturaServerClient.request(
new PlaylistListAction({filter, pager}).setRequestOptions({
new BaseEntryListAction({filter, pager}).setRequestOptions({
responseProfile
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ViewChild
} from '@angular/core';
import {Menu} from 'primeng/menu';
import {KalturaPlaylist} from 'kaltura-ngx-client';
import {KalturaBaseEntry, KalturaPlaylist} from 'kaltura-ngx-client';
import {KalturaEntryStatus} from 'kaltura-ngx-client';
import {AppLocalization} from '@kaltura-ng/mc-shared';
import {globalConfig} from 'config/global';
Expand Down Expand Up @@ -153,7 +153,7 @@ export class PlaylistsTableComponent implements AfterViewInit, OnInit, OnDestroy
this.selectedPlaylistsChange.emit(event);
}

onActionSelected(action: string, playlist: KalturaPlaylist) {
onActionSelected(action: string, playlist: KalturaBaseEntry) {
this.actionSelected.emit({'action': action, 'playlist': playlist});
}

Expand Down

0 comments on commit 60b8776

Please sign in to comment.