From 51a8f8e6c5e507d276827b8daf491f14a69380f1 Mon Sep 17 00:00:00 2001 From: "Rahul R." Date: Sat, 25 Jan 2025 12:01:51 +0530 Subject: [PATCH 1/2] refactor(package): plugin video ui --- .deploy/webapp/Dockerfile | 1 + .../employees/activity/activity.module.ts | 2 +- .../activity/layout/layout.component.ts | 2 +- package.json | 10 ++-- packages/plugins/videos-ui/.dockerignore | 20 ++++++++ packages/plugins/videos-ui/.gitignore | 6 +++ packages/plugins/videos-ui/.npmignore | 4 ++ packages/plugins/videos-ui/CHANGELOG.md | 3 ++ packages/plugins/videos-ui/README.md | 33 ++++++++++++- packages/plugins/videos-ui/package.json | 47 ++++++++++++++++++- packages/plugins/videos-ui/project.json | 2 +- .../video-download-manager.component.spec.ts | 27 +++++------ .../features/video/video.component.spec.ts | 27 +++++------ .../src/lib/features/video/video.component.ts | 2 +- .../video-detail-page.component.spec.ts | 27 +++++------ .../video-page/video-page.component.spec.ts | 27 +++++------ .../src/lib/shared/services/video.service.ts | 2 +- .../action-button-group.component.spec.ts | 27 +++++------ .../action-button.component.spec.ts | 27 +++++------ .../video-edit/video-edit.component.spec.ts | 27 +++++------ .../video-item-skeleton.component.spec.ts | 27 +++++------ .../video-item/video-item.component.spec.ts | 27 +++++------ .../video-metadata.component.html | 2 +- .../video-metadata.component.spec.ts | 27 +++++------ .../video-player/video-player.component.html | 10 ++-- .../video-player.component.spec.ts | 27 +++++------ .../ui/video-player/video-player.component.ts | 32 +++++++------ .../video-skeleton.component.spec.ts | 27 +++++------ .../videos-ui/src/lib/video-ui.module.ts | 6 +-- tsconfig.json | 2 +- 30 files changed, 306 insertions(+), 204 deletions(-) create mode 100644 packages/plugins/videos-ui/.dockerignore create mode 100644 packages/plugins/videos-ui/.gitignore create mode 100644 packages/plugins/videos-ui/.npmignore create mode 100644 packages/plugins/videos-ui/CHANGELOG.md diff --git a/.deploy/webapp/Dockerfile b/.deploy/webapp/Dockerfile index 4bd949c2bd9..253ecab249b 100644 --- a/.deploy/webapp/Dockerfile +++ b/.deploy/webapp/Dockerfile @@ -120,6 +120,7 @@ COPY --chown=node:node packages/plugins/legal-ui/package.json ./packages/plugins COPY --chown=node:node packages/plugins/maintenance-ui/package.json ./packages/plugins/maintenance-ui/ COPY --chown=node:node packages/plugins/onboarding-ui/package.json ./packages/plugins/onboarding-ui/ COPY --chown=node:node packages/plugins/public-layout-ui/package.json ./packages/plugins/public-layout-ui/ +COPY --chown=node:node packages/plugins/videos-ui/package.json ./packages/plugins/videos-ui/ COPY --chown=node:node packages/ui-core/package.json ./packages/ui-core/ COPY --chown=node:node packages/ui-config/package.json ./packages/ui-config/ COPY --chown=node:node packages/ui-auth/package.json ./packages/ui-auth/ diff --git a/apps/gauzy/src/app/pages/employees/activity/activity.module.ts b/apps/gauzy/src/app/pages/employees/activity/activity.module.ts index e23f0c1f39c..41221be9ad1 100644 --- a/apps/gauzy/src/app/pages/employees/activity/activity.module.ts +++ b/apps/gauzy/src/app/pages/employees/activity/activity.module.ts @@ -75,7 +75,7 @@ export class ActivityModule { this._pageRouteRegistryService.registerPageRoute({ location: 'time-activity', path: 'videos', - loadChildren: () => import('@gauzy/videos-ui').then((m) => m.VideoUiModule) + loadChildren: () => import('@gauzy/plugin-videos-ui').then((m) => m.VideoUiModule) }); // Register App Activity Page Routes diff --git a/apps/gauzy/src/app/pages/employees/activity/layout/layout.component.ts b/apps/gauzy/src/app/pages/employees/activity/layout/layout.component.ts index cc1983c5ebc..2fe152110b6 100644 --- a/apps/gauzy/src/app/pages/employees/activity/layout/layout.component.ts +++ b/apps/gauzy/src/app/pages/employees/activity/layout/layout.component.ts @@ -9,7 +9,7 @@ import { PageTabsetRegistryId, RouteUtil } from '@gauzy/ui-core/core'; -import { VideoService } from '@gauzy/videos-ui'; +import { VideoService } from '@gauzy/plugin-videos-ui'; @UntilDestroy({ checkProperties: true }) @Component({ diff --git a/package.json b/package.json index 486cf367086..16589fbd028 100644 --- a/package.json +++ b/package.json @@ -167,9 +167,9 @@ "build:package:plugin": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin", "build:package:plugin:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin", "build:package:plugin:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin", - "build:package:plugins:pre": "yarn run build:package:ui-core && yarn run build:package:ui-auth && yarn run build:package:plugin:onboarding-ui && yarn run build:package:plugin:legal-ui && yarn run build:package:plugin:job-search-ui && yarn run build:package:plugin:job-matching-ui && yarn run build:package:plugin:job-employee-ui && yarn run build:package:plugin:job-proposal-ui && yarn run build:package:plugin:public-layout-ui && yarn run build:package:plugin:maintenance-ui && yarn run build:integration-ui-plugins", - "build:package:plugins:pre:prod": "yarn run build:package:ui-core:prod && yarn run build:package:ui-auth:prod && yarn run build:package:plugin:onboarding-ui:prod && yarn run build:package:plugin:legal-ui:prod && yarn run build:package:plugin:job-search-ui:prod && yarn run build:package:plugin:job-matching-ui:prod && yarn run build:package:plugin:job-employee-ui:prod && yarn run build:package:plugin:job-proposal-ui:prod && yarn run build:package:plugin:public-layout-ui:prod && yarn run build:package:plugin:maintenance-ui:prod && yarn run build:integration-ui-plugins:prod", - "build:package:plugins:pre:docker": "yarn run build:package:ui-core:docker && yarn run build:package:ui-auth:docker && yarn run build:package:plugin:onboarding-ui:docker && yarn run build:package:plugin:legal-ui:docker && yarn run build:package:plugin:job-search-ui:docker && yarn run build:package:plugin:job-matching-ui:docker && yarn run build:package:plugin:job-employee-ui:docker && yarn run build:package:plugin:job-proposal-ui:docker && yarn run build:package:plugin:public-layout-ui:docker && yarn run build:package:plugin:maintenance-ui:docker && yarn run build:integration-ui-plugins:docker", + "build:package:plugins:pre": "yarn run build:package:ui-core && yarn run build:package:ui-auth && yarn run build:package:plugin:onboarding-ui && yarn run build:package:plugin:legal-ui && yarn run build:package:plugin:job-search-ui && yarn run build:package:plugin:job-matching-ui && yarn run build:package:plugin:job-employee-ui && yarn run build:package:plugin:job-proposal-ui && yarn run build:package:plugin:public-layout-ui && yarn run build:package:plugin:maintenance-ui && yarn run build:package:plugin:videos-ui && yarn run build:integration-ui-plugins", + "build:package:plugins:pre:prod": "yarn run build:package:ui-core:prod && yarn run build:package:ui-auth:prod && yarn run build:package:plugin:onboarding-ui:prod && yarn run build:package:plugin:legal-ui:prod && yarn run build:package:plugin:job-search-ui:prod && yarn run build:package:plugin:job-matching-ui:prod && yarn run build:package:plugin:job-employee-ui:prod && yarn run build:package:plugin:job-proposal-ui:prod && yarn run build:package:plugin:public-layout-ui:prod && yarn run build:package:plugin:maintenance-ui:prod && yarn run build:package:plugin:videos-ui:prod && yarn run build:integration-ui-plugins:prod", + "build:package:plugins:pre:docker": "yarn run build:package:ui-core:docker && yarn run build:package:ui-auth:docker && yarn run build:package:plugin:onboarding-ui:docker && yarn run build:package:plugin:legal-ui:docker && yarn run build:package:plugin:job-search-ui:docker && yarn run build:package:plugin:job-matching-ui:docker && yarn run build:package:plugin:job-employee-ui:docker && yarn run build:package:plugin:job-proposal-ui:docker && yarn run build:package:plugin:public-layout-ui:docker && yarn run build:package:plugin:maintenance-ui:docker && yarn run build:package:plugin:videos-ui:docker && yarn run build:integration-ui-plugins:docker", "build:package:plugins:post": "yarn run build:package:plugin:integration-jira && yarn run build:package:plugin:integration-ai && yarn run build:package:plugin:sentry && yarn run build:package:plugin:jitsu-analytic && yarn run build:package:plugin:product-reviews && yarn run build:package:plugin:job-search && yarn run build:package:plugin:job-proposal && yarn run build:package:plugin:integration-github && yarn run build:package:plugin:knowledge-base && yarn run build:package:plugin:changelog && yarn run build:package:plugin:integration-hubstaff && yarn run build:package:plugin:integration-upwork && yarn run build:package:plugin:videos", "build:package:plugins:post:prod": "yarn run build:package:plugin:integration-jira:prod && yarn run build:package:plugin:integration-ai:prod && yarn run build:package:plugin:sentry:prod && yarn run build:package:plugin:jitsu-analytic:prod && yarn run build:package:plugin:product-reviews:prod && yarn run build:package:plugin:job-search:prod && yarn run build:package:plugin:job-proposal:prod && yarn run build:package:plugin:integration-github:prod && yarn run build:package:plugin:knowledge-base:prod && yarn run build:package:plugin:changelog:prod && yarn run build:package:plugin:integration-hubstaff:prod && yarn run build:package:plugin:integration-upwork:prod && yarn run build:package:plugin:videos:prod", "build:package:plugins:post:docker": "yarn run build:package:plugin:integration-jira:docker && yarn run build:package:plugin:integration-ai:docker && yarn run build:package:plugin:sentry:docker && yarn run build:package:plugin:jitsu-analytic:docker && yarn run build:package:plugin:product-reviews:docker && yarn run build:package:plugin:job-search:docker && yarn run build:package:plugin:job-proposal:docker && yarn run build:package:plugin:integration-github:docker && yarn run build:package:plugin:knowledge-base:docker && yarn run build:package:plugin:changelog:docker && yarn run build:package:plugin:integration-hubstaff:docker && yarn run build:package:plugin:integration-upwork:docker && yarn run build:package:plugin:videos:docker", @@ -245,6 +245,9 @@ "build:package:plugin:knowledge-base": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-knowledge-base", "build:package:plugin:knowledge-base:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-knowledge-base", "build:package:plugin:knowledge-base:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-knowledge-base", + "build:package:plugin:videos-ui": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-videos-ui --configuration=development", + "build:package:plugin:videos-ui:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-videos-ui --configuration=production", + "build:package:plugin:videos-ui:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-videos-ui --configuration=production", "build:package:plugin:videos": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-videos", "build:package:plugin:videos:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn nx build plugin-videos", "build:package:plugin:videos:docker": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=60000 yarn nx build plugin-videos", @@ -382,6 +385,7 @@ "minizlib": "^2.1.2" }, "dependencies": { + "@angular-slider/ngx-slider": "^18.0.0", "@angular/animations": "18.2.12", "@angular/cdk": "18.2.14", "@angular/common": "18.2.12", diff --git a/packages/plugins/videos-ui/.dockerignore b/packages/plugins/videos-ui/.dockerignore new file mode 100644 index 00000000000..6edd0523636 --- /dev/null +++ b/packages/plugins/videos-ui/.dockerignore @@ -0,0 +1,20 @@ +docker +tmp +README.md +.env + +# git + +.git +.gitignore +.gitmodules + +# dependencies + +node_modules + +# misc + +npm-debug.log +dist +build diff --git a/packages/plugins/videos-ui/.gitignore b/packages/plugins/videos-ui/.gitignore new file mode 100644 index 00000000000..a34877c2c0e --- /dev/null +++ b/packages/plugins/videos-ui/.gitignore @@ -0,0 +1,6 @@ +# dependencies +node_modules/ + +# misc +npm-debug.log +dist \ No newline at end of file diff --git a/packages/plugins/videos-ui/.npmignore b/packages/plugins/videos-ui/.npmignore new file mode 100644 index 00000000000..1eb4beb9572 --- /dev/null +++ b/packages/plugins/videos-ui/.npmignore @@ -0,0 +1,4 @@ +# .npmignore + +src/ +node_modules/ diff --git a/packages/plugins/videos-ui/CHANGELOG.md b/packages/plugins/videos-ui/CHANGELOG.md new file mode 100644 index 00000000000..0dd18afaf65 --- /dev/null +++ b/packages/plugins/videos-ui/CHANGELOG.md @@ -0,0 +1,3 @@ +# Changelog for @gauzy/plugin-videos-ui + +## [Unreleased] diff --git a/packages/plugins/videos-ui/README.md b/packages/plugins/videos-ui/README.md index ef36afaf0fb..d30862c607a 100644 --- a/packages/plugins/videos-ui/README.md +++ b/packages/plugins/videos-ui/README.md @@ -1,7 +1,36 @@ -# videos-ui +# @gauzy/plugin-videos-ui This library was generated with [Nx](https://nx.dev). +## Overview + +The **@gauzy/plugin-videos-ui** is a UI plugin for managing and displaying videos within the Gauzy ecosystem. +It provides a seamless integration for video-related functionality, making it easy to embed, stream, and organize videos. + +## Features + +✅ **Video Upload & Management** – Easily upload and manage video content. +✅ **Angular & Nebular Integration** – Built with Angular and Nebular UI components. +✅ **Multi-language Support** – Fully compatible with `@ngx-translate/core` for translations. + +## Building + +Run `yarn nx build plugin-videos-ui` to build the library. + ## Running unit tests -Run `nx test videos-ui` to execute the unit tests. +Run `yarn nx test plugin-videos-ui` to execute the unit tests. + +## Publishing + +After building your library with `yarn nx build plugin-videos-ui`, go to the dist folder `dist/packages/plugins/videos-ui` and run `npm publish`. + +## Installation + +To install the `@gauzy/plugin-videos-ui` package, run the following command: + +```bash +npm install @gauzy/plugin-videos-ui +# or using Yarn +yarn add @gauzy/plugin-videos-ui +``` diff --git a/packages/plugins/videos-ui/package.json b/packages/plugins/videos-ui/package.json index d3651ecec83..29805375ee9 100644 --- a/packages/plugins/videos-ui/package.json +++ b/packages/plugins/videos-ui/package.json @@ -1,6 +1,28 @@ { - "name": "@gauzy/videos-ui", - "version": "0.0.1", + "name": "@gauzy/plugin-videos-ui", + "version": "0.1.0", + "description": "A UI plugin for managing and displaying videos within the Gauzy ecosystem.", + "author": { + "name": "Ever Co. LTD", + "email": "ever@ever.co", + "url": "https://ever.co" + }, + "license": "AGPL-3.0", + "repository": { + "type": "git", + "url": "https://github.com/ever-co/ever-gauzy", + "directory": "packages/plugins/videos-ui" + }, + "bugs": { + "url": "https://github.com/ever-co/ever-gauzy/issues" + }, + "homepage": "https://ever.co", + "private": true, + "scripts": { + "lib:build": "yarn nx build plugin-videos-ui --configuration=development", + "lib:build:prod": "yarn nx build plugin-videos-ui --configuration=production", + "lib:watch": "yarn nx build plugin-videos-ui --watch --configuration=development" + }, "peerDependencies": { "@angular/common": "^18.2.0", "@angular/core": "^18.2.0" @@ -18,5 +40,26 @@ "rxjs": "^7.8.0", "tslib": "^2.6.2" }, + "devDependencies": { + "@types/jest": "29.5.14", + "@types/node": "^20.14.9", + "jest-preset-angular": "14.1.1" + }, + "keywords": [ + "gauzy", + "video", + "video-management", + "video-ui", + "angular", + "ngx", + "nebular", + "plugin", + "ui-plugin", + "media" + ], + "engines": { + "node": ">=20.11.1", + "yarn": ">=1.22.19" + }, "sideEffects": false } diff --git a/packages/plugins/videos-ui/project.json b/packages/plugins/videos-ui/project.json index fb6a5aa7f70..b9222f02b1c 100644 --- a/packages/plugins/videos-ui/project.json +++ b/packages/plugins/videos-ui/project.json @@ -1,5 +1,5 @@ { - "name": "videos-ui", + "name": "plugin-videos-ui", "$schema": "../../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/plugins/videos-ui/src", "prefix": "lib", diff --git a/packages/plugins/videos-ui/src/lib/features/video-download-manager/video-download-manager.component.spec.ts b/packages/plugins/videos-ui/src/lib/features/video-download-manager/video-download-manager.component.spec.ts index 9d65c474e44..6597b827a8c 100644 --- a/packages/plugins/videos-ui/src/lib/features/video-download-manager/video-download-manager.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/features/video-download-manager/video-download-manager.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoDownloadManagerComponent } from './video-download-manager.component'; describe('VideoDownloadManagerComponent', () => { - let component: VideoDownloadManagerComponent; - let fixture: ComponentFixture; + let component: VideoDownloadManagerComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoDownloadManagerComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoDownloadManagerComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoDownloadManagerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoDownloadManagerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/features/video/video.component.spec.ts b/packages/plugins/videos-ui/src/lib/features/video/video.component.spec.ts index b9df024ef39..7e641a4930b 100644 --- a/packages/plugins/videos-ui/src/lib/features/video/video.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/features/video/video.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoComponent } from './video.component'; describe('VideoComponent', () => { - let component: VideoComponent; - let fixture: ComponentFixture; + let component: VideoComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/features/video/video.component.ts b/packages/plugins/videos-ui/src/lib/features/video/video.component.ts index e2c29f89ac4..658cdbdc7c8 100644 --- a/packages/plugins/videos-ui/src/lib/features/video/video.component.ts +++ b/packages/plugins/videos-ui/src/lib/features/video/video.component.ts @@ -2,6 +2,7 @@ import { AfterViewInit, ChangeDetectionStrategy, Component, ViewChild } from '@a import { DeleteConfirmationComponent } from '@gauzy/ui-core/shared'; import { NbDialogService } from '@nebular/theme'; import { Actions } from '@ngneat/effects-ng'; +import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { combineLatest, distinctUntilChanged, filter, map, Observable, take, tap } from 'rxjs'; import { VideoActions } from '../../+state/video.action'; import { VideoQuery } from '../../+state/video.query'; @@ -10,7 +11,6 @@ import { IVideo } from '../../shared/models/video.model'; import { VideoEditComponent } from '../../shared/ui/video-edit/video-edit.component'; import { VideoMetadataComponent } from '../../shared/ui/video-metadata/video-metadata.component'; import { VideoPlayerComponent } from '../../shared/ui/video-player/video-player.component'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; @UntilDestroy({ checkProperties: true }) @Component({ diff --git a/packages/plugins/videos-ui/src/lib/pages/video-detail-page/video-detail-page.component.spec.ts b/packages/plugins/videos-ui/src/lib/pages/video-detail-page/video-detail-page.component.spec.ts index d0b242cb9e9..152bde4cdc8 100644 --- a/packages/plugins/videos-ui/src/lib/pages/video-detail-page/video-detail-page.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/pages/video-detail-page/video-detail-page.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoDetailPageComponent } from './video-detail-page.component'; describe('VideoDetailPageComponent', () => { - let component: VideoDetailPageComponent; - let fixture: ComponentFixture; + let component: VideoDetailPageComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoDetailPageComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoDetailPageComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoDetailPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoDetailPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/pages/video-page/video-page.component.spec.ts b/packages/plugins/videos-ui/src/lib/pages/video-page/video-page.component.spec.ts index d8596a42d74..0bf716216ec 100644 --- a/packages/plugins/videos-ui/src/lib/pages/video-page/video-page.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/pages/video-page/video-page.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoPageComponent } from './video-page.component'; describe('VideoPageComponent', () => { - let component: VideoPageComponent; - let fixture: ComponentFixture; + let component: VideoPageComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoPageComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoPageComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/services/video.service.ts b/packages/plugins/videos-ui/src/lib/shared/services/video.service.ts index 817fffbfbcf..a7d105b8369 100644 --- a/packages/plugins/videos-ui/src/lib/shared/services/video.service.ts +++ b/packages/plugins/videos-ui/src/lib/shared/services/video.service.ts @@ -1,8 +1,8 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; +import { map, Observable } from 'rxjs'; import { IPagination } from '@gauzy/contracts'; import { API_PREFIX, toParams } from '@gauzy/ui-core/common'; -import { map, Observable } from 'rxjs'; import { IVideo } from '../models/video.model'; @Injectable({ diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button-group/action-button-group.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button-group/action-button-group.component.spec.ts index f1fa19c8b27..76961c0532d 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button-group/action-button-group.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button-group/action-button-group.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActionButtonGroupComponent } from './action-button-group.component'; describe('ActionButtonGroupComponent', () => { - let component: ActionButtonGroupComponent; - let fixture: ComponentFixture; + let component: ActionButtonGroupComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ActionButtonGroupComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ActionButtonGroupComponent] + }).compileComponents(); - fixture = TestBed.createComponent(ActionButtonGroupComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(ActionButtonGroupComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button/action-button.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button/action-button.component.spec.ts index ea771804cef..e61ece1acda 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button/action-button.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-actions/buttons/action-button/action-button.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ActionButtonComponent } from './action-button.component'; describe('ActionButtonComponent', () => { - let component: ActionButtonComponent; - let fixture: ComponentFixture; + let component: ActionButtonComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ActionButtonComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ActionButtonComponent] + }).compileComponents(); - fixture = TestBed.createComponent(ActionButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(ActionButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-edit/video-edit.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-edit/video-edit.component.spec.ts index 39109e35ab6..1bab498e021 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-edit/video-edit.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-edit/video-edit.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoEditComponent } from './video-edit.component'; describe('VideoEditComponent', () => { - let component: VideoEditComponent; - let fixture: ComponentFixture; + let component: VideoEditComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoEditComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoEditComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoEditComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoEditComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-item-skeleton/video-item-skeleton.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-item-skeleton/video-item-skeleton.component.spec.ts index 97ad262ceab..0e8c6d5f2ed 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-item-skeleton/video-item-skeleton.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-item-skeleton/video-item-skeleton.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoItemSkeletonComponent } from './video-item-skeleton.component'; describe('VideoItemSkeletonComponent', () => { - let component: VideoItemSkeletonComponent; - let fixture: ComponentFixture; + let component: VideoItemSkeletonComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoItemSkeletonComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoItemSkeletonComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoItemSkeletonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoItemSkeletonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-item/video-item.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-item/video-item.component.spec.ts index 89a935d8e3d..681b63c6ef7 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-item/video-item.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-item/video-item.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoItemComponent } from './video-item.component'; describe('VideoItemComponent', () => { - let component: VideoItemComponent; - let fixture: ComponentFixture; + let component: VideoItemComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoItemComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoItemComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoItemComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.html b/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.html index 47525330ccf..67641cad308 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.html +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.html @@ -14,7 +14,7 @@

{{ video.title }}

diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.spec.ts index 2cb6830ce0b..fa72b6f9247 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-metadata/video-metadata.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoMetadataComponent } from './video-metadata.component'; describe('VideoMetadataComponent', () => { - let component: VideoMetadataComponent; - let fixture: ComponentFixture; + let component: VideoMetadataComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoMetadataComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoMetadataComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoMetadataComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoMetadataComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.html b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.html index 271649b03a0..e539487db04 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.html +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.html @@ -1,9 +1,9 @@
@if(src) { - - }@else { -
No video
+ + } @else { +
No video
}
diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.spec.ts index b7cfb053f0e..d79a62fec4c 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoPlayerComponent } from './video-player.component'; describe('VideoPlayerComponent', () => { - let component: VideoPlayerComponent; - let fixture: ComponentFixture; + let component: VideoPlayerComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoPlayerComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoPlayerComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoPlayerComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoPlayerComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts index 7149f19e675..7704aabe6e5 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts @@ -1,6 +1,5 @@ import { ChangeDetectionStrategy, Component, ElementRef, Input, ViewChild } from '@angular/core'; import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; - @Component({ selector: 'plug-video-player', templateUrl: './video-player.component.html', @@ -8,24 +7,29 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser'; changeDetection: ChangeDetectionStrategy.OnPush }) export class VideoPlayerComponent { + /** + * The video source URL. + */ private _src!: string; - @ViewChild('video') - private video!: ElementRef; - @Input() - public controls = false; + public get src(): SafeUrl { + return this.sanitizer.bypassSecurityTrustUrl(this._src); + } + @Input() public set src(value: string) { + this._src = value; + } - constructor(private readonly sanitizer: DomSanitizer) {} + @Input() public controls = false; + @Input() alt: string = ''; + + // Video element + @ViewChild('video') private video!: ElementRef; + /** + * The video player element. + */ public get player(): HTMLVideoElement { return this.video.nativeElement; } - public get src(): SafeUrl { - return this.sanitizer.bypassSecurityTrustUrl(this._src); - } - - @Input() - public set src(value: string) { - this._src = value; - } + constructor(private readonly sanitizer: DomSanitizer) {} } diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-skeleton/video-skeleton.component.spec.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-skeleton/video-skeleton.component.spec.ts index 9a6406203f2..a4aad3c740c 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-skeleton/video-skeleton.component.spec.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-skeleton/video-skeleton.component.spec.ts @@ -3,21 +3,20 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { VideoSkeletonComponent } from './video-skeleton.component'; describe('VideoSkeletonComponent', () => { - let component: VideoSkeletonComponent; - let fixture: ComponentFixture; + let component: VideoSkeletonComponent; + let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [VideoSkeletonComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [VideoSkeletonComponent] + }).compileComponents(); - fixture = TestBed.createComponent(VideoSkeletonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(VideoSkeletonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); - it('should create', () => { - expect(component).toBeTruthy(); - }); + it('should create', () => { + expect(component).toBeTruthy(); + }); }); diff --git a/packages/plugins/videos-ui/src/lib/video-ui.module.ts b/packages/plugins/videos-ui/src/lib/video-ui.module.ts index a6855d1237a..0a9e184390f 100644 --- a/packages/plugins/videos-ui/src/lib/video-ui.module.ts +++ b/packages/plugins/videos-ui/src/lib/video-ui.module.ts @@ -1,7 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; -import { GauzyFiltersModule, NoDataMessageModule, SharedModule } from '@gauzy/ui-core/shared'; import { NbBadgeModule, NbButtonModule, @@ -16,6 +15,9 @@ import { NbSpinnerModule } from '@nebular/theme'; import { provideEffects, provideEffectsManager } from '@ngneat/effects-ng'; +import { TranslateModule } from '@ngx-translate/core'; +import { MomentModule } from 'ngx-moment'; +import { GauzyFiltersModule, NoDataMessageModule, SharedModule } from '@gauzy/ui-core/shared'; import { VideoEffects } from './+state/video.effect'; import { VideoQuery } from './+state/video.query'; import { VideoStore } from './+state/video.store'; @@ -38,8 +40,6 @@ import { VideoMetadataComponent } from './shared/ui/video-metadata/video-metadat import { VideoPlayerComponent } from './shared/ui/video-player/video-player.component'; import { VideoSkeletonComponent } from './shared/ui/video-skeleton/video-skeleton.component'; import { VideoUiRoutingModule } from './video-ui-routing.module'; -import { TranslateModule } from '@ngx-translate/core'; -import { MomentModule } from 'ngx-moment'; @NgModule({ declarations: [ diff --git a/tsconfig.json b/tsconfig.json index 1b6dfaf14f1..411180e66a8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -44,7 +44,7 @@ "@gauzy/plugin-public-layout-ui": ["./packages/plugins/public-layout-ui/src/index.ts"], "@gauzy/plugin-sentry": ["./packages/plugins/sentry-tracing/src/index.ts"], "@gauzy/plugin-videos": ["./packages/plugins/videos/src/index.ts"], - "@gauzy/videos-ui": ["packages/plugins/videos-ui/src/index.ts"], + "@gauzy/plugin-videos-ui": ["./packages/plugins/videos-ui/src/index.ts"], "@gauzy/ui-auth": ["./packages/ui-auth/src/index.ts"], "@gauzy/ui-config": ["./packages/ui-config/src/index.ts"], "@gauzy/ui-core": ["./packages/ui-core/src/index.ts"], From b1cadadc1550ed6e3c838d974a84555424a4939f Mon Sep 17 00:00:00 2001 From: "Rahul R." <41804588+rahul-rocket@users.noreply.github.com> Date: Sat, 25 Jan 2025 12:06:27 +0530 Subject: [PATCH 2/2] Update packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .../src/lib/shared/ui/video-player/video-player.component.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts index 7704aabe6e5..5f4927cd715 100644 --- a/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts +++ b/packages/plugins/videos-ui/src/lib/shared/ui/video-player/video-player.component.ts @@ -28,6 +28,9 @@ export class VideoPlayerComponent { * The video player element. */ public get player(): HTMLVideoElement { + if (!this.video?.nativeElement) { + throw new Error('Video element not initialized'); + } return this.video.nativeElement; }