Skip to content

Commit 69c99d5

Browse files
matthiasbalkeRudiKl
authored andcommitted
Migration to angular-cli / angular 2.0.0 (#108)
* added generated angular2 project * added AdminLTE2 theme * applied infiniboard index.html * fixed layout * added routing added pageNotFound * added mocked dashboards route * fixed 404 layout * added not yet implemented page * package dashy instead of infiniboard-app * exposed mongo port locally * changed CORS port to ng development port * added dashboard service extracted dev/prod urls to environment * building dashy instead of infiniboard-app * added dashboard components for list / details added widget service * moved widget service into dashboard * added dynamic widget creation * added platform status widget * added widget type to quartermaster * added status pipes * moved to hash location strategy * added nvm and license * moved index site * removed function order * seperated frontend build steps * removed linting as long as app- prefix is required * removed old client * added installation of angluar-cli to build * fixed workin dir * exporting the default port crashes the circleci build as a local mongod is already running * pinned dependencies * added definition of transitive dependency fix taken from: angular/angular-cli#1997 * fixed cache dir * added linting to build removed forces prefix * cleaned up removed duplicated links.component removed unimplemented OnInit / constructor removed unused AdminLTE layout fix * activated running of specs * activated singleRun, so tests can be run on circleci * disabled test to finish, so it can be fixed one by one * added junit reporter to karma * updated angular to 2.0.0 * cleaned up tests added example for mocking services * fixed moved import * fixed linting errors * added mock data * added tests for pipes * added dashboard.ts tests * used toEqual instead of toBe * added dashboard service tests * added widget-config tests * added tests for widget service cleanup * prepared for widget service error teststing * changed error handling method to return server error
1 parent fad29c6 commit 69c99d5

File tree

98 files changed

+1315
-806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1315
-806
lines changed

circle.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies:
1515
cache_directories:
1616
- "~/docker"
1717
- "~/.npm"
18-
- "infiniboard-app/node_modules"
18+
- "dashy/node_modules"
1919

2020
override:
2121
- docker version
@@ -24,7 +24,12 @@ dependencies:
2424
- if [[ -e ~/docker/mongo.tar ]]; then docker load --input ~/docker/mongo.tar; fi
2525
- if [[ -e ~/docker/java.tar ]]; then docker load --input ~/docker/java.tar; fi
2626

27-
- cd infiniboard-app && npm install && cd ..
27+
- npm install -g angular-cli@webpack
28+
- cd dashy && npm install
29+
- cd dashy && ng lint
30+
- cd dashy && ng test
31+
- cd dashy && ng build --prod
32+
2833
- ./gradlew --stacktrace --console=plain build integrationTest
2934
- if [ "$CIRCLE_PR_NUMBER" = "" ]; then ./gradlew --stacktrace --console=plain sonarqube; else ./gradlew --stacktrace --console=plain sonarqube -Dsonar.analysis.mode=issues -Dsonar.github.pullRequest=$CIRCLE_PR_NUMBER -Dsonar.github.repository=$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME -Dsonar.github.oauth=$SONAR_GITHUB_OAUTH; fi
3035
- ./gradlew --stacktrace --console=plain buildDocker
@@ -38,8 +43,13 @@ dependencies:
3843
- docker save java:8 > ~/docker/java.tar
3944

4045
post:
46+
- mkdir -p $CIRCLE_TEST_REPORTS/ng-coverage/
47+
- cp -a dashy/build/coverage $CIRCLE_TEST_REPORTS/dashy-istanbul/
4148
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
49+
- cp -a dashy/build/junit/*.xml $CIRCLE_TEST_REPORTS/junit/
50+
4251
- find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
52+
4353
- mkdir -p $CIRCLE_TEST_REPORTS/junit-html/
4454
- find . -type d -regex ".**/build/reports/tests" -exec sh -c 'cp -a {} $CIRCLE_TEST_REPORTS/junit-html/`echo {} | cut -d / -f2`' \;
4555

@@ -57,6 +67,7 @@ test:
5767
- echo ">> quartermaster <<"; curl --retry 10 --retry-delay 5 -v http://localhost:8090/health
5868
- echo ">> harvester <<"; curl --retry 10 --retry-delay 5 -v http://localhost:9090/health
5969
- echo ">> REST API <<"; curl --retry 10 --retry-delay 5 -v http://localhost:8080/api/dashboards
70+
- echo ">> Frontend <<"; curl --retry 10 --retry-delay 5 -v http://localhost:8080/#/dashboards
6071

6172
post:
6273
- echo "Running Docker containers"; docker ps -a
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# http://editorconfig.org
1+
# Editor configuration, see http://editorconfig.org
22
root = true
33

44
[*]
5+
charset = utf-8
56
indent_style = space
67
indent_size = 2
7-
charset = utf-8
8-
trim_trailing_whitespace = true
8+
end_of_line = lf
99
insert_final_newline = true
10+
trim_trailing_whitespace = true
1011

1112
[*.md]
13+
max_line_length = 0
1214
trim_trailing_whitespace = false

dashy/.gitignore

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
7+
# dependencies
8+
/node_modules
9+
/bower_components
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
*.launch
16+
.settings/
17+
18+
# misc
19+
/.sass-cache
20+
/connect.lock
21+
/coverage/*
22+
/libpeerconnection.log
23+
npm-debug.log
24+
testem.log
25+
/typings
26+
27+
# e2e
28+
/e2e/*.js
29+
/e2e/*.map
30+
31+
#System Files
32+
.DS_Store
33+
Thumbs.db

infiniboard-app/README.md renamed to dashy/README.md

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,41 @@
1-
# infiniboard-app
1+
# dashy
2+
3+
This project was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.11-webpack.8.
24

35
## tooling
46
The usage of [nvm](https://github.com/creationix/nvm) is recommended to switch between different versions of node when necessary.
57
For Microsoft Windows based development [nvm-windows](https://github.com/coreybutler/nvm-windows) can be used.
68
The currently used node version can be determined by taking a look the machine section of [circle.yml](https://github.com/reflectoring/infiniboard/blob/master/circle.yml).
79

8-
## building
10+
## angular-cli
11+
12+
### Development server
13+
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
14+
15+
### Code scaffolding
16+
17+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class`.
18+
19+
### Build
20+
21+
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
22+
23+
### Running unit tests
24+
25+
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
26+
27+
### Running end-to-end tests
28+
29+
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
30+
Before running the tests make sure you are serving the app via `ng serve`.
31+
32+
### Deploying to Github Pages
933

10-
### install dependencies
11-
```
12-
$ npm install
13-
```
34+
Run `ng github-pages:deploy` to deploy to Github Pages.
1435

15-
### build infiniboard-app for production usage
16-
```
17-
$ gulp
18-
```
36+
### Further help
1937

20-
### build infiniboard-app for development usage
21-
```
22-
$ gulp dev
23-
```
38+
To get more help on the `angular-cli` use `ng --help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
2439

2540
## license
2641

dashy/angular-cli.json

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"project": {
3+
"version": "1.0.0-beta.11-webpack.8",
4+
"name": "dashy"
5+
},
6+
"apps": [
7+
{
8+
"root": "src",
9+
"outDir": "dist",
10+
"assets": "assets",
11+
"index": "index.html",
12+
"main": "main.ts",
13+
"test": "test.ts",
14+
"tsconfig": "tsconfig.json",
15+
"prefix": "app",
16+
"mobile": false,
17+
"styles": [
18+
"styles.css"
19+
],
20+
"scripts": [
21+
"../node_modules/admin-lte/plugins/jQuery/jquery-2.2.3.min.js",
22+
"../node_modules/admin-lte/bootstrap/js/bootstrap.min.js",
23+
"../node_modules/admin-lte/dist/js/app.min.js"
24+
],
25+
"environments": {
26+
"source": "environments/environment.ts",
27+
"prod": "environments/environment.prod.ts",
28+
"dev": "environments/environment.dev.ts"
29+
}
30+
}
31+
],
32+
"addons": [],
33+
"packages": [],
34+
"e2e": {
35+
"protractor": {
36+
"config": "./protractor.conf.js"
37+
}
38+
},
39+
"test": {
40+
"karma": {
41+
"config": "./karma.conf.js"
42+
}
43+
},
44+
"defaults": {
45+
"styleExt": "css",
46+
"prefixInterfaces": false,
47+
"lazyRoutePrefix": "+"
48+
}
49+
}

dashy/e2e/app.e2e-spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { DashyPage } from './app.po';
2+
3+
describe('dashy App', function() {
4+
let page: DashyPage;
5+
6+
beforeEach(() => {
7+
page = new DashyPage();
8+
});
9+
10+
it('should display message saying app works', () => {
11+
page.navigateTo();
12+
expect(page.getParagraphText()).toEqual('app works!');
13+
});
14+
});

dashy/e2e/app.po.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { browser, element, by } from 'protractor/globals';
2+
3+
export class DashyPage {
4+
navigateTo() {
5+
return browser.get('/');
6+
}
7+
8+
getParagraphText() {
9+
return element(by.css('app-root h1')).getText();
10+
}
11+
}

dashy/e2e/tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"compileOnSave": false,
3+
"compilerOptions": {
4+
"declaration": false,
5+
"emitDecoratorMetadata": true,
6+
"experimentalDecorators": true,
7+
"module": "commonjs",
8+
"moduleResolution": "node",
9+
"outDir": "../dist/out-tsc-e2e",
10+
"sourceMap": true,
11+
"target": "es5",
12+
"typeRoots": [
13+
"../node_modules/@types"
14+
]
15+
}
16+
}

dashy/karma.conf.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', 'angular-cli'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-remap-istanbul'),
12+
require('karma-junit-reporter'),
13+
require('angular-cli/plugins/karma')
14+
],
15+
files: [
16+
{pattern: './src/test.ts', watched: false}
17+
],
18+
preprocessors: {
19+
'./src/test.ts': ['angular-cli']
20+
},
21+
remapIstanbulReporter: {
22+
reports: {
23+
html: 'build/coverage',
24+
lcovonly: './build/coverage/coverage.lcov'
25+
}
26+
},
27+
angularCli: {
28+
config: './angular-cli.json',
29+
environment: 'dev'
30+
},
31+
junitReporter: {
32+
outputDir: 'build/junit', // results will be saved as $outputDir/$browserName.xml
33+
outputFile: undefined, // if included, results will be saved as $outputDir/$browserName/$outputFile
34+
suite: '', // suite will become the package name attribute in xml testsuite element
35+
useBrowserName: true, // add browser name to report and classes names
36+
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
37+
classNameFormatter: undefined, // function (browser, result) to customize the classname attribute in xml testcase element
38+
properties: {} // key value pair of properties to add to the <properties> section of the report
39+
},
40+
reporters: ['progress', 'karma-remap-istanbul', 'junit'],
41+
port: 9876,
42+
colors: true,
43+
logLevel: config.LOG_INFO,
44+
autoWatch: true,
45+
browsers: ['Chrome'],
46+
singleRun: true
47+
});
48+
};

dashy/package.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "dashy",
3+
"version": "0.0.0",
4+
"license": "MIT",
5+
"angular-cli": {},
6+
"scripts": {
7+
"start": "ng serve",
8+
"lint": "tslint \"src/**/*.ts\"",
9+
"test": "ng test",
10+
"pree2e": "webdriver-manager update",
11+
"e2e": "protractor"
12+
},
13+
"private": true,
14+
"dependencies": {
15+
"@angular/common": "2.0.0",
16+
"@angular/compiler": "2.0.0",
17+
"@angular/core": "2.0.0",
18+
"@angular/forms": "2.0.0",
19+
"@angular/http": "2.0.0",
20+
"@angular/platform-browser": "2.0.0",
21+
"@angular/platform-browser-dynamic": "2.0.0",
22+
"@angular/router": "3.0.0",
23+
"admin-lte": "2.3.6",
24+
"core-js": "2.4.1",
25+
"rxjs": "5.0.0-beta.12",
26+
"ts-helpers": "1.1.1",
27+
"zone.js": "0.6.23"
28+
},
29+
"devDependencies": {
30+
"@types/jasmine": "2.2.30",
31+
"awesome-typescript-loader": "2.2.1",
32+
"angular-cli": "1.0.0-beta.14",
33+
"codelyzer": "0.0.26",
34+
"jasmine-core": "2.4.1",
35+
"jasmine-spec-reporter": "2.5.0",
36+
"karma": "1.2.0",
37+
"karma-chrome-launcher": "2.0.0",
38+
"karma-cli": "1.0.1",
39+
"karma-jasmine": "1.0.2",
40+
"karma-junit-reporter": "1.1.0",
41+
"karma-remap-istanbul": "0.2.1",
42+
"protractor": "4.0.5",
43+
"ts-node": "1.2.1",
44+
"tslint": "3.13.0",
45+
"typescript": "2.0.2"
46+
}
47+
}

dashy/protractor.conf.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// Protractor configuration file, see link for more information
2+
// https://github.com/angular/protractor/blob/master/docs/referenceConf.js
3+
4+
/*global jasmine */
5+
var SpecReporter = require('jasmine-spec-reporter');
6+
7+
exports.config = {
8+
allScriptsTimeout: 11000,
9+
specs: [
10+
'./e2e/**/*.e2e-spec.ts'
11+
],
12+
capabilities: {
13+
'browserName': 'chrome'
14+
},
15+
directConnect: true,
16+
baseUrl: 'http://localhost:4200/',
17+
framework: 'jasmine',
18+
jasmineNodeOpts: {
19+
showColors: true,
20+
defaultTimeoutInterval: 30000,
21+
print: function() {}
22+
},
23+
useAllAngular2AppRoots: true,
24+
beforeLaunch: function() {
25+
require('ts-node').register({
26+
project: 'e2e'
27+
});
28+
},
29+
onPrepare: function() {
30+
jasmine.getEnv().addReporter(new SpecReporter());
31+
}
32+
};

0 commit comments

Comments
 (0)