diff --git a/.ng/angular.json b/.ng/angular.json new file mode 100644 index 0000000..f4f9d0d --- /dev/null +++ b/.ng/angular.json @@ -0,0 +1,112 @@ +{ + "$schema": "../node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "projects": { + "exl-cloudapp-sdk-base": { + "projectType": "application", + "schematics": { + "@schematics/angular:component": { + "style": "scss" + } + }, + "root": "", + "sourceRoot": "src", + "prefix": "app", + "architect": { + "build": { + "builder": "@angular-devkit/build-angular:browser", + "options": { + "outputPath": "../build", + "index": "src/index.html", + "main": "src/main.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.app.json", + "aot": false, + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], + "scripts": [], + "allowedCommonJsDependencies": [ + "strongly-typed-events", + "lodash", + "loglevel", + "ngx-translate-parser-plural-select" + ] + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "3mb", + "maximumError": "6mb" + }, + { + "type": "anyComponentStyle", + "maximumWarning": "6kb", + "maximumError": "10kb" + } + ] + } + } + }, + "serve": { + "builder": "@angular-devkit/build-angular:dev-server", + "options": { + "browserTarget": "exl-cloudapp-sdk-base:build", + "proxyConfig": "src/proxy.conf.js", + "disableHostCheck": false, + "port": 4200 + }, + "configurations": { + "production": { + "browserTarget": "exl-cloudapp-sdk-base:build:production" + } + } + }, + "extract-i18n": { + "builder": "@angular-devkit/build-angular:extract-i18n", + "options": { + "browserTarget": "exl-cloudapp-sdk-base:build" + } + }, + "test": { + "builder": "@angular-devkit/build-angular:karma", + "options": { + "main": "src/test.ts", + "polyfills": "src/polyfills.ts", + "tsConfig": "tsconfig.spec.json", + "karmaConfig": "karma.conf.js", + "assets": [ + "src/favicon.ico", + "src/assets" + ], + "styles": [ + "src/styles.scss" + ], + "scripts": [] + } + } + } + }}, + "defaultProject": "exl-cloudapp-sdk-base" +} \ No newline at end of file diff --git a/.ng/browserslist b/.ng/browserslist new file mode 100644 index 0000000..8084853 --- /dev/null +++ b/.ng/browserslist @@ -0,0 +1,12 @@ +# This file is used by the build system to adjust CSS and JS output to support the specified browsers below. +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries + +# You can see what browsers were selected by your queries by running: +# npx browserslist + +> 0.5% +last 2 versions +Firefox ESR +not dead +not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/.ng/jsconfig.json b/.ng/jsconfig.json new file mode 100644 index 0000000..003f5d2 --- /dev/null +++ b/.ng/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "experimentalDecorators": true, + "target": "es5" + }, + "angularCompilerOptions": { + "strictTemplates": true + } +} diff --git a/.ng/karma.conf.js b/.ng/karma.conf.js new file mode 100644 index 0000000..51ab2ee --- /dev/null +++ b/.ng/karma.conf.js @@ -0,0 +1,32 @@ +// Karma configuration file, see link for more information +// https://karma-runner.github.io/1.0/config/configuration-file.html + +module.exports = function (config) { + config.set({ + basePath: '', + frameworks: ['jasmine', '@angular-devkit/build-angular'], + plugins: [ + require('karma-jasmine'), + require('karma-chrome-launcher'), + require('karma-jasmine-html-reporter'), + require('karma-coverage-istanbul-reporter'), + require('@angular-devkit/build-angular/plugins/karma') + ], + client: { + clearContext: false // leave Jasmine Spec Runner output visible in browser + }, + coverageIstanbulReporter: { + dir: require('path').join(__dirname, './coverage/ng-test'), + reports: ['html', 'lcovonly', 'text-summary'], + fixWebpackSourcePaths: true + }, + reporters: ['progress', 'kjhtml'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['Chrome'], + singleRun: false, + restartOnFileChange: true + }); +}; diff --git a/.ng/package.json b/.ng/package.json new file mode 100644 index 0000000..0f207eb --- /dev/null +++ b/.ng/package.json @@ -0,0 +1,12 @@ +{ + "name": "exl-cloudapp-sdk-base", + "version": "0.0.0", + "scripts": { + "start": "node ../node_modules/@angular/cli/bin/ng serve", + "build": "node ../node_modules/@angular/cli/bin/ng build --prod", + "generate": "node ../node_modules/@angular/cli/bin/ng generate", + "test": "node ../node_modules/@angular/cli/bin/ng test", + "extract-i18n": "node ../node_modules/@biesbjerg/ngx-translate-extract/bin/cli.js" + }, + "private": true +} diff --git a/.ng/src/app/app-routing.module.ts b/.ng/src/app/app-routing.module.ts new file mode 100644 index 0000000..a7ac35d --- /dev/null +++ b/.ng/src/app/app-routing.module.ts @@ -0,0 +1,13 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { MainComponent } from './main/main.component'; + +const routes: Routes = [ + { path: '', component: MainComponent }, +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes, { useHash: true })], + exports: [RouterModule] +}) +export class AppRoutingModule { } diff --git a/.ng/src/app/app.component.ts b/.ng/src/app/app.component.ts new file mode 100644 index 0000000..7af5162 --- /dev/null +++ b/.ng/src/app/app.component.ts @@ -0,0 +1,12 @@ +import { Component } from '@angular/core'; +import { AppService } from './app.service'; + +@Component({ + selector: 'app-root', + template: '' +}) +export class AppComponent { + + constructor(private appService: AppService) { } + +} diff --git a/.ng/src/app/app.module.ts b/.ng/src/app/app.module.ts new file mode 100644 index 0000000..2db5949 --- /dev/null +++ b/.ng/src/app/app.module.ts @@ -0,0 +1,37 @@ +import { NgModule } from '@angular/core'; +import { HttpClientModule } from '@angular/common/http'; +import { BrowserModule } from '@angular/platform-browser'; +import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { MaterialModule, CloudAppTranslateModule, AlertModule } from '@exlibris/exl-cloudapp-angular-lib'; +import { AppComponent } from './app.component'; +import { AppRoutingModule } from './app-routing.module'; +import { MainComponent } from './main/main.component'; +import { PrintButtonComponent } from './print-button/print-button.component'; +import { StorageLocationIdSortPipe } from './storage-location-id-sort.pipe'; + +@NgModule({ + declarations: [ + AppComponent, + MainComponent, + PrintButtonComponent, + StorageLocationIdSortPipe + ], + imports: [ + MaterialModule, + BrowserModule, + BrowserAnimationsModule, + AppRoutingModule, + HttpClientModule, + AlertModule, + FormsModule, + ReactiveFormsModule, + CloudAppTranslateModule.forRoot(), + ], + providers: [ + { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'standard' } }, + ], + bootstrap: [AppComponent] +}) +export class AppModule { } diff --git a/.ng/src/app/app.service.ts b/.ng/src/app/app.service.ts new file mode 100644 index 0000000..48b7707 --- /dev/null +++ b/.ng/src/app/app.service.ts @@ -0,0 +1,12 @@ + +import { Injectable } from '@angular/core'; +import { InitService } from '@exlibris/exl-cloudapp-angular-lib'; + +@Injectable({ + providedIn: 'root' +}) +export class AppService { + + constructor(private initService: InitService) {} + +} \ No newline at end of file diff --git a/.ng/src/app/interfaces/requested-resources.interface.ts b/.ng/src/app/interfaces/requested-resources.interface.ts new file mode 100644 index 0000000..69f2416 --- /dev/null +++ b/.ng/src/app/interfaces/requested-resources.interface.ts @@ -0,0 +1,90 @@ +export interface RequestedResources { + requested_resource: RequestedResource[] + total_record_count: number + } + + export interface RequestedResource { + location: Location + resource_metadata: ResourceMetadata + request: Request[] + } + + export interface Location { + library: Library + holding_id: HoldingId + shelving_location: string + copy: Copy[] + call_number?: string + } + + export interface Library { + value: string + desc: string + } + + export interface HoldingId { + value: string + link: string + } + + export interface Copy { + pid: string + barcode: string + base_status: BaseStatus + alternative_call_number: string + storage_location_id: string + link: string + } + + export interface BaseStatus { + value: string + desc: string + } + + export interface ResourceMetadata { + title: string + author?: string + isbn?: string + publisher?: string + mms_id: MmsId + publication_place?: string + publication_year: string + issn?: string + } + + export interface MmsId { + value: string + link: string + } + + export interface Request { + description: any + id: string + destination: Destination + requester: Requester + printed: boolean + reported: boolean + request_type: string + request_sub_type: RequestSubType + request_date: string + request_time: string + link: string + comment?: string + email: string + } + + export interface Destination { + value: string + desc: string + } + + export interface Requester { + desc: string + link?: string + } + + export interface RequestSubType { + value: string + desc?: string + } + \ No newline at end of file diff --git a/.ng/src/app/interfaces/user_info.interface.ts b/.ng/src/app/interfaces/user_info.interface.ts new file mode 100644 index 0000000..4438869 --- /dev/null +++ b/.ng/src/app/interfaces/user_info.interface.ts @@ -0,0 +1,143 @@ +export interface UserInfo { + gender: Gender + password: string + status: Status + record_type: RecordType + primary_id: string + first_name: string + middle_name: string + last_name: string + full_name: string + user_title: UserTitle + job_category: JobCategory + job_description: string + user_group: UserGroup + campus_code: CampusCode + web_site_url: string + cataloger_level: CatalogerLevel + preferred_language: PreferredLanguage + account_type: AccountType + external_id: string + force_password_change: string + status_date: string + contact_info: ContactInfo + user_identifier: any[] + user_role: UserRole[] + user_block: any[] + user_note: any[] + user_statistic: any[] + proxy_for_user: any[] + rs_library: RsLibrary[] + pref_first_name: string + pref_middle_name: string + pref_last_name: string + pref_name_suffix: string + is_researcher: boolean + } + + export interface Gender { + value: string + desc: string + } + + export interface Status { + value: string + desc: string + } + + export interface RecordType { + value: string + desc: string + } + + export interface UserTitle { + value: string + desc: string + } + + export interface JobCategory { + value: string + desc: string + } + + export interface UserGroup { + value: string + desc: string + } + + export interface CampusCode { + desc: string + } + + export interface CatalogerLevel { + value: string + desc: string + } + + export interface PreferredLanguage { + value: string + desc: string + } + + export interface AccountType { + value: string + desc: string + } + + export interface ContactInfo { + address: any[] + email: any[] + phone: any[] + } + + export interface UserRole { + status: Status2 + scope: Scope + role_type: RoleType + parameter: Parameter[] + } + + export interface Status2 { + value: string + desc: string + } + + export interface Scope { + value: string + desc: string + } + + export interface RoleType { + value: string + desc: string + } + + export interface Parameter { + type: Type + scope?: Scope2 + value: Value + } + + export interface Type { + value: string + } + + export interface Scope2 { + value: string + desc: string + } + + export interface Value { + value: string + desc: string + } + + export interface RsLibrary { + code: Code + } + + export interface Code { + value: string + desc: string + } + \ No newline at end of file diff --git a/.ng/src/app/main/main.component.html b/.ng/src/app/main/main.component.html new file mode 100644 index 0000000..1e5449a --- /dev/null +++ b/.ng/src/app/main/main.component.html @@ -0,0 +1,65 @@ +
+ +
+ +
+ + + RMST Pick List + + +
    +
  • + Today's Date: {{ today | date: 'mediumDate' }} +
  • +
  • +

    Total: {{ getTotalVisible() }}

    +
  • +
+
+ +
+
+
+ +
+
+
+ + + {{ i+1 }}. {{ resource.resource_metadata.title }} + + + + +
+
RMST
+
{{ copy.storage_location_id }}
+
Barcode
+
{{ copy.barcode }}
+
Status
+
{{ copy.base_status.desc }}
+
+ +
+
Description
+
{{ request.description }}
+
Pickup Location
+
{{ request.destination.desc }}
+
Requester
+
{{ request.requester.desc }}
+
+
Requester Email
+
{{ request.email }}
+
+
+
+
+
+
+
+ +
+
diff --git a/.ng/src/app/main/main.component.scss b/.ng/src/app/main/main.component.scss new file mode 100644 index 0000000..db5c26b --- /dev/null +++ b/.ng/src/app/main/main.component.scss @@ -0,0 +1,36 @@ +.mat-card { + margin-bottom: 20px; +} + +@media print { + .options { + display: none; + } + + .remove-button { + display: none; + } +} + +dl { + display: flex; + flex-direction: column; + border-collapse: collapse; + width: 100%; + margin: 0; + padding: 0; +} + +dt, +dd { + display: flex; + flex: 1; + justify-content: space-between; + align-items: center; + margin-left: 0; + padding: .25em .25em 0em 0em; +} + +dt { + font-weight: bold; +} \ No newline at end of file diff --git a/.ng/src/app/main/main.component.spec.ts b/.ng/src/app/main/main.component.spec.ts new file mode 100644 index 0000000..49b88fb --- /dev/null +++ b/.ng/src/app/main/main.component.spec.ts @@ -0,0 +1,20 @@ +import { waitForAsync, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; +import { MainComponent } from './main.component'; +describe('MainComponent', () => { + let component: MainComponent; + let fixture: ComponentFixture; + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ MainComponent ], + }) + .compileComponents(); + })); + beforeEach(() => { + fixture = TestBed.createComponent(MainComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + it('should create', () => { + expect(component).toBeTruthy(); + }); +}) \ No newline at end of file diff --git a/.ng/src/app/main/main.component.theme.scss b/.ng/src/app/main/main.component.theme.scss new file mode 100644 index 0000000..efe8e56 --- /dev/null +++ b/.ng/src/app/main/main.component.theme.scss @@ -0,0 +1,8 @@ +@mixin main-component-theme($theme, $typgraphy) { + div.highlight { + border: mat-color(map-get($theme, primary)) solid 2px; + background-color: mat-color(map-get($theme, primary), lighter); + padding: 5px; + font-weight: bolder; + } +} \ No newline at end of file diff --git a/.ng/src/app/main/main.component.ts b/.ng/src/app/main/main.component.ts new file mode 100644 index 0000000..adce017 --- /dev/null +++ b/.ng/src/app/main/main.component.ts @@ -0,0 +1,100 @@ +import { Component, OnInit, OnDestroy } from '@angular/core'; +import { AlertService } from '@exlibris/exl-cloudapp-angular-lib'; +import { RequestedResource, RequestedResources } from '../interfaces/requested-resources.interface'; +import { RequestedResourcesService } from '../services/requested_resources.service'; +import { CloudAppEventsService } from '@exlibris/exl-cloudapp-angular-lib'; +import { UserInfoService } from '../services/user_info.service'; +import { RequestInfoService } from '../services/request_info.service'; + +@Component({ + selector: 'app-main', + templateUrl: './main.component.html', + styleUrls: ['./main.component.scss'] +}) + +export class MainComponent implements OnInit, OnDestroy { + loading: boolean; + noItemsMessage: string; + today: number = Date.now(); + requestedResources: RequestedResources; + currentlyAtLibCode: string; + curentlyAtCircDeskCode: string; + + constructor( + private alert: AlertService, + private eventsService: CloudAppEventsService, + private requestedResourcesService: RequestedResourcesService, + private userInfoService: UserInfoService, + private requestInfoService: RequestInfoService + ) { } + + ngOnInit() { + this.requestedResourcesService.isLoading().subscribe( + loading => this.loading = loading + ); + + this.eventsService.getInitData().subscribe( + data => { + this.requestedResourcesService.getRequestedResources(data.user.currentlyAtLibCode, + data.user['currentlyAtCircDesk'], 100, this.alert).subscribe( + result => { + this.requestedResources = result + + this.requestedResources.requested_resource.forEach(resource => { + console.log('Resource:', resource) + this.addRequestInfoToRequestedResource(resource); + this.addEmailToRequestedResource(resource); + }); + } + ); + } + ); + } + + addRequestInfoToRequestedResource(resource: RequestedResource) { + resource.request.forEach(request => { + if (request.link) { + this.requestInfoService.getRequestInfo(request.link, this.alert).subscribe(result => { + console.log('Request Info: ', result); + this.requestedResources.requested_resource.forEach(() => { + request.description = result.description + console.log(request) + }); + }); + } + }); + } + + addEmailToRequestedResource(resource: RequestedResource) { + resource.request.forEach(request => { + if (request.requester.link) { + this.userInfoService.getUserInfo(request.requester.link, this.alert).subscribe(result => { + this.requestedResources.requested_resource.forEach(() => { + request.email = result.contact_info.email + .map(contact => contact.email_address) + .join(', '); + }); + }); + } + }); + } + + getVisibleResources(): RequestedResource[] { + return this.requestedResources.requested_resource + } + + getTotalVisible(): number { + return this.getVisibleResources().length; + } + + hideResource(index: number): void { + const filteredAndSortedResources = this.getVisibleResources(); + if (filteredAndSortedResources[index]) { + const resourceId = filteredAndSortedResources[index].location.holding_id.value; + this.requestedResources.requested_resource = this.requestedResources.requested_resource.filter(resource => resource.location.holding_id.value !== resourceId); + } + } + + ngOnDestroy(): void { + } +} diff --git a/.ng/src/app/print-button/print-button.component.html b/.ng/src/app/print-button/print-button.component.html new file mode 100644 index 0000000..f0f5a15 --- /dev/null +++ b/.ng/src/app/print-button/print-button.component.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/.ng/src/app/print-button/print-button.component.scss b/.ng/src/app/print-button/print-button.component.scss new file mode 100644 index 0000000..650dc41 --- /dev/null +++ b/.ng/src/app/print-button/print-button.component.scss @@ -0,0 +1,5 @@ +@media print { + .print-button { + display: none; + } +} \ No newline at end of file diff --git a/.ng/src/app/print-button/print-button.component.spec.ts b/.ng/src/app/print-button/print-button.component.spec.ts new file mode 100644 index 0000000..a6a9407 --- /dev/null +++ b/.ng/src/app/print-button/print-button.component.spec.ts @@ -0,0 +1,25 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PrintButtonComponent } from './print-button.component'; + +describe('PrintButtonComponent', () => { + let component: PrintButtonComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ PrintButtonComponent ] + }) + .compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(PrintButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/.ng/src/app/print-button/print-button.component.ts b/.ng/src/app/print-button/print-button.component.ts new file mode 100644 index 0000000..81e1b88 --- /dev/null +++ b/.ng/src/app/print-button/print-button.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-print-button', + templateUrl: './print-button.component.html', + styleUrls: ['./print-button.component.scss'] +}) +export class PrintButtonComponent implements OnInit { + + constructor() { } + + ngOnInit(): void { + } + + print() { + console.log('print?') + window.print(); + } +} diff --git a/.ng/src/app/services/request_info.service.ts b/.ng/src/app/services/request_info.service.ts new file mode 100644 index 0000000..7b9897e --- /dev/null +++ b/.ng/src/app/services/request_info.service.ts @@ -0,0 +1,33 @@ +import { Injectable } from '@angular/core'; +import { CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { finalize, tap, catchError } from 'rxjs/operators'; + +@Injectable({ + providedIn: 'root' +}) +export class RequestInfoService { + private loadingSubject = new BehaviorSubject(false); + + constructor( + private restService: CloudAppRestService, + ) { } + + getRequestInfo(link, alert: any): Observable { + const apiUrl = link; + this.loadingSubject.next(true); + + return this.restService.call(apiUrl).pipe( + finalize(() => this.loadingSubject.next(false)), + catchError(error => { + this.loadingSubject.next(false); + alert.error('Failed to load user info. Error: ' + error.message); + throw error; + }) + ); + } + + isLoading(): Observable { + return this.loadingSubject.asObservable(); + } +} diff --git a/.ng/src/app/services/requested_resources.service.ts b/.ng/src/app/services/requested_resources.service.ts new file mode 100644 index 0000000..7af0981 --- /dev/null +++ b/.ng/src/app/services/requested_resources.service.ts @@ -0,0 +1,35 @@ +import { Injectable } from '@angular/core'; +import { CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { finalize, tap, catchError } from 'rxjs/operators'; +import { RequestedResources } from '../interfaces/requested-resources.interface'; + +@Injectable({ + providedIn: 'root' +}) +export class RequestedResourcesService { + private loadingSubject = new BehaviorSubject(false); + + constructor( + private restService: CloudAppRestService, + ) { } + + getRequestedResources(library: string, circ_desk: string, limit: number, alert: any): Observable { + const apiUrl = `/almaws/v1/task-lists/requested-resources?library=${library}&circ_desk=${circ_desk}&limit=${limit.toString()}`; + this.loadingSubject.next(true); + + return this.restService.call(apiUrl).pipe( + tap(result => console.log('result', JSON.stringify(result))), + finalize(() => this.loadingSubject.next(false)), + catchError(error => { + this.loadingSubject.next(false); + alert.error('Failed to retrieve resource: ' + error.message); + throw error; + }) + ); + } + + isLoading(): Observable { + return this.loadingSubject.asObservable(); + } +} diff --git a/.ng/src/app/services/user_info.service.ts b/.ng/src/app/services/user_info.service.ts new file mode 100644 index 0000000..2df55da --- /dev/null +++ b/.ng/src/app/services/user_info.service.ts @@ -0,0 +1,35 @@ +import { Injectable } from '@angular/core'; +import { CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { finalize, tap, catchError } from 'rxjs/operators'; +import { UserInfo } from '../interfaces/user_info.interface'; + +@Injectable({ + providedIn: 'root' +}) +export class UserInfoService { + private loadingSubject = new BehaviorSubject(false); + + constructor( + private restService: CloudAppRestService, + ) { } + + getUserInfo(link, alert: any): Observable { + const apiUrl = link; + this.loadingSubject.next(true); + + return this.restService.call(apiUrl).pipe( + tap(result => console.log('result', result)), + finalize(() => this.loadingSubject.next(false)), + catchError(error => { + this.loadingSubject.next(false); + alert.error('Failed to load user info. Error: ' + error.message); + throw error; + }) + ); + } + + isLoading(): Observable { + return this.loadingSubject.asObservable(); + } +} \ No newline at end of file diff --git a/.ng/src/app/storage-location-id-sort.pipe.ts b/.ng/src/app/storage-location-id-sort.pipe.ts new file mode 100644 index 0000000..64bdf43 --- /dev/null +++ b/.ng/src/app/storage-location-id-sort.pipe.ts @@ -0,0 +1,20 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { RequestedResource } from './interfaces/requested-resources.interface'; + +@Pipe({ name: 'storageLocationIdSort' }) +export class StorageLocationIdSortPipe implements PipeTransform { + transform(requestedResources: RequestedResource[], sortOrder: 'asc' | 'desc' = 'asc'): RequestedResource[] { + if (!requestedResources) { + return []; + } + + return requestedResources.sort((a, b) => { + const storageLocationIdA = a.location?.copy?.length ? a.location.copy[0].storage_location_id : ''; + const storageLocationIdB = b.location?.copy?.length ? b.location.copy[0].storage_location_id : ''; + + return sortOrder === 'asc' + ? storageLocationIdA.localeCompare(storageLocationIdB) + : storageLocationIdB.localeCompare(storageLocationIdA); + }); + } +} \ No newline at end of file diff --git a/.ng/src/assets/.gitkeep b/.ng/src/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.ng/src/assets/manifest.json b/.ng/src/assets/manifest.json new file mode 100644 index 0000000..eb708c8 --- /dev/null +++ b/.ng/src/assets/manifest.json @@ -0,0 +1,15 @@ +{ + "id": "rmst-pick-list", + "title": "RMST Pick List", + "subtitle": "Cloud App for printing a pick list from an RMST search", + "author": "JHU Library Applications Group", + "icon": { + "type": "font", + "value": "fa fa-list" + }, + "contentSecurity": { + "sandbox": { + "modals": true + } + } +} \ No newline at end of file diff --git a/.ng/src/environments/environment.prod.ts b/.ng/src/environments/environment.prod.ts new file mode 100644 index 0000000..3612073 --- /dev/null +++ b/.ng/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true +}; diff --git a/.ng/src/environments/environment.ts b/.ng/src/environments/environment.ts new file mode 100644 index 0000000..7b4f817 --- /dev/null +++ b/.ng/src/environments/environment.ts @@ -0,0 +1,16 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. +// The list of file replacements can be found in `angular.json`. + +export const environment = { + production: false +}; + +/* + * For easier debugging in development mode, you can import the following file + * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. + * + * This import should be commented out in production mode because it will have a negative impact + * on performance if an error is thrown. + */ +// import 'zone.js/dist/zone-error'; // Included with Angular CLI. diff --git a/.ng/src/favicon.ico b/.ng/src/favicon.ico new file mode 100644 index 0000000..8081c7c Binary files /dev/null and b/.ng/src/favicon.ico differ diff --git a/.ng/src/i18n/.gitkeep b/.ng/src/i18n/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/.ng/src/index.html b/.ng/src/index.html new file mode 100644 index 0000000..b93d64b --- /dev/null +++ b/.ng/src/index.html @@ -0,0 +1,78 @@ + + + + + + + EXL Cloud App + + + + + + + + + +
+ + + +
+
+ + + \ No newline at end of file diff --git a/.ng/src/main.scss b/.ng/src/main.scss new file mode 100644 index 0000000..8b57a01 --- /dev/null +++ b/.ng/src/main.scss @@ -0,0 +1,19 @@ + +@import './app/main/main.component.theme'; + +@mixin themed-styles($theme, $typography) { + /* Include themed component mixins or theme dependent styles here */ + @include main-component-theme($theme, $typography); +} + +@mixin global-styles { + /* Add global styles here */ + + @media print { + @page { + size: 8.5in 11in; + margin: .25in; + margin-bottom: .5in; + } + } +} diff --git a/.ng/src/main.ts b/.ng/src/main.ts new file mode 100644 index 0000000..c7b673c --- /dev/null +++ b/.ng/src/main.ts @@ -0,0 +1,12 @@ +import { enableProdMode } from '@angular/core'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + +import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; + +if (environment.production) { + enableProdMode(); +} + +platformBrowserDynamic().bootstrapModule(AppModule) + .catch(err => console.error(err)); diff --git a/.ng/src/polyfills.ts b/.ng/src/polyfills.ts new file mode 100644 index 0000000..aa665d6 --- /dev/null +++ b/.ng/src/polyfills.ts @@ -0,0 +1,63 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/guide/browser-support + */ + +/*************************************************************************************************** + * BROWSER POLYFILLS + */ + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** + * Web Animations `@angular/platform-browser/animations` + * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari. + * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0). + */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. + +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + * because those flags need to be set before `zone.js` being loaded, and webpack + * will put import in the top of bundle, so user need to create a separate file + * in this directory (for example: zone-flags.ts), and put the following flags + * into that file, and then add the following code before importing zone.js. + * import './zone-flags.ts'; + * + * The flags allowed in zone-flags.ts are listed here. + * + * The following flags will work for all browsers. + * + * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + * + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + * + * (window as any).__Zone_enable_cross_context_check = true; + * + */ + +/*************************************************************************************************** + * Zone JS is required by default for Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ diff --git a/.ng/src/proxy.conf.js b/.ng/src/proxy.conf.js new file mode 100644 index 0000000..fd5a617 --- /dev/null +++ b/.ng/src/proxy.conf.js @@ -0,0 +1,25 @@ +const {target} = require("../config.json"); + +const PROXY_CONFIG = { + "/": { + target, + secure: false, + onProxyRes: (proxyRes, req, res) => { + let cookies = proxyRes.headers['set-cookie']; + cookies && cookies.forEach((val, i, arr) => { + const parts = val.split(";").map(p=>p.trim()); + arr[i] = parts.filter(p=>p.match(/^(?!SameSite|Secure)/i)).join('; ') + /* Handle sticky cookie for load balancer */ + .replace(/__Secure-/g, "KUKUBALALA"); + }); + proxyRes.headers['set-cookie'] = cookies; + }, + onProxyReq: (proxyReq, req, res) => { + let cookies = req.headers['cookie']; + /* Handle sticky cookie for load balancer */ + cookies && proxyReq.setHeader('Cookie', cookies.replace(/KUKUBALALA/g, "__Secure-")); + } + } +} + +module.exports = PROXY_CONFIG; \ No newline at end of file diff --git a/.ng/src/styles.scss b/.ng/src/styles.scss new file mode 100644 index 0000000..4bade68 --- /dev/null +++ b/.ng/src/styles.scss @@ -0,0 +1,11 @@ +@import '~@exlibris/exl-cloudapp-angular-lib/styles/styles'; +@import './main.scss'; + +@each $color, +$theme in $cloudapp-color-map { + body.cloudapp-theme--#{$color} { + @include themed-styles($theme, $app-typography); + } +} + +@include global-styles(); \ No newline at end of file diff --git a/.ng/src/test.ts b/.ng/src/test.ts new file mode 100644 index 0000000..50193eb --- /dev/null +++ b/.ng/src/test.ts @@ -0,0 +1,25 @@ +// This file is required by karma.conf.js and loads recursively all the .spec and framework files + +import 'zone.js/dist/zone-testing'; +import { getTestBed } from '@angular/core/testing'; +import { + BrowserDynamicTestingModule, + platformBrowserDynamicTesting +} from '@angular/platform-browser-dynamic/testing'; + +declare const require: { + context(path: string, deep?: boolean, filter?: RegExp): { + keys(): string[]; + (id: string): T; + }; +}; + +// First, initialize the Angular testing environment. +getTestBed().initTestEnvironment( + BrowserDynamicTestingModule, + platformBrowserDynamicTesting() +); +// Then we find all the tests. +const context = require.context('./', true, /\.spec\.ts$/); +// And load the modules. +context.keys().map(context); diff --git a/.ng/tsconfig.app.json b/.ng/tsconfig.app.json new file mode 100644 index 0000000..876792e --- /dev/null +++ b/.ng/tsconfig.app.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/app", + "types": [] + }, + "files": [ + "src/main.ts", + "src/polyfills.ts" + ], + "exclude": [ + "src/test.ts", + "src/**/*.spec.ts", + "src/testing/*" + ] +} diff --git a/.ng/tsconfig.json b/.ng/tsconfig.json new file mode 100644 index 0000000..4360855 --- /dev/null +++ b/.ng/tsconfig.json @@ -0,0 +1,29 @@ +{ + "compileOnSave": false, + "compilerOptions": { + "baseUrl": "./", + "outDir": "./dist/out-tsc", + "sourceMap": true, + "declaration": false, + "downlevelIteration": true, + "experimentalDecorators": true, + "module": "esnext", + "moduleResolution": "node", + "importHelpers": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" + ], + "lib": [ + "es2018", + "dom" + ] + }, + "angularCompilerOptions": { + "fullTemplateTypeCheck": true, + "enableIvy": true, + "strictInjectionParameters": true + } +} diff --git a/.ng/tsconfig.spec.json b/.ng/tsconfig.spec.json new file mode 100644 index 0000000..6400fde --- /dev/null +++ b/.ng/tsconfig.spec.json @@ -0,0 +1,18 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "types": [ + "jasmine", + "node" + ] + }, + "files": [ + "src/test.ts", + "src/polyfills.ts" + ], + "include": [ + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} diff --git a/package.json b/package.json index 6b0b475..b3a2986 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "private": true, "scripts": { "start": "eca start", - "test": "cd .ng/ && ng test --browsers=ChromeHeadless --progress=false --watch=false --source-map=false" + "test": "eca test --browsers=ChromeHeadless --progress=false --watch=false --source-map=false" }, "dependencies": { "@angular/animations": "~11.2.14",