Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/kaltura/kmc-ng into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
eransakal committed Jul 6, 2017
2 parents c12bcf0 + cf218a8 commit 2944106
Show file tree
Hide file tree
Showing 47 changed files with 2,695 additions and 1,216 deletions.
6 changes: 4 additions & 2 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<router-outlet></router-outlet>

<k-area-blocker [showLoader]="_isBusy" [message]="_blockerMessage">
<router-outlet></router-outlet>
</k-area-blocker>
<!--router-outlet></router-outlet-->
<p-confirmDialog header="Confirmation" [closeOnEscape]="false" width="425"></p-confirmDialog>
30 changes: 27 additions & 3 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { OnInit, Component } from '@angular/core';
import { ConfirmationService, Confirmation } from 'primeng/primeng';
import { BrowserService } from 'app-shared/kmc-shell/providers/browser.service';
import { BrowserService, AppStatus } from 'app-shared/kmc-shell/providers/browser.service';
import { AreaBlockerMessage } from '@kaltura-ng/kaltura-ui';
import { AppLocalization } from '@kaltura-ng/kaltura-common';

/*
* App Component
Expand All @@ -14,12 +16,34 @@ import { BrowserService } from 'app-shared/kmc-shell/providers/browser.service';
})
export class AppComponent implements OnInit {

constructor(private _confirmationService : ConfirmationService, private _browserService : BrowserService ) {
public _isBusy: boolean = false;
public _blockerMessage: AreaBlockerMessage = null;

constructor(private _confirmationService : ConfirmationService, private _browserService : BrowserService, private _appLocalization: AppLocalization ) {

}

ngOnInit()
{
this._browserService.registerOnShowConfirmation(this._confirmationService.confirm.bind(this._confirmationService));
this._browserService.registerOnShowConfirmation(this._confirmationService.confirm.bind(this._confirmationService));

// handle app status: busy and error messages. Allow closing error window using the 'OK' button
this._browserService.appStatus$.subscribe(
(status: AppStatus) => {
this._isBusy = status.isBusy;
if ( status.errorMessage !== null ){
this._blockerMessage = new AreaBlockerMessage({
message: status.errorMessage,
buttons: [{
label: this._appLocalization.get('app.common.ok'),
action: () => {
this._isBusy = false;
this._blockerMessage = null;
}
}]
});
}
}
);
}
}
6 changes: 4 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { Ng2Webstorage } from 'ng2-webstorage';


import { BootstrapAdapterToken, AppBootstrap, AppBootstrapConfig as AppBootstrapConfigType, KalturaCommonModule, AppStorage } from '@kaltura-ng/kaltura-common';
import { KalturaClient, KalturaClientConfiguration } from '@kaltura-ng/kaltura-client';
import { AreaBlockerModule } from '@kaltura-ng/kaltura-ui';
import { KalturaClient, KalturaClientConfiguration } from '@kaltura-ng/kaltura-client';
import { PopupWidgetModule } from '@kaltura-ng/kaltura-ui/popup-widget';

import { BrowserService, KMCShellModule } from 'app-shared/kmc-shell';
Expand Down Expand Up @@ -66,7 +67,8 @@ export function clientConfigurationFactory()
PopupWidgetModule,
routing,
TieredMenuModule,
UploadManagementModule
UploadManagementModule,
AreaBlockerModule
],
declarations: <any>[
AppComponent,
Expand Down
12 changes: 3 additions & 9 deletions src/app/components/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
<div #main>
<div #appMenu>
<div>
<div>
<div #appMenu>
<kKMCAppMenu></kKMCAppMenu>
</div>
</div>
<div>
<div>
<router-outlet></router-outlet>
</div>
</div>
<router-outlet></router-outlet>
</div>


3 changes: 3 additions & 0 deletions src/app/components/dashboard/dashboard.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:host {
width: 100%
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { TagsModule } from '@kaltura-ng/kaltura-ui/tags';
import {
TreeModule, TieredMenuModule, SharedModule, AccordionModule, ButtonModule, InputTextareaModule, PaginatorModule, InputTextModule, MenuModule, DataTableModule, DropdownModule, RadioButtonModule, MultiSelectModule, CheckboxModule, CalendarModule, SpinnerModule, ConfirmDialogModule, ConfirmationService, GrowlModule } from 'primeng/primeng';
import { TreeModule, TieredMenuModule, SharedModule, AccordionModule, ButtonModule, InputTextareaModule, PaginatorModule, InputTextModule, MenuModule, DataTableModule, DropdownModule, RadioButtonModule, MultiSelectModule, CheckboxModule, CalendarModule, SpinnerModule, ConfirmDialogModule, ConfirmationService, GrowlModule } from 'primeng/primeng';
import { KMCShellModule } from 'app-shared/kmc-shell';

import { routing } from './content-entries-app.routes';
Expand All @@ -29,6 +28,7 @@ import { EntriesComponentsList } from './entries/entries-components-list';
import { CategoriesStore } from './shared/categories-store.service';
import { EntriesRefineFiltersProvider } from './entries/entries-refine-filters/entries-refine-filters-provider.service';
import { CategoriesPrimeService } from './shared/categories-prime.service';
import { BulkSchedulingService, BulkAddTagsService, BulkRemoveTagsService, BulkAddCategoriesService, BulkChangeOwnerService } from './entries/bulk-actions/services';
import { SharedComponentsList } from './shared/shared-components-list';

@NgModule({
Expand Down Expand Up @@ -81,7 +81,12 @@ import { SharedComponentsList } from './shared/shared-components-list';
CategoriesStore,
CategoriesPrimeService,
MetadataProfileStore,
EntriesRefineFiltersProvider
EntriesRefineFiltersProvider,
BulkSchedulingService,
BulkAddTagsService,
BulkRemoveTagsService,
BulkAddCategoriesService,
BulkChangeOwnerService
],
})
export class ContentEntriesAppModule {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="kBulkActions">
<button pButton icon="kIcontrash" class="kButtonDanger kBulkDeleteBtn"></button>
<button class="kButtonDefault kBulkActionsBtn" icon="kIcondropdown_arrow_bottom" iconPos="right" pButton label="{{'applications.content.entries.bulkActions' | translate}}" (click)="menu.toggle($event)"></button>
</div>

<p-tieredMenu #menu [model]="_bulkActionsMenu" [popup]="true" [styleClass]="menu" class="kOverrideFAIcons"></p-tieredMenu>


<kPopupWidget #bulkActionsPopup [popupWidth]="_bulkWindowWidth" [popupHeight]="_bulkWindowHeight" [modal]="true">
<ng-template>
<div [ngSwitch]="_bulkAction">
<kBulkScheduling *ngSwitchCase="'setScheduling'" [parentPopupWidget]="bulkActionsPopup" (schedulingChanged)="onSchedulingChanged($event)"></kBulkScheduling>
<kBulkAddTags *ngSwitchCase="'addTags'" [parentPopupWidget]="bulkActionsPopup" (addTagsChanged)="onAddTagsChanged($event)"></kBulkAddTags>
<kBulkRemoveTags *ngSwitchCase="'removeTags'" [selectedEntries]="selectedEntries" [parentPopupWidget]="bulkActionsPopup" (removeTagsChanged)="onRemoveTagsChanged($event)"></kBulkRemoveTags>
<kCategoriesSelector *ngSwitchCase="'addToCategories'" [parentPopupWidget]="bulkActionsPopup" (valueChange)="onAddToCategoriesChanged($event)" [buttonLabel]="'applications.content.bulkActions.apply' | translate"></kCategoriesSelector>
<kBulkChangeOwner *ngSwitchCase="'changeOwner'" [parentPopupWidget]="bulkActionsPopup" (ownerChanged)="onOwnerChanged($event)"></kBulkChangeOwner>
</div>
</ng-template>
</kPopupWidget>

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.kBulkActions{
display: flex;
align-items: center;
.kBulkDeleteBtn{
margin-right: 10px;
width: 44px;
font-size: 18px;
}
.kBulkActionsBtn{
font-weight: 400;
font-size: 15px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
import { Component, Input, Output, EventEmitter, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { MenuItem } from 'primeng/primeng';
import { AppLocalization } from '@kaltura-ng/kaltura-common';
import { PopupWidgetComponent } from '@kaltura-ng/kaltura-ui/popup-widget/popup-widget.component';
import { BrowserService } from "app-shared/kmc-shell/providers/browser.service";

import { SchedulingParams } from './services'
import { BulkSchedulingService, BulkAddTagsService, BulkRemoveTagsService, BulkAddCategoriesService, EntryCategoryItem, BulkChangeOwnerService } from './services';
import { KalturaMediaEntry } from "kaltura-typescript-client/types/KalturaMediaEntry";
import { BulkActionBaseService } from "./services/bulk-action-base.service";
import { environment } from 'app-environment';
import { KalturaUser } from 'kaltura-typescript-client/types/KalturaUser';

@Component({
selector: 'kBulkActions',
templateUrl: './bulk-actions.component.html',
styleUrls: ['./bulk-actions.component.scss']
})
export class BulkActionsComponent implements OnInit, OnDestroy {

public _bulkActionsMenu: MenuItem[] = [];
public _bulkWindowWidth = 500;
public _bulkWindowHeight = 500;
public _bulkAction: string = "";

@Input() selectedEntries: KalturaMediaEntry[];

@Output() onBulkChange = new EventEmitter<{reload: boolean}>();

@ViewChild('bulkActionsPopup') public bulkActionsPopup: PopupWidgetComponent;

constructor(private _appLocalization: AppLocalization, private _browserService : BrowserService,
private _bulkSchedulingService: BulkSchedulingService,
private _bulkAddTagsService: BulkAddTagsService,
private _bulkRemoveTagsService: BulkRemoveTagsService,
private _bulkAddCategoriesService: BulkAddCategoriesService,
private _bulkChangeOwnerService: BulkChangeOwnerService) {

}

ngOnInit(){
this._bulkActionsMenu = this.getBulkActionItems();
}

ngOnDestroy(){

}

openBulkActionWindow(action: string, popupWidth: number, popupHeight: number){
this._bulkAction = action;
this._bulkWindowWidth = popupWidth;
this._bulkWindowHeight = popupHeight;
// use timeout to allow data binding of popup dimensions to update before opening the popup
setTimeout(() => {
this.bulkActionsPopup.open();
}, 0);
}

// set scheduling changes
onSchedulingChanged(schedulingParams: SchedulingParams): void{
this.executeService(this._bulkSchedulingService, schedulingParams);
}

// add tags changed
onAddTagsChanged(tags: string[]): void{
this.executeService(this._bulkAddTagsService, tags);
}

// remove tags changed
onRemoveTagsChanged(tags: string[]): void{
this.executeService(this._bulkRemoveTagsService, tags);
}

// add to categories changed
onAddToCategoriesChanged(categories: EntryCategoryItem[]): void{
this.executeService(this._bulkAddCategoriesService, categories);
}

// owner changed
onOwnerChanged(owners: KalturaUser[]): void{
if (owners && owners.length){
this.executeService(this._bulkChangeOwnerService, owners[0]);
}
}

private executeService(service: BulkActionBaseService<any>, data: any, reloadEntries: boolean = true ): void{
this._bulkAction = "";

const execute = () => {
this._browserService.setAppStatus({isBusy: true, errorMessage: null});
service.execute(this.selectedEntries, data).subscribe(
result => {
this._browserService.setAppStatus({isBusy: false, errorMessage: null});
this.onBulkChange.emit({reload: reloadEntries});
},
error => {
this._browserService.setAppStatus({isBusy: false, errorMessage: this._appLocalization.get('applications.content.bulkActions.error')});
}
);
}

if (this.selectedEntries.length > environment.modules.contentEntries.bulkActionsLimit){
this._browserService.confirm(
{
header: this._appLocalization.get('applications.content.bulkActions.note'),
message: this._appLocalization.get('applications.content.bulkActions.confirm', {"0": this.selectedEntries.length}),
accept: () => {
execute();
}
}
);
}else{
execute();
}
}

getBulkActionItems(): MenuItem[]{
return [
{ label: this._appLocalization.get('applications.content.bulkActions.setScheduling'), command: (event) => { this.openBulkActionWindow("setScheduling", 500, 500) } },
{ label: this._appLocalization.get('applications.content.bulkActions.setAccessControl'), command: (event) => { this.openBulkActionWindow("setAccessControl", 500, 500) } },
{ label: this._appLocalization.get('applications.content.bulkActions.addRemoveTags'), items: [
{ label: this._appLocalization.get('applications.content.bulkActions.addTags'), command: (event) => { this.openBulkActionWindow("addTags", 500, 500) } },
{ label: this._appLocalization.get('applications.content.bulkActions.removeTags'), command: (event) => { this.openBulkActionWindow("removeTags", 500, 500) } }]
},
{ label: this._appLocalization.get('applications.content.bulkActions.addRemoveCategories'), items: [
{ label: this._appLocalization.get('applications.content.bulkActions.addToCategories'), command: (event) => { this.openBulkActionWindow("addToCategories", 560, 586) } },
{ label: this._appLocalization.get('applications.content.bulkActions.removeFromCategories'), command: (event) => { this.openBulkActionWindow("removeFromCategories", 500, 500) } }]
},
{ label: this._appLocalization.get('applications.content.bulkActions.addToNewCategoryPlaylist'), items: [
{ label: this._appLocalization.get('applications.content.bulkActions.addToNewCategory'), command: (event) => { this.openBulkActionWindow("addToNewCategory", 500, 500) } },
{ label: this._appLocalization.get('applications.content.bulkActions.addToNewPlaylist'), command: (event) => { this.openBulkActionWindow("addToNewPlaylist", 500, 500) } }]
},
{ label: this._appLocalization.get('applications.content.bulkActions.changeOwner'), command: (event) => { this.openBulkActionWindow("changeOwner", 500, 500) } },
{ label: this._appLocalization.get('applications.content.bulkActions.download'), command: (event) => { this.openBulkActionWindow("download", 500, 500) } },
{ label: this._appLocalization.get('applications.content.bulkActions.delete'), command: (event) => { this.openBulkActionWindow("delete", 500, 500) } }
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<k-area-blocker [showLoader]="_loading" [message]="_sectionBlockerMessage">
<div class="kContent kOverrideFAIcons">
<span class="kTitle">{{'applications.content.bulkActions.addTags' | translate}}</span>
<div class="kTags">
<span class="kLabel">{{'applications.content.bulkActions.addTagsLabel' | translate}}</span>
<kAutoComplete [(ngModel)]="tags"
suggestionItemField="item"
suggestionSelectableField="isSelectable"
[multiple]="true"
[limitToSuggestions]="false"
[minLength]="3"
[suggestionsProvider]="_tagsProvider"
(completeMethod)="_searchTags($event)">
</kAutoComplete>
</div>
<div class="kFooter">
<button type="button" class="kButtonBranded" pButton label="{{'applications.content.bulkActions.apply' | translate}}" (click)="_apply()"></button>
</div>
</div>
</k-area-blocker>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@import "app-theme/_variables.scss";

.kTitle{
color: $kGrayscale1;
font-size: 24px;
font-weight: 700;
text-align: center;
border-bottom: 1px solid $kGrayscale4;
height: 78px;
line-height: 78px;
}
.kContent{
display: flex;
flex-direction: column;
height: 500px;
.kLabel{
display: block;
margin-bottom: 8px;
}
.kTags{
padding: 12px;
height: 330px;
overflow-y: auto;
overflow-x: hidden;
}
}
.kFooter{
position: absolute;
bottom: 0px;
display: flex;
width: 100%;
height: 66px;
border-top: 1px solid $kGrayscale4;
align-items: center;
justify-content: center;
}
:host /deep/ kautocomplete ul.ui-autocomplete-multiple-container.ui-inputtext{
padding: 0px;
.ui-autocomplete-input-token{
padding: 0px;
input{
height: 34px;
padding-left: 4px;
width: 472px;
}
}
}
Loading

0 comments on commit 2944106

Please sign in to comment.