From 4c65ecbe891bc90f8ef884c81045537839223b66 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 22 Mar 2022 22:01:46 -0700 Subject: [PATCH] Unify management lists with single template --- src-ui/src/app/app.module.ts | 16 ++--- .../correspondent-edit-dialog.component.html | 0 .../correspondent-edit-dialog.component.scss | 0 .../correspondent-edit-dialog.component.ts | 0 .../document-type-edit-dialog.component.html | 0 .../document-type-edit-dialog.component.scss | 0 .../document-type-edit-dialog.component.ts | 0 .../tag-edit-dialog.component.html | 0 .../tag-edit-dialog.component.scss | 0 .../tag-edit-dialog.component.ts | 0 .../common/input/tags/tags.component.ts | 2 +- .../document-detail.component.html | 8 +-- .../document-detail.component.ts | 4 +- .../document-card-large.component.html | 2 +- .../document-card-small.component.html | 2 +- .../correspondent-list.component.html | 59 ----------------- .../correspondent-list.component.ts | 37 ++++++----- .../document-type-list.component.scss | 0 .../document-type-list.component.ts | 33 +++++----- .../management-list.component.html} | 23 ++++--- .../management-list.component.scss} | 0 .../management-list.component.ts} | 63 ++++++++++++------- .../manage/tag-list/tag-list.component.html | 60 ------------------ .../manage/tag-list/tag-list.component.scss | 0 .../manage/tag-list/tag-list.component.ts | 40 +++++++----- src-ui/src/app/pipes/safehtml.pipe.ts | 13 ++++ .../pipes/{safe.pipe.ts => safeurl.pipe.ts} | 4 +- 27 files changed, 156 insertions(+), 210 deletions(-) rename src-ui/src/app/components/{manage/correspondent-list => common/edit-dialog}/correspondent-edit-dialog/correspondent-edit-dialog.component.html (100%) rename src-ui/src/app/components/{manage/correspondent-list => common/edit-dialog}/correspondent-edit-dialog/correspondent-edit-dialog.component.scss (100%) rename src-ui/src/app/components/{manage/correspondent-list => common/edit-dialog}/correspondent-edit-dialog/correspondent-edit-dialog.component.ts (100%) rename src-ui/src/app/components/{manage/document-type-list => common/edit-dialog}/document-type-edit-dialog/document-type-edit-dialog.component.html (100%) rename src-ui/src/app/components/{manage/document-type-list => common/edit-dialog}/document-type-edit-dialog/document-type-edit-dialog.component.scss (100%) rename src-ui/src/app/components/{manage/document-type-list => common/edit-dialog}/document-type-edit-dialog/document-type-edit-dialog.component.ts (100%) rename src-ui/src/app/components/{manage/tag-list => common/edit-dialog}/tag-edit-dialog/tag-edit-dialog.component.html (100%) rename src-ui/src/app/components/{manage/tag-list => common/edit-dialog}/tag-edit-dialog/tag-edit-dialog.component.scss (100%) rename src-ui/src/app/components/{manage/tag-list => common/edit-dialog}/tag-edit-dialog/tag-edit-dialog.component.ts (100%) delete mode 100644 src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html delete mode 100644 src-ui/src/app/components/manage/document-type-list/document-type-list.component.scss rename src-ui/src/app/components/manage/{document-type-list/document-type-list.component.html => management-list/management-list.component.html} (81%) rename src-ui/src/app/components/manage/{correspondent-list/correspondent-list.component.scss => management-list/management-list.component.scss} (100%) rename src-ui/src/app/components/manage/{generic-list/generic-list.component.ts => management-list/management-list.component.ts} (86%) delete mode 100644 src-ui/src/app/components/manage/tag-list/tag-list.component.html delete mode 100644 src-ui/src/app/components/manage/tag-list/tag-list.component.scss create mode 100644 src-ui/src/app/pipes/safehtml.pipe.ts rename src-ui/src/app/pipes/{safe.pipe.ts => safeurl.pipe.ts} (83%) diff --git a/src-ui/src/app/app.module.ts b/src-ui/src/app/app.module.ts index 836337fbe..eadafee89 100644 --- a/src-ui/src/app/app.module.ts +++ b/src-ui/src/app/app.module.ts @@ -13,16 +13,16 @@ import { DocumentDetailComponent } from './components/document-detail/document-d import { DashboardComponent } from './components/dashboard/dashboard.component' import { TagListComponent } from './components/manage/tag-list/tag-list.component' import { DocumentTypeListComponent } from './components/manage/document-type-list/document-type-list.component' +import { CorrespondentListComponent } from './components/manage/correspondent-list/correspondent-list.component' import { LogsComponent } from './components/manage/logs/logs.component' import { SettingsComponent } from './components/manage/settings/settings.component' import { FormsModule, ReactiveFormsModule } from '@angular/forms' import { DatePipe, registerLocaleData } from '@angular/common' import { NotFoundComponent } from './components/not-found/not-found.component' -import { CorrespondentListComponent } from './components/manage/correspondent-list/correspondent-list.component' import { ConfirmDialogComponent } from './components/common/confirm-dialog/confirm-dialog.component' -import { CorrespondentEditDialogComponent } from './components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component' -import { TagEditDialogComponent } from './components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component' -import { DocumentTypeEditDialogComponent } from './components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component' +import { CorrespondentEditDialogComponent } from './components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component' +import { TagEditDialogComponent } from './components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component' +import { DocumentTypeEditDialogComponent } from './components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component' import { TagComponent } from './components/common/tag/tag.component' import { PageHeaderComponent } from './components/common/page-header/page-header.component' import { AppFrameComponent } from './components/app-frame/app-frame.component' @@ -58,7 +58,8 @@ import { MetadataCollapseComponent } from './components/document-detail/metadata import { SelectDialogComponent } from './components/common/select-dialog/select-dialog.component' import { NgSelectModule } from '@ng-select/ng-select' import { NumberComponent } from './components/common/input/number/number.component' -import { SafePipe } from './pipes/safe.pipe' +import { SafeUrlPipe } from './pipes/safeurl.pipe' +import { SafeHtmlPipe } from './pipes/safehtml.pipe' import { CustomDatePipe } from './pipes/custom-date.pipe' import { DateComponent } from './components/common/input/date/date.component' import { ISODateTimeAdapter } from './utils/ngb-iso-date-time-adapter' @@ -112,8 +113,8 @@ registerLocaleData(localeZh) DocumentDetailComponent, DashboardComponent, TagListComponent, - CorrespondentListComponent, DocumentTypeListComponent, + CorrespondentListComponent, LogsComponent, SettingsComponent, NotFoundComponent, @@ -150,7 +151,8 @@ registerLocaleData(localeZh) MetadataCollapseComponent, SelectDialogComponent, NumberComponent, - SafePipe, + SafeUrlPipe, + SafeHtmlPipe, CustomDatePipe, DateComponent, ColorComponent, diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.html similarity index 100% rename from src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.html rename to src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.html diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.scss b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.scss similarity index 100% rename from src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.scss rename to src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.scss diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.ts similarity index 100% rename from src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.ts rename to src-ui/src/app/components/common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component.ts diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.html similarity index 100% rename from src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.html rename to src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.html diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.scss b/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.scss similarity index 100% rename from src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.scss rename to src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.scss diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.ts similarity index 100% rename from src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.ts rename to src-ui/src/app/components/common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component.ts diff --git a/src-ui/src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html similarity index 100% rename from src-ui/src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component.html rename to src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.html diff --git a/src-ui/src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component.scss b/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.scss similarity index 100% rename from src-ui/src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component.scss rename to src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.scss diff --git a/src-ui/src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.ts similarity index 100% rename from src-ui/src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component.ts rename to src-ui/src/app/components/common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component.ts diff --git a/src-ui/src/app/components/common/input/tags/tags.component.ts b/src-ui/src/app/components/common/input/tags/tags.component.ts index d1dc61544..ecc63c54c 100644 --- a/src-ui/src/app/components/common/input/tags/tags.component.ts +++ b/src-ui/src/app/components/common/input/tags/tags.component.ts @@ -1,8 +1,8 @@ import { Component, forwardRef, Input, OnInit } from '@angular/core' import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' -import { TagEditDialogComponent } from 'src/app/components/manage/tag-list/tag-edit-dialog/tag-edit-dialog.component' import { PaperlessTag } from 'src/app/data/paperless-tag' +import { TagEditDialogComponent } from '../../edit-dialog/tag-edit-dialog/tag-edit-dialog.component' import { TagService } from 'src/app/services/rest/tag.service' @Component({ diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index 5cdaf420d..d16acb164 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -142,11 +142,11 @@ - + - + @@ -166,11 +166,11 @@ - + - + diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 4d705131e..52593ced5 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -19,8 +19,8 @@ import { CorrespondentService } from 'src/app/services/rest/correspondent.servic import { DocumentTypeService } from 'src/app/services/rest/document-type.service' import { DocumentService } from 'src/app/services/rest/document.service' import { ConfirmDialogComponent } from '../common/confirm-dialog/confirm-dialog.component' -import { CorrespondentEditDialogComponent } from '../manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component' -import { DocumentTypeEditDialogComponent } from '../manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component' +import { CorrespondentEditDialogComponent } from '../common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component' +import { DocumentTypeEditDialogComponent } from '../common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component' import { PDFDocumentProxy } from 'ng2-pdf-viewer' import { ToastService } from 'src/app/services/toast.service' import { TextComponent } from '../common/input/text/text.component' diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html index 6cbc30c78..ec4b28bc1 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html @@ -51,7 +51,7 @@  View - + diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html index 9fe427795..e3c06e3f0 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html @@ -77,7 +77,7 @@ - + diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html deleted file mode 100644 index 2b0330583..000000000 --- a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - -
-
-
- - -
-
- - -
- - - - - - - - - - - - - - - - - - - - -
NameMatchingDocument countLast correspondenceActions
{{ correspondent.name }}{{ getMatching(correspondent) }}{{ correspondent.document_count }}{{ correspondent.last_correspondence | customDate }} -
- - - -
-
- -
-
{collectionSize, plural, =1 {One correspondent} other {{{collectionSize || 0}} total correspondents}}
- -
diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts index 3322d2ff0..4887f5e34 100644 --- a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts +++ b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.ts @@ -2,39 +2,48 @@ import { Component } from '@angular/core' import { NgbModal } from '@ng-bootstrap/ng-bootstrap' import { FILTER_CORRESPONDENT } from 'src/app/data/filter-rule-type' import { PaperlessCorrespondent } from 'src/app/data/paperless-correspondent' +import { CustomDatePipe } from 'src/app/pipes/custom-date.pipe' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { CorrespondentService } from 'src/app/services/rest/correspondent.service' import { ToastService } from 'src/app/services/toast.service' -import { GenericListComponent } from '../generic-list/generic-list.component' -import { CorrespondentEditDialogComponent } from './correspondent-edit-dialog/correspondent-edit-dialog.component' +import { CorrespondentEditDialogComponent } from '../../common/edit-dialog/correspondent-edit-dialog/correspondent-edit-dialog.component' +import { ManagementListComponent } from '../management-list/management-list.component' @Component({ selector: 'app-correspondent-list', - templateUrl: './correspondent-list.component.html', - styleUrls: ['./correspondent-list.component.scss'], + templateUrl: './../management-list/management-list.component.html', + styleUrls: ['./../management-list/management-list.component.scss'], + providers: [{ provide: CustomDatePipe }], }) -export class CorrespondentListComponent extends GenericListComponent { +export class CorrespondentListComponent extends ManagementListComponent { constructor( correspondentsService: CorrespondentService, modalService: NgbModal, - private list: DocumentListViewService, - toastService: ToastService + toastService: ToastService, + list: DocumentListViewService, + private datePipe: CustomDatePipe ) { super( correspondentsService, modalService, CorrespondentEditDialogComponent, - toastService + toastService, + list, + FILTER_CORRESPONDENT, + $localize`correspondent`, + [ + { + key: 'last_correspondence', + name: $localize`Last correspondence`, + valueFn: (c: PaperlessCorrespondent) => { + return this.datePipe.transform(c.last_correspondence) + }, + }, + ] ) } getDeleteMessage(object: PaperlessCorrespondent) { return $localize`Do you really want to delete the correspondent "${object.name}"?` } - - filterDocuments(object: PaperlessCorrespondent) { - this.list.quickFilter([ - { rule_type: FILTER_CORRESPONDENT, value: object.id.toString() }, - ]) - } } diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.scss b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts index 6950fb483..106194f36 100644 --- a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts +++ b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.ts @@ -5,31 +5,34 @@ import { PaperlessDocumentType } from 'src/app/data/paperless-document-type' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { DocumentTypeService } from 'src/app/services/rest/document-type.service' import { ToastService } from 'src/app/services/toast.service' -import { GenericListComponent } from '../generic-list/generic-list.component' -import { DocumentTypeEditDialogComponent } from './document-type-edit-dialog/document-type-edit-dialog.component' +import { DocumentTypeEditDialogComponent } from '../../common/edit-dialog/document-type-edit-dialog/document-type-edit-dialog.component' +import { ManagementListComponent } from '../management-list/management-list.component' @Component({ selector: 'app-document-type-list', - templateUrl: './document-type-list.component.html', - styleUrls: ['./document-type-list.component.scss'], + templateUrl: './../management-list/management-list.component.html', + styleUrls: ['./../management-list/management-list.component.scss'], }) -export class DocumentTypeListComponent extends GenericListComponent { +export class DocumentTypeListComponent extends ManagementListComponent { constructor( - service: DocumentTypeService, + documentTypeService: DocumentTypeService, modalService: NgbModal, - private list: DocumentListViewService, - toastService: ToastService + toastService: ToastService, + list: DocumentListViewService ) { - super(service, modalService, DocumentTypeEditDialogComponent, toastService) + super( + documentTypeService, + modalService, + DocumentTypeEditDialogComponent, + toastService, + list, + FILTER_DOCUMENT_TYPE, + $localize`document type`, + [] + ) } getDeleteMessage(object: PaperlessDocumentType) { return $localize`Do you really want to delete the document type "${object.name}"?` } - - filterDocuments(object: PaperlessDocumentType) { - this.list.quickFilter([ - { rule_type: FILTER_DOCUMENT_TYPE, value: object.id.toString() }, - ]) - } } diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html b/src-ui/src/app/components/manage/management-list/management-list.component.html similarity index 81% rename from src-ui/src/app/components/manage/document-type-list/document-type-list.component.html rename to src-ui/src/app/components/manage/management-list/management-list.component.html index 32a47dcd8..c9c9d60d3 100644 --- a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html +++ b/src-ui/src/app/components/manage/management-list/management-list.component.html @@ -1,4 +1,4 @@ - + @@ -19,27 +19,32 @@ Name Matching Document count + {{column.name}} Actions - - {{ document_type.name }} - {{ getMatching(document_type) }} - {{ document_type.document_count }} + + {{ object.name }} + {{ getMatching(object) }} + {{ object.document_count }} + +
+ {{ column.valueFn.call(null, object) }} +
- - - - - -
-
-
- - -
-
- - -
- - - - - - - - - - - - - - - - - - - - -
NameColorMatchingDocument countActions
{{ tag.name }}{{tag.color}}{{ getMatching(tag) }}{{ tag.document_count }} -
- - - -
-
- -
-
{collectionSize, plural, =1 {One tag} other {{{collectionSize || 0}} total tags}}
- -
diff --git a/src-ui/src/app/components/manage/tag-list/tag-list.component.scss b/src-ui/src/app/components/manage/tag-list/tag-list.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/src-ui/src/app/components/manage/tag-list/tag-list.component.ts b/src-ui/src/app/components/manage/tag-list/tag-list.component.ts index f29598bfe..01a1614bf 100644 --- a/src-ui/src/app/components/manage/tag-list/tag-list.component.ts +++ b/src-ui/src/app/components/manage/tag-list/tag-list.component.ts @@ -5,31 +5,43 @@ import { PaperlessTag } from 'src/app/data/paperless-tag' import { DocumentListViewService } from 'src/app/services/document-list-view.service' import { TagService } from 'src/app/services/rest/tag.service' import { ToastService } from 'src/app/services/toast.service' -import { GenericListComponent } from '../generic-list/generic-list.component' -import { TagEditDialogComponent } from './tag-edit-dialog/tag-edit-dialog.component' +import { TagEditDialogComponent } from '../../common/edit-dialog/tag-edit-dialog/tag-edit-dialog.component' +import { ManagementListComponent } from '../management-list/management-list.component' @Component({ selector: 'app-tag-list', - templateUrl: './tag-list.component.html', - styleUrls: ['./tag-list.component.scss'], + templateUrl: './../management-list/management-list.component.html', + styleUrls: ['./../management-list/management-list.component.scss'], }) -export class TagListComponent extends GenericListComponent { +export class TagListComponent extends ManagementListComponent { constructor( tagService: TagService, modalService: NgbModal, - private list: DocumentListViewService, - toastService: ToastService + toastService: ToastService, + list: DocumentListViewService ) { - super(tagService, modalService, TagEditDialogComponent, toastService) + super( + tagService, + modalService, + TagEditDialogComponent, + toastService, + list, + FILTER_HAS_TAGS_ALL, + $localize`tag`, + [ + { + key: 'color', + name: $localize`Color`, + rendersHtml: true, + valueFn: (t: PaperlessTag) => { + return `${t.color}` + }, + }, + ] + ) } getDeleteMessage(object: PaperlessTag) { return $localize`Do you really want to delete the tag "${object.name}"?` } - - filterDocuments(object: PaperlessTag) { - this.list.quickFilter([ - { rule_type: FILTER_HAS_TAGS_ALL, value: object.id.toString() }, - ]) - } } diff --git a/src-ui/src/app/pipes/safehtml.pipe.ts b/src-ui/src/app/pipes/safehtml.pipe.ts new file mode 100644 index 000000000..6fba1e75e --- /dev/null +++ b/src-ui/src/app/pipes/safehtml.pipe.ts @@ -0,0 +1,13 @@ +import { Pipe, PipeTransform } from '@angular/core' +import { DomSanitizer } from '@angular/platform-browser' + +@Pipe({ + name: 'safeHtml', +}) +export class SafeHtmlPipe implements PipeTransform { + constructor(private sanitizer: DomSanitizer) {} + + transform(html) { + return this.sanitizer.bypassSecurityTrustHtml(html) + } +} diff --git a/src-ui/src/app/pipes/safe.pipe.ts b/src-ui/src/app/pipes/safeurl.pipe.ts similarity index 83% rename from src-ui/src/app/pipes/safe.pipe.ts rename to src-ui/src/app/pipes/safeurl.pipe.ts index 5a3921cbb..5a7174e06 100644 --- a/src-ui/src/app/pipes/safe.pipe.ts +++ b/src-ui/src/app/pipes/safeurl.pipe.ts @@ -2,9 +2,9 @@ import { Pipe, PipeTransform } from '@angular/core' import { DomSanitizer } from '@angular/platform-browser' @Pipe({ - name: 'safe', + name: 'safeurl', }) -export class SafePipe implements PipeTransform { +export class SafeUrlPipe implements PipeTransform { constructor(private sanitizer: DomSanitizer) {} transform(url) {