2020-07-13 10:52:10 +02:00
|
|
|
import { Component, isDevMode} from '@angular/core';
|
2020-06-19 08:43:22 +02:00
|
|
|
import {LoginService} from './services/login.service';
|
2020-08-11 14:18:16 +02:00
|
|
|
import {NavigationStart, Router} from '@angular/router';
|
2020-06-19 08:43:22 +02:00
|
|
|
|
|
|
|
// TODO: add multiple samples at once
|
2020-07-30 14:23:51 +02:00
|
|
|
// TODO: validation: DPT: filename
|
2020-06-19 08:43:22 +02:00
|
|
|
// TODO: filter by not completely filled/no measurements
|
2020-07-30 14:23:51 +02:00
|
|
|
// TODO: validation of samples
|
2020-08-06 08:18:57 +02:00
|
|
|
// TODO: centralize fetching of materials / templates, etc.
|
|
|
|
// TODO: PWA
|
2020-07-27 17:52:03 +02:00
|
|
|
|
2020-07-30 15:35:19 +02:00
|
|
|
// TODO: get rid of chart.js (+moment.js)
|
2020-01-14 13:41:28 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-root',
|
|
|
|
templateUrl: './app.component.html',
|
|
|
|
styleUrls: ['./app.component.scss']
|
|
|
|
})
|
|
|
|
export class AppComponent {
|
2020-05-22 12:52:17 +02:00
|
|
|
|
2020-08-06 08:18:57 +02:00
|
|
|
bugReport = {do: '', work: ''};
|
2020-08-11 14:18:16 +02:00
|
|
|
isDocumentation = false;
|
|
|
|
devMode = false;
|
2020-08-06 08:18:57 +02:00
|
|
|
|
2020-05-22 12:52:17 +02:00
|
|
|
constructor(
|
2020-08-07 10:49:18 +02:00
|
|
|
public login: LoginService,
|
2020-08-11 14:18:16 +02:00
|
|
|
public router: Router
|
2020-05-22 12:52:17 +02:00
|
|
|
) {
|
2020-08-11 14:18:16 +02:00
|
|
|
this.devMode = isDevMode();
|
|
|
|
this.router.events.subscribe(event => {
|
|
|
|
if (event instanceof NavigationStart) {
|
|
|
|
this.isDocumentation = /\/documentation/.test(event.url);
|
|
|
|
}
|
|
|
|
});
|
2020-07-13 10:52:10 +02:00
|
|
|
}
|
2020-07-14 09:39:37 +02:00
|
|
|
|
|
|
|
logout() {
|
2020-08-07 10:49:18 +02:00
|
|
|
this.login.logout();
|
2020-07-14 09:39:37 +02:00
|
|
|
this.router.navigate(['/']);
|
|
|
|
}
|
2020-08-06 08:18:57 +02:00
|
|
|
|
|
|
|
bugReportContent() {
|
|
|
|
return `mailto:lukas.veit@de.bosch.com?subject=Bug report&body=Thanks for sending the report! Your bug will be (hopefully) fixed soon.
|
|
|
|
%0D%0A%0D%0A--- REPORT DATA ---
|
|
|
|
%0D%0A%0D%0ATime: ${new Date().toString()}%0D%0A
|
|
|
|
URL: ${window.location}%0D%0A%0D%0AWhat did you do?%0D%0A${encodeURIComponent(this.bugReport.do)}
|
|
|
|
%0D%0A%0D%0AWhat did not work?%0D%0A${encodeURIComponent(this.bugReport.work)}%0D%0A%0D%0ABrowser:%0D%0A
|
|
|
|
%0D%0AappCodeName: ${navigator.appCodeName}
|
|
|
|
%0D%0AappVersion: ${navigator.appVersion}
|
|
|
|
%0D%0Alanguage: ${navigator.language}
|
|
|
|
%0D%0AonLine: ${navigator.onLine}
|
|
|
|
%0D%0Aoscpu: ${navigator.oscpu}
|
|
|
|
%0D%0Aplatform: ${navigator.platform}
|
|
|
|
%0D%0AuserAgent: ${navigator.userAgent}
|
|
|
|
%0D%0AinnerWidth: ${window.innerWidth}
|
|
|
|
%0D%0AinnerHeight: ${window.innerHeight}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
closeBugReport(close) {
|
|
|
|
setTimeout(() => close(), 1);
|
|
|
|
}
|
2020-01-14 13:41:28 +01:00
|
|
|
}
|
2020-08-06 08:18:57 +02:00
|
|
|
|
|
|
|
|
|
|
|
|