-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
documents: rewrite public holdings view in Angular
* Implements the holdings section of the document detailed view of the public interface to improve the user experience when loading holdings with lots of items. With the JINJA templates, the performance is very bad. Angular allows to lazy load data and will make easier to add dynamic interaction between the user and the interface. Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
- Loading branch information
1 parent
41f78ca
commit 099ed62
Showing
58 changed files
with
3,158 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// @ts-check | ||
// Protractor configuration file, see link for more information | ||
// https://github.com/angular/protractor/blob/master/lib/config.ts | ||
|
||
const { SpecReporter } = require('jasmine-spec-reporter'); | ||
|
||
/** | ||
* @type { import("protractor").Config } | ||
*/ | ||
exports.config = { | ||
allScriptsTimeout: 11000, | ||
specs: [ | ||
'./src/**/*.e2e-spec.ts' | ||
], | ||
capabilities: { | ||
'browserName': 'chrome' | ||
}, | ||
directConnect: true, | ||
baseUrl: 'http://localhost:4200/', | ||
framework: 'jasmine', | ||
jasmineNodeOpts: { | ||
showColors: true, | ||
defaultTimeoutInterval: 30000, | ||
print: function() {} | ||
}, | ||
onPrepare() { | ||
require('ts-node').register({ | ||
project: require('path').join(__dirname, './tsconfig.json') | ||
}); | ||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { AppPage } from './app.po'; | ||
import { browser, logging } from 'protractor'; | ||
|
||
describe('workspace-project App', () => { | ||
let page: AppPage; | ||
|
||
beforeEach(() => { | ||
page = new AppPage(); | ||
}); | ||
|
||
it('should display welcome message', () => { | ||
page.navigateTo(); | ||
expect(page.getTitleText()).toEqual('Welcome to search-bar!'); | ||
}); | ||
|
||
afterEach(async () => { | ||
// Assert that there are no errors emitted from the browser | ||
const logs = await browser.manage().logs().get(logging.Type.BROWSER); | ||
expect(logs).not.toContain(jasmine.objectContaining({ | ||
level: logging.Level.SEVERE, | ||
} as logging.Entry)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { browser, by, element } from 'protractor'; | ||
|
||
export class AppPage { | ||
navigateTo() { | ||
return browser.get(browser.baseUrl) as Promise<any>; | ||
} | ||
|
||
getTitleText() { | ||
return element(by.css('app-root h1')).getText() as Promise<string>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"extends": "../../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../out-tsc/e2e", | ||
"module": "commonjs", | ||
"target": "es2018", | ||
"types": [ | ||
"jasmine", | ||
"jasminewd2", | ||
"node" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// 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('@angular-devkit/build-angular/plugins/karma') | ||
], | ||
client: { | ||
clearContext: false // leave Jasmine Spec Runner output visible in browser | ||
}, | ||
coverageIstanbulReporter: { | ||
dir: require('path').join(__dirname, '../../coverage/public-holdings-items'), | ||
reports: ['html', 'lcovonly', 'text-summary'], | ||
fixWebpackSourcePaths: true | ||
}, | ||
reporters: ['progress', 'kjhtml'], | ||
port: 9876, | ||
colors: true, | ||
logLevel: config.LOG_INFO, | ||
autoWatch: true, | ||
browsers: ['Chrome'], | ||
customLaunchers: { | ||
ChromeHeadlessCI: { | ||
base: 'ChromeHeadless', | ||
flags: ['--no-sandbox'] | ||
} | ||
}, | ||
singleRun: false, | ||
restartOnFileChange: true | ||
}); | ||
}; |
16 changes: 16 additions & 0 deletions
16
projects/public-holdings-items/src/app/app-config-service.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { AppConfigServiceService } from './app-config-service.service'; | ||
|
||
describe('AppConfigServiceService', () => { | ||
let service: AppConfigServiceService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(AppConfigServiceService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
45 changes: 45 additions & 0 deletions
45
projects/public-holdings-items/src/app/app-config-service.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2019 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
import { Injectable } from '@angular/core'; | ||
import { CoreConfigService } from '@rero/ng-core'; | ||
|
||
import { environment } from '../environments/environment'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class AppConfigService extends CoreConfigService { | ||
|
||
/** Global View Name */ | ||
globalViewName: string; | ||
|
||
/** Translation urls */ | ||
translationsURLs: string[]; | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
constructor() { | ||
super(); | ||
this.production = environment.production; | ||
this.apiBaseUrl = environment.apiBaseUrl; | ||
this.$refPrefix = environment.$refPrefix; | ||
this.languages = environment.languages; | ||
this.globalViewName = environment.globalViewName; | ||
this.translationsURLs = environment.translationsURLs; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
projects/public-holdings-items/src/app/app-initializer.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* RERO ILS UI | ||
* Copyright (C) 2020 RERO | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, version 3 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import { HttpClientTestingModule } from '@angular/common/http/testing'; | ||
import { TestBed } from '@angular/core/testing'; | ||
import { TranslateModule, TranslateService } from '@ngx-translate/core'; | ||
import { SharedConfigService, SharedModule } from '@rero/shared'; | ||
import { AppInitializerService } from './app-initializer.service'; | ||
|
||
|
||
describe('AppInitializerService', () => { | ||
|
||
let appInitializerService: AppInitializerService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [ | ||
HttpClientTestingModule, | ||
TranslateModule.forRoot(), | ||
SharedModule | ||
], | ||
providers: [ | ||
TranslateService, | ||
SharedConfigService | ||
] | ||
}); | ||
appInitializerService = TestBed.inject(AppInitializerService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(appInitializerService).toBeTruthy(); | ||
}); | ||
}); |
Oops, something went wrong.