From 7483c2b49b32631790772cd78968f2d639dee412 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 10 Aug 2021 17:21:17 +0300 Subject: [PATCH 1/7] remove withSort, rename column to sortByKey --- .../default-colors-screen.component.ts | 3 +-- .../dictionary-listing-screen.component.ts | 6 ++---- ...dossier-attributes-listing-screen.component.ts | 6 ++---- .../dossier-templates-listing-screen.component.ts | 9 +++------ .../file-attributes-listing-screen.component.ts | 9 +++------ .../admin/screens/trash/trash-screen.component.ts | 9 +++------ .../dossier-listing-screen.component.ts | 3 +-- .../dossier-overview-screen.component.ts | 15 +++++---------- .../table-header/table-header.component.html | 3 +-- libs/common-ui | 2 +- 10 files changed, 22 insertions(+), 43 deletions(-) diff --git a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts index d3565b06f..aff0306a4 100644 --- a/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/default-colors/default-colors-screen.component.ts @@ -30,8 +30,7 @@ export class DefaultColorsScreenComponent extends ListingComponent imp readonly tableColumnConfigs: TableColumnConfig[] = [ { label: _('default-colors-screen.table-col-names.key'), - withSort: true, - column: 'key' + sortByKey: 'key' }, { label: _('default-colors-screen.table-col-names.color'), class: 'flex-center' } ]; diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts index b8a099343..763b489b4 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.ts @@ -34,13 +34,11 @@ export class DictionaryListingScreenComponent extends ListingComponent[] = [ { label: _('dictionary-listing.table-col-names.type'), - withSort: true, - column: 'label' + sortByKey: 'label' }, { label: _('dictionary-listing.table-col-names.order-of-importance'), - withSort: true, - column: 'rank', + sortByKey: 'rank', class: 'flex-center' }, { diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts index b60c10eef..c2ead8d50 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-attributes-listing/dossier-attributes-listing-screen.component.ts @@ -25,14 +25,12 @@ export class DossierAttributesListingScreenComponent extends ListingComponent[] = [ { label: _('dossier-attributes-listing.table-col-names.label'), - withSort: true, - column: 'label' + sortByKey: 'label' }, { label: _('dossier-attributes-listing.table-col-names.placeholder') }, { label: _('dossier-attributes-listing.table-col-names.type'), - withSort: true, - column: 'type' + sortByKey: 'type' } ]; diff --git a/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts index cd890c435..abda7f33e 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/dossier-template-listing/dossier-templates-listing-screen.component.ts @@ -24,19 +24,16 @@ export class DossierTemplatesListingScreenComponent extends ListingComponent[] = [ { label: _('dossier-templates-listing.table-col-names.name'), - withSort: true, - column: 'name' + sortByKey: 'name' }, { label: _('dossier-templates-listing.table-col-names.created-by'), class: 'user-column' }, { label: _('dossier-templates-listing.table-col-names.created-on'), - withSort: true, - column: 'dateAdded' + sortByKey: 'dateAdded' }, { label: _('dossier-templates-listing.table-col-names.modified-on'), - withSort: true, - column: 'dateModified' + sortByKey: 'dateModified' } ]; diff --git a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts index 6f245c474..358e4737b 100644 --- a/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/file-attributes-listing/file-attributes-listing-screen.component.ts @@ -25,18 +25,15 @@ export class FileAttributesListingScreenComponent extends ListingComponent[] = [ { label: _('file-attributes-listing.table-col-names.name'), - withSort: true, - column: 'label' + sortByKey: 'label' }, { label: _('file-attributes-listing.table-col-names.type'), - withSort: true, - column: 'type' + sortByKey: 'type' }, { label: _('file-attributes-listing.table-col-names.read-only'), - withSort: true, - column: 'editable', + sortByKey: 'editable', class: 'flex-center' }, { label: _('file-attributes-listing.table-col-names.csv-column') }, diff --git a/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts index b10ccb54b..2e2da6bce 100644 --- a/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/trash/trash-screen.component.ts @@ -32,8 +32,7 @@ export class TrashScreenComponent extends ListingComponent impl readonly tableColumnConfigs: TableColumnConfig[] = [ { label: _('trash.table-col-names.name'), - withSort: true, - column: 'dossierName' + sortByKey: 'dossierName' }, { label: _('trash.table-col-names.owner'), @@ -41,13 +40,11 @@ export class TrashScreenComponent extends ListingComponent impl }, { label: _('trash.table-col-names.deleted-on'), - withSort: true, - column: 'softDeletedTime' + sortByKey: 'softDeletedTime' }, { label: _('trash.table-col-names.time-to-restore'), - withSort: true, - column: 'softDeletedTime' + sortByKey: 'softDeletedTime' } ]; protected readonly _primaryKey = 'dossierName'; diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts index fa94e8a2b..cae6b4656 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.ts @@ -55,8 +55,7 @@ export class DossierListingScreenComponent readonly tableColumnConfigs: TableColumnConfig[] = [ { label: _('dossier-listing.table-col-names.name'), - withSort: true, - column: 'dossierName' + sortByKey: 'dossierName' }, { label: _('dossier-listing.table-col-names.needs-work') diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts index 4338f7bc2..0b0686ebc 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.ts @@ -54,33 +54,28 @@ export class DossierOverviewScreenComponent extends ListingComponent[] = [ { label: _('dossier-overview.table-col-names.name'), - withSort: true, - column: 'filename' + sortByKey: 'filename' }, { label: _('dossier-overview.table-col-names.added-on'), - withSort: true, - column: 'added' + sortByKey: 'added' }, { label: _('dossier-overview.table-col-names.needs-work') }, { label: _('dossier-overview.table-col-names.assigned-to'), - withSort: true, class: 'user-column', - column: 'reviewerName' + sortByKey: 'reviewerName' }, { label: _('dossier-overview.table-col-names.pages'), - withSort: true, - column: 'pages' + sortByKey: 'pages' }, { label: _('dossier-overview.table-col-names.status'), - withSort: true, class: 'flex-end', - column: 'statusSort' + sortByKey: 'statusSort' } ]; collapsedDetails = false; diff --git a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html index 796907993..9f0d95c9a 100644 --- a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html +++ b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html @@ -29,12 +29,11 @@
diff --git a/libs/common-ui b/libs/common-ui index c552ed2e2..6811739c7 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit c552ed2e21d3df6fbcfe842ae85ac5a75006ab85 +Subproject commit 6811739c7967a5f9fd8bb62f2b62e47e14ce0430 From 7e66364b8805f8391da26b802ea82fc79e96a793 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 10 Aug 2021 17:55:46 +0300 Subject: [PATCH 2/7] move quick filters --- .../quick-filters.component.html | 8 ----- .../quick-filters.component.scss | 34 ------------------- .../quick-filters/quick-filters.component.ts | 14 -------- .../table-header/table-header.component.html | 2 +- .../table-header/table-header.component.ts | 2 +- .../src/app/modules/shared/shared.module.ts | 2 -- apps/red-ui/src/assets/styles/_variables.scss | 1 + libs/common-ui | 2 +- 8 files changed, 4 insertions(+), 61 deletions(-) delete mode 100644 apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.html delete mode 100644 apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.scss delete mode 100644 apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.ts diff --git a/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.html b/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.html deleted file mode 100644 index 533c9d10a..000000000 --- a/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.html +++ /dev/null @@ -1,8 +0,0 @@ -
- {{ filter.label }} -
diff --git a/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.scss b/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.scss deleted file mode 100644 index c692e2ffc..000000000 --- a/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.scss +++ /dev/null @@ -1,34 +0,0 @@ -@import '../../../../../../assets/styles/variables'; - -:host { - display: flex; - flex: 1; - justify-content: flex-end; -} - -.quick-filter { - box-sizing: border-box; - border: 1px solid $grey-5; - border-radius: 17px; - background-color: $grey-6; - padding: 0 14px; - height: 34px; - display: flex; - align-items: center; - cursor: pointer; - transition: background-color 0.2s; - - &:hover { - background-color: $white; - } - - &.active { - background-color: $white; - font-weight: 600; - border: none; - } - - &:not(:last-child) { - margin-right: 8px; - } -} diff --git a/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.ts b/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.ts deleted file mode 100644 index e94e736a6..000000000 --- a/apps/red-ui/src/app/modules/shared/components/filters/quick-filters/quick-filters.component.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { FilterService } from '@iqser/common-ui'; - -@Component({ - selector: 'redaction-quick-filters', - templateUrl: './quick-filters.component.html', - styleUrls: ['./quick-filters.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class QuickFiltersComponent { - readonly quickFilters$ = this.filterService.getFilterModels$('quickFilters'); - - constructor(readonly filterService: FilterService) {} -} diff --git a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html index 9f0d95c9a..adabeee5a 100644 --- a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html +++ b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html @@ -12,7 +12,7 @@ - + diff --git a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts index f3f4e98ba..f2eeb0d2c 100644 --- a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts +++ b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts @@ -15,7 +15,7 @@ export class TableHeaderComponent { @Input() selectionEnabled = false; @Input() bulkActions: TemplateRef; - readonly hasQuickFilters$ = this.filterService.getGroup$('quickFilters').pipe(map(filters => !!filters)); + readonly quickFilters$ = this.filterService.getFilterModels$('quickFilters').pipe(map(filters => new Set(filters))); constructor(readonly entitiesService: EntitiesService, readonly filterService: FilterService) {} } diff --git a/apps/red-ui/src/app/modules/shared/shared.module.ts b/apps/red-ui/src/app/modules/shared/shared.module.ts index 35ebd9184..b65587c85 100644 --- a/apps/red-ui/src/app/modules/shared/shared.module.ts +++ b/apps/red-ui/src/app/modules/shared/shared.module.ts @@ -27,7 +27,6 @@ import { NavigateLastDossiersScreenDirective } from './directives/navigate-last- import { DictionaryManagerComponent } from './components/dictionary-manager/dictionary-manager.component'; import { SideNavComponent } from '@shared/components/side-nav/side-nav.component'; import { MonacoEditorModule } from '@materia-ui/ngx-monaco-editor'; -import { QuickFiltersComponent } from './components/filters/quick-filters/quick-filters.component'; import { PopupFilterComponent } from '@shared/components/filters/popup-filter/popup-filter.component'; import { AssignUserDropdownComponent } from './components/assign-user-dropdown/assign-user-dropdown.component'; import { InputWithActionComponent } from '@shared/components/input-with-action/input-with-action.component'; @@ -54,7 +53,6 @@ const components = [ SelectComponent, SideNavComponent, DictionaryManagerComponent, - QuickFiltersComponent, AssignUserDropdownComponent, PageHeaderComponent, diff --git a/apps/red-ui/src/assets/styles/_variables.scss b/apps/red-ui/src/assets/styles/_variables.scss index fe3412d18..fd75a9385 100644 --- a/apps/red-ui/src/assets/styles/_variables.scss +++ b/apps/red-ui/src/assets/styles/_variables.scss @@ -35,5 +35,6 @@ $dark: $black; $btn-bg-hover: $grey-4; $btn-bg: $grey-6; +$quick-filter-border: $grey-5; $separator: rgba(226, 228, 233, 0.9); diff --git a/libs/common-ui b/libs/common-ui index 6811739c7..f0c440876 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 6811739c7967a5f9fd8bb62f2b62e47e14ce0430 +Subproject commit f0c440876402cb4f603583537eca36f9038cc6fa From c99d6cda8d0d72301c3ab832f0336fad6df539fb Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 10 Aug 2021 19:53:13 +0300 Subject: [PATCH 3/7] move table header to common lib --- .../downloads-list-screen.component.html | 4 +- .../active-fields-listing.component.html | 4 +- .../active-fields-listing.component.scss | 2 +- .../screens/audit/audit-screen.component.html | 2 +- .../default-colors-screen.component.html | 4 +- .../dictionary-listing-screen.component.html | 4 +- .../dictionary-listing-screen.component.scss | 2 +- ...r-attributes-listing-screen.component.html | 4 +- ...er-templates-listing-screen.component.html | 4 +- ...e-attributes-listing-screen.component.html | 4 +- ...e-attributes-listing-screen.component.scss | 2 +- .../screens/rules/rules-screen.component.ts | 5 +- .../screens/trash/trash-screen.component.html | 4 +- .../user-listing-screen.component.html | 4 +- .../watermark/watermark-screen.component.ts | 7 +- .../file-workload/file-workload.component.ts | 3 +- .../dossier-listing-screen.component.html | 5 +- .../dossier-listing-screen.component.ts | 2 + .../dossier-overview-screen.component.html | 4 +- .../file-preview-screen.component.ts | 3 +- .../search-screen.component.html | 5 +- .../dictionary-manager.component.ts | 3 +- .../table-header/table-header.component.html | 42 ---------- .../table-header/table-header.component.scss | 0 .../table-header/table-header.component.ts | 21 ----- .../shared/directives/sync-width.directive.ts | 76 ------------------- .../src/app/modules/shared/shared.module.ts | 12 +-- .../app/utils/custom-route-reuse.strategy.ts | 2 +- apps/red-ui/src/app/utils/debounce.ts | 14 ---- apps/red-ui/src/assets/styles/red-grid.scss | 31 -------- apps/red-ui/src/assets/styles/red-tables.scss | 5 -- apps/red-ui/src/assets/styles/red-theme.scss | 1 - libs/common-ui | 2 +- 33 files changed, 42 insertions(+), 245 deletions(-) delete mode 100644 apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.html delete mode 100644 apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.scss delete mode 100644 apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts delete mode 100644 apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts delete mode 100644 apps/red-ui/src/app/utils/debounce.ts delete mode 100644 apps/red-ui/src/assets/styles/red-grid.scss diff --git a/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.html b/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.html index 96540c481..d628bf93b 100644 --- a/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.html +++ b/apps/red-ui/src/app/components/downloads-list-screen/downloads-list-screen.component.html @@ -3,13 +3,13 @@
- + > +> div { } } -redaction-table-header::ng-deep .header-item { +iqser-table-header::ng-deep .header-item { padding: 0 24px 0 10px; box-shadow: none; border-top: 1px solid $separator; diff --git a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html index 452ba50bf..1bff06812 100644 --- a/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/audit/audit-screen.component.html @@ -86,7 +86,7 @@
-
+
- + >
diff --git a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html index 9c0be9858..8443f12e3 100644 --- a/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/admin/screens/dictionary-listing/dictionary-listing-screen.component.html @@ -20,13 +20,13 @@
- + >
- + >
-
- +
- + >
- + >
- + > diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts index b27a16217..4c333d833 100644 --- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen.component.ts @@ -5,15 +5,14 @@ import { AppStateService } from '@state/app-state.service'; import { environment } from '@environments/environment'; import { HttpClient } from '@angular/common/http'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Debounce } from '@utils/debounce'; +import { Debounce, IconButtonTypes } from '@iqser/common-ui'; import { WatermarkControllerService, WatermarkModelRes } from '@redaction/red-ui-http'; import { Toaster } from '@services/toaster.service'; import { ActivatedRoute } from '@angular/router'; import { BASE_HREF } from '../../../../tokens'; -import { stampPDFPage } from '../../../../utils/page-stamper'; +import { stampPDFPage } from '@utils/page-stamper'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { LoadingService } from '../../../../services/loading.service'; -import { IconButtonTypes } from '@iqser/common-ui'; +import { LoadingService } from '@services/loading.service'; export const DEFAULT_WATERMARK: WatermarkModelRes = { text: null, diff --git a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts index 022589698..205030f39 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-workload/file-workload.component.ts @@ -15,12 +15,11 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper'; import { AnnotationProcessingService } from '../../services/annotation-processing.service'; import { MatDialogRef, MatDialogState } from '@angular/material/dialog'; import scrollIntoView from 'scroll-into-view-if-needed'; -import { Debounce } from '@utils/debounce'; +import { CircleButtonTypes, Debounce, IconButtonTypes, NestedFilter } from '@iqser/common-ui'; import { FileDataModel } from '@models/file/file-data.model'; import { CommentsComponent } from '../comments/comments.component'; import { PermissionsService } from '@services/permissions.service'; import { WebViewerInstance } from '@pdftron/webviewer'; -import { CircleButtonTypes, IconButtonTypes, NestedFilter } from '@iqser/common-ui'; const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape']; const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown']; diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.html index 96b57646e..cdd63b498 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-listing-screen/dossier-listing-screen.component.html @@ -8,10 +8,7 @@
- + ; @ViewChild(CdkVirtualScrollViewport) diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html index 0aa509fea..cb1c6c5be 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html @@ -36,12 +36,12 @@
- + >
- + - - - - {{ tableHeaderLabel | translate: { length: (entitiesService.displayedLength$ | async) } }} - - - - - - - - -
- -
-
- - - -
- -
-
diff --git a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.scss b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts b/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts deleted file mode 100644 index f2eeb0d2c..000000000 --- a/apps/red-ui/src/app/modules/shared/components/table-header/table-header.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core'; -import { EntitiesService, FilterService, Required, TableColumnConfig } from '@iqser/common-ui'; -import { map } from 'rxjs/operators'; - -@Component({ - selector: 'redaction-table-header', - templateUrl: './table-header.component.html', - styleUrls: ['./table-header.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class TableHeaderComponent { - @Input() @Required() tableHeaderLabel: string; - @Input() @Required() tableColumnConfigs: TableColumnConfig[]; - @Input() hasEmptyColumn = false; - @Input() selectionEnabled = false; - @Input() bulkActions: TemplateRef; - - readonly quickFilters$ = this.filterService.getFilterModels$('quickFilters').pipe(map(filters => new Set(filters))); - - constructor(readonly entitiesService: EntitiesService, readonly filterService: FilterService) {} -} diff --git a/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts b/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts deleted file mode 100644 index dcf09fafc..000000000 --- a/apps/red-ui/src/app/modules/shared/directives/sync-width.directive.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { AfterViewInit, Directive, ElementRef, HostListener, Input, OnDestroy } from '@angular/core'; -import { Debounce } from '@utils/debounce'; - -@Directive({ - selector: '[redactionSyncWidth]', - exportAs: 'redactionSyncWidth' -}) -export class SyncWidthDirective implements AfterViewInit, OnDestroy { - @Input() - redactionSyncWidth: string; - private _interval: number; - - constructor(private readonly _elementRef: ElementRef) {} - - ngAfterViewInit(): void { - this._interval = setInterval(() => { - this.matchWidth(); - }, 1000); - } - - ngOnDestroy(): void { - clearInterval(this._interval); - } - - @Debounce(10) - matchWidth() { - const headerItems = this._elementRef.nativeElement.children; - const tableRows = this._elementRef.nativeElement.parentElement.parentElement.getElementsByClassName(this.redactionSyncWidth); - - if (!tableRows || !tableRows.length) { - return; - } - - this._elementRef.nativeElement.setAttribute('synced', true); - - const { tableRow, length } = this._sampleRow(tableRows); - - const hasExtraColumns = headerItems.length !== length ? 1 : 0; - - for (let idx = 0; idx < length - hasExtraColumns - 1; ++idx) { - if (headerItems[idx]) { - headerItems[idx].style.width = `${tableRow.children[idx].getBoundingClientRect().width}px`; - headerItems[idx].style.minWidth = `${tableRow.children[idx].getBoundingClientRect().width}px`; - } - } - - for (let idx = length - hasExtraColumns - 1; idx < headerItems.length; ++idx) { - if (headerItems[idx]) { - headerItems[idx].style.minWidth = `0`; - } - } - } - - @HostListener('window:resize') - onResize() { - this.matchWidth(); - } - - private _sampleRow(tableRows: HTMLCollectionOf): { - tableRow: Element; - length: number; - } { - let length = 0; - let tableRow: Element; - - for (let idx = 0; idx < tableRows.length; ++idx) { - const row = tableRows.item(idx); - if (row.children.length > length) { - length = row.children.length; - tableRow = row; - } - } - - return { tableRow, length }; - } -} diff --git a/apps/red-ui/src/app/modules/shared/shared.module.ts b/apps/red-ui/src/app/modules/shared/shared.module.ts index b65587c85..44c41e7ee 100644 --- a/apps/red-ui/src/app/modules/shared/shared.module.ts +++ b/apps/red-ui/src/app/modules/shared/shared.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FullPageLoadingIndicatorComponent } from './components/full-page-loading-indicator/full-page-loading-indicator.component'; -import { TranslateModule } from '@ngx-translate/core'; import { InitialsAvatarComponent } from './components/initials-avatar/initials-avatar.component'; import { ScrollingModule } from '@angular/cdk/scrolling'; import { PaginationComponent } from './components/pagination/pagination.component'; @@ -13,7 +12,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AnnotationIconComponent } from './components/annotation-icon/annotation-icon.component'; import { SimpleDoughnutChartComponent } from './components/simple-doughnut-chart/simple-doughnut-chart.component'; import { StatusBarComponent } from './components/status-bar/status-bar.component'; -import { SyncWidthDirective } from './directives/sync-width.directive'; import { HasScrollbarDirective } from './directives/has-scrollbar.directive'; import { DictionaryAnnotationIconComponent } from './components/dictionary-annotation-icon/dictionary-annotation-icon.component'; import { HiddenActionComponent } from './components/hidden-action/hidden-action.component'; @@ -32,14 +30,12 @@ import { AssignUserDropdownComponent } from './components/assign-user-dropdown/a import { InputWithActionComponent } from '@shared/components/input-with-action/input-with-action.component'; import { PageHeaderComponent } from './components/page-header/page-header.component'; import { DatePipe } from '@shared/pipes/date.pipe'; -import { TableHeaderComponent } from './components/table-header/table-header.component'; const buttons = [FileDownloadBtnComponent, UserButtonComponent]; const components = [ FullPageLoadingIndicatorComponent, InitialsAvatarComponent, - TableHeaderComponent, PaginationComponent, InputWithActionComponent, AnnotationIconComponent, @@ -59,14 +55,14 @@ const components = [ ...buttons ]; -const utils = [DatePipe, SyncWidthDirective, HasScrollbarDirective, NavigateLastDossiersScreenDirective]; +const utils = [DatePipe, HasScrollbarDirective, NavigateLastDossiersScreenDirective]; -const modules = [MatConfigModule, TranslateModule, ScrollingModule, IconsModule, FormsModule, ReactiveFormsModule, CommonUiModule]; +const modules = [MatConfigModule, ScrollingModule, IconsModule, FormsModule, ReactiveFormsModule, CommonUiModule]; @NgModule({ - declarations: [...components, ...utils, TableHeaderComponent], + declarations: [...components, ...utils], imports: [CommonModule, ...modules, MonacoEditorModule], - exports: [...modules, ...components, ...utils, TableHeaderComponent], + exports: [...modules, ...components, ...utils], providers: [ { provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] }, { diff --git a/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts b/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts index cfc0e50be..cde02a2eb 100644 --- a/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts +++ b/apps/red-ui/src/app/utils/custom-route-reuse.strategy.ts @@ -1,5 +1,5 @@ import { ActivatedRouteSnapshot, DetachedRouteHandle, RouteReuseStrategy } from '@angular/router'; -import { Debounce } from './debounce'; +import { Debounce } from '@iqser/common-ui'; export interface OnAttach { ngOnAttach(previousRoute: ActivatedRouteSnapshot); diff --git a/apps/red-ui/src/app/utils/debounce.ts b/apps/red-ui/src/app/utils/debounce.ts deleted file mode 100644 index 47fd1a269..000000000 --- a/apps/red-ui/src/app/utils/debounce.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function Debounce(delay: number = 300): MethodDecorator { - return function (target: any, propertyKey: string, descriptor: PropertyDescriptor) { - let timeout = null; - - const original = descriptor.value; - - descriptor.value = function (...args) { - clearTimeout(timeout); - timeout = setTimeout(() => original.apply(this, args), delay); - }; - - return descriptor; - }; -} diff --git a/apps/red-ui/src/assets/styles/red-grid.scss b/apps/red-ui/src/assets/styles/red-grid.scss deleted file mode 100644 index 72e1b083c..000000000 --- a/apps/red-ui/src/assets/styles/red-grid.scss +++ /dev/null @@ -1,31 +0,0 @@ -@import 'variables'; -@import 'red-mixins'; - -.header-item { - background-color: $grey-6; - height: 50px; - padding: 0 24px; - display: flex; - align-items: center; - z-index: 1; - border-bottom: 1px solid $separator; - box-sizing: border-box; - - > *:not(:last-child) { - margin-right: 10px; - } - - .actions { - display: flex; - align-items: center; - justify-content: flex-end; - - > *:not(:last-child) { - margin-right: 16px; - } - } - - &.selection-enabled { - padding-left: 10px; - } -} diff --git a/apps/red-ui/src/assets/styles/red-tables.scss b/apps/red-ui/src/assets/styles/red-tables.scss index c745443f2..2b5122101 100644 --- a/apps/red-ui/src/assets/styles/red-tables.scss +++ b/apps/red-ui/src/assets/styles/red-tables.scss @@ -123,8 +123,3 @@ cdk-virtual-scroll-viewport { } } } - -.scrollbar-placeholder { - width: 11px; - padding: 0 !important; -} diff --git a/apps/red-ui/src/assets/styles/red-theme.scss b/apps/red-ui/src/assets/styles/red-theme.scss index 1e411145a..d55ffb091 100644 --- a/apps/red-ui/src/assets/styles/red-theme.scss +++ b/apps/red-ui/src/assets/styles/red-theme.scss @@ -18,7 +18,6 @@ @import 'red-controls'; @import 'red-toasts'; @import 'red-tooltips'; -@import 'red-grid'; @import 'red-breadcrumbs'; @import 'red-editor'; @import 'red-slider'; diff --git a/libs/common-ui b/libs/common-ui index f0c440876..7e9b28a10 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit f0c440876402cb4f603583537eca36f9038cc6fa +Subproject commit 7e9b28a10c7b226dcab54354c6e7f1d8ccebc0c6 From fbc32d7e23c682ce66d2e7e21908548ee46b3131 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 10 Aug 2021 21:09:50 +0300 Subject: [PATCH 4/7] move status bar to common lib --- .../dossier-listing-actions.component.html | 2 +- .../dossier-listing-actions.component.ts | 17 ++- .../file-actions/file-actions.component.html | 19 +-- .../file-actions/file-actions.component.scss | 2 +- .../file-actions/file-actions.component.ts | 122 +++++++++--------- .../dossier-overview-screen.component.html | 6 +- .../file-preview-screen.component.html | 2 +- .../search-screen.component.html | 6 +- .../simple-doughnut-chart.component.html | 6 +- .../status-bar/status-bar.component.html | 11 -- .../status-bar/status-bar.component.scss | 46 ------- .../status-bar/status-bar.component.ts | 22 ---- .../src/app/modules/shared/shared.module.ts | 2 - .../src/app/services/permissions.service.ts | 2 +- libs/common-ui | 2 +- 15 files changed, 92 insertions(+), 175 deletions(-) delete mode 100644 apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.html delete mode 100644 apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.scss delete mode 100644 apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts diff --git a/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.html index 71b1d646d..caff3a7ed 100644 --- a/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/dossier-listing-actions/dossier-listing-actions.component.html @@ -1,4 +1,4 @@ - +
(); + statusBarConfig: readonly StatusBarConfig[]; + constructor( readonly permissionsService: PermissionsService, readonly appStateService: AppStateService, @@ -26,6 +29,10 @@ export class DossierListingActionsComponent { private readonly _userService: UserService ) {} + ngOnInit() { + this.statusBarConfig = this._getStatusConfig(this.dossier.files); + } + openEditDossierDialog($event: MouseEvent, dossierWrapper: DossierWrapper) { this._dialogService.openDialog('editDossier', $event, { dossierWrapper, @@ -40,8 +47,8 @@ export class DossierListingActionsComponent { }); } - getDossierStatusConfig(dw: DossierWrapper) { - const obj = dw.files.reduce((acc, file) => { + private _getStatusConfig(files: readonly FileStatusWrapper[]) { + const obj = files.reduce((acc, file) => { const status = file.status; if (!acc[status]) { acc[status] = 1; diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html index 5e450dc3e..f0051f62e 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.html @@ -1,6 +1,6 @@
- +
@@ -9,10 +9,9 @@
- @@ -88,14 +87,10 @@ @@ -147,7 +142,7 @@ (click)="$event.stopPropagation()" [checked]="!fileStatus?.isExcluded" [class.mr-24]="screen === 'dossier-overview'" - [disabled]="!permissionsService.canToggleAnalysis(fileStatus)" + [disabled]="!canToggleAnalysis" [matTooltipPosition]="tooltipPosition" [matTooltip]="toggleTooltip | translate" color="primary" diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss index d98d4d2d1..600b5345d 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.scss @@ -17,7 +17,7 @@ font-weight: bold; } -redaction-status-bar { +iqser-status-bar { margin-left: 2px; } diff --git a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts index 7e1657a6b..135159bb0 100644 --- a/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier/components/file-actions/file-actions.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { PermissionsService } from '@services/permissions.service'; import { FileStatusWrapper } from '@models/file/file-status.wrapper'; import { AppStateService } from '@state/app-state.service'; @@ -6,18 +6,18 @@ import { FileActionService } from '../../services/file-action.service'; import { DossiersDialogService } from '../../services/dossiers-dialog.service'; import { ConfirmationDialogInput } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component'; import { LoadingService } from '@services/loading.service'; -import { FileManagementControllerService } from '@redaction/red-ui-http'; -import { TranslateService } from '@ngx-translate/core'; +import { FileManagementControllerService, FileStatus } from '@redaction/red-ui-http'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; -import { CircleButtonTypes } from '@iqser/common-ui'; +import { AutoUnsubscribe, CircleButtonType, CircleButtonTypes, StatusBarConfig } from '@iqser/common-ui'; import { UserService } from '@services/user.service'; +import { filter } from 'rxjs/operators'; @Component({ selector: 'redaction-file-actions', templateUrl: './file-actions.component.html', styleUrls: ['./file-actions.component.scss'] }) -export class FileActionsComponent implements OnInit { +export class FileActionsComponent extends AutoUnsubscribe implements OnInit, OnDestroy { readonly circleButtonTypes = CircleButtonTypes; readonly currentUser = this._userService.currentUser; @@ -27,6 +27,24 @@ export class FileActionsComponent implements OnInit { @Output() actionPerformed = new EventEmitter(); screen: 'file-preview' | 'dossier-overview'; + statusBarConfig?: readonly StatusBarConfig[]; + tooltipPosition?: 'below' | 'above'; + toggleTooltip?: string; + assignTooltip?: string; + buttonType?: CircleButtonType; + isWorkable: boolean; + + canUndoApproval: boolean; + canAssignToSelf: boolean; + canAssign: boolean; + canDelete: boolean; + canReanalyse: boolean; + canOcr: boolean; + canSetToUnderReview: boolean; + canSetToUnderApproval: boolean; + canApprove: boolean; + readyForApproval: boolean; + canToggleAnalysis: boolean; constructor( readonly permissionsService: PermissionsService, @@ -35,23 +53,12 @@ export class FileActionsComponent implements OnInit { private readonly _fileActionService: FileActionService, private readonly _loadingService: LoadingService, private readonly _fileManagementControllerService: FileManagementControllerService, - private readonly _translateService: TranslateService, private readonly _userService: UserService - ) {} - - get statusBarConfig() { - return [{ color: this.fileStatus.status, length: 1 }]; + ) { + super(); } - get tooltipPosition() { - return this.screen === 'file-preview' ? 'below' : 'above'; - } - - get buttonType() { - return this.screen === 'file-preview' ? CircleButtonTypes.default : CircleButtonTypes.dark; - } - - get toggleTooltip(): string { + private get _toggleTooltip(): string { if (!this.currentUser.isManager) { return _('file-preview.toggle-analysis.only-managers'); } @@ -59,57 +66,46 @@ export class FileActionsComponent implements OnInit { return this.fileStatus?.isExcluded ? _('file-preview.toggle-analysis.enable') : _('file-preview.toggle-analysis.disable'); } - get canAssignToSelf() { - return this.permissionsService.canAssignToSelf(this.fileStatus); - } + private _setup() { + this.statusBarConfig = [{ color: this.fileStatus.status, length: 1 }]; + this.tooltipPosition = this.screen === 'file-preview' ? 'below' : 'above'; + this.assignTooltip = this.fileStatus.isUnderApproval + ? _('dossier-overview.assign-approver') + : _('dossier-overview.assign-reviewer'); + this.buttonType = this.screen === 'file-preview' ? CircleButtonTypes.default : CircleButtonTypes.dark; + this.isWorkable = this.fileStatus.isWorkable; + this.toggleTooltip = this._toggleTooltip; - get canAssign() { - return this.permissionsService.canAssignUser(this.fileStatus); - } - - get canDelete() { - return this.permissionsService.canDeleteFile(this.fileStatus); - } - - get canReanalyse() { - return this.permissionsService.canReanalyseFile(this.fileStatus); - } - - get canOcr() { - return this.permissionsService.canOcrFile(this.fileStatus); - } - - get canSetToUnderReview() { - return this.permissionsService.canSetUnderReview(this.fileStatus); - } - - get canSetToUnderApproval() { - return this.permissionsService.canSetUnderApproval(this.fileStatus); - } - - get canUndoApproval() { - return this.permissionsService.canUndoApproval(this.fileStatus); - } - - get assignTooltip() { - return this.fileStatus.isUnderApproval - ? this._translateService.instant('dossier-overview.assign-approver') - : this._translateService.instant('dossier-overview.assign-reviewer'); + this.canUndoApproval = this.permissionsService.canUndoApproval(this.fileStatus); + this.canAssignToSelf = this.permissionsService.canAssignToSelf(this.fileStatus); + this.canAssign = this.permissionsService.canAssignUser(this.fileStatus); + this.canDelete = this.permissionsService.canDeleteFile(this.fileStatus); + this.canReanalyse = this.permissionsService.canReanalyseFile(this.fileStatus); + this.canOcr = this.permissionsService.canOcrFile(this.fileStatus); + this.canSetToUnderReview = this.permissionsService.canSetUnderReview(this.fileStatus); + this.canSetToUnderApproval = this.permissionsService.canSetUnderApproval(this.fileStatus); + this.canApprove = this.permissionsService.canApprove(this.fileStatus); + this.readyForApproval = this.permissionsService.isReadyForApproval(this.fileStatus); + this.canToggleAnalysis = this.permissionsService.canToggleAnalysis(this.fileStatus); } ngOnInit(): void { if (this.fileStatus) { this.screen = 'dossier-overview'; + this._setup(); return; } this.fileStatus = this.appStateService.activeFile; this.screen = 'file-preview'; - this.appStateService.fileChanged.subscribe(fileStatus => { - if (fileStatus.fileId === this.fileStatus?.fileId) { - this.fileStatus = this.appStateService.activeFile; - } - }); + this._setup(); + + this.addSubscription = this.appStateService.fileChanged + .pipe(filter(file => file.fileId === this.fileStatus?.fileId)) + .subscribe(fileStatus => { + this.fileStatus = fileStatus; + this._setup(); + }); } toggleViewDocumentInfo() { @@ -156,7 +152,7 @@ export class FileActionsComponent implements OnInit { reanalyseFile($event: MouseEvent) { $event.stopPropagation(); - this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => { + this.addSubscription = this._fileActionService.reanalyseFile(this.fileStatus).subscribe(() => { this.reloadDossiers('reanalyse'); }); } @@ -171,7 +167,7 @@ export class FileActionsComponent implements OnInit { true ); } else { - this._fileActionService.setFileUnderApproval(this.fileStatus).subscribe(() => { + this.addSubscription = this._fileActionService.setFileUnderApproval(this.fileStatus).subscribe(() => { this.reloadDossiers('set-under-approval'); }); } @@ -179,14 +175,14 @@ export class FileActionsComponent implements OnInit { setFileApproved($event: MouseEvent) { $event.stopPropagation(); - this._fileActionService.setFileApproved(this.fileStatus).subscribe(() => { + this.addSubscription = this._fileActionService.setFileApproved(this.fileStatus).subscribe(() => { this.reloadDossiers('set-approved'); }); } ocrFile($event: MouseEvent) { $event.stopPropagation(); - this._fileActionService.ocrFile(this.fileStatus).subscribe(() => { + this.addSubscription = this._fileActionService.ocrFile(this.fileStatus).subscribe(() => { this.reloadDossiers('ocr-file'); }); } diff --git a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html index cb1c6c5be..06ac1f075 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/dossier-overview-screen/dossier-overview-screen.component.html @@ -147,15 +147,15 @@ class="small-label loading" translate="dossier-overview.file-listing.file-entry.file-processing" >
- + > - +
{{ translations[status] | translate }} diff --git a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html index c646b14e8..ba1fc56ce 100644 --- a/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html +++ b/apps/red-ui/src/app/modules/dossier/screens/search-screen/search-screen.component.html @@ -59,8 +59,8 @@
- + >
diff --git a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html index 09e4aa6af..5c0ed8df1 100644 --- a/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html +++ b/apps/red-ui/src/app/modules/shared/components/simple-doughnut-chart/simple-doughnut-chart.component.html @@ -30,8 +30,8 @@ [class.active]="filterChecked$(val.key) | async" [class.filter-disabled]="(statusFilters$ | async)?.length === 0" > - - +
diff --git a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.html b/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.html deleted file mode 100644 index e06bd34f9..000000000 --- a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
-
-
-
{{ rect.label }}
-
-
diff --git a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.scss b/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.scss deleted file mode 100644 index dbb1e1e5f..000000000 --- a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.scss +++ /dev/null @@ -1,46 +0,0 @@ -@import '../../../../../assets/styles/variables'; - -.rectangle-container { - flex: 1; - display: flex; - width: 100%; - min-width: 12px; - - &.small { - .rectangle { - width: 12px; - min-width: 12px; - } - - .section-wrapper { - display: flex; - align-items: center; - - > *:not(:last-child) { - margin-right: 10px; - } - } - } - - .section-wrapper:first-child { - .rectangle { - border-radius: 6px 0 0 6px; - } - } - - .section-wrapper:last-child { - .rectangle { - border-radius: 0 6px 6px 0; - } - - &:first-child { - .rectangle { - border-radius: 6px; - } - } - } - - .rectangle { - height: 6px; - } -} diff --git a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts b/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts deleted file mode 100644 index 1d4b36646..000000000 --- a/apps/red-ui/src/app/modules/shared/components/status-bar/status-bar.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ChangeDetectionStrategy, Component, Input, ViewEncapsulation } from '@angular/core'; -import { Color } from '@utils/types'; - -@Component({ - selector: 'redaction-status-bar', - templateUrl: './status-bar.component.html', - styleUrls: ['./status-bar.component.scss'], - encapsulation: ViewEncapsulation.None, - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class StatusBarComponent { - @Input() - config: { - length: number; - color: Color; - label?: string; - cssClass?: string; - }[] = []; - - @Input() - small = false; -} diff --git a/apps/red-ui/src/app/modules/shared/shared.module.ts b/apps/red-ui/src/app/modules/shared/shared.module.ts index 44c41e7ee..49a35194f 100644 --- a/apps/red-ui/src/app/modules/shared/shared.module.ts +++ b/apps/red-ui/src/app/modules/shared/shared.module.ts @@ -11,7 +11,6 @@ import { IconsModule } from '../icons/icons.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { AnnotationIconComponent } from './components/annotation-icon/annotation-icon.component'; import { SimpleDoughnutChartComponent } from './components/simple-doughnut-chart/simple-doughnut-chart.component'; -import { StatusBarComponent } from './components/status-bar/status-bar.component'; import { HasScrollbarDirective } from './directives/has-scrollbar.directive'; import { DictionaryAnnotationIconComponent } from './components/dictionary-annotation-icon/dictionary-annotation-icon.component'; import { HiddenActionComponent } from './components/hidden-action/hidden-action.component'; @@ -40,7 +39,6 @@ const components = [ InputWithActionComponent, AnnotationIconComponent, SimpleDoughnutChartComponent, - StatusBarComponent, DictionaryAnnotationIconComponent, HiddenActionComponent, PopupFilterComponent, diff --git a/apps/red-ui/src/app/services/permissions.service.ts b/apps/red-ui/src/app/services/permissions.service.ts index 506c3f81c..c39714027 100644 --- a/apps/red-ui/src/app/services/permissions.service.ts +++ b/apps/red-ui/src/app/services/permissions.service.ts @@ -61,7 +61,7 @@ export class PermissionsService { canAssignToSelf(fileStatus = this._activeFile): boolean { const precondition = this.isDossierMember() && !fileStatus.isProcessing && !fileStatus.isError && !fileStatus.isApproved; - const isTheOnlyReviewer = !this._appStateService.activeDossier.hasMoreThanOneReviewer; + const isTheOnlyReviewer = !this._appStateService.activeDossier?.hasMoreThanOneReviewer; if (precondition) { if ( diff --git a/libs/common-ui b/libs/common-ui index 7e9b28a10..1d46b21c7 160000 --- a/libs/common-ui +++ b/libs/common-ui @@ -1 +1 @@ -Subproject commit 7e9b28a10c7b226dcab54354c6e7f1d8ccebc0c6 +Subproject commit 1d46b21c74c07d6811a99b9de6c940c740bc8ceb From 9e7edc6b694015272f72a24f16e05f9639095114 Mon Sep 17 00:00:00 2001 From: Dan Percic Date: Tue, 10 Aug 2021 23:01:17 +0300 Subject: [PATCH 5/7] dossier wrapper refactor --- .../base-screen/base-screen.component.html | 4 +- .../document-info.component.html | 8 +- .../dossier-details-stats.component.html | 6 +- .../dossier-details.component.html | 4 +- .../dossier-details.component.ts | 11 +- .../dossier-listing-actions.component.ts | 5 +- .../file-actions/file-actions.component.ts | 2 +- .../page-indicator.component.ts | 2 +- .../team-members-manager.component.ts | 12 +- .../add-dossier-dialog.component.ts | 3 +- .../document-info-dialog.component.ts | 1 - ...edit-dossier-download-package.component.ts | 14 +-- .../edit-dossier-dialog.component.html | 2 +- .../edit-dossier-general-info.component.ts | 2 +- .../dossier-listing-screen.component.html | 30 ++--- .../dossier-listing-screen.component.ts | 71 ++++++------ .../dossier-overview-screen.component.ts | 2 +- .../file-preview-screen.component.ts | 2 +- .../dossier/services/file-action.service.ts | 2 +- .../dictionary-manager.component.html | 6 +- .../dictionary-manager.component.ts | 2 +- .../page-header/page-header.component.ts | 6 +- .../red-ui/src/app/state/app-state.service.ts | 31 +++-- .../src/app/state/model/dossier.wrapper.ts | 108 +++++------------- 24 files changed, 146 insertions(+), 190 deletions(-) diff --git a/apps/red-ui/src/app/components/base-screen/base-screen.component.html b/apps/red-ui/src/app/components/base-screen/base-screen.component.html index dd0b594a5..4694549cb 100644 --- a/apps/red-ui/src/app/components/base-screen/base-screen.component.html +++ b/apps/red-ui/src/app/components/base-screen/base-screen.component.html @@ -12,7 +12,7 @@ [routerLink]="'/main/dossiers/' + appStateService.activeDossierId" mat-menu-item > - {{ appStateService.activeDossier.dossier.dossierName }} + {{ appStateService.activeDossier.dossierName }}