diff --git a/angular.json b/angular.json
index 126fb2c..066b70a 100644
--- a/angular.json
+++ b/angular.json
@@ -26,7 +26,8 @@
"assets": [
"src/favicon.ico",
"src/assets",
- { "glob": "**/*", "input": "./node_modules/@inst-iot/bosch-angular-ui-components/assets", "output": "./assets" }
+ { "glob": "**/*", "input": "./node_modules/@inst-iot/bosch-angular-ui-components/assets", "output": "./assets" },
+ "src/Staticfile"
],
"styles": [
"src/styles.scss"
diff --git a/manifest.yml b/manifest.yml
new file mode 100644
index 0000000..852c5cd
--- /dev/null
+++ b/manifest.yml
@@ -0,0 +1,8 @@
+---
+applications:
+ - name: definma
+ path: dist/UI
+ buildpack: staticfile_buildpack
+ memory: 128M
+ instances: 1
+ stack: cflinuxfs3
diff --git a/package.json b/package.json
index d77ae2a..b188818 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
- "build": "ng build",
+ "build": "ng build --prod --aot",
+ "build-push": "ng build --prod --aot && cf push",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
diff --git a/src/Staticfile b/src/Staticfile
new file mode 100644
index 0000000..03b776c
--- /dev/null
+++ b/src/Staticfile
@@ -0,0 +1,2 @@
+pushstate: enabled
+force_https: true
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 140a69a..0546de3 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,7 +1,7 @@
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index e69de29..31ad797 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -0,0 +1,5 @@
+.dev-label {
+ color: #F00;
+ font-size: 32px;
+ margin-right: 40px;
+}
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 1f033c4..8b6391c 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,4 +1,4 @@
-import { Component } from '@angular/core';
+import { Component, isDevMode} from '@angular/core';
import {LoginService} from './services/login.service';
// TODO: add multiple samples at once
@@ -6,6 +6,7 @@ import {LoginService} from './services/login.service';
// TODO: validation: VZ, Humidity: min/max value, DPT: filename
// TODO: filter by not completely filled/no measurements
// TODO: account
+// TODO: admin user handling, template pages, validation of samples
@Component({
selector: 'app-root',
@@ -18,4 +19,8 @@ export class AppComponent {
public loginService: LoginService
) {
}
+
+ get devMode() {
+ return isDevMode();
+ }
}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 0bfe9db..60c0738 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -15,6 +15,7 @@ import { SampleComponent } from './sample/sample.component';
import { ValidateDirective } from './validate.directive';
import {CommonModule} from '@angular/common';
import { ErrorComponent } from './error/error.component';
+import { ObjectPipe } from './object.pipe';
@NgModule({
declarations: [
@@ -24,7 +25,8 @@ import { ErrorComponent } from './error/error.component';
SamplesComponent,
SampleComponent,
ValidateDirective,
- ErrorComponent
+ ErrorComponent,
+ ObjectPipe
],
imports: [
LocalStorageModule.forRoot({
diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts
index bc5612e..765d641 100644
--- a/src/app/login/login.component.ts
+++ b/src/app/login/login.component.ts
@@ -1,6 +1,7 @@
import {Component, OnInit, ViewChild} from '@angular/core';
import {ValidationService} from '../services/validation.service';
import {LoginService} from '../services/login.service';
+import {Router} from '@angular/router';
@Component({
@@ -19,6 +20,7 @@ export class LoginComponent implements OnInit {
constructor(
private validate: ValidationService,
private loginService: LoginService,
+ private router: Router
) { }
ngOnInit() {
@@ -28,6 +30,7 @@ export class LoginComponent implements OnInit {
this.loginService.login(this.username, this.password).then(ok => {
if (ok) {
this.message = 'Login successful'; // TODO: think about following action
+ this.router.navigate(['/samples']);
}
else {
this.message = 'Wrong credentials!';
diff --git a/src/app/object.pipe.spec.ts b/src/app/object.pipe.spec.ts
new file mode 100644
index 0000000..5560af0
--- /dev/null
+++ b/src/app/object.pipe.spec.ts
@@ -0,0 +1,8 @@
+import { ObjectPipe } from './object.pipe';
+
+describe('ObjectPipe', () => {
+ it('create an instance', () => {
+ const pipe = new ObjectPipe();
+ expect(pipe).toBeTruthy();
+ });
+});
diff --git a/src/app/object.pipe.ts b/src/app/object.pipe.ts
new file mode 100644
index 0000000..cf7ced5
--- /dev/null
+++ b/src/app/object.pipe.ts
@@ -0,0 +1,12 @@
+import { Pipe, PipeTransform } from '@angular/core';
+
+@Pipe({
+ name: 'object'
+})
+export class ObjectPipe implements PipeTransform {
+
+ transform(value: object): string {
+ return value ? Object.entries(value).map(e => e.join(': ')).join(', ') : '';
+ }
+
+}
diff --git a/src/app/sample/sample.component.ts b/src/app/sample/sample.component.ts
index 137e986..96d57c3 100644
--- a/src/app/sample/sample.component.ts
+++ b/src/app/sample/sample.component.ts
@@ -24,7 +24,6 @@ import {MeasurementModel} from '../models/measurement.model';
// TODO: multiple samples for base data, extend multiple measurements, conditions
-
@Component({
selector: 'app-sample',
templateUrl: './sample.component.html',
diff --git a/src/app/samples/samples.component.html b/src/app/samples/samples.component.html
index 02f0a6a..ee76318 100644
--- a/src/app/samples/samples.component.html
+++ b/src/app/samples/samples.component.html
@@ -8,17 +8,18 @@
Filter
-
+
+
+
-
+ |
|
|
- {{sample.number}} |
-
- {{materials[sample.material_id].name}} |
- {{materials[sample.material_id].supplier}} |
-
-
-
-
- {{sample.type}} |
- {{sample.color}} |
- {{sample.batch}} |
- {{sample.added | date}} |
+ {{sample.number}} |
+ {{sample.material_number}} |
+ {{materials[sample.material_id].name}} |
+ {{materials[sample.material_id].supplier}} |
+ {{materials[sample.material_id].group}} |
+ {{materials[sample.material_id].glass_fiber}} |
+ {{materials[sample.material_id].carbon_fiber}} |
+ {{materials[sample.material_id].mineral}} |
+ {{sample.type}} |
+ {{sample.color}} |
+ {{sample.batch}} |
+ {{sample.added | date:'dd/MM/yy'}} |
+ {{sample[key[1]] ? sample[key[1]][key[2]] : ''}} |
|
@@ -72,7 +127,7 @@
- of {{pages()}}
+ of {{pages()}} ({{totalSamples}} samples)