From 02c01341f4dae30ec6b81fcb644952393d73c4a8 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Wed, 5 Aug 2020 00:50:07 +0200 Subject: add ng-select for templatable select options - create select-tags component to replace ngx-chips - create select-options to factorize option selection in forms - create select-channel to simplify channel selection - refactor tags validation --- .../src/app/+search/search-filters.component.html | 14 +---- .../src/app/+search/search-filters.component.scss | 2 - client/src/app/+search/search-filters.component.ts | 6 --- client/src/app/+search/search.module.ts | 4 -- .../shared/video-caption-add-modal.component.html | 10 ++-- .../shared/video-caption-add-modal.component.scss | 5 +- .../+video-edit/shared/video-edit.component.html | 59 ++++++++-------------- .../+video-edit/shared/video-edit.component.scss | 2 - .../+video-edit/shared/video-edit.component.ts | 38 +++++++++++--- .../+video-edit/shared/video-edit.module.ts | 3 -- .../video-import-torrent.component.html | 16 +++--- .../video-import-url.component.html | 16 +++--- .../video-add-components/video-send.scss | 7 +++ .../+video-edit/video-add-components/video-send.ts | 4 +- .../video-upload.component.html | 17 +++---- .../+videos/+video-edit/video-update.component.ts | 2 +- .../+videos/+video-edit/video-update.resolver.ts | 7 ++- client/src/app/helpers/utils.ts | 12 ++++- .../form-validators/video-validators.service.ts | 27 ++++++++-- .../shared-forms/select-channel.component.html | 16 ++++++ .../shared-forms/select-channel.component.ts | 51 +++++++++++++++++++ .../shared-forms/select-options.component.html | 18 +++++++ .../shared-forms/select-options.component.ts | 47 +++++++++++++++++ .../shared-forms/select-shared.component.scss | 20 ++++++++ .../shared/shared-forms/select-tags.component.html | 13 +++++ .../shared/shared-forms/select-tags.component.scss | 3 ++ .../shared/shared-forms/select-tags.component.ts | 38 ++++++++++++++ .../app/shared/shared-forms/shared-form.module.ts | 13 ++++- .../app/shared/shared-main/shared-main.module.ts | 7 ++- .../app/shared/shared-main/video/video.service.ts | 12 +++-- 30 files changed, 359 insertions(+), 130 deletions(-) create mode 100644 client/src/app/shared/shared-forms/select-channel.component.html create mode 100644 client/src/app/shared/shared-forms/select-channel.component.ts create mode 100644 client/src/app/shared/shared-forms/select-options.component.html create mode 100644 client/src/app/shared/shared-forms/select-options.component.ts create mode 100644 client/src/app/shared/shared-forms/select-shared.component.scss create mode 100644 client/src/app/shared/shared-forms/select-tags.component.html create mode 100644 client/src/app/shared/shared-forms/select-tags.component.scss create mode 100644 client/src/app/shared/shared-forms/select-tags.component.ts (limited to 'client/src/app') diff --git a/client/src/app/+search/search-filters.component.html b/client/src/app/+search/search-filters.component.html index e20aef8fb..b36b1d2ae 100644 --- a/client/src/app/+search/search-filters.component.html +++ b/client/src/app/+search/search-filters.component.html @@ -144,12 +144,7 @@ - +
@@ -157,12 +152,7 @@ - +
diff --git a/client/src/app/+search/search-filters.component.scss b/client/src/app/+search/search-filters.component.scss index a88a1c0b0..68ac6d021 100644 --- a/client/src/app/+search/search-filters.component.scss +++ b/client/src/app/+search/search-filters.component.scss @@ -65,5 +65,3 @@ input[type=submit] { display: flex; white-space: nowrap; } - -@include ng2-tags; diff --git a/client/src/app/+search/search-filters.component.ts b/client/src/app/+search/search-filters.component.ts index fc1db3258..13ad61647 100644 --- a/client/src/app/+search/search-filters.component.ts +++ b/client/src/app/+search/search-filters.component.ts @@ -1,5 +1,4 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' -import { ValidatorFn } from '@angular/forms' import { ServerService } from '@app/core' import { VideoValidatorsService } from '@app/shared/shared-forms' import { AdvancedSearch } from '@app/shared/shared-search' @@ -20,9 +19,6 @@ export class SearchFiltersComponent implements OnInit { videoLicences: VideoConstant[] = [] videoLanguages: VideoConstant[] = [] - tagValidators: ValidatorFn[] - tagValidatorsMessages: { [ name: string ]: string } - publishedDateRanges: { id: string, label: string }[] = [] sorts: { id: string, label: string }[] = [] durationRanges: { id: string, label: string }[] = [] @@ -40,8 +36,6 @@ export class SearchFiltersComponent implements OnInit { private videoValidatorsService: VideoValidatorsService, private serverService: ServerService ) { - this.tagValidators = this.videoValidatorsService.VIDEO_TAGS.VALIDATORS - this.tagValidatorsMessages = this.videoValidatorsService.VIDEO_TAGS.MESSAGES this.publishedDateRanges = [ { id: 'any_published_date', diff --git a/client/src/app/+search/search.module.ts b/client/src/app/+search/search.module.ts index ee4f07ad1..e85ae07d0 100644 --- a/client/src/app/+search/search.module.ts +++ b/client/src/app/+search/search.module.ts @@ -1,4 +1,3 @@ -import { TagInputModule } from 'ngx-chips' import { NgModule } from '@angular/core' import { SharedFormModule } from '@app/shared/shared-forms' import { SharedMainModule } from '@app/shared/shared-main' @@ -14,8 +13,6 @@ import { VideoLazyLoadResolver } from './video-lazy-load.resolver' @NgModule({ imports: [ - TagInputModule, - SearchRoutingModule, SharedMainModule, @@ -31,7 +28,6 @@ import { VideoLazyLoadResolver } from './video-lazy-load.resolver' ], exports: [ - TagInputModule, SearchComponent ], diff --git a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html index 6a9e31b5a..6a07dafa7 100644 --- a/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-caption-add-modal.component.html @@ -8,11 +8,11 @@