diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 86300bf6b..b46078f62 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -98,6 +98,10 @@ import { HtmlDebugScreenComponent } from './screens/html-debug-screen/html-debug import { ReportDownloadBtnComponent } from './components/buttons/report-download-btn/report-download-btn.component'; import { ProjectListingActionsComponent } from './screens/project-listing-screen/project-listing-actions/project-listing-actions.component'; import { HasScrollbarDirective } from './utils/has-scrollbar.directive'; +import { ProjectTemplatesListingScreenComponent } from './screens/admin/project-templates-listing-screen/project-templates-listing-screen.component'; +import { AddEditProjectTemplateDialogComponent } from './screens/admin/project-templates-listing-screen/add-edit-project-template-dialog/add-edit-project-template-dialog.component'; +import { ProjectTemplateActionsComponent } from './components/project-template-actions/project-template-actions.component'; +import { ProjectTemplateViewSwitchComponent } from './components/project-template-view-switch/project-template-view-switch.component'; import { MatSliderModule } from '@angular/material/slider'; import { PendingChangesGuard } from './utils/can-deactivate.guard'; @@ -168,23 +172,56 @@ const routes = [ { path: 'admin', children: [ - { path: '', redirectTo: 'dictionaries', pathMatch: 'full' }, + { path: '', redirectTo: 'project-templates', pathMatch: 'full' }, { - path: 'dictionaries', - component: DictionaryListingScreenComponent, - canActivate: [CompositeRouteGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] - } - }, - { - path: 'dictionaries/:type', - component: DictionaryOverviewScreenComponent, - canActivate: [CompositeRouteGuard], - canDeactivate: [PendingChangesGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] - } + path: 'project-templates', + children: [ + { + path: '', + component: ProjectTemplatesListingScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + }, + { + path: ':templateId', + children: [ + { + path: 'dictionaries', + children: [ + { + path: '', + component: DictionaryListingScreenComponent, + canActivate: [CompositeRouteGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + }, + { + path: ':type', + component: DictionaryOverviewScreenComponent, + canActivate: [CompositeRouteGuard], + canDeactivate: [PendingChangesGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + } + ] + }, + { + path: 'rules', + component: RulesScreenComponent, + canActivate: [CompositeRouteGuard], + canDeactivate: [PendingChangesGuard], + data: { + routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] + } + }, + { path: '', redirectTo: 'dictionaries', pathMatch: 'full' } + ] + } + ] }, { path: 'users', @@ -194,15 +231,6 @@ const routes = [ routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] } }, - { - path: 'rules', - component: RulesScreenComponent, - canActivate: [CompositeRouteGuard], - canDeactivate: [PendingChangesGuard], - data: { - routeGuards: [AuthGuard, RedRoleGuard, AppStateGuard] - } - }, { path: 'watermark', component: WatermarkScreenComponent, @@ -285,6 +313,8 @@ const matImports = [ CircleButtonComponent, ChevronButtonComponent, DictionaryListingScreenComponent, + ProjectTemplatesListingScreenComponent, + AddEditProjectTemplateDialogComponent, SyncWidthDirective, HasScrollbarDirective, AddEditDictionaryDialogComponent, @@ -298,7 +328,9 @@ const matImports = [ PdfViewerScreenComponent, HtmlDebugScreenComponent, ReportDownloadBtnComponent, - ProjectListingActionsComponent + ProjectListingActionsComponent, + ProjectTemplateActionsComponent, + ProjectTemplateViewSwitchComponent ], imports: [ BrowserModule, @@ -351,7 +383,10 @@ const matImports = [ provide: MAT_DATE_FORMATS, useValue: { display: { - dateInput: 'DD/MM/YY' + dateInput: 'DD/MM/YY', + monthYearLabel: 'YYYY', + dateA11yLabel: 'LL', + monthYearA11yLabel: 'YYYY' } } } diff --git a/apps/red-ui/src/app/common/file-actions/file-actions.component.scss b/apps/red-ui/src/app/common/file-actions/file-actions.component.scss index a530de5f5..4a9497c79 100644 --- a/apps/red-ui/src/app/common/file-actions/file-actions.component.scss +++ b/apps/red-ui/src/app/common/file-actions/file-actions.component.scss @@ -1,7 +1,7 @@ .file-actions { display: flex; - > *:not(last-child) { + > *:not(:last-child) { margin-right: 2px; } } diff --git a/apps/red-ui/src/app/common/filter/filter.component.scss b/apps/red-ui/src/app/common/filter/filter.component.scss index 962f176f3..02a600d80 100644 --- a/apps/red-ui/src/app/common/filter/filter.component.scss +++ b/apps/red-ui/src/app/common/filter/filter.component.scss @@ -9,7 +9,7 @@ .actions { display: flex; - > *:not(last-child) { + > *:not(:last-child) { margin-right: 8px; } } diff --git a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html index 2bedc5574..5549ff5ea 100644 --- a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html +++ b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.html @@ -1,44 +1,46 @@
diff --git a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.scss b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.scss index b2f445392..87b0ab315 100644 --- a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.scss +++ b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.scss @@ -1,3 +1,3 @@ -.ml-32 { +.breadcrumb:not(:first-child):not(.ml-0) { margin-left: 32px; } diff --git a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts index afd0adb8f..b4931d79d 100644 --- a/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts +++ b/apps/red-ui/src/app/components/admin-page-header/admin-breadcrumbs.component.ts @@ -1,7 +1,7 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { TypeValue } from '@redaction/red-ui-http'; -import { AppStateService } from '../../state/app-state.service'; +import { AppStateService, ProjectTemplate } from '../../state/app-state.service'; import { UserPreferenceService } from '../../common/service/user-preference.service'; import { PermissionsService } from '../../common/service/permissions.service'; @@ -12,24 +12,25 @@ import { PermissionsService } from '../../common/service/permissions.service'; }) export class AdminBreadcrumbsComponent implements OnInit { public dictionary: TypeValue; - public root: boolean; - public screen: string; + public projectTemplate: ProjectTemplate; + @Input() + public root = false; constructor( public readonly userPreferenceService: UserPreferenceService, public readonly permissionService: PermissionsService, private readonly _activatedRoute: ActivatedRoute, private readonly _appStateService: AppStateService - ) { + ) {} + + ngOnInit(): void { this._activatedRoute.params.subscribe((params) => { - const url = this._activatedRoute.snapshot.url; - this.root = url.length === 1; - this.screen = url[0].path; - if (this.screen === 'dictionaries' && url.length === 2) { - this.dictionary = this._appStateService.dictionaryData[params.type]; + if (params.templateId) { + this.projectTemplate = this._appStateService.getProjectTemplateById(params.templateId); + } + if (params.type) { + this.dictionary = this._appStateService.getDictionaryTypeValue(params.type); } }); } - - ngOnInit(): void {} } diff --git a/apps/red-ui/src/app/components/comments/comments.component.scss b/apps/red-ui/src/app/components/comments/comments.component.scss index 06f5254bd..127df2bed 100644 --- a/apps/red-ui/src/app/components/comments/comments.component.scss +++ b/apps/red-ui/src/app/components/comments/comments.component.scss @@ -5,14 +5,14 @@ flex-direction: column; margin-top: 10px; - > *:not(last-child) { + > *:not(:last-child) { margin-bottom: 10px; } .comment { display: flex; - > *:not(last-child) { + > *:not(:last-child) { margin-right: 12px; } @@ -53,7 +53,7 @@ display: flex; align-items: center; - > *:not(last-child) { + > *:not(:last-child) { margin-right: 15px; } } @@ -61,7 +61,7 @@ .actions-container { margin-left: 26px; - > *:not(last-child) { + > *:not(:last-child) { margin-right: 5px; } diff --git a/apps/red-ui/src/app/components/needs-work-badge/needs-work-badge.component.scss b/apps/red-ui/src/app/components/needs-work-badge/needs-work-badge.component.scss index a741c5bc3..a69d6a7f5 100644 --- a/apps/red-ui/src/app/components/needs-work-badge/needs-work-badge.component.scss +++ b/apps/red-ui/src/app/components/needs-work-badge/needs-work-badge.component.scss @@ -4,7 +4,7 @@ align-items: center; justify-content: flex-start; - > *:not(last-child) { + > *:not(:last-child) { margin-right: 4px; } } diff --git a/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.html b/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.html new file mode 100644 index 000000000..9b0edb1f4 --- /dev/null +++ b/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.html @@ -0,0 +1,19 @@ + diff --git a/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.scss b/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.scss new file mode 100644 index 000000000..eeb99fae7 --- /dev/null +++ b/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.scss @@ -0,0 +1,7 @@ +.action-buttons { + display: flex; + + redaction-circle-button:not(:last-child) { + margin-right: 2px; + } +} diff --git a/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.ts b/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.ts new file mode 100644 index 000000000..7316bdd35 --- /dev/null +++ b/apps/red-ui/src/app/components/project-template-actions/project-template-actions.component.ts @@ -0,0 +1,37 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { ProjectTemplate } from '../../state/app-state.service'; +import { DialogService } from '../../dialogs/dialog.service'; +import { PermissionsService } from '../../common/service/permissions.service'; + +@Component({ + selector: 'redaction-project-template-actions', + templateUrl: './project-template-actions.component.html', + styleUrls: ['./project-template-actions.component.scss'] +}) +export class ProjectTemplateActionsComponent implements OnInit { + @Input() template: ProjectTemplate; + @Output() loadTemplatesData = new EventEmitter