Skip to content

Commit d9f85ad

Browse files
author
exlbashirn
committed
Update to latest
1 parent a46c824 commit d9f85ad

File tree

13 files changed

+11965
-10420
lines changed

13 files changed

+11965
-10420
lines changed

.vscode/settings.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@
1515
],
1616
"url": "/node_modules/@exlibris/exl-cloudapp-base/manifest.schema.json"
1717
}
18-
]
18+
],
19+
"workbench.colorCustomizations": {
20+
"activityBar.background": "#3F1172",
21+
"titleBar.activeBackground": "#5818A0",
22+
"titleBar.activeForeground": "#FDFCFF"
23+
}
1924
}

cloudapp/jsconfig.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"compilerOptions": {
3-
"experimentalDecorators": true,
4-
"target": "es5"
5-
}
2+
"extends": "../.ng/tsconfig.json",
63
}

cloudapp/src/app/app.module.ts

Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { NgModule } from '@angular/core';
2-
import { HttpClientModule } from '@angular/common/http';
2+
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
33
import { BrowserModule, Title } from '@angular/platform-browser';
44
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55
import { MaterialModule, AlertModule, MenuModule, CloudAppTranslateModule } from '@exlibris/exl-cloudapp-angular-lib';
66
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
7-
import { SelectEntitiesModule } from 'eca-components';
7+
import { SelectEntitiesModule } from '@exlibris/eca-components';
88

99
import { AppComponent } from './app.component';
1010
import { AppRoutingModule } from './app-routing.module';
@@ -26,47 +26,44 @@ import { ErrorComponent } from './static/error.component';
2626
import { ConfirmationDialog, StyleComponent } from './style/style.component';
2727

2828
@NgModule({
29-
declarations: [
30-
AppComponent,
31-
MainComponent,
32-
TopmenuComponent,
33-
NewrouteComponent,
34-
ThemingComponent,
35-
SettingsComponent,
36-
ParallelComponent,
37-
ExternalComponent,
38-
XmlComponent,
39-
BindComponent,
40-
StoreComponent,
41-
TranslateComponent,
42-
ConfigurationComponent,
43-
MultiSelectComponent,
44-
LightboxComponent,
45-
ErrorComponent,
46-
StyleComponent,
47-
ConfirmationDialog,
48-
],
49-
imports: [
50-
MaterialModule,
51-
BrowserModule,
52-
BrowserAnimationsModule,
53-
AppRoutingModule,
54-
HttpClientModule,
55-
FormsModule,
56-
ReactiveFormsModule,
57-
CloudAppTranslateModule.forRoot(),
58-
AlertModule,
59-
SelectEntitiesModule,
60-
MenuModule,
61-
],
62-
providers: [
63-
Title
64-
],
65-
bootstrap: [
66-
AppComponent
67-
],
68-
entryComponents: [
69-
ConfirmationDialog
70-
]
29+
declarations: [
30+
AppComponent,
31+
MainComponent,
32+
TopmenuComponent,
33+
NewrouteComponent,
34+
ThemingComponent,
35+
SettingsComponent,
36+
ParallelComponent,
37+
ExternalComponent,
38+
XmlComponent,
39+
BindComponent,
40+
StoreComponent,
41+
TranslateComponent,
42+
ConfigurationComponent,
43+
MultiSelectComponent,
44+
LightboxComponent,
45+
ErrorComponent,
46+
StyleComponent,
47+
ConfirmationDialog,
48+
],
49+
bootstrap: [
50+
AppComponent
51+
],
52+
imports: [
53+
MaterialModule,
54+
BrowserModule,
55+
BrowserAnimationsModule,
56+
AppRoutingModule,
57+
FormsModule,
58+
ReactiveFormsModule,
59+
CloudAppTranslateModule.forRoot(),
60+
AlertModule,
61+
SelectEntitiesModule,
62+
MenuModule
63+
],
64+
providers: [
65+
Title,
66+
provideHttpClient(withInterceptorsFromDi())
67+
]
7168
})
7269
export class AppModule { }
Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { Component, OnInit, Injectable } from '@angular/core';
2-
import { AppService } from '../app.service';
1+
import { Component, Injectable, OnInit } from '@angular/core';
32
import { FormBuilder, FormGroup } from '@angular/forms';
4-
import { CloudAppConfigService, CloudAppEventsService, CloudAppRestService, InitData, AlertService } from '@exlibris/exl-cloudapp-angular-lib';
5-
import { CanActivate, Router } from '@angular/router';
6-
import { Observable, iif, of } from 'rxjs';
3+
import { Router } from '@angular/router';
4+
import { AlertService, CloudAppConfigService, CloudAppEventsService, CloudAppRestService } from '@exlibris/exl-cloudapp-angular-lib';
5+
import { Observable } from 'rxjs';
76
import { map, switchMap } from 'rxjs/operators';
7+
import { AppService } from '../app.service';
88
import { ErrorMessages } from '../static/error.component';
99

1010
@Component({
@@ -13,9 +13,10 @@ import { ErrorMessages } from '../static/error.component';
1313
styleUrls: ['./configuration.component.scss']
1414
})
1515
export class ConfigurationComponent implements OnInit {
16+
1617
form: FormGroup;
1718
saving = false;
18-
19+
1920
constructor(
2021
private appService: AppService,
2122
private fb: FormBuilder,
@@ -32,11 +33,11 @@ export class ConfigurationComponent implements OnInit {
3233
}
3334

3435
load() {
35-
this.configService.getAsFormGroup().subscribe( config => {
36-
if (Object.keys(config.value).length!=0) {
36+
this.configService.getAsFormGroup().subscribe(config => {
37+
if (Object.keys(config.value).length != 0) {
3738
this.form = config;
3839
}
39-
});
40+
});
4041
}
4142

4243
save() {
@@ -47,33 +48,35 @@ export class ConfigurationComponent implements OnInit {
4748
this.form.markAsPristine();
4849
},
4950
err => this.alert.error(err.message),
50-
() => this.saving = false
51+
() => this.saving = false
5152
);
52-
}
53+
}
5354

5455
}
5556

5657
@Injectable({
5758
providedIn: 'root',
5859
})
59-
export class ConfigurationGuard implements CanActivate {
60-
constructor (
60+
export class ConfigurationGuard {
61+
62+
constructor(
6163
private eventsService: CloudAppEventsService,
6264
private restService: CloudAppRestService,
6365
private router: Router
64-
) {}
66+
) { }
6567

6668
canActivate(): Observable<boolean> {
6769
return this.eventsService.getInitData().pipe(
68-
switchMap( initData => this.restService.call(`/users/${initData.user.primaryId}`)),
69-
map( user => {
70-
if (!user.user_role.some(role=>role.role_type.value=='221')) {
71-
this.router.navigate(['/error'],
72-
{ queryParams: { error: ErrorMessages.NO_ACCESS }});
70+
switchMap(initData => this.restService.call(`/users/${initData.user.primaryId}`)),
71+
map(user => {
72+
if (!user.user_role.some(role => role.role_type.value == '221')) {
73+
this.router.navigate(['/error'],
74+
{ queryParams: { error: ErrorMessages.NO_ACCESS } });
7375
return false;
7476
}
7577
return true;
7678
})
7779
);
7880
}
81+
7982
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@use "@angular/material" as mat;
2+
3+
@mixin external-component-theme($theme, $typgraphy) {
4+
app-external .mat-mdc-tab-group.mat-tabs-with-background > .mat-mdc-tab-header {
5+
color: mat.get-theme-color($theme, on-secondary-fixed-variant);
6+
background-color: mat.get-theme-color($theme, secondary-fixed);
7+
8+
.mat-mdc-tab {
9+
&.mdc-tab--active .mdc-tab__text-label {
10+
color: mat.get-theme-color($theme, on-secondary-fixed);
11+
}
12+
&:hover {
13+
background-color: mat.get-theme-color($theme, secondary-fixed-dim);
14+
}
15+
}
16+
}
17+
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
@use "@angular/material" as mat;
2+
13
@mixin main-component-theme($theme, $typgraphy) {
2-
section>h1 {
3-
background-color: mat-color(map-get($theme, primary));
4-
color: mat-color(map-get($theme, primary), default-contrast);
4+
section > h1 {
5+
background-color: mat.get-theme-color($theme, primary);
6+
color: mat.get-theme-color($theme, on-primary);
57
}
6-
}
8+
}

cloudapp/src/app/style/style.component.scss

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
margin-right: 10px;
99
}
1010

11-
.mat-list {
12-
max-width: 400px;
11+
::ng-deep {
12+
mat-list {
13+
max-width: 400px;
14+
.mat-mdc-list-item-line {
15+
display: flex;
16+
justify-content: space-between;
17+
align-items: center;
18+
}
19+
}
1320
}
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
@use "@angular/material" as mat;
2+
13
@mixin theming-component-theme($theme, $typgraphy) {
24
.themed-box {
3-
border-color: mat-color(map-get($theme, primary));
5+
border-color: mat.get-theme-color($theme, primary);
46
}
5-
}
7+
}

cloudapp/src/app/xml/bib-utils.ts

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import { CloudAppRestService, HttpMethod } from "@exlibris/exl-cloudapp-angular-lib";
2-
import { Observable } from "rxjs";
3-
import { map } from "rxjs/operators";
42

53
export interface Bib {
64
link: string,
@@ -19,43 +17,46 @@ export class BibUtils {
1917
}
2018

2119
/** Retrieve a single BIB record */
22-
getBib (mmsId: string) {
20+
getBib(mmsId: string) {
2321
return this._restService.call<Bib>(`/bibs/${mmsId}`);
24-
}
22+
}
2523

2624
/** Update a BIB record with the specified MARCXML */
27-
updateBib( bib: Bib ) {
28-
return this._restService.call<Bib>( {
25+
updateBib(bib: Bib) {
26+
return this._restService.call<Bib>({
2927
url: `/bibs/${bib.mms_id}`,
30-
headers: {
28+
headers: {
3129
"Content-Type": "application/xml",
32-
Accept: "application/json" },
30+
Accept: "application/json"
31+
},
3332
requestBody: `<bib>${bib.anies}</bib>`,
3433
method: HttpMethod.PUT
3534
});
36-
}
35+
}
3736

3837
/** Adds a 500 note field to a MARC21 Bibliographic Record */
3938
addNoteToBib(bib: Bib) {
4039
const doc = new DOMParser().parseFromString(bib.anies, "application/xml");
41-
const datafield = dom("datafield", {
42-
parent: doc.documentElement,
43-
attributes: [ ["tag", "500"], ["ind1", " "], ["ind2", " "] ]
40+
const datafield = dom("datafield", {
41+
parent: doc.documentElement,
42+
attributes: [["tag", "500"], ["ind1", " "], ["ind2", " "]]
4443
});
45-
dom("subfield", {
46-
parent: datafield,
47-
text: `Record processed at ${(new Date()).toLocaleString()}`,
48-
attributes: [ ["code", "a"] ]
44+
dom("subfield", {
45+
parent: datafield,
46+
text: `Record processed at ${(new Date()).toLocaleString()}`,
47+
attributes: [["code", "a"]]
4948
});
5049
bib.anies = new XMLSerializer().serializeToString(doc.documentElement);
5150
return bib;
52-
}
51+
}
5352
}
5453

5554
/** Adds Element to dom and returns it */
56-
const dom = (name: string, options: {parent?: Element | Node, text?:
57-
string, className?: string, id?: string, attributes?: string[][]} = {}
58-
): Element => {
55+
const dom = (name: string, options: {
56+
parent?: Element, text?:
57+
string, className?: string, id?: string, attributes?: string[][]
58+
} = {}
59+
): Element => {
5960

6061
let ns = options.parent ? options.parent.namespaceURI : '';
6162
let element = document.createElementNS(ns, name);
@@ -66,5 +67,5 @@ const dom = (name: string, options: {parent?: Element | Node, text?:
6667
if (options.id) element.id = options.id;
6768
if (options.attributes) options.attributes.forEach(([att, val]) => element.setAttribute(att, val));
6869

69-
return element;
70+
return element;
7071
}

cloudapp/src/main.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11

22
@import './app/main/main.component.theme';
33
@import './app/theming/theming.component.theme';
4+
@import './app/external/external.component.theme';
45

56
@mixin themed-styles($theme, $typography) {
67
/* Include themed component mixins or theme dependent styles here */
78
@include main-component-theme($theme, $typography);
89
@include theming-component-theme($theme, $typography);
10+
@include external-component-theme($theme, $typography);
911
}
1012

1113
@mixin global-styles {

0 commit comments

Comments
 (0)