Skip to content

Commit

Permalink
fix(studio): support studio v7 FEV-1579
Browse files Browse the repository at this point in the history
  • Loading branch information
amirch1 committed Nov 10, 2022
1 parent 6133a30 commit a4b9c84
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 3 deletions.
4 changes: 4 additions & 0 deletions dev/tools/legacy_permissions/src/permissions_uiconf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@
<permissionGroup id="FEATURE_V3_STUDIO_PERMISSION">
<ui id="studio" showStudioV3="false"/>
</permissionGroup>
<!-- studio v7 -->
<permissionGroup id="FEATURE_V7_STUDIO_PERMISSION">
<ui id="studio" showStudioV7="false"/>
</permissionGroup>


</partnerPermissions>
Expand Down
4 changes: 3 additions & 1 deletion src/applications/studio-app/studio-app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { StudioV2Component } from './studio-v2.component';
import { StudioV3Component } from './studio-v3.component';
import { StudioV7Component } from './studio-v7.component';
import { KalturaUIModule } from '@kaltura-ng/kaltura-ui';
import { routing } from './studio-app.routes';
import { RouterModule } from '@angular/router';
Expand All @@ -14,7 +15,8 @@ import { RouterModule } from '@angular/router';
],
declarations: [
StudioV2Component,
StudioV3Component
StudioV3Component,
StudioV7Component
],
exports: [],
providers: [],
Expand Down
4 changes: 3 additions & 1 deletion src/applications/studio-app/studio-app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { Route } from '@angular/router';

import { StudioV2Component } from './studio-v2.component';
import { StudioV3Component } from './studio-v3.component';
import { StudioV7Component } from './studio-v7.component';


export const routing: Route[] = [
{ path: 'v2', component: StudioV2Component },
{ path: 'v3', component: StudioV3Component }
{ path: 'v3', component: StudioV3Component },
{ path: 'v7', component: StudioV7Component }
];
4 changes: 4 additions & 0 deletions src/applications/studio-app/studio-v7.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="kStudio">
<iframe *ngIf="studioUrl" frameborder="0" [src]="studioUrl | safe"></iframe>
</div>

10 changes: 10 additions & 0 deletions src/applications/studio-app/studio-v7.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@import "app-theme/_variables.scss";

.kStudio{
height: $contentArea;
iframe{
width: 100%;
height: 900px;
}
}

45 changes: 45 additions & 0 deletions src/applications/studio-app/studio-v7.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { AppAuthentication, BrowserService } from 'app-shared/kmc-shell';
import { AppEventsService } from 'app-shared/kmc-shared';
import { serverConfig } from 'config/server';
import { KalturaLogger } from '@kaltura-ng/kaltura-logger';
import { PlayersUpdatedEvent } from 'app-shared/kmc-shared/events';
import { KMCPermissionsService } from 'app-shared/kmc-shared/kmc-permissions';
import { StudioV7MainViewService } from 'app-shared/kmc-shared/kmc-views';

@Component({
selector: 'kStudioV7',
templateUrl: './studio-v7.component.html',
styleUrls: ['./studio-v7.component.scss']
})
export class StudioV7Component implements OnInit, OnDestroy {

public studioUrl = '';

constructor(
private _appEvents: AppEventsService, private logger: KalturaLogger,
private _studioV7MainView: StudioV7MainViewService) {
}

ngOnInit() {
if (this._studioV7MainView.viewEntered()) {
window['kmc'] = {
'preview_embed': {
'updateList': (isPlaylist: boolean) => {
this._updatePlayers(isPlaylist);
}
}
};
this.studioUrl = serverConfig.externalApps.studioV7.uri;
}
}

_updatePlayers(isPlaylist): void {
this._appEvents.publish(new PlayersUpdatedEvent(isPlaylist));
}

ngOnDestroy() {
this.studioUrl = '';
window['kmc'] = null;
}
}
25 changes: 25 additions & 0 deletions src/configuration/server-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ export interface ExternalApplications {
playerBetaVersionsMap?: string,
playerBetaConfVars?: string
};
studioV7?: {
uri: string,
html5_version: string,
html5lib: string,
playerVersionsMap?: string,
playerConfVars?: string,
playerBetaVersionsMap?: string,
playerBetaConfVars?: string
};
liveDashboard?: {
uri: string,
};
Expand Down Expand Up @@ -173,6 +182,22 @@ export const externalAppsConfigurationAdapter: ExternalAppsAdapter<ExternalAppli

return result;
},
studioV7: (configuration) => {
let result = false;

if (configuration) {
result = !!configuration.uri &&
!configuration.uri.match(/\s/g) && // not contains white spaces
!!configuration.html5_version &&
!!configuration.html5lib;

if (result) {
configuration.uri = buildBaseUri(configuration.uri);
}
}

return result;
},
liveDashboard: (configuration) => {
let result = false;

Expand Down
2 changes: 2 additions & 0 deletions src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"studioV2MenuTitle": "Universal Studio",
"studioV3PageTitle": "Studio > TV Platform Studio",
"studio3MenuTitle": "TV Platform Studio",
"studioV7PageTitle": "Studio > Studio V7",
"studio7MenuTitle": "Studio V7",
"usageDashboardPageTitle": "Usage Dashboard",
"usageDashboardMenuTitle": "Usage Dashboard",
"restorePasswordPageTitle": "Reset Password",
Expand Down
3 changes: 2 additions & 1 deletion src/shared/kmc-shared/kmc-permissions/kmc-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@ export enum KMCPermissions {
'APP_TOKEN_BASE' = 1134,
'APP_TOKEN_ADD' = 1135,
'APP_TOKEN_UPDATE' = 1136,
'APP_TOKEN_DELETE' = 1137
'APP_TOKEN_DELETE' = 1137,
'FEATURE_V7_STUDIO_PERMISSION' = 1138,
}
10 changes: 10 additions & 0 deletions src/shared/kmc-shared/kmc-views/kmc-main-views.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ContentUploadsMainViewService,
ContentBulkUploadsMainViewService,
ContentDropFoldersMainViewService,
StudioV7MainViewService,
StudioV3MainViewService,
StudioV2MainViewService,
UsageDashboardMainViewService,
Expand Down Expand Up @@ -63,6 +64,7 @@ export class KmcMainViewsService {
private _contentDropFoldersMain: ContentDropFoldersMainViewService,
private _studioV2Main: StudioV2MainViewService,
private _studioV3Main: StudioV3MainViewService,
private _studioV7Main: StudioV7MainViewService,
private _servicesDashboardMain: ServicesDashboardMainViewService,
private _analyticsMainViewService: AnalyticsMainViewService,
private _analyticsNewMainViewService: AnalyticsNewMainViewService,
Expand Down Expand Up @@ -187,6 +189,14 @@ export class KmcMainViewsService {
},
menuTitle: this._studioV3Main.getViewMetadata().menu
},
{
isAvailable: this._studioV7Main.isAvailable(),
isActiveView: (path) => this._studioV7Main.isActiveView(path),
open: () => {
this._studioV7Main.open();
},
menuTitle: this._studioV7Main.getViewMetadata().menu
}
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions src/shared/kmc-shared/kmc-views/kmc-views.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
SettingsTranscodingMainViewService,
StudioV2MainViewService,
StudioV3MainViewService,
StudioV7MainViewService,
UsageDashboardMainViewService,
KavaAppMainViewService,
AnalyticsNewMainViewService,
Expand Down Expand Up @@ -72,6 +73,7 @@ export class KmcViewsModule {
ContentCategoryViewService,
StudioV2MainViewService,
StudioV3MainViewService,
StudioV7MainViewService,
AnalyticsMainViewService,
UsageDashboardMainViewService,
LiveAnalyticsMainViewService,
Expand Down
1 change: 1 addition & 0 deletions src/shared/kmc-shared/kmc-views/main-views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './content-bulk-uploads-main-view.service';
export * from './content-drop-folders-main-view.service';
export * from './studio-v2-main-view.service';
export * from './studio-v3-main-view.service';
export * from './studio-v7-main-view.service';
export * from './usage-dashboard-main-view.service';
export * from './live-analytics-main-view.service';
export * from './admin-users-main-view.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { Injectable } from '@angular/core';
import { KMCPermissions, KMCPermissionsService } from '../../kmc-permissions';
import { KalturaLogger } from '@kaltura-ng/kaltura-logger';
import { KmcMainViewBaseService, ViewMetadata } from '../kmc-main-view-base.service';
import { Router } from '@angular/router';
import { serverConfig } from 'config/server';
import { BrowserService } from 'app-shared/kmc-shell/providers/browser.service';
import { AppLocalization } from '@kaltura-ng/mc-shared';
import { Title } from '@angular/platform-browser';
import { ContextualHelpService } from 'app-shared/kmc-shared/contextual-help/contextual-help.service';

@Injectable()
export class StudioV7MainViewService extends KmcMainViewBaseService {


constructor(logger: KalturaLogger,
browserService: BrowserService,
router: Router,
private _appPermissions: KMCPermissionsService,
private _appLocalization: AppLocalization,
titleService: Title,
contextualHelpService: ContextualHelpService) {
super(logger.subLogger('StudioV7MainViewService'), browserService, router, titleService, contextualHelpService);
}

isAvailable(): boolean {
const isViewPermitted = this._appPermissions.hasAnyPermissions([
KMCPermissions.STUDIO_BASE,
KMCPermissions.STUDIO_ADD_UICONF,
KMCPermissions.STUDIO_UPDATE_UICONF,
KMCPermissions.STUDIO_DELETE_UICONF,
KMCPermissions.STUDIO_DELETE_UICONF,
]);
const studioHtmlIsAvailable = !!serverConfig.externalApps.studioV7;
const studioHtmlIsPermitted = this._appPermissions.hasPermission(KMCPermissions.FEATURE_V7_STUDIO_PERMISSION);

this._logger.info(`handle isAvailable action by user`,
{ isViewPermitted, studioHtmlIsAvailable, studioHtmlIsPermitted });

return isViewPermitted && studioHtmlIsAvailable && studioHtmlIsPermitted;
}

getRoutePath(): string {
return 'studio/v7';
}

getViewMetadata(): ViewMetadata {
return {
viewKey: 'studio-v7',
title: this._appLocalization.get('app.titles.studioV7PageTitle'),
menu: this._appLocalization.get('app.titles.studio7MenuTitle')
};
}
}


0 comments on commit a4b9c84

Please sign in to comment.