From 59b45f626aaa6d5e078d448b667eeec0aee7da99 Mon Sep 17 00:00:00 2001 From: Chi Nguyen <6671583+cnguyen-de@users.noreply.github.com> Date: Wed, 22 Jul 2020 09:54:57 +0200 Subject: [PATCH] TSK-1215: Workbasket component NGXS store (#1169) * TSK-1214: refactored taskana-classification TSK-1214 Trying to make drag'n drop in tree possible TSK-1214 Removed refreshClassification output from tree TSK-1214 New action in store updates a classification and refetches all, saving now correctly refreshes the classification-list TSK-1214 Fixed tests in tree component TSK-1214 Removed tree service and corresponding test in class-details TSK-1214 fixed issues in tree where multiple actions to store are fired incorrectly TSK-1214 added accessibility action, use space to select a tree node TSK-1214 swapped space and enter in tree component, cleaned code TSK-1214 fixed bug where page isn't updated dynamically according to browser path TSK-1214 workaround circular dependency. service uses snapshot of store, does not actually access the state in store TSK-1214 fixed eslint. TODO: circular dependency between classification.service and classification.state TSK-1214 changed first() to take(1) to fix Observable dying during test TSK-1214 fixed test cases and lint issues TSK-1214 fixed circular dependency TSK-1214 devmode = false TSK-1214: fixed merge problems with notificationService and removed some warnings TSK-1214: fixed merge problems with notificationService TSK-1214 remove wrong imports from before merge * TSK-1215 initialized workbasket ngxs store with get all and select workbasket * TSK-1215 added actions for creating workbasket and getting workbasket access items * TSK-1215 fixed models' attributes in workbasket * TSK-1215 changed workbasket models from class type to interface type * TSK-1215 correct the naming scheme for models in workbasket * TSK-1215 update workbasket models to mirror backend entities * TSK-1215 implemented workbasketsSummary in store * TSK-1215 workbasket list data is now populated using NGXS Store * TSK-1215 fixed console errors while navigating pagination * TSK-1215 initialized workbasket-overview * TSK-1215 removed unnecessary subscriptions * TSK-1215 fixed workbasket access items still using WorkbasketAccessItems as a class instead of an interface * TSK-1215 implemented routing for workbasket overview, removed master-details component * TSK-1215 implemented new behaviors based on ngxs store instead of router * TSK-1215 bug fixes for creating, selecting and deselecting workbasket * TSK-1215 further bugs fixing regarding creating and selecting workbasket * TSK-1215 fixed bugs where input workbasket was immutable in information component * TSK-1215 added remove distribution target and delete workbasket actions * TSK-1215 implemented mark workbasket for deletion in state * TSK-1215 implemented workbasket copy function * TSK-1215 implemented mark workbasket for deletion * TSK-1287 implemented typeahead for owner field in workbasket * TSK-1215 added actions for workbasket access items and distribution targets * TSK-1215 fixed bugs saving or creating new workbasket * TSK-1215 finished workbasket information * TSK-1215 updated tests for workbasket list, details and information * TSK-1215 increased HTML visibility, refine css * TSK-1215 implemented workbasket access items using ngxs state * TSK-1215 increased workbasket distribution target HTML code visibility * TSK-1215 initialization of distribution targets now uses actions from state * TSK-1215 use takeUntil for subscriptions instead of manually unsubscribing * TSK-1215 save function for distribution targets now dispatch an action * TSK-1215: code refinement in ngxs store * TSK-1214: refactored taskana-classification TSK-1214 Trying to make drag'n drop in tree possible TSK-1214 Removed refreshClassification output from tree TSK-1214 New action in store updates a classification and refetches all, saving now correctly refreshes the classification-list TSK-1214 Fixed tests in tree component TSK-1214 Removed tree service and corresponding test in class-details TSK-1214 fixed issues in tree where multiple actions to store are fired incorrectly TSK-1214 added accessibility action, use space to select a tree node TSK-1214 swapped space and enter in tree component, cleaned code TSK-1214 fixed bug where page isn't updated dynamically according to browser path TSK-1214 workaround circular dependency. service uses snapshot of store, does not actually access the state in store TSK-1214 fixed eslint. TODO: circular dependency between classification.service and classification.state TSK-1214 changed first() to take(1) to fix Observable dying during test TSK-1214 fixed test cases and lint issues TSK-1214 fixed circular dependency TSK-1214 devmode = false TSK-1214: fixed merge problems with notificationService and removed some warnings TSK-1214: fixed merge problems with notificationService TSK-1214 remove wrong imports from before merge * TSK-1215 initialized workbasket ngxs store with get all and select workbasket * TSK-1215 added actions for creating workbasket and getting workbasket access items * TSK-1215 fixed models' attributes in workbasket * TSK-1215 changed workbasket models from class type to interface type * TSK-1215 correct the naming scheme for models in workbasket * TSK-1215 update workbasket models to mirror backend entities * TSK-1215 implemented workbasketsSummary in store * TSK-1215 workbasket list data is now populated using NGXS Store * TSK-1215 fixed console errors while navigating pagination * TSK-1215 initialized workbasket-overview * TSK-1215 removed unnecessary subscriptions * TSK-1215 fixed workbasket access items still using WorkbasketAccessItems as a class instead of an interface * TSK-1215 implemented routing for workbasket overview, removed master-details component * TSK-1215 implemented new behaviors based on ngxs store instead of router * TSK-1215 bug fixes for creating, selecting and deselecting workbasket * TSK-1215 further bugs fixing regarding creating and selecting workbasket * TSK-1215 fixed bugs where input workbasket was immutable in information component * TSK-1215 added remove distribution target and delete workbasket actions * TSK-1215 implemented mark workbasket for deletion in state * TSK-1215 implemented workbasket copy function * TSK-1215 implemented mark workbasket for deletion * TSK-1287 implemented typeahead for owner field in workbasket * TSK-1215 added actions for workbasket access items and distribution targets * TSK-1215 fixed bugs saving or creating new workbasket * TSK-1215 finished workbasket information * TSK-1215 updated tests for workbasket list, details and information * TSK-1215 increased HTML visibility, refine css * TSK-1215 implemented workbasket access items using ngxs state * TSK-1215 increased workbasket distribution target HTML code visibility * TSK-1215 initialization of distribution targets now uses actions from state * TSK-1215 use takeUntil for subscriptions instead of manually unsubscribing * TSK-1215 save function for distribution targets now dispatch an action * TSK-1215: code refinement in ngxs store * TSK-1215: Optimize select workbasket algorithm * TSK-1215: Fixed workbasket information not displaying correctly after saving * TSK-1215: configured tests for workbasket distribution targets * TSK-1215: updated unit tests for workbasket * TSK-1215: cleaned up code, prep for PR * TSK-1215: disable dev mode * TSK-1215: fixed failed tests occured after merge * TSK-1215: reverted node version * TSK-1215: Further bugs fixed due to merging * TSK-1068: Fixed bugs workbasket staying active after being moved * TSK-1215: Fixed minor bugs in tests * TSK-1215: various improvement in code, typeahead style * TSK-1215: Updated typeahead css * TSK-1215: Fixed failed tests due to merge * TSK-1342: getTasksWorkbasketReport now filters for states * TSK-1214: refactored taskana-classification TSK-1214 Trying to make drag'n drop in tree possible TSK-1214 Removed refreshClassification output from tree TSK-1214 New action in store updates a classification and refetches all, saving now correctly refreshes the classification-list TSK-1214 Fixed tests in tree component TSK-1214 Removed tree service and corresponding test in class-details TSK-1214 fixed issues in tree where multiple actions to store are fired incorrectly TSK-1214 added accessibility action, use space to select a tree node TSK-1214 swapped space and enter in tree component, cleaned code TSK-1214 fixed bug where page isn't updated dynamically according to browser path TSK-1214 workaround circular dependency. service uses snapshot of store, does not actually access the state in store TSK-1214 fixed eslint. TODO: circular dependency between classification.service and classification.state TSK-1214 changed first() to take(1) to fix Observable dying during test TSK-1214 fixed test cases and lint issues TSK-1214 fixed circular dependency TSK-1214 devmode = false TSK-1214: fixed merge problems with notificationService and removed some warnings TSK-1214: fixed merge problems with notificationService TSK-1214 remove wrong imports from before merge * TSK-1215 initialized workbasket ngxs store with get all and select workbasket * TSK-1215 added actions for creating workbasket and getting workbasket access items * TSK-1215 fixed models' attributes in workbasket * TSK-1215 changed workbasket models from class type to interface type * TSK-1215 correct the naming scheme for models in workbasket * TSK-1215 update workbasket models to mirror backend entities * TSK-1215 implemented workbasketsSummary in store * TSK-1215 workbasket list data is now populated using NGXS Store * TSK-1215 fixed console errors while navigating pagination * TSK-1215 initialized workbasket-overview * TSK-1215 removed unnecessary subscriptions * TSK-1215 fixed workbasket access items still using WorkbasketAccessItems as a class instead of an interface * TSK-1215 implemented routing for workbasket overview, removed master-details component * TSK-1215 implemented new behaviors based on ngxs store instead of router * TSK-1215 bug fixes for creating, selecting and deselecting workbasket * TSK-1215 further bugs fixing regarding creating and selecting workbasket * TSK-1215 fixed bugs where input workbasket was immutable in information component * TSK-1215 added remove distribution target and delete workbasket actions * TSK-1215 implemented mark workbasket for deletion in state * TSK-1215 implemented workbasket copy function * TSK-1215 implemented mark workbasket for deletion * TSK-1287 implemented typeahead for owner field in workbasket * TSK-1215 added actions for workbasket access items and distribution targets * TSK-1215 fixed bugs saving or creating new workbasket * TSK-1215 finished workbasket information * TSK-1215 updated tests for workbasket list, details and information * TSK-1215 increased HTML visibility, refine css * TSK-1215 implemented workbasket access items using ngxs state * TSK-1215 increased workbasket distribution target HTML code visibility * TSK-1215 initialization of distribution targets now uses actions from state * TSK-1215 use takeUntil for subscriptions instead of manually unsubscribing * TSK-1215 save function for distribution targets now dispatch an action * TSK-1215: code refinement in ngxs store * TSK-1215 initialized workbasket ngxs store with get all and select workbasket * TSK-1215 added actions for creating workbasket and getting workbasket access items * TSK-1215 fixed models' attributes in workbasket * TSK-1215 changed workbasket models from class type to interface type * TSK-1215 correct the naming scheme for models in workbasket * TSK-1215 update workbasket models to mirror backend entities * TSK-1215 implemented workbasketsSummary in store * TSK-1215 workbasket list data is now populated using NGXS Store * TSK-1215 fixed console errors while navigating pagination * TSK-1215 initialized workbasket-overview * TSK-1215 removed unnecessary subscriptions * TSK-1215 fixed workbasket access items still using WorkbasketAccessItems as a class instead of an interface * TSK-1215 implemented routing for workbasket overview, removed master-details component * TSK-1215 implemented new behaviors based on ngxs store instead of router * TSK-1215 bug fixes for creating, selecting and deselecting workbasket * TSK-1215 further bugs fixing regarding creating and selecting workbasket * TSK-1215 fixed bugs where input workbasket was immutable in information component * TSK-1215 added remove distribution target and delete workbasket actions * TSK-1215 implemented mark workbasket for deletion in state * TSK-1215 implemented workbasket copy function * TSK-1215 implemented mark workbasket for deletion * TSK-1287 implemented typeahead for owner field in workbasket * TSK-1215 added actions for workbasket access items and distribution targets * TSK-1215 fixed bugs saving or creating new workbasket * TSK-1215 finished workbasket information * TSK-1215 updated tests for workbasket list, details and information * TSK-1215 increased HTML visibility, refine css * TSK-1215 implemented workbasket access items using ngxs state * TSK-1215 increased workbasket distribution target HTML code visibility * TSK-1215 initialization of distribution targets now uses actions from state * TSK-1215 use takeUntil for subscriptions instead of manually unsubscribing * TSK-1215 save function for distribution targets now dispatch an action * TSK-1215: code refinement in ngxs store * TSK-1215: Optimize select workbasket algorithm * TSK-1215: Fixed workbasket information not displaying correctly after saving * TSK-1215: configured tests for workbasket distribution targets * TSK-1215: updated unit tests for workbasket * TSK-1215: cleaned up code, prep for PR * TSK-1215: disable dev mode * TSK-1215: fixed failed tests occured after merge * TSK-1215: reverted node version * TSK-1215: Further bugs fixed due to merging * TSK-1068: Fixed bugs workbasket staying active after being moved * TSK-1215: Fixed minor bugs in tests * TSK-1215: various improvement in code, typeahead style * TSK-1215: Updated typeahead css * TSK-1215: Fixed failed tests due to merge * TSK-1215: Rebase, prep for merge with master Co-authored-by: Mustapha Zorgati <15628173+mustaphazorgati@users.noreply.github.com> Co-authored-by: Tristan Eisermann <19949441+Tristan2357@users.noreply.github.com> --- .../administration-routing.module.ts | 17 +- .../administration/administration.module.ts | 2 + .../classification-list.component.spec.ts | 2 +- .../classification-list.component.ts | 2 +- .../workbasket-access-items.component.html | 37 ++- .../workbasket-access-items.component.scss | 6 + .../workbasket-access-items.component.spec.ts | 117 +++---- .../workbasket-access-items.component.ts | 144 ++++++--- .../workbasket-details.component.spec.ts | 59 ++-- .../workbasket-details.component.ts | 148 ++++----- ...basket-distribution-targets.component.html | 114 ++++--- ...ket-distribution-targets.component.spec.ts | 161 +++++---- ...rkbasket-distribution-targets.component.ts | 306 ++++++++++-------- .../workbasket-dual-list.component.html | 97 +++--- .../workbasket-dual-list.component.ts | 6 +- .../workbasket-information.component.html | 20 +- .../workbasket-information.component.spec.ts | 162 +++------- .../workbasket-information.component.ts | 149 +++------ .../workbasket-list-toolbar.component.spec.ts | 24 +- .../workbasket-list-toolbar.component.ts | 39 ++- .../workbasket-list.component.html | 20 +- .../workbasket-list.component.spec.ts | 95 +++--- .../workbasket-list.component.ts | 126 ++++---- .../workbasket-overview.component.html | 17 + .../workbasket-overview.component.scss | 0 .../workbasket-overview.component.spec.ts | 75 +++++ .../workbasket-overview.component.ts | 57 ++++ .../components/filter/filter.component.html | 9 +- .../pagination/pagination.component.html | 2 +- .../pagination/pagination.component.ts | 1 - .../type-ahead/type-ahead.component.html | 6 +- .../type-ahead/type-ahead.component.scss | 46 +-- web/src/app/shared/models/action.ts | 3 +- .../shared/models/links-workbasket-summary.ts | 10 + web/src/app/shared/models/notifications.ts | 2 +- .../workbasket-access-items-representation.ts | 7 + .../workbasket-access-items-resource.ts | 9 - .../shared/models/workbasket-access-items.ts | 49 ++- .../shared/models/workbasket-definition.ts | 11 +- ...orkbasket-distribution-targets-resource.ts | 10 - .../models/workbasket-distribution-targets.ts | 7 + .../models/workbasket-representation.ts | 7 + .../app/shared/models/workbasket-resource.ts | 9 - .../workbasket-summary-representation.ts | 9 + .../models/workbasket-summary-resource.ts | 12 - .../app/shared/models/workbasket-summary.ts | 38 +-- web/src/app/shared/models/workbasket.ts | 42 ++- .../services/workbasket/workbasket.service.ts | 28 +- web/src/app/shared/store/index.ts | 3 +- .../workbasket-store/workbasket.actions.ts | 102 ++++++ .../workbasket-store/workbasket.selectors.ts | 56 ++++ .../workbasket-store/workbasket.state.ts | 261 +++++++++++++++ 52 files changed, 1668 insertions(+), 1073 deletions(-) create mode 100644 web/src/app/administration/components/workbasket-overview/workbasket-overview.component.html create mode 100644 web/src/app/administration/components/workbasket-overview/workbasket-overview.component.scss create mode 100644 web/src/app/administration/components/workbasket-overview/workbasket-overview.component.spec.ts create mode 100644 web/src/app/administration/components/workbasket-overview/workbasket-overview.component.ts create mode 100644 web/src/app/shared/models/links-workbasket-summary.ts create mode 100644 web/src/app/shared/models/workbasket-access-items-representation.ts delete mode 100644 web/src/app/shared/models/workbasket-access-items-resource.ts delete mode 100644 web/src/app/shared/models/workbasket-distribution-targets-resource.ts create mode 100644 web/src/app/shared/models/workbasket-distribution-targets.ts create mode 100644 web/src/app/shared/models/workbasket-representation.ts delete mode 100644 web/src/app/shared/models/workbasket-resource.ts create mode 100644 web/src/app/shared/models/workbasket-summary-representation.ts delete mode 100644 web/src/app/shared/models/workbasket-summary-resource.ts create mode 100644 web/src/app/shared/store/workbasket-store/workbasket.actions.ts create mode 100644 web/src/app/shared/store/workbasket-store/workbasket.selectors.ts create mode 100644 web/src/app/shared/store/workbasket-store/workbasket.state.ts diff --git a/web/src/app/administration/administration-routing.module.ts b/web/src/app/administration/administration-routing.module.ts index f895f7c16..00da58cbb 100644 --- a/web/src/app/administration/administration-routing.module.ts +++ b/web/src/app/administration/administration-routing.module.ts @@ -1,34 +1,25 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -import { WorkbasketListComponent } from 'app/administration/components/workbasket-list/workbasket-list.component'; -import { WorkbasketDetailsComponent } from 'app/administration/components/workbasket-details/workbasket-details.component'; -import { MasterAndDetailComponent } from 'app/shared/components/master-and-detail/master-and-detail.component'; -import { ClassificationListComponent } from 'app/administration/components/classification-list/classification-list.component'; -import { ClassificationDetailsComponent } from 'app/administration/components/classification-details/classification-details.component'; import { DomainGuard } from 'app/shared/guards/domain.guard'; import { AccessItemsManagementComponent } from './components/access-items-management/access-items-management.component'; import { ClassificationOverviewComponent } from './components/classification-overview/classification-overview.component'; +import { WorkbasketOverviewComponent } from './components/workbasket-overview/workbasket-overview.component'; const routes: Routes = [ { path: 'workbaskets', - component: MasterAndDetailComponent, + component: WorkbasketOverviewComponent, canActivate: [DomainGuard], children: [ { path: '', - component: WorkbasketListComponent, + component: WorkbasketOverviewComponent, outlet: 'master' }, - { - path: 'new-classification/:id', - component: WorkbasketDetailsComponent, - outlet: 'detail' - }, { path: ':id', - component: WorkbasketDetailsComponent, + component: WorkbasketOverviewComponent, outlet: 'detail' }, { diff --git a/web/src/app/administration/administration.module.ts b/web/src/app/administration/administration.module.ts index 0cde5f73c..5d48ebfc1 100644 --- a/web/src/app/administration/administration.module.ts +++ b/web/src/app/administration/administration.module.ts @@ -33,6 +33,7 @@ import { ClassificationDefinitionService } from './services/classification-defin import { WorkbasketDefinitionService } from './services/workbasket-definition.service'; import { ImportExportService } from './services/import-export.service'; import { ClassificationOverviewComponent } from './components/classification-overview/classification-overview.component'; +import { WorkbasketOverviewComponent } from './components/workbasket-overview/workbasket-overview.component'; const MODULES = [ CommonModule, @@ -47,6 +48,7 @@ const MODULES = [ ]; const DECLARATIONS = [ + WorkbasketOverviewComponent, WorkbasketListComponent, WorkbasketListToolbarComponent, WorkbasketAccessItemsComponent, diff --git a/web/src/app/administration/components/classification-list/classification-list.component.spec.ts b/web/src/app/administration/components/classification-list/classification-list.component.spec.ts index f6046b5b9..d9e64b505 100644 --- a/web/src/app/administration/components/classification-list/classification-list.component.spec.ts +++ b/web/src/app/administration/components/classification-list/classification-list.component.spec.ts @@ -45,7 +45,7 @@ describe('ClassificationListComponent', () => { testBed.configureTestingModule({ declarations: [ClassificationListComponent, ImportExportComponent, ClassificationTypesSelectorComponent, DummyDetailComponent], - imports: [HttpClientModule, RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, NgxsModule.forRoot(), MatRadioModule], + imports: [HttpClientModule, RouterTestingModule.withRoutes(routes), FormsModule, AngularSvgIconModule, NgxsModule.forRoot([]), MatRadioModule], providers: [ HttpClient, WorkbasketDefinitionService, NotificationService, ClassificationsService, DomainService, ClassificationDefinitionService, diff --git a/web/src/app/administration/components/classification-list/classification-list.component.ts b/web/src/app/administration/components/classification-list/classification-list.component.ts index 498a6e34c..6ab0bc745 100644 --- a/web/src/app/administration/components/classification-list/classification-list.component.ts +++ b/web/src/app/administration/components/classification-list/classification-list.component.ts @@ -99,7 +99,7 @@ export class ClassificationListComponent implements OnInit, OnDestroy { ); } - ngOnDestroy(): void { + ngOnDestroy() { this.destroy$.next(); this.destroy$.complete(); } diff --git a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.html b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.html index 243b3fc09..7f4555e75 100644 --- a/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.html +++ b/web/src/app/administration/components/workbasket-access-items/workbasket-access-items.component.html @@ -1,4 +1,6 @@