forked from hazza/dspace-angular
Merge branch 'master' into Login-as-EPerson
Conflicts: src/app/+admin/admin-access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts src/app/core/auth/auth.service.spec.ts src/app/profile-page/profile-page.component.spec.ts
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
# http://editorconfig.org
|
# Editor configuration, see https://editorconfig.org
|
||||||
|
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
|
7
.gitignore
vendored
7
.gitignore
vendored
@@ -7,8 +7,9 @@ npm-debug.log
|
|||||||
|
|
||||||
/build/
|
/build/
|
||||||
|
|
||||||
/config/environment.dev.js
|
/src/environments/environment.ts
|
||||||
/config/environment.prod.js
|
/src/environments/environment.dev.ts
|
||||||
|
/src/environments/environment.prod.ts
|
||||||
|
|
||||||
/coverage
|
/coverage
|
||||||
|
|
||||||
@@ -36,3 +37,5 @@ yarn-error.log
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
|
|
||||||
.java-version
|
.java-version
|
||||||
|
|
||||||
|
.env
|
||||||
|
67
.travis.yml
67
.travis.yml
@@ -1,10 +1,25 @@
|
|||||||
sudo: required
|
sudo: required
|
||||||
dist: bionic
|
dist: bionic
|
||||||
|
language: node_js
|
||||||
|
|
||||||
|
# Enable caching for yarn & node_modules
|
||||||
|
cache:
|
||||||
|
yarn: true
|
||||||
|
|
||||||
|
node_js:
|
||||||
|
- "10"
|
||||||
|
- "12"
|
||||||
|
|
||||||
|
# Install latest chrome (for e2e headless testing). Run an update if needed.
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- google-chrome
|
||||||
|
packages:
|
||||||
|
- google-chrome-stable
|
||||||
|
update: true
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Install the latest docker-compose version for ci testing.
|
|
||||||
# The default installation in travis is not compatible with the latest docker-compose file version.
|
|
||||||
COMPOSE_VERSION: 1.24.1
|
|
||||||
# The ci step will test the dspace-angular code against DSpace REST.
|
# The ci step will test the dspace-angular code against DSpace REST.
|
||||||
# Direct that step to utilize a DSpace REST service that has been started in docker.
|
# Direct that step to utilize a DSpace REST service that has been started in docker.
|
||||||
DSPACE_REST_HOST: localhost
|
DSPACE_REST_HOST: localhost
|
||||||
@@ -12,47 +27,31 @@ env:
|
|||||||
DSPACE_REST_NAMESPACE: '/server/api'
|
DSPACE_REST_NAMESPACE: '/server/api'
|
||||||
DSPACE_REST_SSL: false
|
DSPACE_REST_SSL: false
|
||||||
|
|
||||||
services:
|
|
||||||
- xvfb
|
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
# Docker Compose Install
|
# Check our versions of everything
|
||||||
- curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
|
- echo "Check versions"
|
||||||
- chmod +x docker-compose
|
- yarn -v
|
||||||
- sudo mv docker-compose /usr/local/bin
|
- docker-compose -v
|
||||||
|
- google-chrome-stable --version
|
||||||
|
|
||||||
install:
|
install:
|
||||||
# update chrome
|
|
||||||
- wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
|
|
||||||
- sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
|
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get install google-chrome-stable
|
|
||||||
# Start up DSpace 7 using the entities database dump
|
# Start up DSpace 7 using the entities database dump
|
||||||
- docker-compose -f ./docker/docker-compose-travis.yml up -d
|
- docker-compose -f ./docker/docker-compose-travis.yml up -d
|
||||||
# Use the dspace-cli image to populate the assetstore. Trigger a discovery and oai update
|
# Use the dspace-cli image to populate the assetstore. Triggers a discovery and oai update
|
||||||
- docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
|
- docker-compose -f ./docker/cli.yml -f ./docker/cli.assetstore.yml run --rm dspace-cli
|
||||||
- travis_retry yarn install
|
- travis_retry yarn install
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
|
- echo "Check Docker containers"
|
||||||
|
- docker container ls
|
||||||
# The following line could be enabled to verify that the rest server is responding.
|
# The following line could be enabled to verify that the rest server is responding.
|
||||||
# Currently, "yarn run build" takes enough time to run to allow the service to be available
|
#- echo "Check REST API available (via Docker)"
|
||||||
#- curl http://localhost:8080/
|
#- curl http://localhost:8080/server/
|
||||||
|
|
||||||
after_script:
|
|
||||||
- docker-compose -f ./docker/docker-compose-travis.yml down
|
|
||||||
|
|
||||||
language: node_js
|
|
||||||
|
|
||||||
node_js:
|
|
||||||
- "10"
|
|
||||||
- "12"
|
|
||||||
|
|
||||||
cache:
|
|
||||||
yarn: true
|
|
||||||
|
|
||||||
bundler_args: --retry 5
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- yarn run build
|
|
||||||
- yarn run ci
|
- yarn run ci
|
||||||
- cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
- cat coverage/dspace-angular-cli/lcov.info | ./node_modules/coveralls/bin/coveralls.js
|
||||||
|
|
||||||
|
after_script:
|
||||||
|
# Shutdown docker after everything runs
|
||||||
|
- docker-compose -f ./docker/docker-compose-travis.yml down
|
||||||
|
@@ -4,9 +4,9 @@
|
|||||||
FROM node:12-alpine
|
FROM node:12-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ADD . /app/
|
ADD . /app/
|
||||||
EXPOSE 3000
|
EXPOSE 4000
|
||||||
|
|
||||||
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
|
# We run yarn install with an increased network timeout (5min) to avoid "ESOCKETTIMEDOUT" errors from hub.docker.com
|
||||||
# See, for example https://github.com/yarnpkg/yarn/issues/5540
|
# See, for example https://github.com/yarnpkg/yarn/issues/5540
|
||||||
RUN yarn install --network-timeout 300000
|
RUN yarn install --network-timeout 300000
|
||||||
CMD yarn run watch
|
CMD yarn run start:dev
|
||||||
|
80
README.md
80
README.md
@@ -29,7 +29,7 @@ yarn install
|
|||||||
yarn start
|
yarn start
|
||||||
```
|
```
|
||||||
|
|
||||||
Then go to [http://localhost:3000](http://localhost:3000) in your browser
|
Then go to [http://localhost:4000](http://localhost:4000) in your browser
|
||||||
|
|
||||||
Not sure where to start? watch the training videos linked in the [Introduction to the technology](#introduction-to-the-technology) section below.
|
Not sure where to start? watch the training videos linked in the [Introduction to the technology](#introduction-to-the-technology) section below.
|
||||||
|
|
||||||
@@ -59,13 +59,13 @@ Table of Contents
|
|||||||
Introduction to the technology
|
Introduction to the technology
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
You can find more information on the technologies used in this project (Angular.io, Typescript, Angular Universal, RxJS, etc) on the [LYRASIS wiki](https://wiki.lyrasis.org/display/DSPACE/DSpace+7+UI+Technology+Stack)
|
You can find more information on the technologies used in this project (Angular.io, Angular CLI, Typescript, Angular Universal, RxJS, etc) on the [LYRASIS wiki](https://wiki.lyrasis.org/display/DSPACE/DSpace+7+UI+Technology+Stack)
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
|
||||||
- [Node.js](https://nodejs.org), [npm](https://www.npmjs.com/), and [yarn](https://yarnpkg.com)
|
- [Node.js](https://nodejs.org) and [yarn](https://yarnpkg.com)
|
||||||
- Ensure you're running node `v10.x` or `v12.x`, npm >= `v5.x` and yarn >= `v1.x`
|
- Ensure you're running node `v10.x` or `v12.x` and yarn >= `v1.x`
|
||||||
|
|
||||||
If you have [`nvm`](https://github.com/creationix/nvm#install-script) or [`nvm-windows`](https://github.com/coreybutler/nvm-windows) installed, which is highly recommended, you can run `nvm install --lts && nvm use` to install and start using the latest Node LTS.
|
If you have [`nvm`](https://github.com/creationix/nvm#install-script) or [`nvm-windows`](https://github.com/coreybutler/nvm-windows) installed, which is highly recommended, you can run `nvm install --lts && nvm use` to install and start using the latest Node LTS.
|
||||||
|
|
||||||
@@ -77,25 +77,53 @@ Installing
|
|||||||
|
|
||||||
### Configuring
|
### Configuring
|
||||||
|
|
||||||
Default configuration file is located in `config/` folder.
|
Default configuration file is located in `src/environments/` folder.
|
||||||
|
|
||||||
To change the default configuration values, create local files that override the parameters you need to change:
|
To change the default configuration values, create local files that override the parameters you need to change. You can use `environment.template.ts` as a starting point.
|
||||||
|
|
||||||
- Create a new `environment.dev.js` file in `config/` for `devel` environment;
|
- Create a new `environment.dev.ts` file in `src/environments/` for a `development` environment;
|
||||||
- Create a new `environment.prod.js` file in `config/` for `production` environment;
|
- Create a new `environment.prod.ts` file in `src/environments/` for a `production` environment;
|
||||||
|
|
||||||
To use the configuration parameters in your component:
|
The server settings can also be overwritten using an environment file.
|
||||||
|
|
||||||
|
This file should be called `.env` and be placed in the project root.
|
||||||
|
|
||||||
|
The following settings can be overwritten in this file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../config';
|
DSPACE_HOST # The host name of the angular application
|
||||||
|
DSPACE_PORT # The port number of the angular application
|
||||||
|
DSPACE_NAMESPACE # The namespace of the angular application
|
||||||
|
DSPACE_SSL # Whether the angular application uses SSL [true/false]
|
||||||
|
|
||||||
constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig) {}
|
DSPACE_REST_HOST # The host name of the REST application
|
||||||
|
DSPACE_REST_PORT # The port number of the REST application
|
||||||
|
DSPACE_REST_NAMESPACE # The namespace of the REST application
|
||||||
|
DSPACE_REST_SSL # Whether the angular REST uses SSL [true/false]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The same settings can also be overwritten by setting system environment variables instead, E.g.:
|
||||||
|
```bash
|
||||||
|
export DSPACE_HOST=https://dspace7.4science.cloud/server
|
||||||
|
```
|
||||||
|
|
||||||
|
The priority works as follows: **environment variable** overrides **variable in `.env` file** overrides **`environment.(prod, dev or test).ts`** overrides **`environment.common.ts`**
|
||||||
|
|
||||||
|
|
||||||
|
#### Using environment variables in code
|
||||||
|
To use environment variables in a UI component, use:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { environment } from '../environment.ts';
|
||||||
|
```
|
||||||
|
|
||||||
|
This file is generated by the script located in `scripts/set-env.ts`. This script will run automatically before every build, or can be manually triggered using the appropriate `config` script in `package.json`
|
||||||
|
|
||||||
|
|
||||||
Running the app
|
Running the app
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
After you have installed all dependencies you can now run the app. Run `yarn run watch` to start a local server which will watch for changes, rebuild the code, and reload the server for you. You can visit it at `http://localhost:3000`.
|
After you have installed all dependencies you can now run the app. Run `yarn run start:dev` to start a local server which will watch for changes, rebuild the code, and reload the server for you. You can visit it at `http://localhost:4000`.
|
||||||
|
|
||||||
### Running in production mode
|
### Running in production mode
|
||||||
|
|
||||||
@@ -115,14 +143,6 @@ yarn run build:prod
|
|||||||
|
|
||||||
This will build the application and put the result in the `dist` folder
|
This will build the application and put the result in the `dist` folder
|
||||||
|
|
||||||
### Deploy
|
|
||||||
```bash
|
|
||||||
# deploy production in standalone pm2 container
|
|
||||||
yarn run deploy
|
|
||||||
|
|
||||||
# remove production from standalone pm2 container
|
|
||||||
yarn run undeploy
|
|
||||||
```
|
|
||||||
|
|
||||||
### Running the application with Docker
|
### Running the application with Docker
|
||||||
See [Docker Runtime Options](docker/README.md)
|
See [Docker Runtime Options](docker/README.md)
|
||||||
@@ -155,17 +175,15 @@ If you would like to contribute by testing a Pull Request (PR), here's how to do
|
|||||||
* Click it, and follow "Step 1" of those instructions to checkout the pull down the PR branch.
|
* Click it, and follow "Step 1" of those instructions to checkout the pull down the PR branch.
|
||||||
2. `yarn run clean` (This resets your local dependencies to ensure you are up-to-date with this PR)
|
2. `yarn run clean` (This resets your local dependencies to ensure you are up-to-date with this PR)
|
||||||
3. `yarn install` (Updates your local dependencies to those in the PR)
|
3. `yarn install` (Updates your local dependencies to those in the PR)
|
||||||
4. `yarn start` (Rebuilds the project, and deploys to localhost:3000, by default)
|
4. `yarn start` (Rebuilds the project, and deploys to localhost:4000, by default)
|
||||||
5. At this point, the code from the PR will be deployed to http://localhost:3000. Test it out, and ensure that it does what is described in the PR (or fixes the bug described in the ticket linked to the PR).
|
5. At this point, the code from the PR will be deployed to http://localhost:4000. Test it out, and ensure that it does what is described in the PR (or fixes the bug described in the ticket linked to the PR).
|
||||||
|
|
||||||
Once you have tested the Pull Request, please add a comment and/or approval to the PR to let us know whether you found it to be successful (or not). Thanks!
|
Once you have tested the Pull Request, please add a comment and/or approval to the PR to let us know whether you found it to be successful (or not). Thanks!
|
||||||
|
|
||||||
|
|
||||||
### Unit Tests
|
### Unit Tests
|
||||||
|
|
||||||
Unit tests use Karma. You can find the configuration file at the same level of this README file:`./karma.conf.js` If you are going to use a remote test enviroment you need to edit the `./karma.conf.js`. Follow the instructions you will find inside it. To executing tests whenever any file changes you can modify the 'autoWatch' option to 'true' and 'singleRun' option to 'false'. A coverage report is also available at: http://localhost:9876/ after you run: `yarn run coverage`.
|
Unit tests use Karma. You can find the configuration file at the same level of this README file:`./karma.conf.js` If you are going to use a remote test environment you need to edit the `./karma.conf.js`. Follow the instructions you will find inside it. To executing tests whenever any file changes you can modify the 'autoWatch' option to 'true' and 'singleRun' option to 'false'. A coverage report is also available at: http://localhost:9876/ after you run: `yarn run coverage`.
|
||||||
|
|
||||||
To correctly run the tests you need to run the build once with: `yarn run build`.
|
|
||||||
|
|
||||||
The default browser is Google Chrome.
|
The default browser is Google Chrome.
|
||||||
|
|
||||||
@@ -177,17 +195,13 @@ and run: `yarn run test`
|
|||||||
|
|
||||||
E2E tests use Protractor + Selenium server + browsers. You can find the configuration file at the same level of this README file:`./protractor.conf.js` Protractor is installed as 'local' as a dev dependency.
|
E2E tests use Protractor + Selenium server + browsers. You can find the configuration file at the same level of this README file:`./protractor.conf.js` Protractor is installed as 'local' as a dev dependency.
|
||||||
|
|
||||||
If you are going to use a remote test enviroment you need to edit the './protractor.conf.js'. Follow the instructions you will find inside it.
|
If you are going to use a remote test enviroment you need to edit the './e2e//protractor.conf.js'. Follow the instructions you will find inside it.
|
||||||
|
|
||||||
The default browser is Google Chrome.
|
The default browser is Google Chrome.
|
||||||
|
|
||||||
Protractor needs a functional instance of the DSpace interface to run the E2E tests, so you need to run:`yarn run watch`
|
|
||||||
|
|
||||||
or any command that bring up the DSpace interface.
|
|
||||||
|
|
||||||
Place your tests at the following path: `./e2e`
|
Place your tests at the following path: `./e2e`
|
||||||
|
|
||||||
and run: `yarn run e2e`
|
and run: `ng e2e`
|
||||||
|
|
||||||
### Continuous Integration (CI) Test
|
### Continuous Integration (CI) Test
|
||||||
|
|
||||||
@@ -200,7 +214,7 @@ See [`./docs`](docs) for further documentation.
|
|||||||
|
|
||||||
### Building code documentation
|
### Building code documentation
|
||||||
|
|
||||||
To build the code documentation we use [TYPEDOC](http://typedoc.org). TYPEDOC is a documentation generator for TypeScript projects. It extracts informations from properly formatted comments that can be written within the code files. Follow the instructions [here](http://typedoc.org/guides/doccomments/) to know how to make those comments.
|
To build the code documentation we use [TYPEDOC](http://typedoc.org). TYPEDOC is a documentation generator for TypeScript projects. It extracts information from properly formatted comments that can be written within the code files. Follow the instructions [here](http://typedoc.org/guides/doccomments/) to know how to make those comments.
|
||||||
|
|
||||||
Run:`yarn run docs` to produce the documentation that will be available in the 'doc' folder.
|
Run:`yarn run docs` to produce the documentation that will be available in the 'doc' folder.
|
||||||
|
|
||||||
@@ -388,7 +402,7 @@ Frequently asked questions
|
|||||||
- Where do I write my tests?
|
- Where do I write my tests?
|
||||||
- You can write your tests next to your component files. e.g. for `src/app/home/home.component.ts` call it `src/app/home/home.component.spec.ts`
|
- You can write your tests next to your component files. e.g. for `src/app/home/home.component.ts` call it `src/app/home/home.component.spec.ts`
|
||||||
- How do I start the app when I get `EACCES` and `EADDRINUSE` errors?
|
- How do I start the app when I get `EACCES` and `EADDRINUSE` errors?
|
||||||
- The `EADDRINUSE` error means the port `3000` is currently being used and `EACCES` is lack of permission to build files to `./dist/`
|
- The `EADDRINUSE` error means the port `4000` is currently being used and `EACCES` is lack of permission to build files to `./dist/`
|
||||||
- What are the naming conventions for Angular 2?
|
- What are the naming conventions for Angular 2?
|
||||||
- See [the official angular 2 style guide](https://angular.io/styleguide)
|
- See [the official angular 2 style guide](https://angular.io/styleguide)
|
||||||
- Why is the size of my app larger in development?
|
- Why is the size of my app larger in development?
|
||||||
|
154
angular.json
154
angular.json
@@ -1,13 +1,157 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"cli": {
|
"newProjectRoot": "projects",
|
||||||
"defaultCollection": "@ngrx/schematics"
|
|
||||||
},
|
|
||||||
"projects": {
|
"projects": {
|
||||||
"core": {
|
"dspace-angular-cli": {
|
||||||
|
"projectType": "application",
|
||||||
|
"schematics": {
|
||||||
|
"@schematics/angular:component": {
|
||||||
|
"style": "scss"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": "",
|
"root": "",
|
||||||
"projectType": "application"
|
"sourceRoot": "src",
|
||||||
|
"prefix": "ds",
|
||||||
|
"architect": {
|
||||||
|
"build": {
|
||||||
|
"builder": "@angular-builders/custom-webpack:browser",
|
||||||
|
"options": {
|
||||||
|
"customWebpackConfig": {
|
||||||
|
"path": "./webpack/webpack.common.ts",
|
||||||
|
"mergeStrategies": {
|
||||||
|
"loaders": "prepend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputPath": "dist/browser",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.browser.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"aot": false,
|
||||||
|
"assets": [
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"optimization": true,
|
||||||
|
"outputHashing": "all",
|
||||||
|
"extractCss": true,
|
||||||
|
"namedChunks": false,
|
||||||
|
"aot": true,
|
||||||
|
"extractLicenses": true,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": true,
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "3mb",
|
||||||
|
"maximumError": "5mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb",
|
||||||
|
"maximumError": "10kb"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"serve": {
|
||||||
|
"builder": "@angular-builders/custom-webpack:dev-server",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "dspace-angular-cli:build",
|
||||||
|
"port": 4000
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"browserTarget": "dspace-angular-cli:build:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extract-i18n": {
|
||||||
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
"options": {
|
||||||
|
"browserTarget": "dspace-angular-cli:build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"builder": "@angular-builders/custom-webpack:karma",
|
||||||
|
"options": {
|
||||||
|
"customWebpackConfig": {
|
||||||
|
"path": "./webpack/webpack.common.ts",
|
||||||
|
"mergeStrategies": {
|
||||||
|
"loaders": "prepend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"main": "src/test.ts",
|
||||||
|
"polyfills": "src/polyfills.ts",
|
||||||
|
"tsConfig": "tsconfig.spec.json",
|
||||||
|
"karmaConfig": "karma.conf.js",
|
||||||
|
"assets": [
|
||||||
|
"src/assets"
|
||||||
|
],
|
||||||
|
"styles": [
|
||||||
|
"src/styles.scss"
|
||||||
|
],
|
||||||
|
"scripts": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"builder": "@angular-devkit/build-angular:tslint",
|
||||||
|
"options": {
|
||||||
|
"tsConfig": [
|
||||||
|
"tsconfig.app.json",
|
||||||
|
"tsconfig.spec.json",
|
||||||
|
"e2e/tsconfig.json"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/node_modules/**"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"e2e": {
|
||||||
|
"builder": "@angular-devkit/build-angular:protractor",
|
||||||
|
"options": {
|
||||||
|
"protractorConfig": "e2e/protractor.conf.js",
|
||||||
|
"devServerTarget": "dspace-angular-cli:serve"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"devServerTarget": "dspace-angular-cli:serve:production"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"server": {
|
||||||
|
"builder": "@angular-builders/custom-webpack:server",
|
||||||
|
"options": {
|
||||||
|
"customWebpackConfig": {
|
||||||
|
"path": "./webpack/webpack.prod.ts",
|
||||||
|
"mergeStrategies": {
|
||||||
|
"loaders": "prepend"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outputPath": "dist/server",
|
||||||
|
"main": "src/main.server.ts",
|
||||||
|
"tsConfig": "tsconfig.server.json"
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"production": {
|
||||||
|
"sourceMap": false,
|
||||||
|
"optimization": {
|
||||||
|
"scripts": false,
|
||||||
|
"styles": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "dspace-angular-cli"
|
||||||
}
|
}
|
17
app.yaml
17
app.yaml
@@ -1,17 +0,0 @@
|
|||||||
# Copyright 2015-2016, Google, Inc.
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# [START app_yaml]
|
|
||||||
runtime: nodejs
|
|
||||||
env: flex
|
|
||||||
# [END app_yaml]
|
|
11
browserslist
Normal file
11
browserslist
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# 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 IE 9-11 # For IE 9-11 support, remove 'not'.
|
@@ -1,4 +0,0 @@
|
|||||||
// This configuration is currently only being used for unit tests, end-to-end tests use environment.dev.ts
|
|
||||||
module.exports = {
|
|
||||||
|
|
||||||
};
|
|
@@ -7,7 +7,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
DSPACE_HOST: dspace-angular
|
DSPACE_HOST: dspace-angular
|
||||||
DSPACE_NAMESPACE: /
|
DSPACE_NAMESPACE: /
|
||||||
DSPACE_PORT: '3000'
|
DSPACE_PORT: '4000'
|
||||||
DSPACE_SSL: "false"
|
DSPACE_SSL: "false"
|
||||||
image: dspace/dspace-angular:latest
|
image: dspace/dspace-angular:latest
|
||||||
build:
|
build:
|
||||||
@@ -16,11 +16,11 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
dspacenet:
|
dspacenet:
|
||||||
ports:
|
ports:
|
||||||
- published: 3000
|
- published: 4000
|
||||||
target: 3000
|
target: 4000
|
||||||
- published: 9876
|
- published: 9876
|
||||||
target: 9876
|
target: 9876
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
volumes:
|
volumes:
|
||||||
- ./environment.dev.js:/app/config/environment.dev.js
|
- ./environment.dev.js:/app/src/environments/environment.dev.ts
|
||||||
|
@@ -5,7 +5,9 @@
|
|||||||
*
|
*
|
||||||
* http://www.dspace.org/license/
|
* http://www.dspace.org/license/
|
||||||
*/
|
*/
|
||||||
module.exports = {
|
import { GlobalConfig } from '../src/config/global-config.interface';
|
||||||
|
|
||||||
|
export const environment: Partial<GlobalConfig> = {
|
||||||
rest: {
|
rest: {
|
||||||
ssl: false,
|
ssl: false,
|
||||||
host: 'localhost',
|
host: 'localhost',
|
@@ -8,7 +8,7 @@ Default configuration file is located in `config/` folder. All configuration opt
|
|||||||
Some few configuration options can be overridden by setting environment variables. These and the variable names are listed below.
|
Some few configuration options can be overridden by setting environment variables. These and the variable names are listed below.
|
||||||
|
|
||||||
## Nodejs server
|
## Nodejs server
|
||||||
When you start dspace-angular on node, it spins up an http server on which it listens for incoming connections. You can define the ip address and port the server should bind itsself to, and if ssl should be enabled not. By default it listens on `localhost:3000`. If you want it to listen on all your network connections, configure it to bind itself to `0.0.0.0`.
|
When you start dspace-angular on node, it spins up an http server on which it listens for incoming connections. You can define the ip address and port the server should bind itsself to, and if ssl should be enabled not. By default it listens on `localhost:4000`. If you want it to listen on all your network connections, configure it to bind itself to `0.0.0.0`.
|
||||||
|
|
||||||
To change this configuration, change the options `ui.host`, `ui.port` and `ui.ssl` in the appropriate configuration file (see above):
|
To change this configuration, change the options `ui.host`, `ui.port` and `ui.ssl` in the appropriate configuration file (see above):
|
||||||
```
|
```
|
||||||
@@ -17,7 +17,7 @@ module.exports = {
|
|||||||
ui: {
|
ui: {
|
||||||
ssl: false,
|
ssl: false,
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 3000,
|
port: 4000,
|
||||||
nameSpace: '/'
|
nameSpace: '/'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -27,7 +27,7 @@ Alternately you can set the following environment variables. If any of these are
|
|||||||
```
|
```
|
||||||
DSPACE_SSL=true
|
DSPACE_SSL=true
|
||||||
DSPACE_HOST=localhost
|
DSPACE_HOST=localhost
|
||||||
DSPACE_PORT=3000
|
DSPACE_PORT=4000
|
||||||
DSPACE_NAMESPACE=/
|
DSPACE_NAMESPACE=/
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ Alternately you can set the following environment variables. If any of these are
|
|||||||
```
|
```
|
||||||
DSPACE_REST_SSL=true
|
DSPACE_REST_SSL=true
|
||||||
DSPACE_REST_HOST=localhost
|
DSPACE_REST_HOST=localhost
|
||||||
DSPACE_REST_PORT=3000
|
DSPACE_REST_PORT=4000
|
||||||
DSPACE_REST_NAMESPACE=/
|
DSPACE_REST_NAMESPACE=/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
import { browser, element, by } from 'protractor';
|
|
||||||
|
|
||||||
export class ProtractorPage {
|
|
||||||
navigateTo() {
|
|
||||||
return browser.get('/')
|
|
||||||
.then(() => browser.waitForAngular());
|
|
||||||
}
|
|
||||||
|
|
||||||
getPageTitleText() {
|
|
||||||
return browser.getTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
getHomePageNewsText() {
|
|
||||||
return element(by.css('ds-home-news')).getText();
|
|
||||||
}
|
|
||||||
}
|
|
10
e2e/protractor-ci.conf.js
Normal file
10
e2e/protractor-ci.conf.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
const config = require('./protractor.conf').config;
|
||||||
|
|
||||||
|
config.capabilities = {
|
||||||
|
browserName: 'chrome',
|
||||||
|
chromeOptions: {
|
||||||
|
args: ['--headless', '--no-sandbox', '--disable-gpu']
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.config = config;
|
@@ -12,10 +12,10 @@ exports.config = {
|
|||||||
// Change to 'false' to run tests using a remote Selenium server
|
// Change to 'false' to run tests using a remote Selenium server
|
||||||
directConnect: true,
|
directConnect: true,
|
||||||
// Change if the website to test is not on the localhost
|
// Change if the website to test is not on the localhost
|
||||||
baseUrl: 'http://localhost:3000/',
|
baseUrl: 'http://localhost:4000/',
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
specs: [
|
specs: [
|
||||||
'./e2e/**/*.e2e-spec.ts'
|
'./src/**/*.e2e-spec.ts'
|
||||||
],
|
],
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
// Browser and Capabilities: PhantomJS
|
// Browser and Capabilities: PhantomJS
|
||||||
@@ -67,7 +67,7 @@ exports.config = {
|
|||||||
//],
|
//],
|
||||||
|
|
||||||
plugins: [{
|
plugins: [{
|
||||||
path: 'node_modules/protractor-istanbul-plugin'
|
path: '../node_modules/protractor-istanbul-plugin'
|
||||||
}],
|
}],
|
||||||
|
|
||||||
framework: 'jasmine',
|
framework: 'jasmine',
|
||||||
@@ -79,7 +79,7 @@ exports.config = {
|
|||||||
useAllAngular2AppRoots: true,
|
useAllAngular2AppRoots: true,
|
||||||
beforeLaunch: function () {
|
beforeLaunch: function () {
|
||||||
require('ts-node').register({
|
require('ts-node').register({
|
||||||
project: 'e2e'
|
project: './e2e/tsconfig.json'
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onPrepare: function () {
|
onPrepare: function () {
|
@@ -9,11 +9,14 @@ describe('protractor App', () => {
|
|||||||
|
|
||||||
it('should display translated title "DSpace Angular :: Home"', () => {
|
it('should display translated title "DSpace Angular :: Home"', () => {
|
||||||
page.navigateTo();
|
page.navigateTo();
|
||||||
|
page.waitUntilNotLoading();
|
||||||
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home');
|
expect<any>(page.getPageTitleText()).toEqual('DSpace Angular :: Home');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should contain a news section', () => {
|
it('should contain a news section', () => {
|
||||||
page.navigateTo()
|
page.navigateTo();
|
||||||
.then(() => expect<any>(page.getHomePageNewsText()).toBeDefined());
|
page.waitUntilNotLoading();
|
||||||
|
const text = page.getHomePageNewsText();
|
||||||
|
expect<any>(text).toBeDefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
23
e2e/src/app.po.ts
Normal file
23
e2e/src/app.po.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { browser, element, by, protractor, promise } from 'protractor';
|
||||||
|
|
||||||
|
export class ProtractorPage {
|
||||||
|
navigateTo() {
|
||||||
|
return browser.get('/')
|
||||||
|
.then(() => browser.waitForAngular());
|
||||||
|
}
|
||||||
|
|
||||||
|
getPageTitleText() {
|
||||||
|
return browser.getTitle();
|
||||||
|
}
|
||||||
|
|
||||||
|
getHomePageNewsText() {
|
||||||
|
return element(by.css('ds-home-news')).getText();
|
||||||
|
}
|
||||||
|
|
||||||
|
waitUntilNotLoading(): promise.Promise<unknown> {
|
||||||
|
const loading = element(by.css('.loader'))
|
||||||
|
const EC = protractor.ExpectedConditions;
|
||||||
|
const notLoading = EC.not(EC.presenceOf(loading));
|
||||||
|
return browser.wait(notLoading, 10000);
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,5 @@
|
|||||||
import { ProtractorPage } from './search-page.po';
|
import { ProtractorPage } from './search-page.po';
|
||||||
import { browser } from 'protractor';
|
import { browser } from 'protractor';
|
||||||
import { promise } from 'selenium-webdriver';
|
|
||||||
|
|
||||||
describe('protractor SearchPage', () => {
|
describe('protractor SearchPage', () => {
|
||||||
let page: ProtractorPage;
|
let page: ProtractorPage;
|
||||||
@@ -23,9 +22,11 @@ describe('protractor SearchPage', () => {
|
|||||||
.then(() => page.getRandomScopeOption())
|
.then(() => page.getRandomScopeOption())
|
||||||
.then((scopeString: string) => {
|
.then((scopeString: string) => {
|
||||||
page.navigateToSearchWithScopeParameter(scopeString);
|
page.navigateToSearchWithScopeParameter(scopeString);
|
||||||
page.getCurrentScope().then((s: string) => {
|
page.waitUntilNotLoading();
|
||||||
|
page.getCurrentScope()
|
||||||
|
.then((s: string) => {
|
||||||
expect<string>(s).toEqual(scopeString);
|
expect<string>(s).toEqual(scopeString);
|
||||||
});
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -33,13 +34,16 @@ describe('protractor SearchPage', () => {
|
|||||||
page.navigateToSearch()
|
page.navigateToSearch()
|
||||||
.then(() => page.getRandomScopeOption())
|
.then(() => page.getRandomScopeOption())
|
||||||
.then((scopeString: string) => {
|
.then((scopeString: string) => {
|
||||||
page.setCurrentScope(scopeString);
|
page.setCurrentScope(scopeString)
|
||||||
page.submitSearchForm();
|
.then(() => page.submitSearchForm())
|
||||||
|
.then(() => page.waitUntilNotLoading())
|
||||||
|
.then(() => () => {
|
||||||
browser.wait(() => {
|
browser.wait(() => {
|
||||||
return browser.getCurrentUrl().then((url: string) => {
|
return browser.getCurrentUrl().then((url: string) => {
|
||||||
return url.indexOf('scope=' + encodeURI(scopeString)) !== -1;
|
return url.indexOf('scope=' + encodeURI(scopeString)) !== -1;
|
||||||
});
|
})
|
||||||
});
|
})
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@@ -27,7 +27,7 @@ export class ProtractorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCurrentScope(scope: string) {
|
setCurrentScope(scope: string) {
|
||||||
element(by.css('#search-form option[value="' + scope + '"]')).click();
|
return element(by.css('#search-form option[value="' + scope + '"]')).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
setCurrentQuery(query: string) {
|
setCurrentQuery(query: string) {
|
||||||
@@ -35,7 +35,7 @@ export class ProtractorPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
submitSearchForm() {
|
submitSearchForm() {
|
||||||
element(by.css('#search-form button.search-button')).click();
|
return element(by.css('#search-form button.search-button')).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
getRandomScopeOption(): promise.Promise<string> {
|
getRandomScopeOption(): promise.Promise<string> {
|
||||||
@@ -46,4 +46,10 @@ export class ProtractorPage {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waitUntilNotLoading(): promise.Promise<unknown> {
|
||||||
|
const loading = element(by.css('.loader'));
|
||||||
|
const EC = protractor.ExpectedConditions;
|
||||||
|
const notLoading = EC.not(EC.presenceOf(loading));
|
||||||
|
return browser.wait(notLoading, 10000);
|
||||||
|
}
|
||||||
}
|
}
|
189
karma.conf.js
189
karma.conf.js
@@ -1,176 +1,37 @@
|
|||||||
/**
|
// Karma configuration file, see link for more information
|
||||||
* @author: @AngularClass
|
// https://karma-runner.github.io/1.0/config/configuration-file.html
|
||||||
*/
|
|
||||||
|
|
||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
|
config.set({
|
||||||
var testWebpackConfig = require('./webpack/webpack.test.js')({
|
|
||||||
env: 'test'
|
|
||||||
});
|
|
||||||
|
|
||||||
// Uncomment and change to run tests on a remote Selenium server
|
|
||||||
var webdriverConfig = {
|
|
||||||
hostname: 'localhost',
|
|
||||||
port: 4444
|
|
||||||
};
|
|
||||||
|
|
||||||
var configuration = {
|
|
||||||
client: {
|
|
||||||
jasmine: {
|
|
||||||
random: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// base path that will be used to resolve all patterns (e.g. files, exclude)
|
|
||||||
basePath: '',
|
basePath: '',
|
||||||
|
frameworks: ['jasmine', '@angular-devkit/build-angular'],
|
||||||
/*
|
|
||||||
* Frameworks to use
|
|
||||||
*
|
|
||||||
* available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
|
||||||
*/
|
|
||||||
frameworks: ['jasmine'],
|
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
require("istanbul-instrumenter-loader"),
|
|
||||||
require('karma-chrome-launcher'),
|
|
||||||
require('karma-coverage'),
|
|
||||||
require("karma-istanbul-preprocessor"),
|
|
||||||
require('karma-jasmine'),
|
require('karma-jasmine'),
|
||||||
|
require('karma-chrome-launcher'),
|
||||||
|
require('karma-jasmine-html-reporter'),
|
||||||
|
require('karma-coverage-istanbul-reporter'),
|
||||||
|
require('@angular-devkit/build-angular/plugins/karma'),
|
||||||
require('karma-mocha-reporter'),
|
require('karma-mocha-reporter'),
|
||||||
require('karma-phantomjs-launcher'),
|
|
||||||
require('karma-remap-coverage'),
|
|
||||||
require('karma-remap-istanbul'),
|
|
||||||
require('karma-sourcemap-loader'),
|
|
||||||
require('karma-webdriver-launcher'),
|
|
||||||
require('karma-webpack')
|
|
||||||
],
|
],
|
||||||
|
client: {
|
||||||
// list of files to exclude
|
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||||
exclude: [],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* list of files / patterns to load in the browser
|
|
||||||
*
|
|
||||||
* we are building the test environment in ./spec-bundle.js
|
|
||||||
*/
|
|
||||||
files: [{
|
|
||||||
pattern: './spec-bundle.js',
|
|
||||||
watched: false,
|
|
||||||
}],
|
|
||||||
|
|
||||||
/*
|
|
||||||
* preprocess matching files before serving them to the browser
|
|
||||||
* available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
|
||||||
*/
|
|
||||||
preprocessors: {
|
|
||||||
'./spec-bundle.js': [
|
|
||||||
'istanbul',
|
|
||||||
'webpack',
|
|
||||||
'sourcemap'
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
|
coverageIstanbulReporter: {
|
||||||
// Webpack Config at ./webpack.test.js
|
dir: require('path').join(__dirname, './coverage/dspace-angular-cli'),
|
||||||
webpack: testWebpackConfig,
|
reports: ['html', 'lcovonly', 'text-summary'],
|
||||||
|
fixWebpackSourcePaths: true
|
||||||
// save interim raw coverage report in memory
|
|
||||||
coverageReporter: {
|
|
||||||
type: 'in-memory'
|
|
||||||
},
|
},
|
||||||
|
reporters: ['mocha', 'kjhtml'],
|
||||||
remapCoverageReporter: {
|
|
||||||
'text-summary': null, // to show summary in console
|
|
||||||
html: './coverage/html',
|
|
||||||
cobertura: './coverage/cobertura.xml'
|
|
||||||
},
|
|
||||||
|
|
||||||
remapIstanbulReporter: {
|
|
||||||
remapOptions: {}, //additional remap options
|
|
||||||
reports: {
|
|
||||||
json: './coverage/coverage.json',
|
|
||||||
lcovonly: './coverage/lcov.info',
|
|
||||||
html: './coverage/html/',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Webpack please don't spam the console when running in karma!
|
|
||||||
*/
|
|
||||||
webpackMiddleware: {
|
|
||||||
/**
|
|
||||||
* webpack-dev-middleware configuration
|
|
||||||
* i.e.
|
|
||||||
*/
|
|
||||||
noInfo: true,
|
|
||||||
/**
|
|
||||||
* and use stats to turn off verbose output
|
|
||||||
*/
|
|
||||||
stats: {
|
|
||||||
/**
|
|
||||||
* options i.e.
|
|
||||||
*/
|
|
||||||
chunks: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
|
||||||
* test results reporter to use
|
|
||||||
*
|
|
||||||
* possible values: 'dots', 'progress'
|
|
||||||
* available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
|
||||||
*/
|
|
||||||
reporters: [
|
|
||||||
'mocha',
|
|
||||||
'coverage',
|
|
||||||
'remap-coverage',
|
|
||||||
'karma-remap-istanbul'
|
|
||||||
],
|
|
||||||
|
|
||||||
// Karma web server port
|
|
||||||
port: 9876,
|
|
||||||
|
|
||||||
// enable / disable colors in the output (reporters and logs)
|
|
||||||
colors: true,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* level of logging
|
|
||||||
* possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
|
||||||
*/
|
|
||||||
logLevel: config.LOG_WARN,
|
|
||||||
|
|
||||||
// enable / disable watching file and executing tests whenever any file changes
|
|
||||||
autoWatch: false,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* start these browsers
|
|
||||||
* available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
|
|
||||||
*/
|
|
||||||
browsers: [
|
|
||||||
'Chrome'
|
|
||||||
],
|
|
||||||
|
|
||||||
customLaunchers: {
|
|
||||||
// Remote Selenium Server with Chrome - launcher
|
|
||||||
'SeleniumChrome': {
|
|
||||||
base: 'WebDriver',
|
|
||||||
config: webdriverConfig,
|
|
||||||
browserName: 'chrome'
|
|
||||||
},
|
|
||||||
// Remote Selenium Server with Firefox - launcher
|
|
||||||
'SeleniumFirefox': {
|
|
||||||
base: 'WebDriver',
|
|
||||||
config: webdriverConfig,
|
|
||||||
browserName: 'firefox'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mochaReporter: {
|
mochaReporter: {
|
||||||
ignoreSkipped: true
|
ignoreSkipped: true,
|
||||||
|
output: 'autowatch'
|
||||||
},
|
},
|
||||||
|
port: 9876,
|
||||||
browserNoActivityTimeout: 30000
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
};
|
autoWatch: true,
|
||||||
|
browsers: ['Chrome'],
|
||||||
config.set(configuration);
|
singleRun: false,
|
||||||
|
restartOnFileChange: true
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
5
mock-nodemon.json
Normal file
5
mock-nodemon.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"watch": ["src/environments/mock-environment.ts"],
|
||||||
|
"ext": "ts",
|
||||||
|
"exec": "ts-node --project ./tsconfig.ts-node.json scripts/set-mock-env.ts"
|
||||||
|
}
|
11
nodemon.json
11
nodemon.json
@@ -1,9 +1,6 @@
|
|||||||
{
|
{
|
||||||
"watch": [
|
"watch": ["src/environments"],
|
||||||
"dist",
|
"ext": "ts",
|
||||||
"config",
|
"ignore": ["src/environments/environment.ts", "src/environments/mock-environment.ts"],
|
||||||
"src/index.html"
|
"exec": "ts-node --project ./tsconfig.ts-node.json scripts/set-env.ts --dev"
|
||||||
],
|
|
||||||
"ext": "js ts json html",
|
|
||||||
"delay": "50"
|
|
||||||
}
|
}
|
||||||
|
256
package.json
256
package.json
@@ -1,21 +1,38 @@
|
|||||||
{
|
{
|
||||||
"name": "dspace-angular",
|
"name": "dspace-angular-cli",
|
||||||
"version": "0.0.1",
|
"version": "0.0.0",
|
||||||
"description": "Angular Universal UI for DSpace",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/dspace/dspace-angular.git"
|
|
||||||
},
|
|
||||||
"license": "BSD-2-Clause",
|
|
||||||
"engines": {
|
|
||||||
"node": "10.* || >= 12.*"
|
|
||||||
},
|
|
||||||
"resolutions": {
|
|
||||||
"serialize-javascript": ">= 2.1.2",
|
|
||||||
"set-value": ">= 2.0.1"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"global": "npm install -g @angular/cli marked node-gyp nodemon node-nightly npm-check-updates npm-run-all rimraf typescript ts-node typedoc webpack webpack-bundle-analyzer pm2 rollup",
|
"ng": "ng",
|
||||||
|
"config:dev": "ts-node --project ./tsconfig.ts-node.json scripts/set-env.ts --dev",
|
||||||
|
"config:prod": "ts-node --project ./tsconfig.ts-node.json scripts/set-env.ts --prod",
|
||||||
|
"config:test": "ts-node --project ./tsconfig.ts-node.json scripts/set-mock-env.ts",
|
||||||
|
"config:test:watch": "nodemon --config mock-nodemon.json",
|
||||||
|
"config:dev:watch": "nodemon",
|
||||||
|
"prestart:dev": "yarn run config:dev",
|
||||||
|
"prebuild": "yarn run config:dev",
|
||||||
|
"pretest": "yarn run config:test",
|
||||||
|
"pretest:watch": "yarn run config:test",
|
||||||
|
"pretest:headless": "yarn run config:test",
|
||||||
|
"prebuild:prod": "yarn run config:prod",
|
||||||
|
"pree2e": "yarn run config:prod",
|
||||||
|
"pree2e:ci": "yarn run config:prod",
|
||||||
|
"start": "yarn run start:prod",
|
||||||
|
"serve": "ng serve",
|
||||||
|
"start:dev": "npm-run-all --parallel config:dev:watch serve",
|
||||||
|
"start:prod": "yarn run build:prod && yarn run serve:ssr",
|
||||||
|
"build": "ng build",
|
||||||
|
"build:prod": "yarn run build:ssr",
|
||||||
|
"build:ssr": "yarn run build:client-and-server-bundles && yarn run compile:server",
|
||||||
|
"build:client-and-server-bundles": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod && ng run dspace-angular-cli:server:production --bundleDependencies all",
|
||||||
|
"test:watch": "npm-run-all --parallel config:test:watch test",
|
||||||
|
"test": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng test --sourceMap=true --watch=true",
|
||||||
|
"test:headless": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng test --watch=false --sourceMap=true --browsers=ChromeHeadless --code-coverage",
|
||||||
|
"lint": "ng lint",
|
||||||
|
"e2e": "ng e2e",
|
||||||
|
"e2e:ci": "ng e2e --protractor-config=./e2e/protractor-ci.conf.js",
|
||||||
|
"compile:server": "webpack --config webpack.server.config.js --progress --colors",
|
||||||
|
"serve:ssr": "node dist/server",
|
||||||
|
"ci": "ng lint && yarn run build:prod && yarn test:headless && yarn run e2e:ci",
|
||||||
"clean:coverage": "rimraf coverage",
|
"clean:coverage": "rimraf coverage",
|
||||||
"clean:dist": "rimraf dist",
|
"clean:dist": "rimraf dist",
|
||||||
"clean:doc": "rimraf doc",
|
"clean:doc": "rimraf doc",
|
||||||
@@ -24,105 +41,60 @@
|
|||||||
"clean:bld": "rimraf build",
|
"clean:bld": "rimraf build",
|
||||||
"clean:node": "rimraf node_modules",
|
"clean:node": "rimraf node_modules",
|
||||||
"clean:prod": "yarn run clean:coverage && yarn run clean:doc && yarn run clean:dist && yarn run clean:log && yarn run clean:json && yarn run clean:bld",
|
"clean:prod": "yarn run clean:coverage && yarn run clean:doc && yarn run clean:dist && yarn run clean:log && yarn run clean:json && yarn run clean:bld",
|
||||||
"clean": "yarn run clean:prod && yarn run clean:node",
|
"clean": "yarn run clean:prod && yarn run clean:node && yarn run clean:env",
|
||||||
"prebuild": "yarn run clean:bld && yarn run clean:dist",
|
"clean:env": "rimraf src/environments/environment.ts",
|
||||||
"prebuild:ci": "yarn run prebuild",
|
"sync-i18n": "ts-node --project ./tsconfig.ts-node.json scripts/sync-i18n-files.ts"
|
||||||
"prebuild:prod": "yarn run prebuild",
|
|
||||||
"build": "node ./scripts/webpack.js --progress --mode development",
|
|
||||||
"build:ci": "yarn run syncbuilddir && node ./scripts/webpack.js --env.aot --env.server --mode development && node ./scripts/webpack.js --env.aot --env.client --mode development",
|
|
||||||
"build:prod": "yarn run syncbuilddir && node ./scripts/webpack.js --env.aot --env.server --mode production && node ./scripts/webpack.js --env.aot --env.client --mode production",
|
|
||||||
"postbuild:prod": "yarn run rollup",
|
|
||||||
"rollup": "rollup -c rollup.config.js",
|
|
||||||
"prestart": "yarn run build:prod",
|
|
||||||
"prestart:dev": "yarn run build",
|
|
||||||
"start": "yarn run server",
|
|
||||||
"start:dev": "yarn run server",
|
|
||||||
"deploy": "pm2 start dist/server.js",
|
|
||||||
"predeploy": "npm run build:prod",
|
|
||||||
"preundeploy": "pm2 stop dist/server.js",
|
|
||||||
"undeploy": "pm2 delete dist/server.js",
|
|
||||||
"postundeploy": "npm run clean:dist",
|
|
||||||
"server": "node dist/server.js",
|
|
||||||
"server:watch": "nodemon dist/server.js",
|
|
||||||
"server:watch:debug": "nodemon --debug dist/server.js",
|
|
||||||
"syncbuilddir": "node ./scripts/sync-build-dir.js",
|
|
||||||
"webpack:watch": "node ./scripts/webpack.js -w --mode development",
|
|
||||||
"watch": "yarn run build && npm-run-all -p webpack:watch server:watch",
|
|
||||||
"watch:debug": "yarn run build && npm-run-all -p webpack:watch server:watch:debug",
|
|
||||||
"predebug": "yarn run build",
|
|
||||||
"predebug:server": "yarn run build",
|
|
||||||
"debug": "node --debug-brk dist/server.js",
|
|
||||||
"debug:server": "node-nightly --inspect --debug-brk dist/server.js",
|
|
||||||
"debug:build": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js --mode development",
|
|
||||||
"debug:build:prod": "node-nightly --inspect --debug-brk node_modules/webpack/bin/webpack.js --env.aot --env.client --env.server --mode production",
|
|
||||||
"ci": "yarn run lint && yarn run build:ci && yarn run test:headless && npm-run-all -p -r server e2e",
|
|
||||||
"protractor": "node node_modules/protractor/bin/protractor",
|
|
||||||
"pree2e": "yarn run webdriver:update",
|
|
||||||
"e2e": "yarn run protractor",
|
|
||||||
"pretest": "yarn run clean:bld",
|
|
||||||
"pretest:headless": "yarn run pretest",
|
|
||||||
"pretest:watch": "yarn run pretest",
|
|
||||||
"test": "karma start --single-run",
|
|
||||||
"test:headless": "karma start --single-run --browsers ChromeHeadless",
|
|
||||||
"test:watch": "karma start --no-single-run --auto-watch",
|
|
||||||
"webdriver:start": "node node_modules/protractor/bin/webdriver-manager start --seleniumPort 4444",
|
|
||||||
"webdriver:update": "node node_modules/protractor/bin/webdriver-manager update --standalone --gecko false",
|
|
||||||
"lint": "tslint \"src/**/*.ts\" && tslint \"e2e/**/*.ts\"",
|
|
||||||
"docs": "typedoc --options typedoc.json ./src/",
|
|
||||||
"coverage": "http-server -c-1 -o -p 9875 ./coverage",
|
|
||||||
"postinstall": "yarn run patch-protractor",
|
|
||||||
"patch-protractor": "ncp node_modules/webdriver-manager node_modules/protractor/node_modules/webdriver-manager",
|
|
||||||
"sync-i18n": "node ./scripts/sync-i18n-files.js"
|
|
||||||
},
|
},
|
||||||
|
"browser": {
|
||||||
|
"fs": false,
|
||||||
|
"path": false,
|
||||||
|
"http": false,
|
||||||
|
"https": false
|
||||||
|
},
|
||||||
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^8.2.14",
|
"@angular/animations": "~8.2.14",
|
||||||
"@angular/cdk": "8.2.3",
|
"@angular/cdk": "8.2.3",
|
||||||
"@angular/cli": "^8.3.25",
|
"@angular/common": "~8.2.14",
|
||||||
"@angular/common": "^8.2.14",
|
"@angular/compiler": "~8.2.14",
|
||||||
"@angular/core": "^8.2.14",
|
"@angular/core": "~8.2.14",
|
||||||
"@angular/forms": "^8.2.14",
|
"@angular/forms": "~8.2.14",
|
||||||
"@angular/platform-browser": "^8.2.14",
|
"@angular/platform-browser": "~8.2.14",
|
||||||
"@angular/platform-browser-dynamic": "^8.2.14",
|
"@angular/platform-browser-dynamic": "~8.2.14",
|
||||||
"@angular/platform-server": "^8.2.14",
|
"@angular/platform-server": "~8.2.14",
|
||||||
"@angular/router": "^8.2.14",
|
"@angular/router": "~8.2.14",
|
||||||
"@angularclass/bootloader": "1.0.1",
|
"@angularclass/bootloader": "1.0.1",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^5.2.1",
|
"@ng-bootstrap/ng-bootstrap": "5.2.1",
|
||||||
"@ng-dynamic-forms/core": "8.1.1",
|
"@ng-dynamic-forms/core": "8.1.1",
|
||||||
"@ng-dynamic-forms/ui-ng-bootstrap": "8.1.1",
|
"@ng-dynamic-forms/ui-ng-bootstrap": "8.1.1",
|
||||||
"@ngrx/effects": "^8.6.0",
|
"@ngrx/effects": "^8.6.0",
|
||||||
"@ngrx/router-store": "^8.6.0",
|
"@ngrx/router-store": "^8.6.0",
|
||||||
"@ngrx/store": "^8.6.0",
|
"@ngrx/store": "^8.6.0",
|
||||||
"@nguniversal/express-engine": "^8.2.6",
|
"@nguniversal/express-engine": "8.2.6",
|
||||||
|
"@nguniversal/module-map-ngfactory-loader": "v8.2.6",
|
||||||
"@ngx-translate/core": "11.0.1",
|
"@ngx-translate/core": "11.0.1",
|
||||||
"@ngx-translate/http-loader": "4.0.0",
|
|
||||||
"@nicky-lenaers/ngx-scroll-to": "^3.0.1",
|
"@nicky-lenaers/ngx-scroll-to": "^3.0.1",
|
||||||
"angular-idle-preload": "3.0.0",
|
"angular-idle-preload": "3.0.0",
|
||||||
"angular2-text-mask": "9.0.0",
|
"angular2-text-mask": "9.0.0",
|
||||||
"angulartics2": "7.5.2",
|
"angulartics2": "7.5.2",
|
||||||
"body-parser": "1.18.2",
|
|
||||||
"bootstrap": "4.3.1",
|
"bootstrap": "4.3.1",
|
||||||
|
"caniuse-lite": "^1.0.30000697",
|
||||||
"cerialize": "0.1.18",
|
"cerialize": "0.1.18",
|
||||||
"compression": "1.7.1",
|
"cli-progress": "^3.8.0",
|
||||||
"cookie-parser": "1.4.3",
|
"cookie-parser": "1.4.3",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
"debug-loader": "^0.0.1",
|
"debug-loader": "^0.0.1",
|
||||||
|
"deepmerge": "^4.2.2",
|
||||||
"express": "4.16.2",
|
"express": "4.16.2",
|
||||||
"express-session": "1.15.6",
|
|
||||||
"fast-json-patch": "^2.0.7",
|
"fast-json-patch": "^2.0.7",
|
||||||
"file-saver": "^1.3.8",
|
"file-saver": "^1.3.8",
|
||||||
"font-awesome": "4.7.0",
|
"font-awesome": "4.7.0",
|
||||||
"fork-ts-checker-webpack-plugin": "^0.4.10",
|
|
||||||
"hammerjs": "^2.0.8",
|
|
||||||
"http-server": "0.11.1",
|
|
||||||
"https": "1.0.0",
|
"https": "1.0.0",
|
||||||
"js-cookie": "2.2.0",
|
"js-cookie": "2.2.0",
|
||||||
"js.clone": "0.0.3",
|
|
||||||
"json5": "^2.1.0",
|
"json5": "^2.1.0",
|
||||||
"jsonschema": "1.2.2",
|
"jsonschema": "1.2.2",
|
||||||
"jwt-decode": "^2.2.0",
|
"jwt-decode": "^2.2.0",
|
||||||
"methods": "1.1.2",
|
|
||||||
"moment": "^2.22.1",
|
"moment": "^2.22.1",
|
||||||
"moment-range": "^4.0.2",
|
|
||||||
"morgan": "^1.9.1",
|
"morgan": "^1.9.1",
|
||||||
"ng-mocks": "^8.1.0",
|
"ng-mocks": "^8.1.0",
|
||||||
"ng2-file-upload": "1.2.1",
|
"ng2-file-upload": "1.2.1",
|
||||||
@@ -134,124 +106,74 @@
|
|||||||
"ngx-sortablejs": "^3.1.4",
|
"ngx-sortablejs": "^3.1.4",
|
||||||
"nouislider": "^11.0.0",
|
"nouislider": "^11.0.0",
|
||||||
"pem": "1.13.2",
|
"pem": "1.13.2",
|
||||||
|
"postcss-cli": "^6.0.0",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rxjs": "6.5.4",
|
"rxjs": "~6.4.0",
|
||||||
"rxjs-spy": "^7.5.1",
|
"rxjs-spy": "^7.5.1",
|
||||||
"sass-resources-loader": "^2.0.0",
|
"sass-resources-loader": "^2.0.0",
|
||||||
"sortablejs": "1.7.0",
|
"sortablejs": "1.7.0",
|
||||||
"text-mask-core": "5.0.1",
|
"tslib": "^1.10.0",
|
||||||
"ts-loader": "^5.2.1",
|
|
||||||
"ts-md5": "^1.2.4",
|
|
||||||
"url-parse": "^1.4.7",
|
|
||||||
"uuid": "^3.2.1",
|
|
||||||
"webfontloader": "1.6.28",
|
"webfontloader": "1.6.28",
|
||||||
"webpack-cli": "^3.2.0",
|
|
||||||
"zone.js": "^0.9.1"
|
"zone.js": "^0.9.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/build-angular": "^0.803.25",
|
"@angular-builders/custom-webpack": "8.4.1",
|
||||||
"@angular/compiler": "^8.2.14",
|
"@angular-devkit/build-angular": "~0.803.25",
|
||||||
"@angular/compiler-cli": "^8.2.14",
|
"@angular/cli": "~8.3.25",
|
||||||
|
"@angular/compiler-cli": "~8.2.14",
|
||||||
|
"@angular/language-service": "~8.2.14",
|
||||||
"@fortawesome/fontawesome-free": "^5.5.0",
|
"@fortawesome/fontawesome-free": "^5.5.0",
|
||||||
"@ngrx/entity": "^8.6.0",
|
|
||||||
"@ngrx/schematics": "^8.6.0",
|
|
||||||
"@ngrx/store-devtools": "^8.6.0",
|
"@ngrx/store-devtools": "^8.6.0",
|
||||||
"@ngtools/webpack": "^8.3.25",
|
"@ngtools/webpack": "^8.3.25",
|
||||||
"@schematics/angular": "^0.7.5",
|
|
||||||
"@types/acorn": "^4.0.3",
|
|
||||||
"@types/cookie-parser": "1.4.1",
|
|
||||||
"@types/deep-freeze": "0.1.1",
|
"@types/deep-freeze": "0.1.1",
|
||||||
"@types/express": "^4.11.1",
|
"@types/express": "^4.17.0",
|
||||||
"@types/express-serve-static-core": "4.16.0",
|
|
||||||
"@types/file-saver": "^1.3.0",
|
"@types/file-saver": "^1.3.0",
|
||||||
"@types/hammerjs": "2.0.35",
|
|
||||||
"@types/jasmine": "^3.3.9",
|
"@types/jasmine": "^3.3.9",
|
||||||
|
"@types/jasminewd2": "~2.0.3",
|
||||||
"@types/js-cookie": "2.1.0",
|
"@types/js-cookie": "2.1.0",
|
||||||
"@types/json5": "^0.0.30",
|
|
||||||
"@types/lodash": "^4.14.110",
|
"@types/lodash": "^4.14.110",
|
||||||
"@types/memory-cache": "0.2.0",
|
"@types/node": "11.15.3",
|
||||||
"@types/mime": "2.0.0",
|
"codelyzer": "^5.0.0",
|
||||||
"@types/node": "^11.11.2",
|
|
||||||
"@types/serve-static": "1.13.2",
|
|
||||||
"@types/uuid": "^3.4.3",
|
|
||||||
"@types/webfontloader": "1.6.29",
|
|
||||||
"@typescript-eslint/eslint-plugin": "^2.12.0",
|
|
||||||
"@typescript-eslint/parser": "^2.12.0",
|
|
||||||
"ajv": "^6.1.1",
|
|
||||||
"ajv-keywords": "^3.1.0",
|
|
||||||
"angular2-template-loader": "0.6.2",
|
|
||||||
"autoprefixer": "^9.1.3",
|
|
||||||
"caniuse-lite": "^1.0.30000697",
|
|
||||||
"cli-progress": "^3.3.1",
|
|
||||||
"codelyzer": "^5.1.0",
|
|
||||||
"commander": "^3.0.2",
|
|
||||||
"compression-webpack-plugin": "^3.0.1",
|
"compression-webpack-plugin": "^3.0.1",
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
"copy-webpack-plugin": "^5.1.1",
|
||||||
"copyfiles": "^2.1.1",
|
|
||||||
"coveralls": "3.0.0",
|
"coveralls": "3.0.0",
|
||||||
"css-loader": "3.4.0",
|
"css-loader": "3.4.0",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.10",
|
||||||
"deep-freeze": "0.0.1",
|
"deep-freeze": "0.0.1",
|
||||||
"eslint": "^6.7.2",
|
"dotenv": "^8.2.0",
|
||||||
"exports-loader": "^0.7.0",
|
"fork-ts-checker-webpack-plugin": "^0.4.10",
|
||||||
"html-webpack-plugin": "3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
"imports-loader": "0.8.0",
|
|
||||||
"istanbul-instrumenter-loader": "3.0.1",
|
|
||||||
"jasmine-core": "^3.3.0",
|
"jasmine-core": "^3.3.0",
|
||||||
"jasmine-marbles": "0.3.1",
|
"jasmine-marbles": "0.3.1",
|
||||||
"jasmine-spec-reporter": "4.2.1",
|
"jasmine-spec-reporter": "~4.2.1",
|
||||||
"karma": "4.0.1",
|
"karma": "~4.1.0",
|
||||||
"karma-chrome-launcher": "2.2.0",
|
"karma-chrome-launcher": "~2.2.0",
|
||||||
"karma-cli": "2.0.0",
|
"karma-coverage-istanbul-reporter": "~2.0.1",
|
||||||
"karma-coverage": "1.1.2",
|
|
||||||
"karma-istanbul-preprocessor": "0.0.2",
|
|
||||||
"karma-jasmine": "2.0.1",
|
"karma-jasmine": "2.0.1",
|
||||||
|
"karma-jasmine-html-reporter": "^1.4.0",
|
||||||
"karma-mocha-reporter": "2.2.5",
|
"karma-mocha-reporter": "2.2.5",
|
||||||
"karma-phantomjs-launcher": "1.0.4",
|
"nodemon": "^2.0.2",
|
||||||
"karma-remap-coverage": "^0.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"karma-remap-istanbul": "0.6.0",
|
|
||||||
"karma-sourcemap-loader": "0.3.7",
|
|
||||||
"karma-webdriver-launcher": "^1.0.7",
|
|
||||||
"karma-webpack": "3.0.0",
|
|
||||||
"ncp": "^2.0.0",
|
|
||||||
"nodemon": "^1.15.0",
|
|
||||||
"npm-run-all": "4.1.3",
|
|
||||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||||
"postcss": "^7.0.2",
|
|
||||||
"postcss-apply": "0.11.0",
|
"postcss-apply": "0.11.0",
|
||||||
"postcss-cli": "^6.0.0",
|
|
||||||
"postcss-cssnext": "3.1.0",
|
"postcss-cssnext": "3.1.0",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"postcss-responsive-type": "1.0.0",
|
"postcss-responsive-type": "1.0.0",
|
||||||
"postcss-smart-import": "0.7.6",
|
"postcss-smart-import": "^0.7.6",
|
||||||
"protractor": "^5.4.2",
|
"protractor": "~5.4.0",
|
||||||
"protractor-istanbul-plugin": "2.0.0",
|
"protractor-istanbul-plugin": "2.0.0",
|
||||||
"raw-loader": "0.5.1",
|
"raw-loader": "0.5.1",
|
||||||
"rimraf": "2.6.2",
|
"rimraf": "^3.0.2",
|
||||||
"rollup": "^0.65.0",
|
|
||||||
"rollup-plugin-commonjs": "^9.1.6",
|
|
||||||
"rollup-plugin-node-globals": "1.2.1",
|
|
||||||
"rollup-plugin-node-resolve": "^3.0.3",
|
|
||||||
"rollup-plugin-terser": "^2.0.2",
|
|
||||||
"sass-loader": "7.3.1",
|
|
||||||
"script-ext-html-webpack-plugin": "2.1.4",
|
"script-ext-html-webpack-plugin": "2.1.4",
|
||||||
"source-map": "0.7.3",
|
|
||||||
"source-map-loader": "0.2.4",
|
|
||||||
"string-replace-loader": "^2.1.1",
|
"string-replace-loader": "^2.1.1",
|
||||||
"terser-webpack-plugin": "^2.3.1",
|
"terser-webpack-plugin": "^2.3.1",
|
||||||
"to-string-loader": "1.1.5",
|
"ts-loader": "^5.2.0",
|
||||||
"ts-helpers": "1.1.2",
|
"ts-node": "^8.8.1",
|
||||||
"ts-node": "4.1.0",
|
"tslint": "~5.15.0",
|
||||||
"tslint": "5.11.0",
|
"typescript": "~3.5.3",
|
||||||
"typedoc": "^0.9.0",
|
"webpack": "^4.0.0",
|
||||||
"typescript": "3.5.3",
|
|
||||||
"webdriver-manager": "^12.1.7",
|
|
||||||
"webpack": "^4.29.6",
|
|
||||||
"webpack-bundle-analyzer": "^3.3.2",
|
"webpack-bundle-analyzer": "^3.3.2",
|
||||||
"webpack-dev-middleware": "3.2.0",
|
"webpack-cli": "^3.1.0",
|
||||||
"webpack-dev-server": "^3.1.11",
|
|
||||||
"webpack-import-glob-loader": "^1.6.3",
|
|
||||||
"webpack-merge": "4.1.4",
|
|
||||||
"webpack-node-externals": "1.7.2"
|
"webpack-node-externals": "1.7.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,21 +0,0 @@
|
|||||||
import nodeResolve from 'rollup-plugin-node-resolve'
|
|
||||||
import commonjs from 'rollup-plugin-commonjs';
|
|
||||||
import terser from 'rollup-plugin-terser'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
input: 'dist/client.js',
|
|
||||||
output: {
|
|
||||||
file: 'dist/client.js',
|
|
||||||
format: 'iife',
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
nodeResolve({
|
|
||||||
jsnext: true,
|
|
||||||
module: true
|
|
||||||
}),
|
|
||||||
commonjs({
|
|
||||||
include: 'node_modules/rxjs/**'
|
|
||||||
}),
|
|
||||||
terser.terser()
|
|
||||||
]
|
|
||||||
}
|
|
116
scripts/set-env.ts
Normal file
116
scripts/set-env.ts
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
import { writeFile } from 'fs';
|
||||||
|
import { environment as commonEnv } from '../src/environments/environment.common';
|
||||||
|
import { GlobalConfig } from '../src/config/global-config.interface';
|
||||||
|
import { ServerConfig } from '../src/config/server-config.interface';
|
||||||
|
import { hasValue } from '../src/app/shared/empty.util';
|
||||||
|
|
||||||
|
// Configure Angular `environment.ts` file path
|
||||||
|
const targetPath = './src/environments/environment.ts';
|
||||||
|
// Load node modules
|
||||||
|
const colors = require('colors');
|
||||||
|
require('dotenv').config();
|
||||||
|
const merge = require('deepmerge');
|
||||||
|
|
||||||
|
const environment = process.argv[2];
|
||||||
|
let environmentFilePath;
|
||||||
|
let production = false;
|
||||||
|
|
||||||
|
switch (environment) {
|
||||||
|
case '--prod':
|
||||||
|
case '--production':
|
||||||
|
production = true;
|
||||||
|
console.log(`Building ${colors.red.bold(`production`)} environment`);
|
||||||
|
environmentFilePath = '../src/environments/environment.prod.ts';
|
||||||
|
break;
|
||||||
|
case '--test':
|
||||||
|
console.log(`Building ${colors.blue.bold(`test`)} environment`);
|
||||||
|
environmentFilePath = '../src/environments/environment.test.ts';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log(`Building ${colors.green.bold(`development`)} environment`);
|
||||||
|
environmentFilePath = '../src/environments/environment.dev.ts';
|
||||||
|
}
|
||||||
|
|
||||||
|
const processEnv = {
|
||||||
|
ui: createServerConfig(
|
||||||
|
process.env.DSPACE_HOST,
|
||||||
|
process.env.DSPACE_PORT,
|
||||||
|
process.env.DSPACE_NAMESPACE,
|
||||||
|
process.env.DSPACE_SSL),
|
||||||
|
rest: createServerConfig(
|
||||||
|
process.env.DSPACE_REST_HOST,
|
||||||
|
process.env.DSPACE_REST_PORT,
|
||||||
|
process.env.DSPACE_REST_NAMESPACE,
|
||||||
|
process.env.DSPACE_REST_SSL)
|
||||||
|
} as GlobalConfig;
|
||||||
|
|
||||||
|
import(environmentFilePath)
|
||||||
|
.then((file) => generateEnvironmentFile(merge.all([commonEnv, file.environment, processEnv])))
|
||||||
|
.catch(() => {
|
||||||
|
console.log(colors.yellow.bold(`No specific environment file found for ` + environment));
|
||||||
|
generateEnvironmentFile(merge(commonEnv, processEnv))
|
||||||
|
});
|
||||||
|
|
||||||
|
function generateEnvironmentFile(file: GlobalConfig): void {
|
||||||
|
file.production = production;
|
||||||
|
buildBaseUrls(file);
|
||||||
|
const contents = `export const environment = ` + JSON.stringify(file);
|
||||||
|
writeFile(targetPath, contents, (err) => {
|
||||||
|
if (err) {
|
||||||
|
throw console.error(err);
|
||||||
|
} else {
|
||||||
|
console.log(`Angular ${colors.bold('environment.ts')} file generated correctly at ${colors.bold(targetPath)} \n`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// allow to override a few important options by environment variables
|
||||||
|
function createServerConfig(host?: string, port?: string, nameSpace?: string, ssl?: string): ServerConfig {
|
||||||
|
const result = {} as any;
|
||||||
|
if (hasValue(host)) {
|
||||||
|
result.host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue(nameSpace)) {
|
||||||
|
result.nameSpace = nameSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue(port)) {
|
||||||
|
result.port = Number(port);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasValue(ssl)) {
|
||||||
|
result.ssl = ssl.trim().match(/^(true|1|yes)$/i) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildBaseUrls(config: GlobalConfig): void {
|
||||||
|
for (const key in config) {
|
||||||
|
if (config.hasOwnProperty(key) && config[key].host) {
|
||||||
|
config[key].baseUrl = [
|
||||||
|
getProtocol(config[key].ssl),
|
||||||
|
getHost(config[key].host),
|
||||||
|
getPort(config[key].port),
|
||||||
|
getNameSpace(config[key].nameSpace)
|
||||||
|
].join('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProtocol(ssl: boolean): string {
|
||||||
|
return ssl ? 'https://' : 'http://';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHost(host: string): string {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPort(port: number): string {
|
||||||
|
return port ? (port !== 80 && port !== 443) ? ':' + port : '' : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getNameSpace(nameSpace: string): string {
|
||||||
|
return nameSpace ? nameSpace.charAt(0) === '/' ? nameSpace : '/' + nameSpace : '';
|
||||||
|
}
|
11
scripts/set-mock-env.ts
Normal file
11
scripts/set-mock-env.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { copyFile } from 'fs';
|
||||||
|
|
||||||
|
// Configure Angular `environment.ts` file path
|
||||||
|
const sourcePath = './src/environments/mock-environment.ts';
|
||||||
|
const targetPath = './src/environments/environment.ts';
|
||||||
|
|
||||||
|
// destination.txt will be created or overwritten by default.
|
||||||
|
copyFile(sourcePath, targetPath, (err) => {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log(sourcePath + ' was copied to ' + targetPath);
|
||||||
|
});
|
@@ -1,10 +1,9 @@
|
|||||||
#!/usr/bin/env node
|
import { projectRoot} from '../webpack/helpers';
|
||||||
const commander = require('commander');
|
const commander = require('commander');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const JSON5 = require('json5');
|
const JSON5 = require('json5');
|
||||||
const _cliProgress = require('cli-progress');
|
const _cliProgress = require('cli-progress');
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const {projectRoot} = require('../webpack/helpers');
|
|
||||||
|
|
||||||
const program = new commander.Command();
|
const program = new commander.Command();
|
||||||
program.version('1.0.0', '-v, --version');
|
program.version('1.0.0', '-v, --version');
|
||||||
@@ -13,8 +12,8 @@ const NEW_MESSAGE_TODO = '// TODO New key - Add a translation';
|
|||||||
const MESSAGE_CHANGED_TODO = '// TODO Source message changed - Revise the translation';
|
const MESSAGE_CHANGED_TODO = '// TODO Source message changed - Revise the translation';
|
||||||
const COMMENTS_CHANGED_TODO = '// TODO Source comments changed - Revise the translation';
|
const COMMENTS_CHANGED_TODO = '// TODO Source comments changed - Revise the translation';
|
||||||
|
|
||||||
const DEFAULT_SOURCE_FILE_LOCATION = 'resources/i18n/en.json5';
|
const DEFAULT_SOURCE_FILE_LOCATION = 'src/assets/i18n/en.json5';
|
||||||
const LANGUAGE_FILES_LOCATION = 'resources/i18n';
|
const LANGUAGE_FILES_LOCATION = 'src/assets/i18n';
|
||||||
|
|
||||||
parseCliInput();
|
parseCliInput();
|
||||||
|
|
75
server.ts
Normal file
75
server.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
/**
|
||||||
|
* *** NOTE ON IMPORTING FROM ANGULAR AND NGUNIVERSAL IN THIS FILE ***
|
||||||
|
*
|
||||||
|
* If your application uses third-party dependencies, you'll need to
|
||||||
|
* either use Webpack or the Angular CLI's `bundleDependencies` feature
|
||||||
|
* in order to adequately package them for use on the server without a
|
||||||
|
* node_modules directory.
|
||||||
|
*
|
||||||
|
* However, due to the nature of the CLI's `bundleDependencies`, importing
|
||||||
|
* Angular in this file will create a different instance of Angular than
|
||||||
|
* the version in the compiled application code. This leads to unavoidable
|
||||||
|
* conflicts. Therefore, please do not explicitly import from @angular or
|
||||||
|
* @nguniversal in this file. You can export any needed resources
|
||||||
|
* from your application's main.server.ts file, as seen below with the
|
||||||
|
* import for `ngExpressEngine`.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import 'zone.js/dist/zone-node';
|
||||||
|
import 'reflect-metadata';
|
||||||
|
|
||||||
|
import * as express from 'express';
|
||||||
|
import { join } from 'path';
|
||||||
|
import { REQUEST, RESPONSE } from '@nguniversal/express-engine/tokens';
|
||||||
|
import * as bodyParser from 'body-parser';
|
||||||
|
import * as cookieParser from 'cookie-parser';
|
||||||
|
import { environment } from './src/environments/environment';
|
||||||
|
|
||||||
|
// Express server
|
||||||
|
const app = express();
|
||||||
|
|
||||||
|
const PORT = environment.ui.port || 4000;
|
||||||
|
const DIST_FOLDER = join(process.cwd(), 'dist/browser');
|
||||||
|
|
||||||
|
// * NOTE :: leave this as require() since this file is built Dynamically from webpack
|
||||||
|
const { ServerAppModuleNgFactory, LAZY_MODULE_MAP, ngExpressEngine, provideModuleMap } = require('./dist/server/main');
|
||||||
|
|
||||||
|
app.use(cookieParser());
|
||||||
|
app.use(bodyParser.json());
|
||||||
|
|
||||||
|
app.engine('html', (_, options, callback) =>
|
||||||
|
ngExpressEngine({
|
||||||
|
bootstrap: ServerAppModuleNgFactory,
|
||||||
|
providers: [
|
||||||
|
{
|
||||||
|
provide: REQUEST,
|
||||||
|
useValue: (options as any).req,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: RESPONSE,
|
||||||
|
useValue: (options as any).req.res,
|
||||||
|
},
|
||||||
|
provideModuleMap(LAZY_MODULE_MAP)
|
||||||
|
],
|
||||||
|
})(_, options, callback)
|
||||||
|
);
|
||||||
|
|
||||||
|
app.set('view engine', 'html');
|
||||||
|
app.set('views', DIST_FOLDER);
|
||||||
|
|
||||||
|
// Example Express Rest API endpoints
|
||||||
|
// app.get('/api/**', (req, res) => { });
|
||||||
|
// Serve static files from /browser
|
||||||
|
app.get('*.*', express.static(DIST_FOLDER, {
|
||||||
|
maxAge: '1y'
|
||||||
|
}));
|
||||||
|
|
||||||
|
// All regular routes use the Universal engine
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.render('index', { req });
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start up the Node server
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Node Express server listening on http://localhost:${PORT}`);
|
||||||
|
});
|
@@ -1,48 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author: @AngularClass
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* When testing with webpack and ES6, we have to do some extra
|
|
||||||
* things to get testing to work right. Because we are gonna write tests
|
|
||||||
* in ES6 too, we have to compile those as well. That's handled in
|
|
||||||
* karma.conf.js with the karma-webpack plugin. This is the entry
|
|
||||||
* file for webpack test. Just like webpack will create a bundle.js
|
|
||||||
* file for our client, when we run test, it will compile and bundle them
|
|
||||||
* all here! Crazy huh. So we need to do some setup
|
|
||||||
*/
|
|
||||||
Error.stackTraceLimit = Infinity;
|
|
||||||
|
|
||||||
require('core-js/es');
|
|
||||||
require('core-js/features/reflect');
|
|
||||||
|
|
||||||
// Typescript emit helpers polyfill
|
|
||||||
require('ts-helpers');
|
|
||||||
|
|
||||||
require('zone.js/dist/zone');
|
|
||||||
require('zone.js/dist/long-stack-trace-zone');
|
|
||||||
require('zone.js/dist/proxy'); // since zone.js 0.6.15
|
|
||||||
require('zone.js/dist/sync-test');
|
|
||||||
require('zone.js/dist/jasmine-patch'); // put here since zone.js 0.6.14
|
|
||||||
require('zone.js/dist/async-test');
|
|
||||||
require('zone.js/dist/fake-async-test');
|
|
||||||
|
|
||||||
// RxJS
|
|
||||||
require('rxjs');
|
|
||||||
|
|
||||||
var testing = require('@angular/core/testing');
|
|
||||||
var browser = require('@angular/platform-browser-dynamic/testing');
|
|
||||||
|
|
||||||
testing.TestBed.initTestEnvironment(
|
|
||||||
browser.BrowserDynamicTestingModule,
|
|
||||||
browser.platformBrowserDynamicTesting()
|
|
||||||
);
|
|
||||||
|
|
||||||
var tests = require.context('./src', true, /\.spec\.ts$/);
|
|
||||||
|
|
||||||
tests.keys().forEach(tests);
|
|
||||||
|
|
||||||
// includes all modules into test coverage
|
|
||||||
const modules = require.context('./src/app', true, /\.module\.ts$/);
|
|
||||||
|
|
||||||
modules.keys().forEach(modules);
|
|
@@ -3,19 +3,27 @@ import { RouterModule } from '@angular/router';
|
|||||||
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
import { EPeopleRegistryComponent } from './epeople-registry/epeople-registry.component';
|
||||||
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
import { GroupFormComponent } from './group-registry/group-form/group-form.component';
|
||||||
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
import { GroupsRegistryComponent } from './group-registry/groups-registry.component';
|
||||||
|
import { URLCombiner } from '../../core/url-combiner/url-combiner';
|
||||||
|
import { getAccessControlModulePath } from '../admin-routing.module';
|
||||||
|
|
||||||
|
const GROUP_EDIT_PATH = 'groups';
|
||||||
|
|
||||||
|
export function getGroupEditPath(id: string) {
|
||||||
|
return new URLCombiner(getAccessControlModulePath(), GROUP_EDIT_PATH, id).toString();
|
||||||
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forChild([
|
RouterModule.forChild([
|
||||||
{ path: 'epeople', component: EPeopleRegistryComponent, data: { title: 'admin.access-control.epeople.title' } },
|
{ path: 'epeople', component: EPeopleRegistryComponent, data: { title: 'admin.access-control.epeople.title' } },
|
||||||
{ path: 'groups', component: GroupsRegistryComponent, data: { title: 'admin.access-control.groups.title' } },
|
{ path: GROUP_EDIT_PATH, component: GroupsRegistryComponent, data: { title: 'admin.access-control.groups.title' } },
|
||||||
{
|
{
|
||||||
path: 'groups/:groupId',
|
path: `${GROUP_EDIT_PATH}/:groupId`,
|
||||||
component: GroupFormComponent,
|
component: GroupFormComponent,
|
||||||
data: {title: 'admin.registries.schema.title'}
|
data: {title: 'admin.registries.schema.title'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'groups/newGroup',
|
path: `${GROUP_EDIT_PATH}/newGroup`,
|
||||||
component: GroupFormComponent,
|
component: GroupFormComponent,
|
||||||
data: {title: 'admin.registries.schema.title'}
|
data: {title: 'admin.registries.schema.title'}
|
||||||
},
|
},
|
||||||
|
@@ -15,15 +15,15 @@ import { EPersonDataService } from '../../../core/eperson/eperson-data.service';
|
|||||||
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
import { EPerson } from '../../../core/eperson/models/eperson.model';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||||
import { getMockFormBuilderService } from '../../../shared/mocks/mock-form-builder-service';
|
|
||||||
import { MockTranslateLoader } from '../../../shared/mocks/mock-translate-loader';
|
|
||||||
import { getMockTranslateService } from '../../../shared/mocks/mock-translate.service';
|
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { EPersonMock, EPersonMock2 } from '../../../shared/testing/eperson-mock';
|
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
|
||||||
import { EPeopleRegistryComponent } from './epeople-registry.component';
|
import { EPeopleRegistryComponent } from './epeople-registry.component';
|
||||||
|
import { EPersonMock, EPersonMock2 } from '../../../shared/testing/eperson.mock';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { getMockFormBuilderService } from '../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { getMockTranslateService } from '../../../shared/mocks/translate.service.mock';
|
||||||
|
import { TranslateLoaderMock } from '../../../shared/mocks/translate-loader.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
|
||||||
describe('EPeopleRegistryComponent', () => {
|
describe('EPeopleRegistryComponent', () => {
|
||||||
let component: EPeopleRegistryComponent;
|
let component: EPeopleRegistryComponent;
|
||||||
@@ -89,7 +89,7 @@ describe('EPeopleRegistryComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: MockTranslateLoader
|
useClass: TranslateLoaderMock
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { EPersonMock } from '../../../shared/testing/eperson-mock';
|
|
||||||
import { EPeopleRegistryCancelEPersonAction, EPeopleRegistryEditEPersonAction } from './epeople-registry.actions';
|
import { EPeopleRegistryCancelEPersonAction, EPeopleRegistryEditEPersonAction } from './epeople-registry.actions';
|
||||||
import { ePeopleRegistryReducer, EPeopleRegistryState } from './epeople-registry.reducers';
|
import { ePeopleRegistryReducer, EPeopleRegistryState } from './epeople-registry.reducers';
|
||||||
|
import { EPersonMock } from '../../../shared/testing/eperson.mock';
|
||||||
|
|
||||||
const initialState: EPeopleRegistryState = {
|
const initialState: EPeopleRegistryState = {
|
||||||
editEPerson: null,
|
editEPerson: null,
|
||||||
|
@@ -22,17 +22,17 @@ import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service
|
|||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { UUIDService } from '../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
import { getMockFormBuilderService } from '../../../../shared/mocks/mock-form-builder-service';
|
|
||||||
import { getMockTranslateService } from '../../../../shared/mocks/mock-translate.service';
|
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { EPersonMock, EPersonMock2 } from '../../../../shared/testing/eperson-mock';
|
|
||||||
import { MockTranslateLoader } from '../../../../shared/testing/mock-translate-loader';
|
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service-stub';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
|
||||||
import { EPeopleRegistryComponent } from '../epeople-registry.component';
|
import { EPeopleRegistryComponent } from '../epeople-registry.component';
|
||||||
import { EPersonFormComponent } from './eperson-form.component';
|
import { EPersonFormComponent } from './eperson-form.component';
|
||||||
|
import { EPersonMock, EPersonMock2 } from '../../../../shared/testing/eperson.mock';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
|
import { TranslateLoaderMock } from '../../../../shared/mocks/translate-loader.mock';
|
||||||
import { AuthService } from '../../../../core/auth/auth.service';
|
import { AuthService } from '../../../../core/auth/auth.service';
|
||||||
import { AuthServiceStub } from '../../../../shared/testing/auth-service-stub';
|
import { AuthServiceStub } from '../../../../shared/testing/auth-service.stub';
|
||||||
|
|
||||||
describe('EPersonFormComponent', () => {
|
describe('EPersonFormComponent', () => {
|
||||||
let component: EPersonFormComponent;
|
let component: EPersonFormComponent;
|
||||||
@@ -113,7 +113,7 @@ describe('EPersonFormComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: MockTranslateLoader
|
useClass: TranslateLoaderMock
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@@ -23,15 +23,15 @@ import { HALEndpointService } from '../../../../core/shared/hal-endpoint.service
|
|||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { UUIDService } from '../../../../core/shared/uuid.service';
|
import { UUIDService } from '../../../../core/shared/uuid.service';
|
||||||
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../shared/form/builder/form-builder.service';
|
||||||
import { getMockFormBuilderService } from '../../../../shared/mocks/mock-form-builder-service';
|
|
||||||
import { MockRouter } from '../../../../shared/mocks/mock-router';
|
|
||||||
import { getMockTranslateService } from '../../../../shared/mocks/mock-translate.service';
|
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { GroupMock, GroupMock2 } from '../../../../shared/testing/group-mock';
|
import { GroupMock, GroupMock2 } from '../../../../shared/testing/group-mock';
|
||||||
import { MockTranslateLoader } from '../../../../shared/testing/mock-translate-loader';
|
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service-stub';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
|
||||||
import { GroupFormComponent } from './group-form.component';
|
import { GroupFormComponent } from './group-form.component';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
|
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { getMockTranslateService } from '../../../../shared/mocks/translate.service.mock';
|
||||||
|
import { TranslateLoaderMock } from '../../../../shared/testing/translate-loader.mock';
|
||||||
|
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
|
|
||||||
describe('GroupFormComponent', () => {
|
describe('GroupFormComponent', () => {
|
||||||
let component: GroupFormComponent;
|
let component: GroupFormComponent;
|
||||||
@@ -90,13 +90,13 @@ describe('GroupFormComponent', () => {
|
|||||||
};
|
};
|
||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
translateService = getMockTranslateService();
|
translateService = getMockTranslateService();
|
||||||
router = new MockRouter();
|
router = new RouterMock();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
|
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
|
||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: MockTranslateLoader
|
useClass: TranslateLoaderMock
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@@ -16,17 +16,17 @@ import { EPerson } from '../../../../../core/eperson/models/eperson.model';
|
|||||||
import { Group } from '../../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../../core/eperson/models/group.model';
|
||||||
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../../shared/form/builder/form-builder.service';
|
||||||
import { getMockFormBuilderService } from '../../../../../shared/mocks/mock-form-builder-service';
|
|
||||||
import { MockRouter } from '../../../../../shared/mocks/mock-router';
|
|
||||||
import { getMockTranslateService } from '../../../../../shared/mocks/mock-translate.service';
|
|
||||||
import { NotificationsService } from '../../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../../shared/notifications/notifications.service';
|
||||||
import { EPersonMock, EPersonMock2 } from '../../../../../shared/testing/eperson-mock';
|
|
||||||
import { GroupMock, GroupMock2 } from '../../../../../shared/testing/group-mock';
|
import { GroupMock, GroupMock2 } from '../../../../../shared/testing/group-mock';
|
||||||
import { MockTranslateLoader } from '../../../../../shared/testing/mock-translate-loader';
|
|
||||||
import { NotificationsServiceStub } from '../../../../../shared/testing/notifications-service-stub';
|
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
|
||||||
import { MembersListComponent } from './members-list.component';
|
import { MembersListComponent } from './members-list.component';
|
||||||
|
import { EPersonMock, EPersonMock2 } from '../../../../../shared/testing/eperson.mock';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||||
|
import { getMockTranslateService } from '../../../../../shared/mocks/translate.service.mock';
|
||||||
|
import { getMockFormBuilderService } from '../../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../../../shared/testing/notifications-service.stub';
|
||||||
|
import { RouterMock } from '../../../../../shared/mocks/router.mock';
|
||||||
|
|
||||||
describe('MembersListComponent', () => {
|
describe('MembersListComponent', () => {
|
||||||
let component: MembersListComponent;
|
let component: MembersListComponent;
|
||||||
@@ -119,7 +119,7 @@ describe('MembersListComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: MockTranslateLoader
|
useClass: TranslateLoaderMock
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@@ -129,7 +129,7 @@ describe('MembersListComponent', () => {
|
|||||||
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: FormBuilderService, useValue: builderService },
|
{ provide: FormBuilderService, useValue: builderService },
|
||||||
{ provide: Router, useValue: new MockRouter() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@@ -14,16 +14,16 @@ import { GroupDataService } from '../../../../../core/eperson/group-data.service
|
|||||||
import { Group } from '../../../../../core/eperson/models/group.model';
|
import { Group } from '../../../../../core/eperson/models/group.model';
|
||||||
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||||
import { FormBuilderService } from '../../../../../shared/form/builder/form-builder.service';
|
import { FormBuilderService } from '../../../../../shared/form/builder/form-builder.service';
|
||||||
import { getMockFormBuilderService } from '../../../../../shared/mocks/mock-form-builder-service';
|
|
||||||
import { MockRouter } from '../../../../../shared/mocks/mock-router';
|
|
||||||
import { getMockTranslateService } from '../../../../../shared/mocks/mock-translate.service';
|
|
||||||
import { NotificationsService } from '../../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../../shared/notifications/notifications.service';
|
||||||
import { GroupMock, GroupMock2 } from '../../../../../shared/testing/group-mock';
|
import { GroupMock, GroupMock2 } from '../../../../../shared/testing/group-mock';
|
||||||
import { MockTranslateLoader } from '../../../../../shared/testing/mock-translate-loader';
|
|
||||||
import { NotificationsServiceStub } from '../../../../../shared/testing/notifications-service-stub';
|
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
|
||||||
import { SubgroupsListComponent } from './subgroups-list.component';
|
import { SubgroupsListComponent } from './subgroups-list.component';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||||
|
import { RouterMock } from '../../../../../shared/mocks/router.mock';
|
||||||
|
import { getMockFormBuilderService } from '../../../../../shared/mocks/form-builder-service.mock';
|
||||||
|
import { getMockTranslateService } from '../../../../../shared/mocks/translate.service.mock';
|
||||||
|
import { TranslateLoaderMock } from '../../../../../shared/testing/translate-loader.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../../../shared/testing/notifications-service.stub';
|
||||||
|
|
||||||
describe('SubgroupsListComponent', () => {
|
describe('SubgroupsListComponent', () => {
|
||||||
let component: SubgroupsListComponent;
|
let component: SubgroupsListComponent;
|
||||||
@@ -82,7 +82,7 @@ describe('SubgroupsListComponent', () => {
|
|||||||
return observableOf(new RestResponse(true, 200, 'Success'));
|
return observableOf(new RestResponse(true, 200, 'Success'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
routerStub = new MockRouter();
|
routerStub = new RouterMock();
|
||||||
builderService = getMockFormBuilderService();
|
builderService = getMockFormBuilderService();
|
||||||
translateService = getMockTranslateService();
|
translateService = getMockTranslateService();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
@@ -90,7 +90,7 @@ describe('SubgroupsListComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: MockTranslateLoader
|
useClass: TranslateLoaderMock
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
@@ -15,15 +15,15 @@ import { EPerson } from '../../../core/eperson/models/eperson.model';
|
|||||||
import { Group } from '../../../core/eperson/models/group.model';
|
import { Group } from '../../../core/eperson/models/group.model';
|
||||||
import { RouteService } from '../../../core/services/route.service';
|
import { RouteService } from '../../../core/services/route.service';
|
||||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import { MockRouter } from '../../../shared/mocks/mock-router';
|
|
||||||
import { MockTranslateLoader } from '../../../shared/mocks/mock-translate-loader';
|
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { EPersonMock, EPersonMock2 } from '../../../shared/testing/eperson-mock';
|
|
||||||
import { GroupMock, GroupMock2 } from '../../../shared/testing/group-mock';
|
import { GroupMock, GroupMock2 } from '../../../shared/testing/group-mock';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
|
||||||
import { routeServiceStub } from '../../../shared/testing/route-service-stub';
|
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
|
||||||
import { GroupsRegistryComponent } from './groups-registry.component';
|
import { GroupsRegistryComponent } from './groups-registry.component';
|
||||||
|
import { EPersonMock, EPersonMock2 } from '../../../shared/testing/eperson.mock';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { TranslateLoaderMock } from '../../../shared/testing/translate-loader.mock';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { routeServiceStub } from '../../../shared/testing/route-service.stub';
|
||||||
|
import { RouterMock } from '../../../shared/mocks/router.mock';
|
||||||
|
|
||||||
describe('GroupRegistryComponent', () => {
|
describe('GroupRegistryComponent', () => {
|
||||||
let component: GroupsRegistryComponent;
|
let component: GroupsRegistryComponent;
|
||||||
@@ -82,7 +82,7 @@ describe('GroupRegistryComponent', () => {
|
|||||||
TranslateModule.forRoot({
|
TranslateModule.forRoot({
|
||||||
loader: {
|
loader: {
|
||||||
provide: TranslateLoader,
|
provide: TranslateLoader,
|
||||||
useClass: MockTranslateLoader
|
useClass: TranslateLoaderMock
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@@ -92,7 +92,7 @@ describe('GroupRegistryComponent', () => {
|
|||||||
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
{ provide: GroupDataService, useValue: groupsDataServiceStub },
|
||||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||||
{ provide: RouteService, useValue: routeServiceStub },
|
{ provide: RouteService, useValue: routeServiceStub },
|
||||||
{ provide: Router, useValue: new MockRouter() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@@ -47,7 +47,7 @@ export class GroupsRegistryComponent implements OnInit {
|
|||||||
// Current search in groups registry
|
// Current search in groups registry
|
||||||
currentSearchQuery: string;
|
currentSearchQuery: string;
|
||||||
|
|
||||||
constructor(private groupService: GroupDataService,
|
constructor(public groupService: GroupDataService,
|
||||||
private ePersonDataService: EPersonDataService,
|
private ePersonDataService: EPersonDataService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private notificationsService: NotificationsService,
|
private notificationsService: NotificationsService,
|
||||||
|
@@ -11,8 +11,8 @@ import { BitstreamFormatDataService } from '../../../../core/data/bitstream-form
|
|||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
import { AddBitstreamFormatComponent } from './add-bitstream-format.component';
|
import { AddBitstreamFormatComponent } from './add-bitstream-format.component';
|
||||||
|
|
||||||
describe('AddBitstreamFormatComponent', () => {
|
describe('AddBitstreamFormatComponent', () => {
|
||||||
|
@@ -11,10 +11,10 @@ import { PaginationComponent } from '../../../shared/pagination/pagination.compo
|
|||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
||||||
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
import { BitstreamFormatDataService } from '../../../core/data/bitstream-format-data.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../core/shared/bitstream-format.model';
|
||||||
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../core/shared/bitstream-format-support-level';
|
||||||
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
import { cold, getTestScheduler, hot } from 'jasmine-marbles';
|
||||||
|
@@ -12,8 +12,8 @@ import { RemoteData } from '../../../../core/data/remote-data';
|
|||||||
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
import { BitstreamFormatSupportLevel } from '../../../../core/shared/bitstream-format-support-level';
|
||||||
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../core/shared/bitstream-format.model';
|
||||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
import { EditBitstreamFormatComponent } from './edit-bitstream-format.component';
|
import { EditBitstreamFormatComponent } from './edit-bitstream-format.component';
|
||||||
|
|
||||||
describe('EditBitstreamFormatComponent', () => {
|
describe('EditBitstreamFormatComponent', () => {
|
||||||
|
@@ -3,7 +3,7 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { RouterStub } from '../../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../../shared/testing/router.stub';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { FormatFormComponent } from './format-form.component';
|
import { FormatFormComponent } from './format-form.component';
|
||||||
|
@@ -10,14 +10,14 @@ import { RegistryService } from '../../../core/registry/registry.service';
|
|||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
|
||||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('MetadataRegistryComponent', () => {
|
describe('MetadataRegistryComponent', () => {
|
||||||
let comp: MetadataRegistryComponent;
|
let comp: MetadataRegistryComponent;
|
||||||
|
@@ -10,18 +10,18 @@ import { RegistryService } from '../../../core/registry/registry.service';
|
|||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
||||||
import { HostWindowService } from '../../../shared/host-window.service';
|
import { HostWindowService } from '../../../shared/host-window.service';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router-stub';
|
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
|
|
||||||
import { MetadataField } from '../../../core/metadata/metadata-field.model';
|
import { MetadataField } from '../../../core/metadata/metadata-field.model';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('MetadataSchemaComponent', () => {
|
describe('MetadataSchemaComponent', () => {
|
||||||
let comp: MetadataSchemaComponent;
|
let comp: MetadataSchemaComponent;
|
||||||
|
@@ -12,6 +12,10 @@ export function getRegistriesModulePath() {
|
|||||||
return new URLCombiner(getAdminModulePath(), REGISTRIES_MODULE_PATH).toString();
|
return new URLCombiner(getAdminModulePath(), REGISTRIES_MODULE_PATH).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getAccessControlModulePath() {
|
||||||
|
return new URLCombiner(getAdminModulePath(), ACCESS_CONTROL_MODULE_PATH).toString();
|
||||||
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forChild([
|
RouterModule.forChild([
|
||||||
|
@@ -10,7 +10,6 @@ import { Bitstream } from '../../../../../core/shared/bitstream.model';
|
|||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service';
|
import { mockTruncatableService } from '../../../../../shared/mocks/mock-trucatable.service';
|
||||||
import { SharedModule } from '../../../../../shared/shared.module';
|
import { SharedModule } from '../../../../../shared/shared.module';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
|
||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
||||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||||
@@ -18,6 +17,7 @@ import { By } from '@angular/platform-browser';
|
|||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
import { ItemAdminSearchResultGridElementComponent } from './item-admin-search-result-grid-element.component';
|
import { ItemAdminSearchResultGridElementComponent } from './item-admin-search-result-grid-element.component';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('ItemAdminSearchResultGridElementComponent', () => {
|
describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||||
let component: ItemAdminSearchResultGridElementComponent;
|
let component: ItemAdminSearchResultGridElementComponent;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { MenuService } from '../../../shared/menu/menu.service';
|
import { MenuService } from '../../../shared/menu/menu.service';
|
||||||
import { MenuServiceStub } from '../../../shared/testing/menu-service-stub';
|
import { MenuServiceStub } from '../../../shared/testing/menu-service.stub';
|
||||||
import { CSSVariableService } from '../../../shared/sass-helper/sass-helper.service';
|
import { CSSVariableService } from '../../../shared/sass-helper/sass-helper.service';
|
||||||
import { CSSVariableServiceStub } from '../../../shared/testing/css-variable-service-stub';
|
import { CSSVariableServiceStub } from '../../../shared/testing/css-variable-service.stub';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { AdminSidebarSectionComponent } from './admin-sidebar-section.component';
|
import { AdminSidebarSectionComponent } from './admin-sidebar-section.component';
|
||||||
|
@@ -4,10 +4,10 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, Injector, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { AdminSidebarComponent } from './admin-sidebar.component';
|
import { AdminSidebarComponent } from './admin-sidebar.component';
|
||||||
import { MenuService } from '../../shared/menu/menu.service';
|
import { MenuService } from '../../shared/menu/menu.service';
|
||||||
import { MenuServiceStub } from '../../shared/testing/menu-service-stub';
|
import { MenuServiceStub } from '../../shared/testing/menu-service.stub';
|
||||||
import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service';
|
import { CSSVariableService } from '../../shared/sass-helper/sass-helper.service';
|
||||||
import { CSSVariableServiceStub } from '../../shared/testing/css-variable-service-stub';
|
import { CSSVariableServiceStub } from '../../shared/testing/css-variable-service.stub';
|
||||||
import { AuthServiceStub } from '../../shared/testing/auth-service-stub';
|
import { AuthServiceStub } from '../../shared/testing/auth-service.stub';
|
||||||
import { AuthService } from '../../core/auth/auth.service';
|
import { AuthService } from '../../core/auth/auth.service';
|
||||||
|
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
|
@@ -2,9 +2,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
|
|
||||||
import { ExpandableAdminSidebarSectionComponent } from './expandable-admin-sidebar-section.component';
|
import { ExpandableAdminSidebarSectionComponent } from './expandable-admin-sidebar-section.component';
|
||||||
import { MenuService } from '../../../shared/menu/menu.service';
|
import { MenuService } from '../../../shared/menu/menu.service';
|
||||||
import { MenuServiceStub } from '../../../shared/testing/menu-service-stub';
|
import { MenuServiceStub } from '../../../shared/testing/menu-service.stub';
|
||||||
import { CSSVariableService } from '../../../shared/sass-helper/sass-helper.service';
|
import { CSSVariableService } from '../../../shared/sass-helper/sass-helper.service';
|
||||||
import { CSSVariableServiceStub } from '../../../shared/testing/css-variable-service-stub';
|
import { CSSVariableServiceStub } from '../../../shared/testing/css-variable-service.stub';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
|
@@ -8,17 +8,16 @@ import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { BrowseService } from '../../core/browse/browse.service';
|
import { BrowseService } from '../../core/browse/browse.service';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { MockRouter } from '../../shared/mocks/mock-router';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { ENV_CONFIG, GLOBAL_CONFIG } from '../../../config';
|
|
||||||
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
import { BrowseEntrySearchOptions } from '../../core/browse/browse-entry-search-options.model';
|
||||||
import { toRemoteData } from '../+browse-by-metadata-page/browse-by-metadata-page.component.spec';
|
import { toRemoteData } from '../+browse-by-metadata-page/browse-by-metadata-page.component.spec';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('BrowseByDatePageComponent', () => {
|
describe('BrowseByDatePageComponent', () => {
|
||||||
let comp: BrowseByDatePageComponent;
|
let comp: BrowseByDatePageComponent;
|
||||||
@@ -71,11 +70,10 @@ describe('BrowseByDatePageComponent', () => {
|
|||||||
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
|
||||||
declarations: [BrowseByDatePageComponent, EnumKeysPipe, VarDirective],
|
declarations: [BrowseByDatePageComponent, EnumKeysPipe, VarDirective],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: GLOBAL_CONFIG, useValue: ENV_CONFIG },
|
|
||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
{ provide: BrowseService, useValue: mockBrowseService },
|
{ provide: BrowseService, useValue: mockBrowseService },
|
||||||
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
||||||
{ provide: Router, useValue: new MockRouter() },
|
{ provide: Router, useValue: new RouterMock() },
|
||||||
{ provide: ChangeDetectorRef, useValue: mockCdRef }
|
{ provide: ChangeDetectorRef, useValue: mockCdRef }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
@@ -11,9 +11,9 @@ import { hasValue, isNotEmpty } from '../../shared/empty.util';
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { BrowseService } from '../../core/browse/browse.service';
|
import { BrowseService } from '../../core/browse/browse.service';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
|
|
||||||
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
import { StartsWithType } from '../../shared/starts-with/starts-with-decorator';
|
||||||
import { BrowseByType, rendersBrowseBy } from '../+browse-by-switcher/browse-by-decorator';
|
import { BrowseByType, rendersBrowseBy } from '../+browse-by-switcher/browse-by-decorator';
|
||||||
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-browse-by-date-page',
|
selector: 'ds-browse-by-date-page',
|
||||||
@@ -33,8 +33,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
*/
|
*/
|
||||||
defaultMetadataField = 'dc.date.issued';
|
defaultMetadataField = 'dc.date.issued';
|
||||||
|
|
||||||
public constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
|
public constructor(protected route: ActivatedRoute,
|
||||||
protected route: ActivatedRoute,
|
|
||||||
protected browseService: BrowseService,
|
protected browseService: BrowseService,
|
||||||
protected dsoService: DSpaceObjectDataService,
|
protected dsoService: DSpaceObjectDataService,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
@@ -77,7 +76,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
updateStartsWithOptions(definition: string, metadataField: string, scope?: string) {
|
updateStartsWithOptions(definition: string, metadataField: string, scope?: string) {
|
||||||
this.subs.push(
|
this.subs.push(
|
||||||
this.browseService.getFirstItemFor(definition, scope).subscribe((firstItemRD: RemoteData<Item>) => {
|
this.browseService.getFirstItemFor(definition, scope).subscribe((firstItemRD: RemoteData<Item>) => {
|
||||||
let lowerLimit = this.config.browseBy.defaultLowerLimit;
|
let lowerLimit = environment.browseBy.defaultLowerLimit;
|
||||||
if (hasValue(firstItemRD.payload)) {
|
if (hasValue(firstItemRD.payload)) {
|
||||||
const date = firstItemRD.payload.firstMetadataValue(metadataField);
|
const date = firstItemRD.payload.firstMetadataValue(metadataField);
|
||||||
if (hasValue(date)) {
|
if (hasValue(date)) {
|
||||||
@@ -88,8 +87,8 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
|
|||||||
}
|
}
|
||||||
const options = [];
|
const options = [];
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
const oneYearBreak = Math.floor((currentYear - this.config.browseBy.oneYearLimit) / 5) * 5;
|
const oneYearBreak = Math.floor((currentYear - environment.browseBy.oneYearLimit) / 5) * 5;
|
||||||
const fiveYearBreak = Math.floor((currentYear - this.config.browseBy.fiveYearLimit) / 10) * 10;
|
const fiveYearBreak = Math.floor((currentYear - environment.browseBy.fiveYearLimit) / 10) * 10;
|
||||||
if (lowerLimit <= fiveYearBreak) {
|
if (lowerLimit <= fiveYearBreak) {
|
||||||
lowerLimit -= 10;
|
lowerLimit -= 10;
|
||||||
} else if (lowerLimit <= oneYearBreak) {
|
} else if (lowerLimit <= oneYearBreak) {
|
||||||
|
@@ -7,7 +7,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
@@ -19,10 +19,10 @@ import { SortDirection } from '../../core/cache/models/sort-options.model';
|
|||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { MockRouter } from '../../shared/mocks/mock-router';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
|
||||||
import { BrowseEntry } from '../../core/shared/browse-entry.model';
|
import { BrowseEntry } from '../../core/shared/browse-entry.model';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('BrowseByMetadataPageComponent', () => {
|
describe('BrowseByMetadataPageComponent', () => {
|
||||||
let comp: BrowseByMetadataPageComponent;
|
let comp: BrowseByMetadataPageComponent;
|
||||||
@@ -91,7 +91,7 @@ describe('BrowseByMetadataPageComponent', () => {
|
|||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
{ provide: BrowseService, useValue: mockBrowseService },
|
{ provide: BrowseService, useValue: mockBrowseService },
|
||||||
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
||||||
{ provide: Router, useValue: new MockRouter() }
|
{ provide: Router, useValue: new RouterMock() }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@@ -1,17 +1,17 @@
|
|||||||
import { BrowseBySwitcherComponent } from './browse-by-switcher.component';
|
import { BrowseBySwitcherComponent } from './browse-by-switcher.component';
|
||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { ENV_CONFIG, GLOBAL_CONFIG } from '../../../config';
|
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import * as decorator from './browse-by-decorator';
|
import * as decorator from './browse-by-decorator';
|
||||||
import createSpy = jasmine.createSpy;
|
import createSpy = jasmine.createSpy;
|
||||||
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
|
import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject';
|
||||||
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
describe('BrowseBySwitcherComponent', () => {
|
describe('BrowseBySwitcherComponent', () => {
|
||||||
let comp: BrowseBySwitcherComponent;
|
let comp: BrowseBySwitcherComponent;
|
||||||
let fixture: ComponentFixture<BrowseBySwitcherComponent>;
|
let fixture: ComponentFixture<BrowseBySwitcherComponent>;
|
||||||
|
|
||||||
const types = ENV_CONFIG.browseBy.types;
|
const types = environment.browseBy.types;
|
||||||
|
|
||||||
const params = new BehaviorSubject(createParamsWithId('initialValue'));
|
const params = new BehaviorSubject(createParamsWithId('initialValue'));
|
||||||
|
|
||||||
@@ -23,7 +23,6 @@ describe('BrowseBySwitcherComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ BrowseBySwitcherComponent ],
|
declarations: [ BrowseBySwitcherComponent ],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: GLOBAL_CONFIG, useValue: ENV_CONFIG },
|
|
||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub }
|
{ provide: ActivatedRoute, useValue: activatedRouteStub }
|
||||||
],
|
],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { Component, Inject, OnInit } from '@angular/core';
|
import { Component, Inject, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../config';
|
|
||||||
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
import { BrowseByTypeConfig } from '../../../config/browse-by-type-config.interface';
|
||||||
import { map, tap } from 'rxjs/operators';
|
import { map, tap } from 'rxjs/operators';
|
||||||
import { getComponentByBrowseByType } from './browse-by-decorator';
|
import { getComponentByBrowseByType } from './browse-by-decorator';
|
||||||
|
import { environment } from '../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-browse-by-switcher',
|
selector: 'ds-browse-by-switcher',
|
||||||
@@ -20,8 +20,7 @@ export class BrowseBySwitcherComponent implements OnInit {
|
|||||||
*/
|
*/
|
||||||
browseByComponent: Observable<any>;
|
browseByComponent: Observable<any>;
|
||||||
|
|
||||||
public constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
|
public constructor(protected route: ActivatedRoute) {
|
||||||
protected route: ActivatedRoute) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +30,7 @@ export class BrowseBySwitcherComponent implements OnInit {
|
|||||||
this.browseByComponent = this.route.params.pipe(
|
this.browseByComponent = this.route.params.pipe(
|
||||||
map((params) => {
|
map((params) => {
|
||||||
const id = params.id;
|
const id = params.id;
|
||||||
return this.config.browseBy.types.find((config: BrowseByTypeConfig) => config.id === id);
|
return environment.browseBy.types.find((config: BrowseByTypeConfig) => config.id === id);
|
||||||
}),
|
}),
|
||||||
map((config: BrowseByTypeConfig) => getComponentByBrowseByType(config.type))
|
map((config: BrowseByTypeConfig) => getComponentByBrowseByType(config.type))
|
||||||
);
|
);
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { Item } from '../../core/shared/item.model';
|
import { Item } from '../../core/shared/item.model';
|
||||||
import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
@@ -13,12 +13,11 @@ import { toRemoteData } from '../+browse-by-metadata-page/browse-by-metadata-pag
|
|||||||
import { BrowseByTitlePageComponent } from './browse-by-title-page.component';
|
import { BrowseByTitlePageComponent } from './browse-by-title-page.component';
|
||||||
import { ItemDataService } from '../../core/data/item-data.service';
|
import { ItemDataService } from '../../core/data/item-data.service';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { RemoteData } from '../../core/data/remote-data';
|
|
||||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||||
import { BrowseService } from '../../core/browse/browse.service';
|
import { BrowseService } from '../../core/browse/browse.service';
|
||||||
import { MockRouter } from '../../shared/mocks/mock-router';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('BrowseByTitlePageComponent', () => {
|
describe('BrowseByTitlePageComponent', () => {
|
||||||
let comp: BrowseByTitlePageComponent;
|
let comp: BrowseByTitlePageComponent;
|
||||||
@@ -70,7 +69,7 @@ describe('BrowseByTitlePageComponent', () => {
|
|||||||
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
{ provide: ActivatedRoute, useValue: activatedRouteStub },
|
||||||
{ provide: BrowseService, useValue: mockBrowseService },
|
{ provide: BrowseService, useValue: mockBrowseService },
|
||||||
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
{ provide: DSpaceObjectDataService, useValue: mockDsoService },
|
||||||
{ provide: Router, useValue: new MockRouter() }
|
{ provide: Router, useValue: new RouterMock() }
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
import { first } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import { BrowseByGuard } from './browse-by-guard';
|
import { BrowseByGuard } from './browse-by-guard';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { ENV_CONFIG } from '../../config';
|
|
||||||
|
|
||||||
describe('BrowseByGuard', () => {
|
describe('BrowseByGuard', () => {
|
||||||
describe('canActivate', () => {
|
describe('canActivate', () => {
|
||||||
@@ -25,7 +24,7 @@ describe('BrowseByGuard', () => {
|
|||||||
translateService = {
|
translateService = {
|
||||||
instant: () => field
|
instant: () => field
|
||||||
};
|
};
|
||||||
guard = new BrowseByGuard(ENV_CONFIG, dsoService, translateService);
|
guard = new BrowseByGuard(dsoService, translateService);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return true, and sets up the data correctly, with a scope and value', () => {
|
it('should return true, and sets up the data correctly, with a scope and value', () => {
|
||||||
|
@@ -6,7 +6,7 @@ import { map } from 'rxjs/operators';
|
|||||||
import { getSucceededRemoteData } from '../core/shared/operators';
|
import { getSucceededRemoteData } from '../core/shared/operators';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
/**
|
/**
|
||||||
@@ -14,8 +14,7 @@ import { GLOBAL_CONFIG, GlobalConfig } from '../../config';
|
|||||||
*/
|
*/
|
||||||
export class BrowseByGuard implements CanActivate {
|
export class BrowseByGuard implements CanActivate {
|
||||||
|
|
||||||
constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
|
constructor(protected dsoService: DSpaceObjectDataService,
|
||||||
protected dsoService: DSpaceObjectDataService,
|
|
||||||
protected translate: TranslateService) {
|
protected translate: TranslateService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +23,7 @@ export class BrowseByGuard implements CanActivate {
|
|||||||
const id = route.params.id || route.queryParams.id || route.data.id;
|
const id = route.params.id || route.queryParams.id || route.data.id;
|
||||||
let metadataField = route.data.metadataField;
|
let metadataField = route.data.metadataField;
|
||||||
if (hasNoValue(metadataField) && hasValue(id)) {
|
if (hasNoValue(metadataField) && hasValue(id)) {
|
||||||
const config = this.config.browseBy.types.find((conf) => conf.id === id);
|
const config = environment.browseBy.types.find((conf) => conf.id === id);
|
||||||
if (hasValue(config) && hasValue(config.metadataField)) {
|
if (hasValue(config) && hasValue(config.metadataField)) {
|
||||||
metadataField = config.metadataField;
|
metadataField = config.metadataField;
|
||||||
}
|
}
|
||||||
|
@@ -7,11 +7,11 @@ import { CommonModule } from '@angular/common';
|
|||||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||||
import { SearchFormComponent } from '../../shared/search-form/search-form.component';
|
import { SearchFormComponent } from '../../shared/search-form/search-form.component';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
|
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||||
import { RouterStub } from '../../shared/testing/router-stub';
|
import { RouterStub } from '../../shared/testing/router.stub';
|
||||||
import { SearchServiceStub } from '../../shared/testing/search-service-stub';
|
import { SearchServiceStub } from '../../shared/testing/search-service.stub';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
import { ItemDataService } from '../../core/data/item-data.service';
|
import { ItemDataService } from '../../core/data/item-data.service';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { Collection } from '../../core/shared/collection.model';
|
import { Collection } from '../../core/shared/collection.model';
|
||||||
@@ -20,7 +20,7 @@ import { PaginationComponentOptions } from '../../shared/pagination/pagination-c
|
|||||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||||
import { EventEmitter } from '@angular/core';
|
import { EventEmitter } from '@angular/core';
|
||||||
import { HostWindowService } from '../../shared/host-window.service';
|
import { HostWindowService } from '../../shared/host-window.service';
|
||||||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
@@ -29,7 +29,7 @@ import { PaginationComponent } from '../../shared/pagination/pagination.componen
|
|||||||
import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../shared/utils/enum-keys-pipe';
|
||||||
import { ItemSelectComponent } from '../../shared/object-select/item-select/item-select.component';
|
import { ItemSelectComponent } from '../../shared/object-select/item-select/item-select.component';
|
||||||
import { ObjectSelectService } from '../../shared/object-select/object-select.service';
|
import { ObjectSelectService } from '../../shared/object-select/object-select.service';
|
||||||
import { ObjectSelectServiceStub } from '../../shared/testing/object-select-service-stub';
|
import { ObjectSelectServiceStub } from '../../shared/testing/object-select-service.stub';
|
||||||
import { VarDirective } from '../../shared/utils/var.directive';
|
import { VarDirective } from '../../shared/utils/var.directive';
|
||||||
import { of as observableOf, of } from 'rxjs/internal/observable/of';
|
import { of as observableOf, of } from 'rxjs/internal/observable/of';
|
||||||
import { RestResponse } from '../../core/cache/response.models';
|
import { RestResponse } from '../../core/cache/response.models';
|
||||||
|
@@ -11,7 +11,7 @@ import { of as observableOf } from 'rxjs';
|
|||||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
import { CommunityDataService } from '../../core/data/community-data.service';
|
||||||
import { CreateCollectionPageComponent } from './create-collection-page.component';
|
import { CreateCollectionPageComponent } from './create-collection-page.component';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
|
||||||
describe('CreateCollectionPageComponent', () => {
|
describe('CreateCollectionPageComponent', () => {
|
||||||
let comp: CreateCollectionPageComponent;
|
let comp: CreateCollectionPageComponent;
|
||||||
|
@@ -1,11 +1,8 @@
|
|||||||
import { CreateCollectionPageGuard } from './create-collection-page.guard';
|
import { CreateCollectionPageGuard } from './create-collection-page.guard';
|
||||||
import { MockRouter } from '../../shared/mocks/mock-router';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { first } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import {
|
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
createFailedRemoteDataObject$,
|
|
||||||
createSuccessfulRemoteDataObject$
|
|
||||||
} from '../../shared/testing/utils';
|
|
||||||
|
|
||||||
describe('CreateCollectionPageGuard', () => {
|
describe('CreateCollectionPageGuard', () => {
|
||||||
describe('canActivate', () => {
|
describe('canActivate', () => {
|
||||||
@@ -25,7 +22,7 @@ describe('CreateCollectionPageGuard', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
router = new MockRouter();
|
router = new RouterMock();
|
||||||
|
|
||||||
guard = new CreateCollectionPageGuard(router, communityDataServiceStub);
|
guard = new CreateCollectionPageGuard(router, communityDataServiceStub);
|
||||||
});
|
});
|
||||||
|
@@ -9,7 +9,7 @@ import { of as observableOf } from 'rxjs/internal/observable/of';
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { CollectionMetadataComponent } from './collection-metadata.component';
|
import { CollectionMetadataComponent } from './collection-metadata.component';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
|
||||||
describe('CollectionMetadataComponent', () => {
|
describe('CollectionMetadataComponent', () => {
|
||||||
let comp: CollectionMetadataComponent;
|
let comp: CollectionMetadataComponent;
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-comcol-role
|
||||||
|
*ngFor="let comcolRole of getComcolRoles() | async"
|
||||||
|
[dso]="collection$ | async"
|
||||||
|
[comcolRole]="comcolRole"
|
||||||
|
>
|
||||||
|
</ds-comcol-role>
|
||||||
|
@@ -0,0 +1,121 @@
|
|||||||
|
import { ComponentFixture, TestBed} from '@angular/core/testing';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
|
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { CollectionRolesComponent } from './collection-roles.component';
|
||||||
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
|
import { SharedModule } from '../../../shared/shared.module';
|
||||||
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
|
describe('CollectionRolesComponent', () => {
|
||||||
|
|
||||||
|
let fixture: ComponentFixture<CollectionRolesComponent>;
|
||||||
|
let comp: CollectionRolesComponent;
|
||||||
|
let de: DebugElement;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
const route = {
|
||||||
|
parent: {
|
||||||
|
data: observableOf({
|
||||||
|
dso: new RemoteData(
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
undefined,
|
||||||
|
Object.assign(new Collection(), {
|
||||||
|
_links: {
|
||||||
|
'irrelevant': {
|
||||||
|
href: 'irrelevant link',
|
||||||
|
},
|
||||||
|
'adminGroup': {
|
||||||
|
href: 'adminGroup link',
|
||||||
|
},
|
||||||
|
'submittersGroup': {
|
||||||
|
href: 'submittersGroup link',
|
||||||
|
},
|
||||||
|
'itemReadGroup': {
|
||||||
|
href: 'itemReadGroup link',
|
||||||
|
},
|
||||||
|
'bitstreamReadGroup': {
|
||||||
|
href: 'bitstreamReadGroup link',
|
||||||
|
},
|
||||||
|
'workflowGroups/test': {
|
||||||
|
href: 'test workflow group link',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const requestService = {
|
||||||
|
hasByHrefObservable: () => observableOf(true),
|
||||||
|
};
|
||||||
|
|
||||||
|
const groupDataService = {
|
||||||
|
findByHref: () => observableOf(new RemoteData(
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
undefined,
|
||||||
|
{},
|
||||||
|
200,
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
SharedModule,
|
||||||
|
RouterTestingModule.withRoutes([]),
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
CollectionRolesComponent,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{ provide: ActivatedRoute, useValue: route },
|
||||||
|
{ provide: RequestService, useValue: requestService },
|
||||||
|
{ provide: GroupDataService, useValue: groupDataService },
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(CollectionRolesComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
de = fixture.debugElement;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a collection admin role component', () => {
|
||||||
|
expect(de.query(By.css('ds-comcol-role .collection-admin')))
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a submitters role component', () => {
|
||||||
|
expect(de.query(By.css('ds-comcol-role .submitters')))
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a default item read role component', () => {
|
||||||
|
expect(de.query(By.css('ds-comcol-role .item_read')))
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a default bitstream read role component', () => {
|
||||||
|
expect(de.query(By.css('ds-comcol-role .bitstream_read')))
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a test workflow role component', () => {
|
||||||
|
expect(de.query(By.css('ds-comcol-role .test')))
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@@ -1,4 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { first, map } from 'rxjs/operators';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
|
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
|
import { ComcolRole } from '../../../shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for managing a collection's roles
|
* Component for managing a collection's roles
|
||||||
@@ -7,6 +14,48 @@ import { Component } from '@angular/core';
|
|||||||
selector: 'ds-collection-roles',
|
selector: 'ds-collection-roles',
|
||||||
templateUrl: './collection-roles.component.html',
|
templateUrl: './collection-roles.component.html',
|
||||||
})
|
})
|
||||||
export class CollectionRolesComponent {
|
export class CollectionRolesComponent implements OnInit {
|
||||||
/* TODO: Implement Collection Edit - Roles */
|
|
||||||
|
dsoRD$: Observable<RemoteData<Collection>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The collection to manage, as an observable.
|
||||||
|
*/
|
||||||
|
get collection$(): Observable<Collection> {
|
||||||
|
return this.dsoRD$.pipe(
|
||||||
|
getSucceededRemoteData(),
|
||||||
|
getRemoteDataPayload(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The different roles for the collection, as an observable.
|
||||||
|
*/
|
||||||
|
getComcolRoles(): Observable<ComcolRole[]> {
|
||||||
|
return this.collection$.pipe(
|
||||||
|
map((collection) =>
|
||||||
|
[
|
||||||
|
ComcolRole.COLLECTION_ADMIN,
|
||||||
|
ComcolRole.SUBMITTERS,
|
||||||
|
ComcolRole.ITEM_READ,
|
||||||
|
ComcolRole.BITSTREAM_READ,
|
||||||
|
...Object.keys(collection._links)
|
||||||
|
.filter((link) => link.startsWith('workflowGroups/'))
|
||||||
|
.map((link) => new ComcolRole(link.substr('workflowGroups/'.length), link)),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected route: ActivatedRoute,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.dsoRD$ = this.route.parent.data.pipe(
|
||||||
|
first(),
|
||||||
|
map((data) => data.dso),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,8 +14,7 @@ import { NotificationsService } from '../../../shared/notifications/notification
|
|||||||
import { DynamicFormControlModel, DynamicFormService } from '@ng-dynamic-forms/core';
|
import { DynamicFormControlModel, DynamicFormService } from '@ng-dynamic-forms/core';
|
||||||
import { hasValue } from '../../../shared/empty.util';
|
import { hasValue } from '../../../shared/empty.util';
|
||||||
import { FormControl, FormGroup } from '@angular/forms';
|
import { FormControl, FormGroup } from '@angular/forms';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { GLOBAL_CONFIG } from '../../../../config';
|
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Collection } from '../../../core/shared/collection.model';
|
import { Collection } from '../../../core/shared/collection.model';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
@@ -128,7 +127,6 @@ describe('CollectionSourceComponent', () => {
|
|||||||
{ provide: DynamicFormService, useValue: formService },
|
{ provide: DynamicFormService, useValue: formService },
|
||||||
{ provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: new RemoteData(false, false, true, null, collection) }) } } },
|
{ provide: ActivatedRoute, useValue: { parent: { data: observableOf({ dso: new RemoteData(false, false, true, null, collection) }) } } },
|
||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: GLOBAL_CONFIG, useValue: { collection: { edit: { undoTimeout: 10 } } } as any },
|
|
||||||
{ provide: CollectionDataService, useValue: collectionService },
|
{ provide: CollectionDataService, useValue: collectionService },
|
||||||
{ provide: RequestService, useValue: requestService }
|
{ provide: RequestService, useValue: requestService }
|
||||||
],
|
],
|
||||||
|
@@ -26,12 +26,12 @@ import { ActivatedRoute, Router } from '@angular/router';
|
|||||||
import { FieldUpdate, FieldUpdates } from '../../../core/data/object-updates/object-updates.reducer';
|
import { FieldUpdate, FieldUpdates } from '../../../core/data/object-updates/object-updates.reducer';
|
||||||
import { Subscription } from 'rxjs/internal/Subscription';
|
import { Subscription } from 'rxjs/internal/Subscription';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
|
||||||
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
import { CollectionDataService } from '../../../core/data/collection-data.service';
|
||||||
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
import { MetadataConfig } from '../../../core/shared/metadata-config.model';
|
import { MetadataConfig } from '../../../core/shared/metadata-config.model';
|
||||||
import { INotification } from '../../../shared/notifications/models/notification.model';
|
import { INotification } from '../../../shared/notifications/models/notification.model';
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { environment } from '../../../../environments/environment';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for managing the content source of the collection
|
* Component for managing the content source of the collection
|
||||||
@@ -236,7 +236,6 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
protected translate: TranslateService,
|
protected translate: TranslateService,
|
||||||
protected route: ActivatedRoute,
|
protected route: ActivatedRoute,
|
||||||
protected router: Router,
|
protected router: Router,
|
||||||
@Inject(GLOBAL_CONFIG) protected EnvConfig: GlobalConfig,
|
|
||||||
protected collectionService: CollectionDataService,
|
protected collectionService: CollectionDataService,
|
||||||
protected requestService: RequestService) {
|
protected requestService: RequestService) {
|
||||||
super(objectUpdatesService, notificationsService, translate);
|
super(objectUpdatesService, notificationsService, translate);
|
||||||
@@ -247,7 +246,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
|
|||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.notificationsPrefix = 'collection.edit.tabs.source.notifications.';
|
this.notificationsPrefix = 'collection.edit.tabs.source.notifications.';
|
||||||
this.discardTimeOut = this.EnvConfig.collection.edit.undoTimeout;
|
this.discardTimeOut = environment.collection.edit.undoTimeout;
|
||||||
this.url = this.router.url;
|
this.url = this.router.url;
|
||||||
if (this.url.indexOf('?') > 0) {
|
if (this.url.indexOf('?') > 0) {
|
||||||
this.url = this.url.substr(0, this.url.indexOf('?'));
|
this.url = this.url.substr(0, this.url.indexOf('?'));
|
||||||
|
@@ -11,7 +11,7 @@ import { of as observableOf } from 'rxjs';
|
|||||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
import { CommunityDataService } from '../../core/data/community-data.service';
|
||||||
import { CreateCommunityPageComponent } from './create-community-page.component';
|
import { CreateCommunityPageComponent } from './create-community-page.component';
|
||||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
|
||||||
|
|
||||||
describe('CreateCommunityPageComponent', () => {
|
describe('CreateCommunityPageComponent', () => {
|
||||||
let comp: CreateCommunityPageComponent;
|
let comp: CreateCommunityPageComponent;
|
||||||
|
@@ -1,11 +1,8 @@
|
|||||||
import { CreateCommunityPageGuard } from './create-community-page.guard';
|
import { CreateCommunityPageGuard } from './create-community-page.guard';
|
||||||
import { MockRouter } from '../../shared/mocks/mock-router';
|
import { RouterMock } from '../../shared/mocks/router.mock';
|
||||||
import { Community } from '../../core/shared/community.model';
|
import { Community } from '../../core/shared/community.model';
|
||||||
import { first } from 'rxjs/operators';
|
import { first } from 'rxjs/operators';
|
||||||
import {
|
import { createFailedRemoteDataObject$, createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
createFailedRemoteDataObject$,
|
|
||||||
createSuccessfulRemoteDataObject$
|
|
||||||
} from '../../shared/testing/utils';
|
|
||||||
|
|
||||||
describe('CreateCommunityPageGuard', () => {
|
describe('CreateCommunityPageGuard', () => {
|
||||||
describe('canActivate', () => {
|
describe('canActivate', () => {
|
||||||
@@ -25,7 +22,7 @@ describe('CreateCommunityPageGuard', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
router = new MockRouter();
|
router = new RouterMock();
|
||||||
|
|
||||||
guard = new CreateCommunityPageGuard(router, communityDataServiceStub);
|
guard = new CreateCommunityPageGuard(router, communityDataServiceStub);
|
||||||
});
|
});
|
||||||
|
@@ -9,7 +9,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|||||||
import { CommunityMetadataComponent } from './community-metadata.component';
|
import { CommunityMetadataComponent } from './community-metadata.component';
|
||||||
import { CommunityDataService } from '../../../core/data/community-data.service';
|
import { CommunityDataService } from '../../../core/data/community-data.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
|
||||||
describe('CommunityMetadataComponent', () => {
|
describe('CommunityMetadataComponent', () => {
|
||||||
let comp: CommunityMetadataComponent;
|
let comp: CommunityMetadataComponent;
|
||||||
|
@@ -0,0 +1,6 @@
|
|||||||
|
<ds-comcol-role
|
||||||
|
*ngFor="let comcolRole of getComcolRoles()"
|
||||||
|
[dso]="community$ | async"
|
||||||
|
[comcolRole]="comcolRole"
|
||||||
|
>
|
||||||
|
</ds-comcol-role>
|
||||||
|
@@ -0,0 +1,89 @@
|
|||||||
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
|
import { DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { CommunityRolesComponent } from './community-roles.component';
|
||||||
|
import { Community } from '../../../core/shared/community.model';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { GroupDataService } from '../../../core/eperson/group-data.service';
|
||||||
|
import { SharedModule } from '../../../shared/shared.module';
|
||||||
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
|
|
||||||
|
describe('CommunityRolesComponent', () => {
|
||||||
|
|
||||||
|
let fixture: ComponentFixture<CommunityRolesComponent>;
|
||||||
|
let comp: CommunityRolesComponent;
|
||||||
|
let de: DebugElement;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
|
||||||
|
const route = {
|
||||||
|
parent: {
|
||||||
|
data: observableOf({
|
||||||
|
dso: new RemoteData(
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
undefined,
|
||||||
|
Object.assign(new Community(), {
|
||||||
|
_links: {
|
||||||
|
irrelevant: {
|
||||||
|
href: 'irrelevant link',
|
||||||
|
},
|
||||||
|
adminGroup: {
|
||||||
|
href: 'adminGroup link',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const requestService = {
|
||||||
|
hasByHrefObservable: () => observableOf(true),
|
||||||
|
};
|
||||||
|
|
||||||
|
const groupDataService = {
|
||||||
|
findByHref: () => observableOf(new RemoteData(
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
undefined,
|
||||||
|
{},
|
||||||
|
200,
|
||||||
|
)),
|
||||||
|
};
|
||||||
|
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [
|
||||||
|
SharedModule,
|
||||||
|
RouterTestingModule.withRoutes([]),
|
||||||
|
TranslateModule.forRoot(),
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
CommunityRolesComponent,
|
||||||
|
],
|
||||||
|
providers: [
|
||||||
|
{ provide: ActivatedRoute, useValue: route },
|
||||||
|
{ provide: RequestService, useValue: requestService },
|
||||||
|
{ provide: GroupDataService, useValue: groupDataService },
|
||||||
|
],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).compileComponents();
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(CommunityRolesComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
de = fixture.debugElement;
|
||||||
|
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a community admin role component', () => {
|
||||||
|
expect(de.query(By.css('ds-comcol-role .community-admin')))
|
||||||
|
.toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@@ -1,4 +1,11 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { ActivatedRoute } from '@angular/router';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { first, map } from 'rxjs/operators';
|
||||||
|
import { Community } from '../../../core/shared/community.model';
|
||||||
|
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
|
import { ComcolRole } from '../../../shared/comcol-forms/edit-comcol-page/comcol-role/comcol-role';
|
||||||
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component for managing a community's roles
|
* Component for managing a community's roles
|
||||||
@@ -7,6 +14,38 @@ import { Component } from '@angular/core';
|
|||||||
selector: 'ds-community-roles',
|
selector: 'ds-community-roles',
|
||||||
templateUrl: './community-roles.component.html',
|
templateUrl: './community-roles.component.html',
|
||||||
})
|
})
|
||||||
export class CommunityRolesComponent {
|
export class CommunityRolesComponent implements OnInit {
|
||||||
/* TODO: Implement Community Edit - Roles */
|
|
||||||
|
dsoRD$: Observable<RemoteData<Community>>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The community to manage, as an observable.
|
||||||
|
*/
|
||||||
|
get community$(): Observable<Community> {
|
||||||
|
return this.dsoRD$.pipe(
|
||||||
|
getSucceededRemoteData(),
|
||||||
|
getRemoteDataPayload(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The different roles for the community.
|
||||||
|
*/
|
||||||
|
getComcolRoles(): ComcolRole[] {
|
||||||
|
return [
|
||||||
|
ComcolRole.COMMUNITY_ADMIN,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
protected route: ActivatedRoute,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.dsoRD$ = this.route.parent.data.pipe(
|
||||||
|
first(),
|
||||||
|
map((data) => data.dso),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -12,11 +12,11 @@ import { Community } from '../../core/shared/community.model';
|
|||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { CollectionDataService } from '../../core/data/collection-data.service';
|
import { CollectionDataService } from '../../core/data/collection-data.service';
|
||||||
import { FindListOptions } from '../../core/data/request.models';
|
import { FindListOptions } from '../../core/data/request.models';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { HostWindowService } from '../../shared/host-window.service';
|
import { HostWindowService } from '../../shared/host-window.service';
|
||||||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
|
||||||
describe('CommunityPageSubCollectionList Component', () => {
|
describe('CommunityPageSubCollectionList Component', () => {
|
||||||
|
@@ -12,10 +12,10 @@ import { Community } from '../../core/shared/community.model';
|
|||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { FindListOptions } from '../../core/data/request.models';
|
import { FindListOptions } from '../../core/data/request.models';
|
||||||
import { HostWindowService } from '../../shared/host-window.service';
|
import { HostWindowService } from '../../shared/host-window.service';
|
||||||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
||||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
import { CommunityDataService } from '../../core/data/community-data.service';
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
|
||||||
|
@@ -12,10 +12,10 @@ import { Community } from '../../core/shared/community.model';
|
|||||||
import { PaginatedList } from '../../core/data/paginated-list';
|
import { PaginatedList } from '../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils';
|
||||||
import { FindListOptions } from '../../core/data/request.models';
|
import { FindListOptions } from '../../core/data/request.models';
|
||||||
import { HostWindowService } from '../../shared/host-window.service';
|
import { HostWindowService } from '../../shared/host-window.service';
|
||||||
import { HostWindowServiceStub } from '../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../shared/testing/host-window-service.stub';
|
||||||
import { CommunityDataService } from '../../core/data/community-data.service';
|
import { CommunityDataService } from '../../core/data/community-data.service';
|
||||||
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
|
||||||
|
|
||||||
|
@@ -9,21 +9,18 @@ import { NotificationsService } from '../../../shared/notifications/notification
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { UploadBitstreamComponent } from './upload-bitstream.component';
|
import { UploadBitstreamComponent } from './upload-bitstream.component';
|
||||||
import { AuthService } from '../../../core/auth/auth.service';
|
import { AuthService } from '../../../core/auth/auth.service';
|
||||||
import { AuthServiceStub } from '../../../shared/testing/auth-service-stub';
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import {
|
|
||||||
createPaginatedList,
|
|
||||||
createSuccessfulRemoteDataObject,
|
|
||||||
createSuccessfulRemoteDataObject$
|
|
||||||
} from '../../../shared/testing/utils';
|
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
|
||||||
import { VarDirective } from '../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||||
import { Bitstream } from '../../../core/shared/bitstream.model';
|
import { Bitstream } from '../../../core/shared/bitstream.model';
|
||||||
import { BundleDataService } from '../../../core/data/bundle-data.service';
|
import { BundleDataService } from '../../../core/data/bundle-data.service';
|
||||||
import { Bundle } from '../../../core/shared/bundle.model';
|
import { Bundle } from '../../../core/shared/bundle.model';
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
|
import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
|
||||||
|
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||||
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
|
import { AuthServiceStub } from '../../../shared/testing/auth-service.stub';
|
||||||
|
|
||||||
describe('UploadBistreamComponent', () => {
|
describe('UploadBistreamComponent', () => {
|
||||||
let comp: UploadBitstreamComponent;
|
let comp: UploadBitstreamComponent;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Inject, Injectable, OnInit } from '@angular/core';
|
import { Component, Injectable, OnInit } from '@angular/core';
|
||||||
import { FieldUpdate, FieldUpdates } from '../../../core/data/object-updates/object-updates.reducer';
|
import { FieldUpdate, FieldUpdates } from '../../../core/data/object-updates/object-updates.reducer';
|
||||||
import { Observable } from 'rxjs/internal/Observable';
|
import { Observable } from 'rxjs/internal/Observable';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
@@ -7,10 +7,10 @@ import { ObjectUpdatesService } from '../../../core/data/object-updates/object-u
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
|
||||||
import { first, map } from 'rxjs/operators';
|
import { first, map } from 'rxjs/operators';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { AbstractTrackableComponent } from '../../../shared/trackable/abstract-trackable.component';
|
import { AbstractTrackableComponent } from '../../../shared/trackable/abstract-trackable.component';
|
||||||
|
import { environment } from '../../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-abstract-item-update',
|
selector: 'ds-abstract-item-update',
|
||||||
@@ -36,7 +36,6 @@ export class AbstractItemUpdateComponent extends AbstractTrackableComponent impl
|
|||||||
public router: Router,
|
public router: Router,
|
||||||
public notificationsService: NotificationsService,
|
public notificationsService: NotificationsService,
|
||||||
public translateService: TranslateService,
|
public translateService: TranslateService,
|
||||||
@Inject(GLOBAL_CONFIG) public EnvConfig: GlobalConfig,
|
|
||||||
public route: ActivatedRoute
|
public route: ActivatedRoute
|
||||||
) {
|
) {
|
||||||
super(objectUpdatesService, notificationsService, translateService)
|
super(objectUpdatesService, notificationsService, translateService)
|
||||||
@@ -55,7 +54,7 @@ export class AbstractItemUpdateComponent extends AbstractTrackableComponent impl
|
|||||||
this.postItemInit();
|
this.postItemInit();
|
||||||
});
|
});
|
||||||
|
|
||||||
this.discardTimeOut = this.EnvConfig.item.edit.undoTimeout;
|
this.discardTimeOut = environment.item.edit.undoTimeout;
|
||||||
this.url = this.router.url;
|
this.url = this.router.url;
|
||||||
if (this.url.indexOf('?') > 0) {
|
if (this.url.indexOf('?') > 0) {
|
||||||
this.url = this.url.substr(0, this.url.indexOf('?'));
|
this.url = this.url.substr(0, this.url.indexOf('?'));
|
||||||
|
@@ -5,7 +5,7 @@ import {findSuccessfulAccordingTo} from './edit-item-operators';
|
|||||||
import {
|
import {
|
||||||
createFailedRemoteDataObject,
|
createFailedRemoteDataObject,
|
||||||
createSuccessfulRemoteDataObject
|
createSuccessfulRemoteDataObject
|
||||||
} from '../../shared/testing/utils';
|
} from '../../shared/remote-data.utils';
|
||||||
|
|
||||||
describe('findSuccessfulAccordingTo', () => {
|
describe('findSuccessfulAccordingTo', () => {
|
||||||
let mockItem1;
|
let mockItem1;
|
||||||
|
@@ -11,14 +11,11 @@ import { TranslateModule } from '@ngx-translate/core';
|
|||||||
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { GLOBAL_CONFIG } from '../../../../config';
|
|
||||||
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectorRef, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { FieldChangeType } from '../../../core/data/object-updates/object-updates.actions';
|
import { FieldChangeType } from '../../../core/data/object-updates/object-updates.actions';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
|
||||||
import { INotification, Notification } from '../../../shared/notifications/models/notification.model';
|
import { INotification, Notification } from '../../../shared/notifications/models/notification.model';
|
||||||
import { NotificationType } from '../../../shared/notifications/models/notification-type';
|
import { NotificationType } from '../../../shared/notifications/models/notification-type';
|
||||||
import { BitstreamDataService } from '../../../core/data/bitstream-data.service';
|
import { BitstreamDataService } from '../../../core/data/bitstream-data.service';
|
||||||
import { getMockRequestService } from '../../../shared/mocks/mock-request.service';
|
|
||||||
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
import { ObjectCacheService } from '../../../core/cache/object-cache.service';
|
||||||
import { RequestService } from '../../../core/data/request.service';
|
import { RequestService } from '../../../core/data/request.service';
|
||||||
import { ObjectValuesPipe } from '../../../shared/utils/object-values-pipe';
|
import { ObjectValuesPipe } from '../../../shared/utils/object-values-pipe';
|
||||||
@@ -27,6 +24,8 @@ import { BundleDataService } from '../../../core/data/bundle-data.service';
|
|||||||
import { Bundle } from '../../../core/shared/bundle.model';
|
import { Bundle } from '../../../core/shared/bundle.model';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
|
||||||
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
|
import { getMockRequestService } from '../../../shared/mocks/request.service.mock';
|
||||||
|
|
||||||
let comp: ItemBitstreamsComponent;
|
let comp: ItemBitstreamsComponent;
|
||||||
let fixture: ComponentFixture<ItemBitstreamsComponent>;
|
let fixture: ComponentFixture<ItemBitstreamsComponent>;
|
||||||
@@ -158,7 +157,6 @@ describe('ItemBitstreamsComponent', () => {
|
|||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: ActivatedRoute, useValue: route },
|
{ provide: ActivatedRoute, useValue: route },
|
||||||
{ provide: NotificationsService, useValue: notificationsService },
|
{ provide: NotificationsService, useValue: notificationsService },
|
||||||
{ provide: GLOBAL_CONFIG, useValue: { item: { edit: { undoTimeout: 10 } } } as any },
|
|
||||||
{ provide: BitstreamDataService, useValue: bitstreamService },
|
{ provide: BitstreamDataService, useValue: bitstreamService },
|
||||||
{ provide: ObjectCacheService, useValue: objectCache },
|
{ provide: ObjectCacheService, useValue: objectCache },
|
||||||
{ provide: RequestService, useValue: requestService },
|
{ provide: RequestService, useValue: requestService },
|
||||||
|
@@ -8,7 +8,6 @@ import { ObjectUpdatesService } from '../../../core/data/object-updates/object-u
|
|||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
|
||||||
import { BitstreamDataService } from '../../../core/data/bitstream-data.service';
|
import { BitstreamDataService } from '../../../core/data/bitstream-data.service';
|
||||||
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
|
import { hasValue, isNotEmpty, isNotEmptyOperator } from '../../../shared/empty.util';
|
||||||
import { zip as observableZip, combineLatest as observableCombineLatest, of as observableOf } from 'rxjs';
|
import { zip as observableZip, combineLatest as observableCombineLatest, of as observableOf } from 'rxjs';
|
||||||
@@ -86,7 +85,6 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
|
|||||||
public router: Router,
|
public router: Router,
|
||||||
public notificationsService: NotificationsService,
|
public notificationsService: NotificationsService,
|
||||||
public translateService: TranslateService,
|
public translateService: TranslateService,
|
||||||
@Inject(GLOBAL_CONFIG) public EnvConfig: GlobalConfig,
|
|
||||||
public route: ActivatedRoute,
|
public route: ActivatedRoute,
|
||||||
public bitstreamService: BitstreamDataService,
|
public bitstreamService: BitstreamDataService,
|
||||||
public objectCache: ObjectCacheService,
|
public objectCache: ObjectCacheService,
|
||||||
@@ -94,7 +92,7 @@ export class ItemBitstreamsComponent extends AbstractItemUpdateComponent impleme
|
|||||||
public cdRef: ChangeDetectorRef,
|
public cdRef: ChangeDetectorRef,
|
||||||
public bundleService: BundleDataService
|
public bundleService: BundleDataService
|
||||||
) {
|
) {
|
||||||
super(itemService, objectUpdatesService, router, notificationsService, translateService, EnvConfig, route);
|
super(itemService, objectUpdatesService, router, notificationsService, translateService, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -10,11 +10,12 @@ import { BundleDataService } from '../../../../../core/data/bundle-data.service'
|
|||||||
import { createMockRDObs } from '../../item-bitstreams.component.spec';
|
import { createMockRDObs } from '../../item-bitstreams.component.spec';
|
||||||
import { Bitstream } from '../../../../../core/shared/bitstream.model';
|
import { Bitstream } from '../../../../../core/shared/bitstream.model';
|
||||||
import { BitstreamFormat } from '../../../../../core/shared/bitstream-format.model';
|
import { BitstreamFormat } from '../../../../../core/shared/bitstream-format.model';
|
||||||
import { createPaginatedList, createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
|
||||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { take } from 'rxjs/operators';
|
import { take } from 'rxjs/operators';
|
||||||
import { ResponsiveTableSizes } from '../../../../../shared/responsive-table-sizes/responsive-table-sizes';
|
import { ResponsiveTableSizes } from '../../../../../shared/responsive-table-sizes/responsive-table-sizes';
|
||||||
import { ResponsiveColumnSizes } from '../../../../../shared/responsive-table-sizes/responsive-column-sizes';
|
import { ResponsiveColumnSizes } from '../../../../../shared/responsive-table-sizes/responsive-column-sizes';
|
||||||
|
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||||
|
import { createPaginatedList } from '../../../../../shared/testing/utils.test';
|
||||||
|
|
||||||
describe('PaginatedDragAndDropBitstreamListComponent', () => {
|
describe('PaginatedDragAndDropBitstreamListComponent', () => {
|
||||||
let comp: PaginatedDragAndDropBitstreamListComponent;
|
let comp: PaginatedDragAndDropBitstreamListComponent;
|
||||||
|
@@ -29,12 +29,12 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
|
|||||||
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
|
||||||
import { SearchFormComponent } from '../../../shared/search-form/search-form.component';
|
import { SearchFormComponent } from '../../../shared/search-form/search-form.component';
|
||||||
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model';
|
import { PaginatedSearchOptions } from '../../../shared/search/paginated-search-options.model';
|
||||||
import { ActivatedRouteStub } from '../../../shared/testing/active-router-stub';
|
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
|
||||||
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service-stub';
|
import { HostWindowServiceStub } from '../../../shared/testing/host-window-service.stub';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { ObjectSelectServiceStub } from '../../../shared/testing/object-select-service-stub';
|
import { ObjectSelectServiceStub } from '../../../shared/testing/object-select-service.stub';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { SearchServiceStub } from '../../../shared/testing/search-service-stub';
|
import { SearchServiceStub } from '../../../shared/testing/search-service.stub';
|
||||||
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
import { EnumKeysPipe } from '../../../shared/utils/enum-keys-pipe';
|
||||||
import { VarDirective } from '../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||||
import { ItemCollectionMapperComponent } from './item-collection-mapper.component';
|
import { ItemCollectionMapperComponent } from './item-collection-mapper.component';
|
||||||
|
@@ -1,31 +1,31 @@
|
|||||||
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { ItemType } from '../../../core/shared/item-relationships/item-type.model';
|
import { ItemType } from '../../../core/shared/item-relationships/item-type.model';
|
||||||
import { Relationship } from '../../../core/shared/item-relationships/relationship.model';
|
import { Relationship } from '../../../core/shared/item-relationships/relationship.model';
|
||||||
import {Item} from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import {RouterStub} from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import {of as observableOf} from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import {NotificationsServiceStub} from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import {CommonModule} from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import {FormsModule} from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import {RouterTestingModule} from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import {TranslateModule} from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
|
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import {ActivatedRoute, Router} from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import {ItemDataService} from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import {NotificationsService} from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import {CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
|
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||||
import {By} from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import {ItemDeleteComponent} from './item-delete.component';
|
import { ItemDeleteComponent } from './item-delete.component';
|
||||||
import {getItemEditPath} from '../../item-page-routing.module';
|
import { getItemEditPath } from '../../item-page-routing.module';
|
||||||
import {createSuccessfulRemoteDataObject} from '../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
import {VarDirective} from '../../../shared/utils/var.directive';
|
import { VarDirective } from '../../../shared/utils/var.directive';
|
||||||
import {ObjectUpdatesService} from '../../../core/data/object-updates/object-updates.service';
|
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
||||||
import {RelationshipService} from '../../../core/data/relationship.service';
|
import { RelationshipService } from '../../../core/data/relationship.service';
|
||||||
import {RelationshipType} from '../../../core/shared/item-relationships/relationship-type.model';
|
import { RelationshipType } from '../../../core/shared/item-relationships/relationship-type.model';
|
||||||
import {RemoteData} from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import {PaginatedList} from '../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../core/data/paginated-list';
|
||||||
import {PageInfo} from '../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||||
import {EntityTypeService} from '../../../core/data/entity-type.service';
|
import { EntityTypeService } from '../../../core/data/entity-type.service';
|
||||||
|
|
||||||
let comp: ItemDeleteComponent;
|
let comp: ItemDeleteComponent;
|
||||||
let fixture: ComponentFixture<ItemDeleteComponent>;
|
let fixture: ComponentFixture<ItemDeleteComponent>;
|
||||||
|
@@ -15,7 +15,7 @@ import { RegistryService } from '../../../../core/registry/registry.service';
|
|||||||
import { MetadatumViewModel } from '../../../../core/shared/metadata.models';
|
import { MetadatumViewModel } from '../../../../core/shared/metadata.models';
|
||||||
import { InputSuggestion } from '../../../../shared/input-suggestions/input-suggestions.model';
|
import { InputSuggestion } from '../../../../shared/input-suggestions/input-suggestions.model';
|
||||||
import { SharedModule } from '../../../../shared/shared.module';
|
import { SharedModule } from '../../../../shared/shared.module';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-data.utils';
|
||||||
import { EditInPlaceFieldComponent } from './edit-in-place-field.component';
|
import { EditInPlaceFieldComponent } from './edit-in-place-field.component';
|
||||||
|
|
||||||
let comp: EditInPlaceFieldComponent;
|
let comp: EditInPlaceFieldComponent;
|
||||||
|
@@ -85,7 +85,7 @@ export class EditInPlaceFieldComponent implements OnInit, OnChanges {
|
|||||||
* Method to check the validity of a form control
|
* Method to check the validity of a form control
|
||||||
* @param ngModel
|
* @param ngModel
|
||||||
*/
|
*/
|
||||||
private checkValidity(ngModel: NgModel) {
|
public checkValidity(ngModel: NgModel) {
|
||||||
ngModel.control.setValue(ngModel.viewModel);
|
ngModel.control.setValue(ngModel.viewModel);
|
||||||
ngModel.control.updateValueAndValidity();
|
ngModel.control.updateValueAndValidity();
|
||||||
this.objectUpdatesService.setValidFieldUpdate(this.url, this.metadata.uuid, ngModel.control.valid);
|
this.objectUpdatesService.setValidFieldUpdate(this.url, this.metadata.uuid, ngModel.control.valid);
|
||||||
|
@@ -16,8 +16,7 @@ import {
|
|||||||
Notification
|
Notification
|
||||||
} from '../../../shared/notifications/models/notification.model';
|
} from '../../../shared/notifications/models/notification.model';
|
||||||
import { NotificationType } from '../../../shared/notifications/models/notification-type';
|
import { NotificationType } from '../../../shared/notifications/models/notification-type';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { GLOBAL_CONFIG } from '../../../../config';
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { FieldChangeType } from '../../../core/data/object-updates/object-updates.actions';
|
import { FieldChangeType } from '../../../core/data/object-updates/object-updates.actions';
|
||||||
import { MetadatumViewModel } from '../../../core/shared/metadata.models';
|
import { MetadatumViewModel } from '../../../core/shared/metadata.models';
|
||||||
@@ -29,7 +28,7 @@ import { MetadataField } from '../../../core/metadata/metadata-field.model';
|
|||||||
import {
|
import {
|
||||||
createSuccessfulRemoteDataObject,
|
createSuccessfulRemoteDataObject,
|
||||||
createSuccessfulRemoteDataObject$
|
createSuccessfulRemoteDataObject$
|
||||||
} from '../../../shared/testing/utils';
|
} from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
let comp: any;
|
let comp: any;
|
||||||
let fixture: ComponentFixture<ItemMetadataComponent>;
|
let fixture: ComponentFixture<ItemMetadataComponent>;
|
||||||
@@ -130,7 +129,7 @@ describe('ItemMetadataComponent', () => {
|
|||||||
paginatedMetadataFields = new PaginatedList(undefined, [mdField1, mdField2, mdField3]);
|
paginatedMetadataFields = new PaginatedList(undefined, [mdField1, mdField2, mdField3]);
|
||||||
|
|
||||||
metadataFieldService = jasmine.createSpyObj({
|
metadataFieldService = jasmine.createSpyObj({
|
||||||
getAllMetadataFields:createSuccessfulRemoteDataObject$(paginatedMetadataFields)
|
getAllMetadataFields: createSuccessfulRemoteDataObject$(paginatedMetadataFields)
|
||||||
});
|
});
|
||||||
scheduler = getTestScheduler();
|
scheduler = getTestScheduler();
|
||||||
objectUpdatesService = jasmine.createSpyObj('objectUpdatesService',
|
objectUpdatesService = jasmine.createSpyObj('objectUpdatesService',
|
||||||
@@ -161,7 +160,6 @@ describe('ItemMetadataComponent', () => {
|
|||||||
{ provide: Router, useValue: router },
|
{ provide: Router, useValue: router },
|
||||||
{ provide: ActivatedRoute, useValue: routeStub },
|
{ provide: ActivatedRoute, useValue: routeStub },
|
||||||
{ provide: NotificationsService, useValue: notificationsService },
|
{ provide: NotificationsService, useValue: notificationsService },
|
||||||
{ provide: GLOBAL_CONFIG, useValue: { item: { edit: { undoTimeout: 10 } } } as any },
|
|
||||||
{ provide: RegistryService, useValue: metadataFieldService },
|
{ provide: RegistryService, useValue: metadataFieldService },
|
||||||
], schemas: [
|
], schemas: [
|
||||||
NO_ERRORS_SCHEMA
|
NO_ERRORS_SCHEMA
|
||||||
|
@@ -1,19 +1,15 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { LinkService } from '../../../core/cache/builders/link.service';
|
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||||
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
import { ObjectUpdatesService } from '../../../core/data/object-updates/object-updates.service';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { cloneDeep } from 'lodash';
|
import { cloneDeep } from 'lodash';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import {
|
import { Identifiable } from '../../../core/data/object-updates/object-updates.reducer';
|
||||||
Identifiable
|
|
||||||
} from '../../../core/data/object-updates/object-updates.reducer';
|
|
||||||
import { first, map, switchMap, take, tap } from 'rxjs/operators';
|
import { first, map, switchMap, take, tap } from 'rxjs/operators';
|
||||||
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
import { getSucceededRemoteData } from '../../../core/shared/operators';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { GLOBAL_CONFIG, GlobalConfig } from '../../../../config';
|
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { RegistryService } from '../../../core/registry/registry.service';
|
import { RegistryService } from '../../../core/registry/registry.service';
|
||||||
import { MetadatumViewModel } from '../../../core/shared/metadata.models';
|
import { MetadatumViewModel } from '../../../core/shared/metadata.models';
|
||||||
@@ -42,11 +38,10 @@ export class ItemMetadataComponent extends AbstractItemUpdateComponent {
|
|||||||
public router: Router,
|
public router: Router,
|
||||||
public notificationsService: NotificationsService,
|
public notificationsService: NotificationsService,
|
||||||
public translateService: TranslateService,
|
public translateService: TranslateService,
|
||||||
@Inject(GLOBAL_CONFIG) public EnvConfig: GlobalConfig,
|
|
||||||
public route: ActivatedRoute,
|
public route: ActivatedRoute,
|
||||||
public metadataFieldService: RegistryService,
|
public metadataFieldService: RegistryService,
|
||||||
) {
|
) {
|
||||||
super(itemService, objectUpdatesService, router, notificationsService, translateService, EnvConfig, route);
|
super(itemService, objectUpdatesService, router, notificationsService, translateService, route);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -15,8 +15,8 @@ import { Collection } from '../../../core/shared/collection.model';
|
|||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { SearchService } from '../../../core/shared/search/search.service';
|
import { SearchService } from '../../../core/shared/search/search.service';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { ItemMoveComponent } from './item-move.component';
|
import { ItemMoveComponent } from './item-move.component';
|
||||||
|
|
||||||
describe('ItemMoveComponent', () => {
|
describe('ItemMoveComponent', () => {
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
@@ -16,7 +16,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ItemPrivateComponent } from './item-private.component';
|
import { ItemPrivateComponent } from './item-private.component';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
let comp: ItemPrivateComponent;
|
let comp: ItemPrivateComponent;
|
||||||
let fixture: ComponentFixture<ItemPrivateComponent>;
|
let fixture: ComponentFixture<ItemPrivateComponent>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
@@ -16,7 +16,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ItemPublicComponent } from './item-public.component';
|
import { ItemPublicComponent } from './item-public.component';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
let comp: ItemPublicComponent;
|
let comp: ItemPublicComponent;
|
||||||
let fixture: ComponentFixture<ItemPublicComponent>;
|
let fixture: ComponentFixture<ItemPublicComponent>;
|
||||||
|
@@ -1,9 +1,9 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { Item } from '../../../core/shared/item.model';
|
import { Item } from '../../../core/shared/item.model';
|
||||||
import { RouterStub } from '../../../shared/testing/router-stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { RemoteData } from '../../../core/data/remote-data';
|
import { RemoteData } from '../../../core/data/remote-data';
|
||||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service.stub';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
@@ -16,7 +16,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { ItemReinstateComponent } from './item-reinstate.component';
|
import { ItemReinstateComponent } from './item-reinstate.component';
|
||||||
import { RestResponse } from '../../../core/cache/response.models';
|
import { RestResponse } from '../../../core/cache/response.models';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
|
||||||
|
|
||||||
let comp: ItemReinstateComponent;
|
let comp: ItemReinstateComponent;
|
||||||
let fixture: ComponentFixture<ItemReinstateComponent>;
|
let fixture: ComponentFixture<ItemReinstateComponent>;
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
@import '../../../../../styles/variables.scss';
|
|
||||||
|
|
||||||
.relationship-row:not(.alert-danger) {
|
.relationship-row:not(.alert-danger) {
|
||||||
padding: $alert-padding-y 0;
|
padding: $alert-padding-y 0;
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import { RelationshipType } from '../../../../core/shared/item-relationships/rel
|
|||||||
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { getMockLinkService } from '../../../../shared/mocks/mock-link-service';
|
import { getMockLinkService } from '../../../../shared/mocks/link-service.mock';
|
||||||
import { SharedModule } from '../../../../shared/shared.module';
|
import { SharedModule } from '../../../../shared/shared.module';
|
||||||
import { EditRelationshipListComponent } from './edit-relationship-list.component';
|
import { EditRelationshipListComponent } from './edit-relationship-list.component';
|
||||||
|
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
@import '../../../../../styles/variables.scss';
|
|
||||||
|
|
||||||
.btn[disabled] {
|
.btn[disabled] {
|
||||||
color: $gray-600;
|
color: $gray-600;
|
||||||
border-color: $gray-600;
|
border-color: $gray-600;
|
||||||
|
@@ -40,8 +40,8 @@ export class EditRelationshipComponent implements OnChanges {
|
|||||||
return this.fieldUpdate.field as Relationship;
|
return this.fieldUpdate.field as Relationship;
|
||||||
}
|
}
|
||||||
|
|
||||||
private leftItem$: Observable<Item>;
|
public leftItem$: Observable<Item>;
|
||||||
private rightItem$: Observable<Item>;
|
public rightItem$: Observable<Item>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The related item of this relationship
|
* The related item of this relationship
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user