Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular upgrade: this connects to #83 and this connects to #86 #123

Merged
merged 29 commits into from Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c08f5c6
dependency upgrades, server and platform module updates, linting wip
wwelling Jul 12, 2017
d131e1c
fixed pagination component spec, linting wip
wwelling Jul 12, 2017
8ba6959
updated environment config comments
wwelling Jul 13, 2017
8a0eb1a
fixed linting in pagination component spec
wwelling Jul 13, 2017
ff934d0
upgraded to ngx-pagination
wwelling Jul 13, 2017
d864b30
downgraded zone.js, breaks ci
wwelling Jul 13, 2017
929fc90
updated dspace logo and favicon
wwelling Jul 13, 2017
75cb60e
added new dspace logo to home page news section
wwelling Jul 13, 2017
066bba2
fixed lint errors
wwelling Jul 13, 2017
41cda80
have default config use rehydrate pre-render strategy
wwelling Jul 13, 2017
35e8bbf
turn off debug for default config
wwelling Jul 13, 2017
9507b38
updated file tree in readme
wwelling Jul 13, 2017
ec7e7fd
upgraded node types
wwelling Jul 13, 2017
5a7df67
allow weak typed comparison in pagination component
wwelling Jul 14, 2017
4ffb8a6
fixed environment config, upgraded angular again
wwelling Jul 17, 2017
0449e36
fixed linting on config.ts
wwelling Jul 17, 2017
b19daa8
upgraded postcss
wwelling Jul 17, 2017
c42004e
fixed coverege error
wwelling Jul 17, 2017
40dc207
updated yarn lock
wwelling Jul 17, 2017
8e87d3e
resolved critial dependency warning
wwelling Jul 18, 2017
583f6e9
have prod, test, and dev environment config files override default
wwelling Jul 19, 2017
4ab26b1
add timestamp to listening console log
wwelling Jul 19, 2017
9352440
fixed base url construction
wwelling Jul 19, 2017
bd76342
abstracted server start logging
wwelling Jul 19, 2017
1c28180
added CSR fallback and optionally disable SSR
wwelling Jul 19, 2017
db0505c
upgraded some dependencies
wwelling Jul 19, 2017
89d8159
upgraded angular again
wwelling Jul 19, 2017
d4179bc
upgraded zone.js
wwelling Jul 19, 2017
1ec0c61
upgraded webpack
wwelling Jul 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
197 changes: 114 additions & 83 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ To change the default configuration values, create local files that override the
To use the configuration parameters in your component:

```bash
import { GlobalConfig } from "../config";
import { GLOBAL_CONFIG, GlobalConfig } from '../config';

constructor(@Inject(GLOBAL_CONFIG) public config: GlobalConfig) {}
```

Running the app
---------------

After you have installed all dependencies you can now run the app. Run `yarn run watch: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:3000`.
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`.

Running in production mode
--------------------------
Expand All @@ -113,7 +115,7 @@ yarn start
If you only want to build for production, without starting, run:

```bash
yarn run build:prod:ngc:json
yarn run build:prod
```

This will build the application and put the result in the `dist` folder
Expand Down Expand Up @@ -155,7 +157,7 @@ If you are going to use a remote test enviroment you need to edit the './protrac

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:dev`
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.

Expand All @@ -171,6 +173,17 @@ To run all the tests (e.g.: to run tests with Continuous Integration software) y

Run:`yarn run docs` to produce the documentation that will be available in the 'doc' folder.

Deploy
------

```bash
# deploy production in standalone pm2 container
yarn run deploy

# remove production from standalone pm2 container
yarn run undeploy
```

Other commands
--------------

Expand Down Expand Up @@ -201,87 +214,105 @@ See [the guide on the wiki](https://wiki.duraspace.org/display/DSPACE/DSpace+7+-
File Structure
--------------

Descriptions coming soon...

```
dspace-angular
├── README.md * This document
├── app.json * Application manifest file
├── config * Folder for configuration files
│   └── environment.default.js * Default configuration files
├── dist * Folder for e2e test files
├── e2e *
│   ├── app.e2e-spec.ts *
│   ├── app.po.ts *
│   ├── pagenotfound *
│   │   ├── pagenotfound.e2e-spec.ts *
│   │   └── pagenotfound.po.ts *
│   └── tsconfig.json *
├── empty.js *
├── helpers.js *
├── karma.conf.js * Unit Test configuration file
├── nodemon.json * Nodemon (https://nodemon.io/) configuration
├── package.json * This file describes the npm package for this project, its dependencies, scripts, etc.
├── postcss.config.json * PostCSS (http://postcss.org/) configuration file
├── protractor.conf.js * E2E tests configuration file
├── resources * Folder for static resources
│   ├── i18n * Folder for i18n translations
│   │   └── en.json *
│   └── images * Folder for images
│   └── dspace_logo.png *
├── rollup-client.js * Rollup (http://rollupjs.org/) configuration for the client
├── rollup-server.js * Rollup (http://rollupjs.org/) configuration for the server
├── spec-bundle.js *
├── src * The source of the application
│   ├── app * The location of the app module, and root of the application shared by client and server
│   │   ├── app-routing.module.ts *
│   │   ├── app.component.html *
│   │   ├── app.component.scss *
│   │   ├── app.component.spec.ts *
│   │   ├── app.component.ts *
│   │   ├── app.effects.ts *
│   │   ├── app.module.ts *
│   │   ├── app.reducers.ts *
│   │   ├── core *
│   │   ├── header *
│   │   ├── home *
│   │   ├── pagenotfound *
│   │   ├── shared *
│   │   └── store.actions.ts *
│   ├── backend * Folder containing a mock of the REST API, hosted by the express server
│   │   ├── api.ts *
│   │   ├── bitstreams.ts *
│   │   ├── bundles.ts *
│   │   ├── cache.ts *
│   │   ├── collections.ts *
│   │   ├── db.ts *
│   │   ├── items.ts *
│   │   └── metadata.ts *
│   ├── client.aot.ts * The bootstrap file for the client, in production
│   ├── client.ts * The bootstrap file for the client, during development
│   ├── config.ts * File that loads environmental and shareable settings and makes them available to app components
│   ├── index.html * The index.html file
│   ├── platform *
│   │   ├── angular2-meta.ts *
│   │   ├── modules *
│   │   │   ├── browser.module.ts * The root module for the client
│   │   │   └── node.module.ts * The root module for the server
│   │   └── workarounds *
│   │   ├── __workaround.browser.ts *
│   │   └── __workaround.node.ts *
│   ├── server.aot.ts * The express (http://expressjs.com/) config and bootstrap file for the server, in production
│   ├── server.routes.ts * The routes file for the server
│   ├── server.ts * The express (http://expressjs.com/) config and bootstrap file for the server, during development
│   ├── styles * Folder containing global styles.
│   │   ├── main.scss * Global scss file
│   │   └── variables.scss * Global sass variables file
│   └── typings.d.ts * File that allows you to add custom typings for libraries without TypeScript support
├── tsconfig.aot.json * TypeScript config for production builds
├── tsconfig.json * TypeScript config for development build
├── tslint.json * TSLint (https://palantir.github.io/tslint/) configuration
├── typedoc.json * TYPEDOC configuration
├── webpack.config.ts * Webpack (https://webpack.github.io/) config for development builds
├── webpack.prod.config.ts * Webpack (https://webpack.github.io/) config for production builds
├── webpack.test.config.js * Webpack (https://webpack.github.io/) config for testing
└── yarn.lock * Yarn lockfile (https://yarnpkg.com/en/docs/yarn-lock)
.
├── README.md
├── app.yaml
├── config
│   ├── environment.default.js
│   ├── environment.dev.js
│   ├── environment.prod.js
│   └── environment.test.js
├── e2e
│   ├── app.e2e-spec.ts
│   ├── app.po.ts
│   ├── pagenotfound
│   │   ├── pagenotfound.e2e-spec.ts
│   │   └── pagenotfound.po.ts
│   └── tsconfig.json
├── karma.conf.js
├── nodemon.json
├── package.json
├── postcss.config.js
├── protractor.conf.js
├── resources
│   ├── data
│   │   └── en
│   ├── i18n
│   │   └── en.json
│   └── images
│   └── dspace_logo.png
├── rollup.config.js
├── spec-bundle.js
├── src
│   ├── app
│   │   ├── app-routing.module.ts
│   │   ├── app.component.html
│   │   ├── app.component.scss
│   │   ├── app.component.spec.ts
│   │   ├── app.component.ts
│   │   ├── app.effects.ts
│   │   ├── app.module.ts
│   │   ├── app.reducer.ts
│   │   ├── browser-app.module.ts
│   │   ├── collection-page
│   │   ├── community-page
│   │   ├── core
│   │   ├── header
│   │   ├── home
│   │   ├── item-page
│   │   ├── object-list
│   │   ├── pagenotfound
│   │   ├── server-app.module.ts
│   │   ├── shared
│   │   ├── store.actions.ts
│   │   ├── store.effects.ts
│   │   ├── thumbnail
│   │   └── typings.d.ts
│   ├── backend
│   │   ├── api.ts
│   │   ├── cache.ts
│   │   ├── data
│   │   └── db.ts
│   ├── config
│   │   ├── cache-config.interface.ts
│   │   ├── global-config.interface.ts
│   │   └── server-config.interface.ts
│   ├── config.ts
│   ├── index.html
│   ├── main.browser.ts
│   ├── main.server.aot.ts
│   ├── main.server.ts
│   ├── modules
│   │   ├── cookies
│   │   ├── data-loader
│   │   ├── transfer-http
│   │   ├── transfer-state
│   │   ├── transfer-store
│   │   └── translate-universal-loader.ts
│   ├── routes.ts
│   ├── styles
│   │   ├── _mixins.scss
│   │   └── variables.scss
│   ├── tsconfig.browser.json
│   ├── tsconfig.server.aot.json
│   ├── tsconfig.server.json
│   └── tsconfig.test.json
├── tsconfig.json
├── tslint.json
├── typedoc.json
├── webpack
│   ├── helpers.js
│   ├── webpack.client.js
│   ├── webpack.common.js
│   ├── webpack.prod.js
│   ├── webpack.server.js
│   └── webpack.test.js
├── webpack.config.ts
└── yarn.lock
```

3rd Party Library Installation
Expand Down
12 changes: 0 additions & 12 deletions app.json

This file was deleted.

17 changes: 17 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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]
42 changes: 22 additions & 20 deletions config/environment.default.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
module.exports = {
// The REST API server settings.
"rest": {
"ssl": false,
"address": "dspace7.4science.it",
"port": 80,
// Angular2 UI server settings.
ui: {
ssl: false,
host: 'localhost',
port: 3000,
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
"nameSpace": "/dspace-spring-rest/api"
nameSpace: '/'
},
// Angular2 UI server settings.
"ui": {
"ssl": false,
"address": "localhost",
"port": 3000,
// The REST API server settings.
rest: {
ssl: false,
host: 'dspace7.4science.it',
port: 80,
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
"nameSpace": "/"
nameSpace: '/dspace-spring-rest/api'
},
"cache": {
cache: {
// how long should objects be cached for by default
"msToLive": 15 * 60 * 1000, // 15 minute
"control": "max-age=60" // revalidate browser
msToLive: 15 * 60 * 1000, // 15 minute
control: 'max-age=60' // revalidate browser
},
"universal": {
// Angular Universal settings
"preboot": true,
"async": true
}
logDirectory: '.',
// NOTE: rehydrate or replay
// rehydrate will transfer prerender state to browser state, actions do not need to replay
// replay will transfer an array of actions to browser, actions replay automatically
prerenderStrategy: 'replay',
// NOTE: will log all redux actions and transfers in console
debug: true
};
30 changes: 30 additions & 0 deletions config/environment.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
// Angular2 UI server settings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angular2?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update.

ui: {
ssl: false,
host: 'localhost',
port: 3000,
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
nameSpace: '/'
},
// The REST API server settings.
rest: {
ssl: false,
host: 'dspace7.4science.it',
port: 80,
// NOTE: Space is capitalized because 'namespace' is a reserved string in TypeScript
nameSpace: '/dspace-spring-rest/api'
},
cache: {
// how long should objects be cached for by default
msToLive: 15 * 60 * 1000, // 15 minute
control: 'max-age=60' // revalidate browser
},
logDirectory: '.',
// NOTE: rehydrate or replay
// rehydrate will transfer prerender state to browser state, actions do not need to replay
// replay will transfer an array of actions to browser, actions replay automatically
prerenderStrategy: 'rehydrate',
// NOTE: will log all redux actions and transfers in console
debug: true
};
6 changes: 3 additions & 3 deletions e2e/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ProtractorPage } from './app.po';

describe('protractor App', function() {
describe('protractor App', () => {
let page: ProtractorPage;

beforeEach(() => {
Expand All @@ -9,11 +9,11 @@ describe('protractor App', function() {

it('should display title "DSpace"', () => {
page.navigateTo();
expect(page.getPageTitleText()).toEqual('DSpace');
expect<any>(page.getPageTitleText()).toEqual('DSpace');
});

it('should display header "Welcome to DSpace"', () => {
page.navigateTo();
expect(page.getFirstHeaderText()).toEqual('Welcome to DSpace');
expect<any>(page.getFirstHeaderText()).toEqual('Welcome to DSpace');
});
});
10 changes: 5 additions & 5 deletions e2e/pagenotfound/pagenotfound.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ProtractorPage } from './pagenotfound.po';

describe('protractor PageNotFound', function() {
describe('protractor PageNotFound', () => {
let page: ProtractorPage;

beforeEach(() => {
page = new ProtractorPage();
});

it('should contain element ds-pagenotfound when navigating to page that doesnt exist"', () => {
it('should contain element ds-pagenotfound when navigating to page that doesnt exist', () => {
page.navigateToNonExistingPage();
expect(page.elementTagExists("ds-pagenotfound")).toEqual(true);
expect<any>(page.elementTagExists('ds-pagenotfound')).toEqual(true);
});

it('should not contain element ds-pagenotfound when navigating to existing page"', () => {
it('should not contain element ds-pagenotfound when navigating to existing page', () => {
page.navigateToExistingPage();
expect(page.elementTagExists("ds-pagenotfound")).toEqual(false);
expect<any>(page.elementTagExists('ds-pagenotfound')).toEqual(false);
});
});
Loading