RED-9321: refactored account and archive modules.
This commit is contained in:
parent
c4912ffd8f
commit
28b3301063
@ -77,7 +77,7 @@ const dossierTemplateIdRoutes: IqserRoutes = [
|
||||
},
|
||||
{
|
||||
path: `${ARCHIVE_ROUTE}`,
|
||||
loadChildren: () => import('./modules/archive/archive.module').then(m => m.ArchiveModule),
|
||||
loadChildren: () => import('./modules/archive/archive.routes'),
|
||||
canActivate: [CompositeRouteGuard, webViewerLoadedGuard(), loadArchivedDossiersGuard()],
|
||||
data: {
|
||||
routeGuards: [FeaturesGuard],
|
||||
@ -99,7 +99,7 @@ const mainRoutes: IqserRoutes = [
|
||||
},
|
||||
{
|
||||
path: 'account',
|
||||
loadChildren: () => import('./modules/account/account.module').then(m => m.AccountModule),
|
||||
loadChildren: () => import('./modules/account/account.routes'),
|
||||
},
|
||||
{
|
||||
path: 'admin',
|
||||
|
||||
@ -4,6 +4,10 @@ import { IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Roles } from '@users/roles';
|
||||
import { User } from '@red/domain';
|
||||
import { getCurrentUser } from '@iqser/common-ui/lib/users';
|
||||
import { SideNavComponent } from '@common-ui/shared';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
import { RouterLink, RouterLinkActive } from '@angular/router';
|
||||
|
||||
interface NavItem {
|
||||
readonly label: string;
|
||||
@ -17,6 +21,8 @@ interface NavItem {
|
||||
templateUrl: './account-side-nav.component.html',
|
||||
styleUrls: ['./account-side-nav.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: true,
|
||||
imports: [SideNavComponent, TranslateModule, NgForOf, NgIf, RouterLinkActive, RouterLink],
|
||||
})
|
||||
export class AccountSideNavComponent {
|
||||
readonly currentUser = getCurrentUser<User>();
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { SharedModule } from '@shared/shared.module';
|
||||
import { AccountRoutingModule } from './account-routing.module';
|
||||
import { AccountSideNavComponent } from './account-side-nav/account-side-nav.component';
|
||||
import { BaseAccountScreenComponent } from './base-account-screen/base-account-screen-component';
|
||||
import { NotificationPreferencesService } from './services/notification-preferences.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { IconButtonComponent, IqserAllowDirective, IqserHelpModeModule } from '@iqser/common-ui';
|
||||
import { PreferencesComponent } from './screens/preferences/preferences.component';
|
||||
import { SideNavComponent } from '@iqser/common-ui/lib/shared';
|
||||
import { DialogDefaultsComponent } from './screens/preferences/dialog-defaults/dialog-defaults.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AccountSideNavComponent, BaseAccountScreenComponent, PreferencesComponent, DialogDefaultsComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
SharedModule,
|
||||
AccountRoutingModule,
|
||||
TranslateModule,
|
||||
IqserHelpModeModule,
|
||||
IconButtonComponent,
|
||||
SideNavComponent,
|
||||
IqserAllowDirective,
|
||||
],
|
||||
providers: [NotificationPreferencesService],
|
||||
})
|
||||
export class AccountModule {}
|
||||
@ -1,5 +1,3 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { CompositeRouteGuard, IqserPermissionsGuard, IqserRoutes } from '@iqser/common-ui';
|
||||
import { RedRoleGuard } from '@users/red-role.guard';
|
||||
import { BaseAccountScreenComponent } from './base-account-screen/base-account-screen-component';
|
||||
@ -7,8 +5,9 @@ import { PreferencesComponent } from './screens/preferences/preferences.componen
|
||||
import { Roles } from '@users/roles';
|
||||
import { IqserAuthGuard } from '@iqser/common-ui/lib/users';
|
||||
import { PendingChangesGuard } from '@guards/can-deactivate.guard';
|
||||
import { NotificationPreferencesService } from './services/notification-preferences.service';
|
||||
|
||||
const routes: IqserRoutes = [
|
||||
export default [
|
||||
{ path: '', redirectTo: 'user-profile', pathMatch: 'full' },
|
||||
{
|
||||
path: 'user-profile',
|
||||
@ -31,6 +30,7 @@ const routes: IqserRoutes = [
|
||||
redirectTo: '/',
|
||||
},
|
||||
},
|
||||
providers: [NotificationPreferencesService],
|
||||
loadChildren: () => import('./screens/notifications/notifications.routes'),
|
||||
},
|
||||
{
|
||||
@ -63,10 +63,4 @@ const routes: IqserRoutes = [
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AccountRoutingModule {}
|
||||
] satisfies IqserRoutes;
|
||||
@ -1,12 +1,17 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit, ViewContainerRef } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { Router, RouterOutlet } from '@angular/router';
|
||||
import { accountTranslations } from '@translations/account-translations';
|
||||
import { NgClass, NgIf } from '@angular/common';
|
||||
import { AccountSideNavComponent } from '../account-side-nav/account-side-nav.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-base-account-screen',
|
||||
templateUrl: './base-account-screen-component.html',
|
||||
styleUrls: ['./base-account-screen-component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: true,
|
||||
imports: [NgClass, NgIf, RouterOutlet, AccountSideNavComponent, TranslateModule],
|
||||
})
|
||||
export class BaseAccountScreenComponent implements OnInit {
|
||||
readonly translations = accountTranslations;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import { ChangeDetectorRef, Component, inject } from '@angular/core';
|
||||
import { BaseFormComponent } from '@common-ui/form';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import {
|
||||
RedactOrHintOption,
|
||||
RedactOrHintOptions,
|
||||
@ -17,6 +17,12 @@ import {
|
||||
removeOptions,
|
||||
SystemDefaultType,
|
||||
} from '../../../utils/dialog-defaults';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatFormField } from '@angular/material/form-field';
|
||||
import { MatOption, MatSelect } from '@angular/material/select';
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
import { IconButtonComponent } from '@iqser/common-ui';
|
||||
|
||||
interface DefaultOptionsForm {
|
||||
addRedaction: RedactOrHintOption | SystemDefaultType;
|
||||
@ -35,6 +41,8 @@ interface DefaultOptionsForm {
|
||||
selector: 'redaction-dialog-defaults',
|
||||
templateUrl: './dialog-defaults.component.html',
|
||||
styleUrl: './dialog-defaults.component.scss',
|
||||
standalone: true,
|
||||
imports: [ReactiveFormsModule, TranslateModule, MatFormField, MatSelect, MatOption, NgForOf, MatCheckbox, NgIf, IconButtonComponent],
|
||||
})
|
||||
export class DialogDefaultsComponent extends BaseFormComponent {
|
||||
readonly #formBuilder = inject(FormBuilder);
|
||||
|
||||
@ -1,10 +1,24 @@
|
||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { BaseFormComponent, getConfig, IqserPermissionsService, isIqserDevMode, KEYS, LoadingService } from '@iqser/common-ui';
|
||||
import {
|
||||
BaseFormComponent,
|
||||
getConfig,
|
||||
IconButtonComponent,
|
||||
IqserAllowDirective,
|
||||
IqserPermissionsService,
|
||||
isIqserDevMode,
|
||||
KEYS,
|
||||
LoadingService,
|
||||
} from '@iqser/common-ui';
|
||||
import { AsControl } from '@iqser/common-ui/lib/utils';
|
||||
import { Roles } from '@users/roles';
|
||||
import { PreferencesKeys, UserPreferenceService } from '@users/user-preference.service';
|
||||
import { DialogDefaultsComponent } from './dialog-defaults/dialog-defaults.component';
|
||||
import { NgClass, NgIf } from '@angular/common';
|
||||
import { MatSlideToggle } from '@angular/material/slide-toggle';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatCheckbox } from '@angular/material/checkbox';
|
||||
|
||||
interface PreferencesForm {
|
||||
// preferences
|
||||
@ -30,6 +44,18 @@ const Screens = {
|
||||
templateUrl: './preferences.component.html',
|
||||
styleUrls: ['./preferences.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: true,
|
||||
imports: [
|
||||
DialogDefaultsComponent,
|
||||
NgClass,
|
||||
NgIf,
|
||||
ReactiveFormsModule,
|
||||
MatSlideToggle,
|
||||
TranslateModule,
|
||||
IqserAllowDirective,
|
||||
MatCheckbox,
|
||||
IconButtonComponent,
|
||||
],
|
||||
})
|
||||
export class PreferencesComponent extends BaseFormComponent implements OnInit {
|
||||
readonly form: FormGroup<AsControl<PreferencesForm>>;
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ArchivedDossiersScreenComponent } from './screens/archived-dossiers-screen/archived-dossiers-screen.component';
|
||||
import { ArchiveRoutingModule } from './archive-routing.module';
|
||||
import { TableItemComponent } from './components/table-item/table-item.component';
|
||||
import { ConfigService } from './services/config.service';
|
||||
import { IqserHelpModeModule, IqserListingModule } from '@iqser/common-ui';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { SharedModule } from '@shared/shared.module';
|
||||
import { SharedDossiersModule } from '../shared-dossiers/shared-dossiers.module';
|
||||
import { InitialsAvatarComponent, IqserUsersModule } from '@iqser/common-ui/lib/users';
|
||||
import { DossiersTypeSwitchComponent } from '@shared/components/dossiers-type-switch/dossiers-type-switch.component';
|
||||
import { DossierNameColumnComponent } from '@shared/components/dossier-name-column/dossier-name-column.component';
|
||||
import { DossierStateComponent } from '@shared/components/dossier-state/dossier-state.component';
|
||||
import { DossiersListingActionsComponent } from '../shared-dossiers/components/dossiers-listing-actions/dossiers-listing-actions.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [TableItemComponent, ArchivedDossiersScreenComponent],
|
||||
imports: [
|
||||
CommonModule,
|
||||
ArchiveRoutingModule,
|
||||
IqserHelpModeModule,
|
||||
IqserUsersModule,
|
||||
TranslateModule,
|
||||
IqserListingModule,
|
||||
SharedModule,
|
||||
SharedDossiersModule,
|
||||
InitialsAvatarComponent,
|
||||
DossiersTypeSwitchComponent,
|
||||
DossierNameColumnComponent,
|
||||
DossierStateComponent,
|
||||
DossiersListingActionsComponent,
|
||||
],
|
||||
providers: [ConfigService],
|
||||
})
|
||||
export class ArchiveModule {}
|
||||
@ -1,12 +1,11 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { BreadcrumbTypes, DOSSIER_ID, FILE_ID } from '@red/domain';
|
||||
import { ArchivedDossiersScreenComponent } from './screens/archived-dossiers-screen/archived-dossiers-screen.component';
|
||||
import { CompositeRouteGuard } from '@iqser/common-ui';
|
||||
import { CompositeRouteGuard, IqserRoutes } from '@iqser/common-ui';
|
||||
import { ARCHIVED_DOSSIERS_SERVICE } from '../../tokens';
|
||||
import { DossierFilesGuard } from '@guards/dossier-files-guard';
|
||||
import { ConfigService } from './services/config.service';
|
||||
|
||||
const routes: Routes = [
|
||||
export default [
|
||||
{
|
||||
path: '',
|
||||
pathMatch: 'full',
|
||||
@ -18,6 +17,7 @@ const routes: Routes = [
|
||||
reuse: true,
|
||||
dossiersService: ARCHIVED_DOSSIERS_SERVICE,
|
||||
},
|
||||
providers: [ConfigService],
|
||||
},
|
||||
{
|
||||
path: `:${DOSSIER_ID}`,
|
||||
@ -40,10 +40,4 @@ const routes: Routes = [
|
||||
},
|
||||
loadChildren: () => import('../file-preview/file-preview.routes'),
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forChild(routes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class ArchiveRoutingModule {}
|
||||
] satisfies IqserRoutes;
|
||||
@ -3,11 +3,25 @@ import { Dossier, DossierStats } from '@red/domain';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { DossierStatsService } from '@services/dossiers/dossier-stats.service';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { DossierNameColumnComponent } from '@shared/components/dossier-name-column/dossier-name-column.component';
|
||||
import { InitialsAvatarComponent } from '@common-ui/users';
|
||||
import { DossierStateComponent } from '@shared/components/dossier-state/dossier-state.component';
|
||||
import { DossiersListingActionsComponent } from '../../../shared-dossiers/components/dossiers-listing-actions/dossiers-listing-actions.component';
|
||||
import { AsyncPipe, DatePipe } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-table-item [dossier]',
|
||||
templateUrl: './table-item.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: true,
|
||||
imports: [
|
||||
DossierNameColumnComponent,
|
||||
InitialsAvatarComponent,
|
||||
DossierStateComponent,
|
||||
DossiersListingActionsComponent,
|
||||
AsyncPipe,
|
||||
DatePipe,
|
||||
],
|
||||
})
|
||||
export class TableItemComponent implements OnChanges {
|
||||
@Input() dossier!: Dossier;
|
||||
|
||||
@ -1,18 +1,24 @@
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { ListingComponent, listingProvidersFactory, LoadingService } from '@iqser/common-ui';
|
||||
import { IqserListingModule, ListingComponent, listingProvidersFactory, LoadingService } from '@iqser/common-ui';
|
||||
import { Dossier, DOSSIER_TEMPLATE_ID } from '@red/domain';
|
||||
import { ConfigService } from '../../services/config.service';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { ArchivedDossiersService } from '@services/dossiers/archived-dossiers.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { OnAttach } from '@common-ui/utils';
|
||||
import { DossiersTypeSwitchComponent } from '@shared/components/dossiers-type-switch/dossiers-type-switch.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TableItemComponent } from '../../components/table-item/table-item.component';
|
||||
import { AsyncPipe, NgIf } from '@angular/common';
|
||||
|
||||
@Component({
|
||||
selector: 'redaction-archived-dossiers-screen',
|
||||
templateUrl: './archived-dossiers-screen.component.html',
|
||||
providers: listingProvidersFactory(ArchivedDossiersScreenComponent),
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: true,
|
||||
imports: [IqserListingModule, DossiersTypeSwitchComponent, TranslateModule, TableItemComponent, NgIf, AsyncPipe],
|
||||
})
|
||||
export class ArchivedDossiersScreenComponent extends ListingComponent<Dossier> implements OnInit, OnAttach {
|
||||
readonly tableColumnConfigs = this._configService.tableConfig;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user