From 587e484cf8995324b5abcd9cf68fb122a99129b6 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Tue, 21 Jan 2020 18:15:50 +0100 Subject: [PATCH 1/3] AW-835 Remove validFrom/To filter from interface. --- projects/common/src/fm/services/codelistitem.service.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/common/src/fm/services/codelistitem.service.ts b/projects/common/src/fm/services/codelistitem.service.ts index d75320c..841606e 100644 --- a/projects/common/src/fm/services/codelistitem.service.ts +++ b/projects/common/src/fm/services/codelistitem.service.ts @@ -15,11 +15,10 @@ export class CodeListItemService { return this.appConfig.getConfig("apiEndPoint"); } - getCodeListItems(codelist: string[], codegroup?: string, dataFilter?: any, onlyBetweenValidFromAndTo: boolean = true): Observable { + getCodeListItems(codelist: string[], codegroup?: string, dataFilter?: any): Observable { var params = new HttpParams(); params = params.append("cl", codelist.join(",")); if (codegroup) params = params.append("g", codegroup); - if (onlyBetweenValidFromAndTo) params = params.append("v", onlyBetweenValidFromAndTo); if (dataFilter) params = params.append("df", dataFilter); return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params }); } From a12b45f8f9e5ee084fbdb8a19885815a079528af Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Wed, 22 Jan 2020 09:52:40 +0100 Subject: [PATCH 2/3] AW-835 Added CodeListItem. Some cleanup. --- .../common/src/fm/common-service.module.ts | 56 +++++-------------- projects/common/src/fm/common.module.ts | 38 +++++++------ 2 files changed, 35 insertions(+), 59 deletions(-) diff --git a/projects/common/src/fm/common-service.module.ts b/projects/common/src/fm/common-service.module.ts index 7acf908..d113bfa 100644 --- a/projects/common/src/fm/common-service.module.ts +++ b/projects/common/src/fm/common-service.module.ts @@ -1,23 +1,16 @@ // angular modules -import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector,Optional,SkipSelf } from '@angular/core'; -import { CommonModule, DatePipe } from '@angular/common'; -import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http'; -import { FormsModule } from '@angular/forms'; +import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core'; +import { DatePipe } from '@angular/common'; +import { HTTP_INTERCEPTORS } from '@angular/common/http'; // external modules -import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; - - -// routing module -import { AppCommonRoutingModule } from './common-routing.module'; - -import { MODULE_NAME } from './module-name'; +import { OAuthModule, OAuthService } from 'angular-oauth2-oidc'; //components import { ItemTypeService } from './services/itemtype.service'; import { FolderService } from './services/folder.service'; -import { TimespanService} from './services/timespan.service'; -import { ItemService} from './services/item.service'; +import { TimespanService } from './services/timespan.service'; +import { ItemService } from './services/item.service'; import { EventService } from './services/event.service'; import { TypeaheadService } from './services/typeahead.service'; import { UserService } from './services/user.service'; @@ -27,40 +20,21 @@ import { appConfigFactory } from "./shared/app.config.factory"; import { AuthGuard } from './services/auth-guard.service'; import { NavBarGuard } from './services/nav-bar-guard.service'; import { FullScreenGuard } from './services/full-screen-guard.service'; -import { SafePipe } from './shared/safe.pipe'; -import { AppComponent} from './components/app/app.component'; -import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component'; import { AuthCallbackGuard } from './components/auth-callback/auth-callback.guard'; -import { SessionClearedComponent } from './components/session-cleared/session-cleared.component'; import { ResumableFileUploadService } from './components/resumable-file-upload/resumable-file-upload.service'; -import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component'; -import { NotFoundComponent } from './components/not-found/not-found.component'; -import { NotImplementedComponent } from './components/not-implemented/not-implemented.component'; -import { SidePanelComponent } from './components/side-panel/side-panel.component'; -import { TimespanComponent } from './components/timespan/timespan.component'; -import { TagInputComponent } from './components/tag-input/tag-input.component'; -import {IEventMessage } from './models/event.message'; -import { IItem, Item } from './models/item'; -import {IItemType} from './models/item.type'; -import {IItemTypes} from './models/item.types'; -import {IItemTask,ItemTask} from './models/itemTask'; -import {IListItem} from './models/list.item'; -import {ITypeaheadItem} from './models/typeahead.item'; -import {IUser} from './models/user'; -import * as commonActions from './actions/app-common.actions'; -import * as commonReducers from './reducers/app-common.reducer'; -import * as commonEffects from './effects/app-common.effects'; -import {NgbDateNativeAdapter} from './services/date-adapter.service' -import { from } from 'rxjs'; -import {AuthConfigFactory} from './shared/authconfigFactory'; +import { NgbDateNativeAdapter } from './services/date-adapter.service' +import { AuthConfigFactory } from './shared/authconfigFactory'; +import { CodeListItemService } from './services/codelistitem.service'; -export {FolderService, +export { + FolderService, ItemTypeService, TimespanService, ItemService, EventService, TypeaheadService, UserService, + CodeListItemService, AppConfig, AccessTokenInterceptor, AuthGuard, @@ -77,7 +51,7 @@ export {FolderService, ] }) export class AppCommonServiceModule { - constructor (@Optional() @SkipSelf() parentModule: AppCommonServiceModule) { + constructor(@Optional() @SkipSelf() parentModule: AppCommonServiceModule) { if (parentModule) { throw new Error( 'AppCommonServiceModule is already loaded. Import it in the AppModule only'); @@ -91,9 +65,9 @@ export class AppCommonServiceModule { { provide: APP_INITIALIZER, useFactory: appConfigFactory, - deps: [Injector, AppConfig, OAuthService,AuthConfigFactory], + deps: [Injector, AppConfig, OAuthService, AuthConfigFactory], multi: true - }, + }, { provide: HTTP_INTERCEPTORS, useClass: AccessTokenInterceptor, diff --git a/projects/common/src/fm/common.module.ts b/projects/common/src/fm/common.module.ts index ab43fb2..3735b4b 100644 --- a/projects/common/src/fm/common.module.ts +++ b/projects/common/src/fm/common.module.ts @@ -1,26 +1,26 @@ // angular modules -import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector,Optional,SkipSelf } from '@angular/core'; +import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core'; import { CommonModule, DatePipe } from '@angular/common'; import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http'; import { FormsModule } from '@angular/forms'; // external modules -import { OAuthModule,AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; -import { StoreModule,Store } from '@ngrx/store'; +import { OAuthModule, AuthConfig, OAuthService, OAuthStorage } from 'angular-oauth2-oidc'; +import { StoreModule, Store } from '@ngrx/store'; import { EffectsModule } from '@ngrx/effects'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; -import {UploadxModule } from 'ngx-uploadx'; +import { UploadxModule } from 'ngx-uploadx'; // routing module import { AppCommonRoutingModule } from './common-routing.module'; -import { MODULE_NAME } from './module-name'; +import { MODULE_NAME } from './module-name'; //components import { SafePipe } from './shared/safe.pipe'; -import { AuthConfigFactory,IAuthconfigFactory} from './shared/authconfigFactory'; -import { AppComponent} from './components/app/app.component'; +import { AuthConfigFactory, IAuthconfigFactory } from './shared/authconfigFactory'; +import { AppComponent } from './components/app/app.component'; import { AuthCallbackComponent } from './components/auth-callback/auth-callback.component'; import { SessionClearedComponent } from './components/session-cleared/session-cleared.component'; import { ResumableFileUploadComponent } from './components/resumable-file-upload/resumable-file-upload.component'; @@ -29,15 +29,16 @@ import { NotImplementedComponent } from './components/not-implemented/not-implem import { SidePanelComponent } from './components/side-panel/side-panel.component'; import { TimespanComponent } from './components/timespan/timespan.component'; import { TagInputComponent } from './components/tag-input/tag-input.component'; -import {MenuBackgroundComponent} from './components/menu-background/menu-background.component'; -import {IEventMessage } from './models/event.message'; +import { MenuBackgroundComponent } from './components/menu-background/menu-background.component'; +import { IEventMessage } from './models/event.message'; import { IItem, Item } from './models/item'; -import {IItemType} from './models/item.type'; -import {IItemTypes} from './models/item.types'; -import {IItemTask,ItemTask} from './models/itemTask'; -import {IListItem} from './models/list.item'; -import {ITypeaheadItem} from './models/typeahead.item'; -import {IUser} from './models/user'; +import { IItemType } from './models/item.type'; +import { IItemTypes } from './models/item.types'; +import { IItemTask, ItemTask } from './models/itemTask'; +import { IListItem } from './models/list.item'; +import { ITypeaheadItem } from './models/typeahead.item'; +import { IUser } from './models/user'; +import { ICodeListItem } from './models/code.list.item'; import * as commonActions from './actions/app-common.actions'; import * as commonReducers from './reducers/app-common.reducer'; import * as commonEffects from './effects/app-common.effects'; @@ -63,6 +64,7 @@ export { IListItem, ITypeaheadItem, IUser, + ICodeListItem, commonActions, commonReducers, IAuthconfigFactory, @@ -75,7 +77,7 @@ export { CommonModule, HttpClientModule, AppCommonRoutingModule, - StoreModule.forFeature(MODULE_NAME, commonReducers.reducer ), + StoreModule.forFeature(MODULE_NAME, commonReducers.reducer), EffectsModule.forFeature([commonEffects.AppCommonEffects]), OAuthModule.forRoot(), NgbModule, @@ -100,7 +102,7 @@ export { UploadxModule, CommonModule, AppComponent, - ResumableFileUploadComponent, + ResumableFileUploadComponent, AuthCallbackComponent, SidePanelComponent, SafePipe, @@ -111,7 +113,7 @@ export { TagInputComponent, SessionClearedComponent, MenuBackgroundComponent - ] + ] }) export class AppCommonModule { } From 313e0c94f73482432f4857819a6a547bb4d20a56 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Wed, 22 Jan 2020 10:05:03 +0100 Subject: [PATCH 3/3] AW-835 Fixed ERROR: projects/common/src/fm/services/codelistitem.service.ts(23,5): error TS2322: Type 'Observable' is not assignable to type 'Observable'. --- projects/common/src/fm/services/codelistitem.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/common/src/fm/services/codelistitem.service.ts b/projects/common/src/fm/services/codelistitem.service.ts index 841606e..33040d1 100644 --- a/projects/common/src/fm/services/codelistitem.service.ts +++ b/projects/common/src/fm/services/codelistitem.service.ts @@ -20,6 +20,6 @@ export class CodeListItemService { params = params.append("cl", codelist.join(",")); if (codegroup) params = params.append("g", codegroup); if (dataFilter) params = params.append("df", dataFilter); - return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params }); + return this.httpClient.get(`${this.ApiEndpoint()}/api/v1/codelistitems/`, { params: params }); } }