diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e07ae6f..40ba424 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -41,8 +41,8 @@ + android:host="www.maptology.com" + android:pathPrefix="/app/shares/"/> Maptology https://maptology.com/api - https://maptology.com/app/pages/map/ + https://maptology.com/app/shares/ true false false diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 346d8bf..0000000 --- a/package-lock.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "requires": true, - "lockfileVersion": 1, - "dependencies": { - "angular": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/angular/-/angular-1.6.8.tgz", - "integrity": "sha512-9WErZIOw1Cu1V5Yxdvxz/6YpND8ntdP71fdPpufPFJvZodZXqCjQBYrHqEoMZreO5i84O3D/Jw/vepoFt68Azw==" - } - } -} diff --git a/service/ejb/src/main/resources/emails/new-email.txt b/service/ejb/src/main/resources/emails/new-email.txt index c74d681..57d9ec2 100644 --- a/service/ejb/src/main/resources/emails/new-email.txt +++ b/service/ejb/src/main/resources/emails/new-email.txt @@ -5,7 +5,7 @@ we have received a request for a new email address association. If you have added this email address to your maptology account, please confirm the email address association by visiting -https://www.maptology.com/app/pages/verify/${token}. +https://www.maptology.com/app/activate/${token}. If you did not request the association, simply delete this email or contact us. diff --git a/service/ejb/src/main/resources/emails/new-user.txt b/service/ejb/src/main/resources/emails/new-user.txt index 6f62454..d221fc9 100644 --- a/service/ejb/src/main/resources/emails/new-user.txt +++ b/service/ejb/src/main/resources/emails/new-user.txt @@ -4,7 +4,7 @@ Dear ${name}, we have received an account request for a new Maptology account. If you have requested the account, please confirm your email by -visiting https://www.maptology.com/app/pages/verify/${token}. +visiting https://www.maptology.com/app/activate/${token}. If you did not request the account, simply delete this email or contact us. diff --git a/service/ejb/src/main/resources/emails/reset-user.txt b/service/ejb/src/main/resources/emails/reset-user.txt index a8f7d27..c82d153 100644 --- a/service/ejb/src/main/resources/emails/reset-user.txt +++ b/service/ejb/src/main/resources/emails/reset-user.txt @@ -4,7 +4,7 @@ Dear ${name}, we have received a request for a Maptology account reset. If you have requested the reset, please assign a new password -by visiting https://www.maptology.com/app/pages/reset/${token}. +by visiting https://www.maptology.com/app/reset/${token}. If you did not request the reset, simply delete this email or contact us. diff --git a/web/angular/.angular-cli.json b/web/angular/.angular-cli.json index 00799ac..5df2d69 100644 --- a/web/angular/.angular-cli.json +++ b/web/angular/.angular-cli.json @@ -1,7 +1,7 @@ { - "$schema": "../node_modules/@angular/cli/lib/config/schema.json", + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { - "name": "maptology" + "name": "webapp-ng" }, "apps": [ { @@ -9,7 +9,7 @@ "outDir": "dist", "assets": [ "assets", - "icon_launcher.png" + "favicon.ico" ], "index": "index.html", "main": "main.ts", @@ -19,18 +19,9 @@ "testTsconfig": "tsconfig.spec.json", "prefix": "app", "styles": [ - "../node_modules/font-awesome/css/font-awesome.css", - "../node_modules/simple-line-icons/css/simple-line-icons.css", - "../src/scss/style.scss", - "../node_modules/leaflet/dist/leaflet.css", - "../node_modules/ngx-toastr/toastr.css", - "../node_modules/ngx-bootstrap/datepicker/bs-datepicker.css" - ], - "scripts": [ - "../node_modules/chart.js/dist/Chart.bundle.min.js", - "../node_modules/chart.js/dist/Chart.min.js", - "../node_modules/leaflet/dist/leaflet.js" + "styles.scss" ], + "scripts": [], "environmentSource": "environments/environment.ts", "environments": { "dev": "environments/environment.ts", @@ -64,7 +55,6 @@ }, "defaults": { "styleExt": "scss", - "prefixInterfaces": false, "component": {} } } diff --git a/web/angular/.gitignore b/web/angular/.gitignore index 019c3f3..9f5d6d3 100644 --- a/web/angular/.gitignore +++ b/web/angular/.gitignore @@ -1,47 +1,48 @@ -# See http://help.github.com/ignore-files/ for more about ignoring files. - -# compiled output -/dist -/tmp -/out-tsc - -# dependencies -/node_modules - -# IDEs and editors -/.idea -.project -.classpath -.c9/ -*.launch -.settings/ -*.sublime-workspace - -# IDE - VSCode -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json - -# misc -/.sass-cache -/connect.lock -/coverage -/libpeerconnection.log -npm-debug.log -testem.log -/typings - -# e2e -/e2e/*.js -/e2e/*.map - -# System Files -.DS_Store -Thumbs.db - -# auto-generated api client -/src/api - +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# compiled output +/dist +/tmp +/out-tsc + +# dependencies +/node_modules +/node + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +testem.log +/typings + +# e2e +/e2e/*.js +/e2e/*.map + +# System Files +.DS_Store +Thumbs.db + +# auto-generated api client +/src/api + /package-lock.json diff --git a/web/angular/README.md b/web/angular/README.md index dabd46d..61465af 100644 --- a/web/angular/README.md +++ b/web/angular/README.md @@ -1,6 +1,6 @@ -# Maptology +# WebappNg -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.5.0. +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.0. ## Development server diff --git a/web/angular/e2e/app.e2e-spec.ts b/web/angular/e2e/app.e2e-spec.ts index cec6a55..220b433 100644 --- a/web/angular/e2e/app.e2e-spec.ts +++ b/web/angular/e2e/app.e2e-spec.ts @@ -1,6 +1,6 @@ import { AppPage } from './app.po'; -describe('maptology App', () => { +describe('webapp-ng App', () => { let page: AppPage; beforeEach(() => { diff --git a/web/angular/package.json b/web/angular/package.json index 6fb5b66..f30b523 100644 --- a/web/angular/package.json +++ b/web/angular/package.json @@ -1,70 +1,58 @@ { "name": "maptology", - "version": "0.0.0", + "version": "1.0.0", "license": "MIT", "scripts": { "ng": "ng", - "start": "npm run api && ng serve --proxy-config proxy.conf.json --base-href=/app/", - "build": "npm run api && ng build", - "test": "npm run api && ng test", - "lint": "npm run api && ng lint", - "e2e": "npm run api && ng e2e", - "release": "npm run api && ng b -prod", + "start": "npm run api && npm run ng serve --proxy-config proxy.conf.json --base-href=/app/", + "build": "npm run api && npm run ng build", + "test": "npm run api && npm run ng test", + "lint": "npm run api && npm run ng lint", + "e2e": "npm run api && npm run ng e2e", + "release": "npm run api && npm run ng b -prod", "api": "a4apigen -s src/api/maptology.json -o ./src/api" }, "private": true, "dependencies": { - "@angular/animations": "^5.1.2", - "@angular/common": "^5.1.2", - "@angular/compiler": "^5.1.2", - "@angular/core": "^5.1.2", - "@angular/forms": "^5.1.2", - "@angular/http": "^5.1.2", - "@angular/platform-browser": "^5.1.2", - "@angular/platform-browser-dynamic": "^5.1.2", - "@angular/router": "^5.1.2", - "@angular/upgrade": "^5.1.2", - "bootstrap": "4.0.0-beta.2", - "bootstrap-logs": "^1.0.2", - "chart.js": "2.7.1", - "core-js": "2.5.3", - "font-awesome": "^4.7.0", - "jquery": "^3.3.1", + "@angular/animations": "^5.2.5", + "@angular/cdk": "^5.2.1", + "@angular/common": "^5.2.0", + "@angular/compiler": "^5.2.0", + "@angular/core": "^5.2.0", + "@angular/flex-layout": "^2.0.0-beta.12", + "@angular/forms": "^5.2.0", + "@angular/http": "^5.2.0", + "@angular/material": "^5.2.1", + "@angular/platform-browser": "^5.2.0", + "@angular/platform-browser-dynamic": "^5.2.0", + "@angular/router": "^5.2.0", + "core-js": "^2.4.1", + "hammerjs": "^2.0.8", "leaflet": "^1.2.0", - "leaflet-easybutton": "^2.2.4", - "material-design-icons": "^3.0.1", - "moment": "2.19.1", - "ngx-bootstrap": "2.0.1", "ngx-gauge": "^1.0.0-beta.2", - "ngx-toastr": "^8.0.0", - "popper.js": "^1.12.9", - "rxjs": "5.5.2", - "simple-line-icons": "^2.4.1", - "ts-helpers": "1.1.2", - "zone.js": "0.8.18" + "rxjs": "^5.5.6", + "zone.js": "^0.8.19" }, "devDependencies": { - "@angular-devkit/core": "0.0.28", - "@angular/cli": "1.5.0", - "@angular/compiler-cli": "^5.0.0", - "@angular/language-service": "^5.0.0", - "@types/jasmine": "~2.5.53", + "@angular/cli": "~1.7.0", + "@angular/compiler-cli": "^5.2.0", + "@angular/language-service": "^5.2.0", + "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", + "@types/node": "~6.0.60", "@types/leaflet": "^1.2.3", - "@types/node": "^6.0.92", "angular4-swagger-client-generator": "0.1.13", - "codelyzer": "~4.0.1", - "jasmine-core": "~2.6.2", - "jasmine-spec-reporter": "~4.1.0", - "karma": "~1.7.0", - "karma-chrome-launcher": "~2.1.0", - "karma-cli": "~1.0.1", + "codelyzer": "^4.0.1", + "jasmine-core": "~2.8.0", + "jasmine-spec-reporter": "~4.2.1", + "karma": "~2.0.0", + "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", - "ts-node": "~3.2.0", - "tslint": "~5.7.0", - "typescript": "~2.4.2" + "ts-node": "~4.1.0", + "tslint": "~5.9.1", + "typescript": "~2.5.3" } } diff --git a/web/angular/proxy.conf.json b/web/angular/proxy.conf.json index 70cfe2a..72be29b 100644 --- a/web/angular/proxy.conf.json +++ b/web/angular/proxy.conf.json @@ -1,7 +1,8 @@ { "/api": { - "target": "http://localhost:8090", + "target": "https://maptology.com", "secure": false, - "ws": true + "ws": true, + "logLevel": "debug" } } diff --git a/web/angular/src/_variables.scss b/web/angular/src/_variables.scss deleted file mode 100644 index acb8e93..0000000 --- a/web/angular/src/_variables.scss +++ /dev/null @@ -1,15 +0,0 @@ -/* - Here we can configure bootstrap sass variables - more variables can be found in the _variables.scss - in the bootstrap node module (see - ../node_modules/bootstrap/scss/_variables.scss) - - When defining variables here, leave out the - !default to make this definiton the default. -*/ - -// change some colors to UDE schema at -// https://www.uni-due.de/offen-im-denken/farben.php -$primary: #004c93; // UDE Primär (buttons will be darker now) -$secondary: #efe4bf; // UDE Sekundär (probably not a good idea) -$body-color: #1a171b; // UDE Schwarz diff --git a/web/angular/src/app/Utils/helper.service.ts b/web/angular/src/app/Utils/helper.service.ts deleted file mode 100644 index 3a578ec..0000000 --- a/web/angular/src/app/Utils/helper.service.ts +++ /dev/null @@ -1,29 +0,0 @@ -import {Injectable} from "@angular/core"; -import {HttpErrorResponse} from "@angular/common/http"; -import {ToastService} from "../toast.service"; -import {ConsoleService} from "../console.service"; - -@Injectable() -export class HelperService { - errorMessage: string = ''; - - constructor(private toastService:ToastService, - private consoleService:ConsoleService) {} - - handleError(error: HttpErrorResponse) { - if (error.status == 400) { - this.errorMessage = "Ungültiger Anfrageparameter."; - } else if (error.status == 403) { - this.errorMessage = "Unzureichende Zugriffsrechte."; - } else if (error.status == 404) { - this.errorMessage = "Die Ressource wurde nicht gefunden."; - } else if (error.status == 409){ - this.errorMessage = "Benutzer wurde parallel geändert."; - this.consoleService.log(this.errorMessage); - } else { - this.errorMessage = "Unbekannter Fehler"; - } - this.toastService.showError("Fehler aufgetreten",this.errorMessage); - this.consoleService.log(this.errorMessage); - }; -} diff --git a/web/angular/src/app/_nav.ts b/web/angular/src/app/_nav.ts deleted file mode 100755 index 8d772c7..0000000 --- a/web/angular/src/app/_nav.ts +++ /dev/null @@ -1,22 +0,0 @@ -export const navigation = [ - { - name: 'Freigaben', - url: '/maptology/shares', - icon: 'share' - }, - { - name: 'Profil', - url: '/maptology/profile', - icon: 'person' - }, - { - name: 'Statistiken', - url: '/maptology/statistic', - icon: 'explore' - }, - { - name: 'Karte', - url: '/maptology/map', - icon: 'map' - } -]; diff --git a/web/angular/src/app/app.component.html b/web/angular/src/app/app.component.html index e69de29..90c6b64 100755 --- a/web/angular/src/app/app.component.html +++ b/web/angular/src/app/app.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/angular/src/app/app.component.spec.ts b/web/angular/src/app/app.component.spec.ts deleted file mode 100755 index 13c632d..0000000 --- a/web/angular/src/app/app.component.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { TestBed, async } from '@angular/core/testing'; -import { AppComponent } from './app.component'; - -describe('AppComponent', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - declarations: [ - AppComponent - ], - }); - TestBed.compileComponents(); - }); - - it('should create the app', async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app).toBeTruthy(); - })); - - it(`should have as title 'app works!'`, async(() => { - const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; - expect(app.title).toEqual('app works!'); - })); - - it('should render title in a h1 tag', async(() => { - const fixture = TestBed.createComponent(AppComponent); - fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; - expect(compiled.querySelector('h1').textContent).toContain('app works!'); - })); -}); diff --git a/web/angular/src/app/app.component.ts b/web/angular/src/app/app.component.ts index 5095d21..9a7c2a4 100755 --- a/web/angular/src/app/app.component.ts +++ b/web/angular/src/app/app.component.ts @@ -1,8 +1,8 @@ import { Component } from '@angular/core'; @Component({ - // tslint:disable-next-line - selector: 'body', - template: '' + selector: 'app', + templateUrl: './app.component.html' }) -export class AppComponent { } +export class AppComponent { +} diff --git a/web/angular/src/app/app.module.ts b/web/angular/src/app/app.module.ts index 7186b60..03a0e2d 100755 --- a/web/angular/src/app/app.module.ts +++ b/web/angular/src/app/app.module.ts @@ -1,178 +1,194 @@ import { BrowserModule } from '@angular/platform-browser'; -import {FormsModule} from "@angular/forms"; -import {NgModule, LOCALE_ID} from '@angular/core'; -import {LocationStrategy, HashLocationStrategy, PathLocationStrategy} from '@angular/common'; +import { NgModule, LOCALE_ID } from '@angular/core'; + +import { FlexLayoutModule } from '@angular/flex-layout'; +import { NgxGaugeModule } from 'ngx-gauge'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import {MatButtonModule, MatIconModule, MatCheckboxModule, MatSidenavModule, MatToolbarModule, MatTooltipModule, MatCardModule, MatInputModule, MatFormFieldModule, MatProgressBarModule, MatProgressSpinnerModule, MatSnackBarModule, MatDialogContent, MatDialogModule, MatListModule, MatPaginatorModule, MatTableModule, MAT_PAGINATOR_INTL_PROVIDER, MatPaginatorIntl, MatExpansionModule, MatSelectModule, MatDatepickerModule, MatNativeDateModule, MatTabsModule} from '@angular/material'; + +import { LocationStrategy, PathLocationStrategy, registerLocaleData } from '@angular/common'; +import LocaleDE from '@angular/common/locales/de' +import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; + + +import { AppRoutingModule } from './app.routing'; import { AppComponent } from './app.component'; -// http client and http client interceptors -import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; -import { DelayInterceptor } from "./delay.interceptor"; -import { AuthInterceptor } from "./auth.interceptor"; -import { ConsoleService } from "./console.service"; -import {AuthService} from "./auth.service"; -import {AuthGuard} from "./auth.guard"; - -// Import custom pages -import { LoginComponent } from './views/pages/login/login.component'; -import { RegisterComponent } from './views/pages/register/register.component'; - -// Import custom components -import { HomepageComponent } from './views/components/homepage/homepage.component'; -import { ProfileComponent } from './views/components/profile/profile.component'; -import { StatisticComponent } from './views/components/statistic/statistic.component'; -import { SharesComponent } from './views/components/shares/shares.component'; -import {NotAuthGuard} from "./notAuth.guard"; -import {ParentAuthGuard} from "./parentAuth.guard"; -import {ApiClientService} from "../api/index"; -import {MapComponent} from "./views/components/map/map.component"; -import {LocationService} from "./location.service"; -import { PrivilegesService } from './privileges.service'; -import { StatisticService } from './statistic.service'; -import {VerifyEmailComponent} from "./views/pages/verify-email/verify-email.component"; -import {ResetPasswordComponent} from "./views/pages/reset-password/reset-password.component"; -import {ResetPasswordEmailComponent} from "./views/pages/reset-password-email/reset-password-email.component"; -import {AdminComponent} from "./views/components/admin/admin.component"; -import {UserManagementComponent} from "./views/components/user-management/user-management.component"; -import {PlaceComponent} from "./views/components/place/place.component"; -import {UserDevicesComponent} from "./views/components/user-devices/user-devices.component"; -import {AdminStatisticComponent} from "./views/components/admin-statistic/admin-statistic.component"; -import {SystemStatusComponent} from "./views/components/system-status/system-status.component"; -import { ToastService } from "./toast.service"; -import { HelperService } from "./Utils/helper.service"; -import { defineLocale, LocaleData } from 'ngx-bootstrap/chronos'; -import { deLocale } from 'ngx-bootstrap/locale'; -defineLocale(deLocale.abbr, deLocale); - -// Import containers -import { - FullLayoutComponent, - SimpleLayoutComponent -} from './containers'; +import { InsideComponent } from './layouts/inside.component'; +import { OutsideComponent } from './layouts/outside.component'; +import { FooterComponent } from './layouts/footer.component'; +import { ToolbarButtonComponent } from './widgets/toolbar-button.component' +import { LoginComponent } from './views/login.component'; +import { DelayInterceptor } from './interceptors/delay.interceptor'; +import { AuthInterceptor } from './interceptors/auth.interceptor'; +import { ApiClientService } from '../api'; +import { ConsoleService } from './services/console.service'; +import { UserService } from './services/user.service'; +import { FormsModule } from '@angular/forms'; +import { CredentialService } from './services/credential.service'; +import { LoginFieldComponent } from './widgets/login-field.component'; +import { UseParentFormDirective } from './directives/use-parent-form.directive'; +import { PasswordFieldComponent } from './widgets/password-field.component'; +import { NameFieldComponent } from './widgets/name-field.component'; +import { EmailFieldComponent } from './widgets/email-field.component'; +import { MessageDialogComponent } from './widgets/message-dialog.component'; +import { RegisterComponent } from './views/register.component'; +import { ActivateComponent } from './views/activate.component'; +import { ResetComponent } from './views/reset.component'; +import { ChangeComponent } from './views/change.component'; +import { ProfileButtonComponent } from './widgets/profile-button.component'; +import { DrawerComponent } from './layouts/drawer.component'; +import { PrivilegeService } from './services/privilege.service'; +import { DevicesComponent } from './views/devices.component'; +import { GermanPaginatorProvider } from './providers/paginator.provider'; +import { DeviceLocationComponent } from './views/device-location.component'; +import { TileMapComponent } from './widgets/tile-map.component'; +import { PrivilegesComponent } from './views/privileges.component'; +import { DeviceService } from './services/device.service'; +import { MarkerMapComponent } from './widgets/marker-map.component'; +import { ShareComponent } from './views/share.component'; +import { PlaceService } from './services/place.service'; +import { PlacesComponent } from './views/places.component'; +import { ConfirmationDialogComponent } from './widgets/confirmation-dialog.component'; +import { ShareDialogComponent } from './widgets/share-dialog.component'; +import { UserComponent } from './views/user.component'; +import { NicknameDialogComponent } from './widgets/nickname-dialog.component'; +import { NoticeCardComponent } from './widgets/notice-card.component'; +import { NoticeService } from './services/notice.service'; +import { NoticesComponent } from './views/notices.component'; +import { PlaceVisitService } from './services/place-visit.service'; +import { PlaceVisitsComponent } from './views/place-visits.component'; +import { DeviceVisitService } from './services/device-visit.service'; +import { DeviceVisitsComponent } from './views/device-visits.component'; +import { AuthGuard } from './guards/auth.guard'; +import { ManageLogComponent } from './views/manage-log.component'; +import { ManageLogService } from './services/manage-log.service'; +import { LogDialogComponent } from './widgets/log-dialog.component'; +import { ManageSystemComponent } from './views/manage-system.component'; +import { ManageUsersComponent } from './views/manage-users.component'; +import { ManageUserService } from './services/manage-user.service'; +import { ManageNoticeService } from './services/manage-notice.service'; +import { ManageNoticesComponent } from './views/manage-notices.component'; +import { EditNoticeComponent } from './views/edit-notice.component'; +import { LanguageSelectComponent } from './widgets/language-select.component'; /** * Computes the api domain from the browser location. */ -const apidomain: ()=>string = ()=>{ +const apidomain = ():{ http: string, ws: string } => { let host = document.location.hostname; let port = document.location.port; let protocol = document.location.protocol; + var hostportpath = ""; if (port.length > 0) { - return protocol + "//" + host + ":" + port + "/api"; + hostportpath = "://" + host + ":" + port + "/api"; } else { - return protocol + "//" + host + "/api" + hostportpath = "://" + host + "/api" } + let secure = (protocol != "http:")?"s":""; + return { http: "http" + secure + hostportpath, ws: "ws" + secure + hostportpath }; }; -const APP_CONTAINERS = [ - FullLayoutComponent, - SimpleLayoutComponent -]; - -// Import components -import { - AppFooterComponent, - AppHeaderComponent, - AppSidebarComponent, - AppSidebarFooterComponent, - AppSidebarFormComponent, - AppSidebarHeaderComponent, - AppSidebarMinimizerComponent, - APP_SIDEBAR_NAV -} from './components'; - -const APP_COMPONENTS = [ - AppFooterComponent, - AppHeaderComponent, - AppSidebarComponent, - AppSidebarFooterComponent, - AppSidebarFormComponent, - AppSidebarHeaderComponent, - AppSidebarMinimizerComponent, - APP_SIDEBAR_NAV, - LoginComponent, - RegisterComponent, - HomepageComponent, - ProfileComponent, - StatisticComponent, - MapComponent, - VerifyEmailComponent, - ResetPasswordComponent, - ResetPasswordEmailComponent, - AdminComponent, - UserManagementComponent, - PlaceComponent, - SharesComponent, - UserDevicesComponent, - AdminStatisticComponent, - SystemStatusComponent -]; - -// Import directives -import { - AsideToggleDirective, - NAV_DROPDOWN_DIRECTIVES, - ReplaceDirective, - SIDEBAR_TOGGLE_DIRECTIVES -} from './directives'; - -const APP_DIRECTIVES = [ - AsideToggleDirective, - NAV_DROPDOWN_DIRECTIVES, - ReplaceDirective, - SIDEBAR_TOGGLE_DIRECTIVES -]; - -// Import routing module -import { AppRoutingModule } from './app.routing'; - -// Import 3rd party components -import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; -import { TabsModule } from 'ngx-bootstrap/tabs'; -import { PaginationModule } from 'ngx-bootstrap/pagination'; -import { ModalModule } from 'ngx-bootstrap/modal'; -import { ToastrModule } from 'ngx-toastr'; -import { DatepickerModule, BsDatepickerModule } from 'ngx-bootstrap/datepicker'; -import { NgxGaugeModule } from 'ngx-gauge'; +/** + * Registers the locale data for DE. + */ +registerLocaleData(LocaleDE); @NgModule({ - imports: [ - BrowserModule, - FormsModule, - HttpClientModule, - BrowserAnimationsModule, - AppRoutingModule, - BsDropdownModule.forRoot(), - TabsModule.forRoot(), - PaginationModule.forRoot(), - ModalModule.forRoot(), - ToastrModule.forRoot({ - newestOnTop:true - }), - BsDatepickerModule.forRoot(), - DatepickerModule.forRoot(), - NgxGaugeModule - ], declarations: [ AppComponent, - ...APP_CONTAINERS, - ...APP_COMPONENTS, - ...APP_DIRECTIVES + FooterComponent, + InsideComponent, + OutsideComponent, + ToolbarButtonComponent, + ProfileButtonComponent, + LanguageSelectComponent, + DrawerComponent, + LoginFieldComponent, + PasswordFieldComponent, + EmailFieldComponent, + NameFieldComponent, + MessageDialogComponent, + ConfirmationDialogComponent, + TileMapComponent, + MarkerMapComponent, + LoginComponent, + RegisterComponent, + ShareComponent, + ActivateComponent, + ResetComponent, + ChangeComponent, + DevicesComponent, + DeviceLocationComponent, + PrivilegesComponent, + PlacesComponent, + ShareDialogComponent, + UserComponent, + NicknameDialogComponent, + NoticeCardComponent, + NoticesComponent, + PlaceVisitsComponent, + DeviceVisitsComponent, + ManageLogComponent, + LogDialogComponent, + ManageSystemComponent, + ManageUsersComponent, + ManageNoticesComponent, + EditNoticeComponent, + UseParentFormDirective, ], - providers: [{ - provide: LocationStrategy, - useClass: PathLocationStrategy //HashLocationStrategy possible - }, - {provide: "domain", useValue: apidomain()}, + imports: [ + BrowserModule, + BrowserAnimationsModule, + FormsModule, + FlexLayoutModule, + NgxGaugeModule, + HttpClientModule, + MatProgressBarModule, + MatProgressSpinnerModule, + MatPaginatorModule, + MatExpansionModule, + MatTableModule, + MatButtonModule, + MatInputModule, + MatFormFieldModule, + MatListModule, + MatIconModule, + MatCardModule, + MatSelectModule, + MatSnackBarModule, + MatTooltipModule, + MatToolbarModule, + MatSidenavModule, + MatProgressBarModule, + MatDialogModule, + MatCheckboxModule, + MatDatepickerModule, + MatNativeDateModule, + MatTabsModule, + AppRoutingModule, + ], + providers: [ + // injection token for http client + { provide: "domain", useValue: apidomain().http }, + { provide: "wsdomain", useValue: apidomain().ws }, + // location stategy for passing that with the router + { provide: LocationStrategy, useClass: PathLocationStrategy }, // add two global interceptors (one two slow down the server and one for authentication) {provide: HTTP_INTERCEPTORS, useClass: DelayInterceptor, multi: true}, {provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true}, + // change the locale to DE and add custom paginator provider for tables { provide: LOCALE_ID, useValue: 'de' }, + { provide: MatPaginatorIntl, useClass: GermanPaginatorProvider }, // add our application services (api access, logging, authentication) - ApiClientService, ConsoleService, AuthGuard, NotAuthGuard, ParentAuthGuard, AuthService, LocationService, PrivilegesService, StatisticService, ToastService, HelperService - ], - bootstrap: [ AppComponent ] + ApiClientService, ConsoleService, AuthGuard, + CredentialService, UserService, + DeviceService, PrivilegeService, PlaceService, NoticeService, PlaceVisitService, DeviceVisitService, + ManageLogService, ManageUserService, ManageNoticeService +], + entryComponents: [MessageDialogComponent, ConfirmationDialogComponent, ShareDialogComponent, NicknameDialogComponent, LogDialogComponent], + bootstrap: [AppComponent] }) export class AppModule { } diff --git a/web/angular/src/app/app.routing.ts b/web/angular/src/app/app.routing.ts index 1308a69..cebb5ce 100755 --- a/web/angular/src/app/app.routing.ts +++ b/web/angular/src/app/app.routing.ts @@ -1,119 +1,74 @@ -import { NgModule } from '@angular/core'; +import { NgModule, Component } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; -// Import Containers -import { - FullLayoutComponent, - SimpleLayoutComponent -} from './containers'; - // Import custom pages -import { LoginComponent } from './views/pages/login/login.component'; -import { RegisterComponent } from './views/pages/register/register.component'; - -// Import custom components -import { HomepageComponent } from './views/components/homepage/homepage.component'; -import { ProfileComponent } from './views/components/profile/profile.component'; -import { StatisticComponent } from './views/components/statistic/statistic.component'; -import { SharesComponent } from './views/components/shares/shares.component'; - -import { AuthGuard } from './auth.guard'; -import { NotAuthGuard } from './notAuth.guard'; -import { ParentAuthGuard } from './parentAuth.guard'; -import { MapComponent } from './views/components/map/map.component'; -import {VerifyEmailComponent} from "./views/pages/verify-email/verify-email.component"; -import {ResetPasswordComponent} from "./views/pages/reset-password/reset-password.component"; -import {ResetPasswordEmailComponent} from "./views/pages/reset-password-email/reset-password-email.component"; -import {AdminComponent} from "./views/components/admin/admin.component"; +import { InsideComponent } from './layouts/inside.component'; +import { OutsideComponent } from './layouts/outside.component'; +import { LoginComponent } from './views/login.component'; +import { RegisterComponent } from './views/register.component'; +import { ActivateComponent } from './views/activate.component'; +import { ResetComponent } from './views/reset.component'; +import { ChangeComponent } from './views/change.component'; +import { DevicesComponent } from './views/devices.component'; +import { DeviceLocationComponent } from './views/device-location.component'; +import { PrivilegesComponent } from './views/privileges.component'; +import { ShareComponent } from './views/share.component'; +import { PlacesComponent } from './views/places.component'; +import { UserComponent } from './views/user.component'; +import { NoticesComponent } from './views/notices.component'; +import { PlaceVisitsComponent } from './views/place-visits.component'; +import { DeviceVisitsComponent } from './views/device-visits.component'; +import { AuthGuard } from './guards/auth.guard'; +import { ManageLogComponent } from './views/manage-log.component'; +import { ManageSystemComponent } from './views/manage-system.component'; +import { ManageUsersComponent } from './views/manage-users.component'; +import { ManageNoticesComponent } from './views/manage-notices.component'; +import { EditNoticeComponent } from './views/edit-notice.component'; export const routes: Routes = [ - { - path: 'maptology', - component: FullLayoutComponent, - canActivate: [ParentAuthGuard], canActivateChild: [AuthGuard], - children: [ - {path: '', redirectTo: 'shares', pathMatch: 'full'}, - { - path: 'shares', - component: SharesComponent, - data: { - expectedRole: 'user' - } - }, - { - path: 'profile', - component: ProfileComponent, - data: { - expectedRole: 'user' - } - }, - { - path: 'statistic', - component: StatisticComponent, - data: { - expectedRole: 'user' - } - }, - { - path: 'map', - component: MapComponent, - data: { - expectedRole: 'user' - } - }, - { - path: 'map/:id', - component: MapComponent, - data: { - expectedRole: 'user' - } - }, - { - path: 'admin', - component: AdminComponent, - data: { - expectedRole: 'admin' - } - } - ] - }, - { - path: 'pages', - component: SimpleLayoutComponent, - data: { - title: 'Pages' - }, - canActivateChild: [NotAuthGuard], - children: [ - { path: '', redirectTo: '/pages/login', pathMatch: 'full'}, - { - path: 'login', - component: LoginComponent - }, - { - path: 'register', - component: RegisterComponent - }, - { - path: 'map/:id', - component: MapComponent - }, - { - path: 'verify/:token', - component: VerifyEmailComponent - }, - { - path: 'reset', - component: ResetPasswordEmailComponent - }, - { - path: 'reset/:token', - component: ResetPasswordComponent - } - ] - }, - { path: '', redirectTo: '/maptology/shares', pathMatch: 'full' }, - { path: '**', redirectTo: '/pages/login' } // "Catch-All" Route + { path: "", canActivate: [AuthGuard], canActivateChild:[AuthGuard], children: [ + // inside (logged in) + { path: 'devices', component: InsideComponent, children: [ + { path:'', component: DevicesComponent }, + { path:':id', children: [ + { path: 'location', component: DeviceLocationComponent }, + { path: 'visits', component: DeviceVisitsComponent } + ] }, + ]}, + { path: 'notices', component: InsideComponent, children: [{ path:'', component: NoticesComponent }] }, + { path: 'places', component: InsideComponent, children: [ + { path:'', component: PlacesComponent }, + { path:':id', component: PlaceVisitsComponent } + ] }, + { path: 'privileges', component: InsideComponent, children: [ + { path:'', component: PrivilegesComponent }, + { path:':token', component: ShareComponent } + ] }, + { path: 'profile', component: InsideComponent, children: [ + { path:'', component: UserComponent } + ]}, + /// inside (admin) + { path: 'manage', component: InsideComponent, children: [ + { path: 'logs', component: ManageLogComponent }, + { path: 'system', component: ManageSystemComponent }, + { path: 'users', component: ManageUsersComponent }, + { path: 'notices', children:[ + { path: '', component: ManageNoticesComponent }, + { path: ':id', component: EditNoticeComponent } + ]} + ]}, + // outside (logged out) + { path: 'login', component: OutsideComponent, children: [{ path:'', component: LoginComponent }] }, + { path: 'register', component: OutsideComponent, children: [{ path:'', component: RegisterComponent }] }, + { path: 'reset', component: OutsideComponent, children: [ + { path:'', component: ResetComponent }, + { path:':token', component: ChangeComponent } + ] }, + { path: 'activate', component: OutsideComponent, children: [{ path:':token', component: ActivateComponent }] }, + { path: 'shares', component: OutsideComponent, children: [{ path:':token', component: ShareComponent }] }, + // catch all + { path: '**', redirectTo: '/login' } + ]} ]; @NgModule({ diff --git a/web/angular/src/app/auth.guard.ts b/web/angular/src/app/auth.guard.ts deleted file mode 100644 index 9462bbf..0000000 --- a/web/angular/src/app/auth.guard.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Injectable } from '@angular/core'; -import {Router, CanActivate, CanActivateChild, ActivatedRouteSnapshot} from '@angular/router'; -import {AuthService, AuthState} from "./auth.service"; -import {User} from "../api/models/user.model"; - -@Injectable() -export class AuthGuard implements CanActivateChild { - - constructor(private router: Router, private authService:AuthService) { } - - canActivateChild(route: ActivatedRouteSnapshot) { - - //if current user ist n - if(!this.getCurrentUser()){ - this.router.navigate(['/pages/login']); - return false; - } - - // this will be passed from the route config - // on the data property - const expectedRole = route.data.expectedRole; - - // check if user logged in and if it has expected role - if (this.authService.getLogin() && this.checkRole(this.getCurrentUser().roles, expectedRole)) { - // logged in so return true - return true; - } - // not logged in so redirect to login page - this.router.navigate(['/pages/login']); - return false; - } - - private checkRole(roles: string[], expectedRole: string): boolean{ - for(var i =0; i { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [AuthService] - }); - }); - - it('should be created', inject([AuthService], (service: AuthService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/web/angular/src/app/auth.service.ts b/web/angular/src/app/auth.service.ts deleted file mode 100644 index eec9173..0000000 --- a/web/angular/src/app/auth.service.ts +++ /dev/null @@ -1,236 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ConsoleService } from './console.service'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { HttpErrorResponse } from '@angular/common/http'; -import { Router } from '@angular/router'; -import { User } from "../api/models/user.model"; -import { ApiClientService } from "../api/index"; -import { PrivilegesService } from './privileges.service'; -import { UserPassword } from '../api/models/userpassword.model'; -import {ToastService} from "./toast.service"; -import {HelperService} from "./Utils/helper.service"; - -/** - * The possible states of the auth service. - */ -export enum AuthState { - /** - * The user has not tried to login. - */ - Unauthorized, - /** - * The user is currently logging in. - */ - Authorizing, - /** - * The user has logged in. - */ - Authorized -} - -/** - * A service to manage the user's credentials and login state. The - * service can be in one of the AuthStates. While the user is - * Authorized, the service will maintain a reference to the - * user object from the server. In addition, when the service is - * in the AutState.Authorizing or AuthState.Authorized, a request - * interceptor will use the service getAuthHeader() method to - * compute a basic auth header that is transmitted with each request. - * - * To let the user's login state survive a page reload (without - * actually having a session on the server), the credentials are - * stored in the browser's session storage (if available). According - * to the docs, the session storage is "secure" enough to do this. - * However, since Safari does not support session storage in the - * private browsing mode, we also store the credentials in memory. - */ -@Injectable() -export class AuthService { - - private static KEY_LOGIN = "login"; - private static KEY_PASSWORD = "password"; - public static KEY_CURRENT_USER = "currentUser"; - - private login: string; - private password: string; - - user: BehaviorSubject = new BehaviorSubject(null); - state: BehaviorSubject = new BehaviorSubject(AuthState.Unauthorized); - error: BehaviorSubject = new BehaviorSubject(null); - - constructor(private consoleService: ConsoleService, - private apiClientService: ApiClientService, - private privilegesService: PrivilegesService, - private router: Router, - private toastService:ToastService, - private helperService:HelperService) { - // get the username from the session storage, if it is there - if (window.sessionStorage) { - this.login = window.sessionStorage.getItem(AuthService.KEY_LOGIN); - this.password = window.sessionStorage.getItem(AuthService.KEY_PASSWORD); - } - // immediately login, if we have credentials - if (this.isSet(this.login) && this.isSet(this.password)) { - // but return the service first, otherwise - // angular will go through an infinite service - // creation loop since the constructor did not - // return yet - setTimeout(() => { - this.requestLogin(); - }, 100); - } - } - - /** - * Returns the login name, if set. - * - * @returns The login name. - */ - getLogin(): string { - return this.login; - } - - /** - * Asks the service to perform a login. If there is no - * on-going server interacton, the service will try to - * retrieve the current user's account which validates - * the credential as a side-effect. If there is an - * ongoing interaction, the call to this method will - * be ignored. - */ - requestLogin(): void { - if (this.state.getValue() != AuthState.Authorizing) { - this.consoleService.log("Issuing login request."); - this.state.next(AuthState.Authorizing); - this.user.next(null); - this.error.next(null); - this.apiClientService.getCurrentUser().subscribe(result => { - this.user.next(result.body); - this.state.next(AuthState.Authorized); - // store the username into the session storage to - // make it survive a browser reload - if (window.sessionStorage) { - this.consoleService.log("Storing login."); - window.sessionStorage.setItem(AuthService.KEY_LOGIN, this.login); - window.sessionStorage.setItem(AuthService.KEY_PASSWORD, this.password); - window.sessionStorage.setItem(AuthService.KEY_CURRENT_USER, JSON.stringify(result.body)); - } - if (this.privilegesService.shareTokenToAddToPrivileges !== '') { - this.router.navigate(['/maptology/shares']); - } else if (this.router.url == '/pages/login') { - this.router.navigate(['/maptology/shares']); - } else { - this.router.navigate([this.router.url]); - } - }, error => { - this.consoleService.log("Error during login."); - this.helperService.handleError(error); - this.state.next(AuthState.Unauthorized); - }); - } else { - this.consoleService.log("Ignoring login request during login."); - } - } - - /** - * Asks the service to update the credentials. Similar to - * request login and request logout, this method will only - * do something while there is no ongoing service interaction. - * - * @param login The login name. - * @param password The password. - */ - setCredential(login: string, password: string): void { - if (this.state.getValue() != AuthState.Authorizing) { - this.login = login; - this.password = password; - this.state.next(AuthState.Unauthorized); - this.error.next(null); - this.user.next(null); - } - } - - /** - * Returns the auth header for the current username and password - * or null, if none are set or the service is not authorizing or - * authorized. - * - * @returns A basic auth header or null. - */ - getHeader(): string { - if (this.isSet(this.login) && this.isSet(this.password)) { - return "Basic " + btoa(this.login + ":" + this.password); - } else { - return null; - } - } - - /** - * Requests a logout, that will be executed unless the - * service is currently interacting with the server. - */ - requestLogout(): void { - if (this.state.getValue() != AuthState.Authorizing) { - // forget the credentials in memory - this.login = null; - this.password = null; - // also wipe the session storage - if (window.sessionStorage) { - window.sessionStorage.removeItem(AuthService.KEY_LOGIN); - window.sessionStorage.removeItem(AuthService.KEY_PASSWORD); - window.sessionStorage.removeItem(AuthService.KEY_CURRENT_USER); - } - // reset the service's state - this.state.next(AuthState.Unauthorized); - this.error.next(null); - this.user.next(null); - this.router.navigate(['/pages/login']); - } - } - - /** - * Determines whether the value is set by - * checking that it is not null and has a - * length > 0. - * - * @param value The value. - */ - private isSet(value: string) { - return value != null && value.length > 0; - } - - isAdmin(): boolean { - var tempRoles = this.user.getValue().roles; - for (var i = 0; i < tempRoles.length; i++) { - if (tempRoles[i] == "admin") { - return true; - } - } - return false; - } - - - verifyPassword(password: string): boolean { - if (this.password === password) - return true; - else - return false; - } - - requestPasswordReset(newPassword: string) { - console.log("info", newPassword); - let userPassword: UserPassword = { - password: newPassword - }; - console.log("info", userPassword); - this.apiClientService.setCurrentPassword(userPassword).subscribe(result => { - //Fancy Anzeige "Passwort geupdatet" - this.password = newPassword; - window.sessionStorage.setItem(AuthService.KEY_PASSWORD, newPassword); - - }, error => { - this.consoleService.log("Error during password reset."); - this.helperService.handleError(error); - }); - } -} diff --git a/web/angular/src/app/components/app-footer/app-footer.component.html b/web/angular/src/app/components/app-footer/app-footer.component.html deleted file mode 100755 index 4b53b71..0000000 --- a/web/angular/src/app/components/app-footer/app-footer.component.html +++ /dev/null @@ -1,4 +0,0 @@ - diff --git a/web/angular/src/app/components/app-footer/app-footer.component.ts b/web/angular/src/app/components/app-footer/app-footer.component.ts deleted file mode 100755 index 1e8f1ae..0000000 --- a/web/angular/src/app/components/app-footer/app-footer.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-footer', - templateUrl: './app-footer.component.html' -}) -export class AppFooterComponent { } diff --git a/web/angular/src/app/components/app-footer/index.ts b/web/angular/src/app/components/app-footer/index.ts deleted file mode 100755 index f029f14..0000000 --- a/web/angular/src/app/components/app-footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-footer.component'; diff --git a/web/angular/src/app/components/app-header/app-header.component.html b/web/angular/src/app/components/app-header/app-header.component.html deleted file mode 100755 index bf92f93..0000000 --- a/web/angular/src/app/components/app-header/app-header.component.html +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/web/angular/src/app/components/app-header/app-header.component.scss b/web/angular/src/app/components/app-header/app-header.component.scss deleted file mode 100644 index 25ef80f..0000000 --- a/web/angular/src/app/components/app-header/app-header.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.navbar-nav{ - padding-right: 10px; -} diff --git a/web/angular/src/app/components/app-header/app-header.component.ts b/web/angular/src/app/components/app-header/app-header.component.ts deleted file mode 100755 index 59c211f..0000000 --- a/web/angular/src/app/components/app-header/app-header.component.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { Component } from '@angular/core'; -import { AuthService } from '../../auth.service'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { User } from '../../../api/models/user.model'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'app-header', - templateUrl: './app-header.component.html', - styleUrls: ['./app-header.component.scss'], -}) -export class AppHeaderComponent { - - constructor(private authService: AuthService, private router: Router) { } - - getUser(): BehaviorSubject { - return this.authService.user; - } - - profileButton(): void { - this.router.navigate(['/maptology/profile']); - } - - requestLogout(): void { - this.authService.requestLogout(); - } -} diff --git a/web/angular/src/app/components/app-header/index.ts b/web/angular/src/app/components/app-header/index.ts deleted file mode 100755 index dcfab51..0000000 --- a/web/angular/src/app/components/app-header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-header.component'; diff --git a/web/angular/src/app/components/app-sidebar-footer/app-sidebar-footer.component.html b/web/angular/src/app/components/app-sidebar-footer/app-sidebar-footer.component.html deleted file mode 100755 index 63d421d..0000000 --- a/web/angular/src/app/components/app-sidebar-footer/app-sidebar-footer.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/angular/src/app/components/app-sidebar-footer/app-sidebar-footer.component.ts b/web/angular/src/app/components/app-sidebar-footer/app-sidebar-footer.component.ts deleted file mode 100755 index 9b2e92e..0000000 --- a/web/angular/src/app/components/app-sidebar-footer/app-sidebar-footer.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-sidebar-footer', - templateUrl: './app-sidebar-footer.component.html' -}) -export class AppSidebarFooterComponent { } diff --git a/web/angular/src/app/components/app-sidebar-footer/index.ts b/web/angular/src/app/components/app-sidebar-footer/index.ts deleted file mode 100755 index 5c8e33e..0000000 --- a/web/angular/src/app/components/app-sidebar-footer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-sidebar-footer.component'; diff --git a/web/angular/src/app/components/app-sidebar-form/app-sidebar-form.component.html b/web/angular/src/app/components/app-sidebar-form/app-sidebar-form.component.html deleted file mode 100755 index b5f736b..0000000 --- a/web/angular/src/app/components/app-sidebar-form/app-sidebar-form.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/angular/src/app/components/app-sidebar-form/app-sidebar-form.component.ts b/web/angular/src/app/components/app-sidebar-form/app-sidebar-form.component.ts deleted file mode 100755 index e1a39dc..0000000 --- a/web/angular/src/app/components/app-sidebar-form/app-sidebar-form.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-sidebar-form', - templateUrl: './app-sidebar-form.component.html' -}) -export class AppSidebarFormComponent { } diff --git a/web/angular/src/app/components/app-sidebar-form/index.ts b/web/angular/src/app/components/app-sidebar-form/index.ts deleted file mode 100755 index 63300f6..0000000 --- a/web/angular/src/app/components/app-sidebar-form/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-sidebar-form.component'; diff --git a/web/angular/src/app/components/app-sidebar-header/app-sidebar-header.component.html b/web/angular/src/app/components/app-sidebar-header/app-sidebar-header.component.html deleted file mode 100755 index 807585c..0000000 --- a/web/angular/src/app/components/app-sidebar-header/app-sidebar-header.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/angular/src/app/components/app-sidebar-header/app-sidebar-header.component.ts b/web/angular/src/app/components/app-sidebar-header/app-sidebar-header.component.ts deleted file mode 100755 index db1182a..0000000 --- a/web/angular/src/app/components/app-sidebar-header/app-sidebar-header.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-sidebar-header', - templateUrl: './app-sidebar-header.component.html' -}) -export class AppSidebarHeaderComponent { } diff --git a/web/angular/src/app/components/app-sidebar-header/index.ts b/web/angular/src/app/components/app-sidebar-header/index.ts deleted file mode 100755 index 6b1403e..0000000 --- a/web/angular/src/app/components/app-sidebar-header/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-sidebar-header.component'; diff --git a/web/angular/src/app/components/app-sidebar-minimizer/app-sidebar-minimizer.component.html b/web/angular/src/app/components/app-sidebar-minimizer/app-sidebar-minimizer.component.html deleted file mode 100755 index 462b3db..0000000 --- a/web/angular/src/app/components/app-sidebar-minimizer/app-sidebar-minimizer.component.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/web/angular/src/app/components/app-sidebar-minimizer/app-sidebar-minimizer.component.ts b/web/angular/src/app/components/app-sidebar-minimizer/app-sidebar-minimizer.component.ts deleted file mode 100755 index 5378fbf..0000000 --- a/web/angular/src/app/components/app-sidebar-minimizer/app-sidebar-minimizer.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-sidebar-minimizer', - templateUrl: './app-sidebar-minimizer.component.html' -}) -export class AppSidebarMinimizerComponent { } diff --git a/web/angular/src/app/components/app-sidebar-minimizer/index.ts b/web/angular/src/app/components/app-sidebar-minimizer/index.ts deleted file mode 100755 index 5b646bd..0000000 --- a/web/angular/src/app/components/app-sidebar-minimizer/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-sidebar-minimizer.component'; diff --git a/web/angular/src/app/components/app-sidebar-nav/app-sidebar-nav.component.ts b/web/angular/src/app/components/app-sidebar-nav/app-sidebar-nav.component.ts deleted file mode 100755 index b5d5c1e..0000000 --- a/web/angular/src/app/components/app-sidebar-nav/app-sidebar-nav.component.ts +++ /dev/null @@ -1,226 +0,0 @@ -import {Component, ElementRef, Input, OnInit, Renderer2, OnDestroy} from '@angular/core'; -import {AuthService} from "../../auth.service"; - -// Import navigation elements -import { navigation } from './../../_nav'; - -@Component({ - selector: 'app-sidebar-nav', - template: ` - ` -}) -export class AppSidebarNavComponent implements OnInit, OnDestroy{ - - public navigation = navigation; - - public isDivider(item) { - return item.divider ? true : false - } - - public isTitle(item) { - return item.title ? true : false - } - - constructor(private authService:AuthService) { } - - private user: any; - - ngOnInit(){ - // Checks if current user is admin && that admin nav item not visible now - this.user = this.authService.user.subscribe((value)=>{ - if(value){ - if(this.authService.isAdmin() && !this.checkAdminNavItem()){ - navigation.push( - { - name: 'Admin', - url: '/maptology/admin', - icon: 'settings' - } - ); - } - } - }); - } - - ngOnDestroy(){ - if(this.checkAdminNavItem()){ - navigation.pop(); - } - this.user.unsubscribe(); - } - - // checks if navigation contain admin nav item - checkAdminNavItem():boolean{ - for(var i=0; i < navigation.length; i++){ - if(navigation[i].name == "Admin"){ - return true; - } - } - return false; - } -} - -import { Router } from '@angular/router'; - -@Component({ - selector: 'app-sidebar-nav-item', - template: ` -
  • - -
  • - -
  • - -
  • -
    - ` -}) -export class AppSidebarNavItemComponent { - @Input() item: any; - - public hasClass() { - return this.item.class ? true : false - } - - public isDropdown() { - return this.item.children ? true : false - } - - public thisUrl() { - return this.item.url - } - - public isActive() { - return this.router.isActive(this.thisUrl(), false) - } - - constructor( private router: Router ) { } - -} - -@Component({ - selector: 'app-sidebar-nav-link', - template: ` - - {{ link.icon }} - {{ link.name }} - {{ link.badge.text }} - - - - {{ link.icon }} - {{ link.name }} - {{ link.badge.text }} - - - ` -}) -export class AppSidebarNavLinkComponent { - @Input() link: any; - - public hasVariant() { - return this.link.variant ? true : false - } - - public isBadge() { - return this.link.badge ? true : false - } - - public isExternalLink() { - return this.link.url.substring(0, 4) === 'http' ? true : false - } - - public isIcon() { - return this.link.icon ? true : false - } - - constructor() { } -} - -@Component({ - selector: 'app-sidebar-nav-dropdown', - template: ` - - {{ link.icon }} - {{ link.name }} - {{ link.badge.text }} - - - ` -}) -export class AppSidebarNavDropdownComponent { - @Input() link: any; - - public isBadge() { - return this.link.badge ? true : false - } - - public isIcon() { - return this.link.icon ? true : false - } - - constructor() { } -} - -@Component({ - selector: 'app-sidebar-nav-title', - template: '' -}) -export class AppSidebarNavTitleComponent implements OnInit { - @Input() title: any; - - constructor(private el: ElementRef, private renderer: Renderer2) { } - - ngOnInit() { - const nativeElement: HTMLElement = this.el.nativeElement; - const li = this.renderer.createElement('li'); - const name = this.renderer.createText(this.title.name); - - this.renderer.addClass(li, 'nav-title'); - - if ( this.title.class ) { - const classes = this.title.class; - this.renderer.addClass(li, classes); - } - - if ( this.title.wrapper ) { - const wrapper = this.renderer.createElement(this.title.wrapper.element); - - this.renderer.appendChild(wrapper, name); - this.renderer.appendChild(li, wrapper); - } else { - this.renderer.appendChild(li, name); - } - this.renderer.appendChild(nativeElement, li) - } -} - -export const APP_SIDEBAR_NAV = [ - AppSidebarNavComponent, - AppSidebarNavDropdownComponent, - AppSidebarNavItemComponent, - AppSidebarNavLinkComponent, - AppSidebarNavTitleComponent -]; diff --git a/web/angular/src/app/components/app-sidebar-nav/index.ts b/web/angular/src/app/components/app-sidebar-nav/index.ts deleted file mode 100755 index 958932a..0000000 --- a/web/angular/src/app/components/app-sidebar-nav/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-sidebar-nav.component'; diff --git a/web/angular/src/app/components/app-sidebar/app-sidebar.component.html b/web/angular/src/app/components/app-sidebar/app-sidebar.component.html deleted file mode 100755 index ac0dda4..0000000 --- a/web/angular/src/app/components/app-sidebar/app-sidebar.component.html +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/web/angular/src/app/components/app-sidebar/app-sidebar.component.ts b/web/angular/src/app/components/app-sidebar/app-sidebar.component.ts deleted file mode 100755 index 7f5065c..0000000 --- a/web/angular/src/app/components/app-sidebar/app-sidebar.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-sidebar', - templateUrl: './app-sidebar.component.html' -}) -export class AppSidebarComponent { } diff --git a/web/angular/src/app/components/app-sidebar/index.ts b/web/angular/src/app/components/app-sidebar/index.ts deleted file mode 100755 index 173dc43..0000000 --- a/web/angular/src/app/components/app-sidebar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './app-sidebar.component'; diff --git a/web/angular/src/app/components/index.ts b/web/angular/src/app/components/index.ts deleted file mode 100755 index f63d6b1..0000000 --- a/web/angular/src/app/components/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -export * from './app-footer'; -export * from './app-header'; -export * from './app-sidebar'; -export * from './app-sidebar-footer'; -export * from './app-sidebar-form'; -export * from './app-sidebar-header'; -export * from './app-sidebar-minimizer'; -export * from './app-sidebar-nav'; diff --git a/web/angular/src/app/console.service.spec.ts b/web/angular/src/app/console.service.spec.ts deleted file mode 100644 index be11fa6..0000000 --- a/web/angular/src/app/console.service.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { ConsoleService } from './console.service'; - -describe('ConsoleService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [ConsoleService] - }); - }); - - it('should be created', inject([ConsoleService], (service: ConsoleService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/web/angular/src/app/containers/full-layout/full-layout.component.html b/web/angular/src/app/containers/full-layout/full-layout.component.html deleted file mode 100755 index 9107317..0000000 --- a/web/angular/src/app/containers/full-layout/full-layout.component.html +++ /dev/null @@ -1,12 +0,0 @@ - -
    - - -
    -
    - -
    -
    - -
    - diff --git a/web/angular/src/app/containers/full-layout/full-layout.component.scss b/web/angular/src/app/containers/full-layout/full-layout.component.scss deleted file mode 100644 index fe8f87e..0000000 --- a/web/angular/src/app/containers/full-layout/full-layout.component.scss +++ /dev/null @@ -1,3 +0,0 @@ -.container-fluid { - height: 100%; -} diff --git a/web/angular/src/app/containers/full-layout/full-layout.component.ts b/web/angular/src/app/containers/full-layout/full-layout.component.ts deleted file mode 100755 index ecd257f..0000000 --- a/web/angular/src/app/containers/full-layout/full-layout.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-dashboard', - templateUrl: './full-layout.component.html', - styleUrls: ['./full-layout.component.scss'] -}) -export class FullLayoutComponent { } diff --git a/web/angular/src/app/containers/full-layout/index.ts b/web/angular/src/app/containers/full-layout/index.ts deleted file mode 100755 index 315223d..0000000 --- a/web/angular/src/app/containers/full-layout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './full-layout.component'; diff --git a/web/angular/src/app/containers/index.ts b/web/angular/src/app/containers/index.ts deleted file mode 100755 index b917dd1..0000000 --- a/web/angular/src/app/containers/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './full-layout'; -export * from './simple-layout'; diff --git a/web/angular/src/app/containers/simple-layout/index.ts b/web/angular/src/app/containers/simple-layout/index.ts deleted file mode 100755 index 6510703..0000000 --- a/web/angular/src/app/containers/simple-layout/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './simple-layout.component'; diff --git a/web/angular/src/app/containers/simple-layout/simple-layout.component.html b/web/angular/src/app/containers/simple-layout/simple-layout.component.html deleted file mode 100755 index e69de29..0000000 diff --git a/web/angular/src/app/containers/simple-layout/simple-layout.component.ts b/web/angular/src/app/containers/simple-layout/simple-layout.component.ts deleted file mode 100755 index 90cca2e..0000000 --- a/web/angular/src/app/containers/simple-layout/simple-layout.component.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-dashboard', - template: '', -}) -export class SimpleLayoutComponent { } diff --git a/web/angular/src/app/directives/aside/aside.directive.ts b/web/angular/src/app/directives/aside/aside.directive.ts deleted file mode 100755 index b3cc471..0000000 --- a/web/angular/src/app/directives/aside/aside.directive.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { Directive, HostListener } from '@angular/core'; - -/** -* Allows the aside to be toggled via click. -*/ -@Directive({ - selector: '[appAsideMenuToggler]', -}) -export class AsideToggleDirective { - constructor() { } - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - document.querySelector('body').classList.toggle('aside-menu-hidden'); - } -} diff --git a/web/angular/src/app/directives/aside/index.ts b/web/angular/src/app/directives/aside/index.ts deleted file mode 100755 index 3b84b70..0000000 --- a/web/angular/src/app/directives/aside/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './aside.directive'; diff --git a/web/angular/src/app/directives/index.ts b/web/angular/src/app/directives/index.ts deleted file mode 100755 index cd971e8..0000000 --- a/web/angular/src/app/directives/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './aside'; -export * from './nav-dropdown'; -export * from './replace'; -export * from './sidebar'; diff --git a/web/angular/src/app/directives/nav-dropdown/index.ts b/web/angular/src/app/directives/nav-dropdown/index.ts deleted file mode 100755 index 3eb0787..0000000 --- a/web/angular/src/app/directives/nav-dropdown/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './nav-dropdown.directive'; diff --git a/web/angular/src/app/directives/nav-dropdown/nav-dropdown.directive.ts b/web/angular/src/app/directives/nav-dropdown/nav-dropdown.directive.ts deleted file mode 100755 index 98c827d..0000000 --- a/web/angular/src/app/directives/nav-dropdown/nav-dropdown.directive.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Directive, HostListener, ElementRef } from '@angular/core'; - -@Directive({ - selector: '[appNavDropdown]' -}) -export class NavDropdownDirective { - - constructor(private el: ElementRef) { } - - toggle() { - this.el.nativeElement.classList.toggle('open'); - } -} - -/** -* Allows the dropdown to be toggled via click. -*/ -@Directive({ - selector: '[appNavDropdownToggle]' -}) -export class NavDropdownToggleDirective { - constructor(private dropdown: NavDropdownDirective) {} - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - this.dropdown.toggle(); - } -} - -export const NAV_DROPDOWN_DIRECTIVES = [NavDropdownDirective, NavDropdownToggleDirective]; diff --git a/web/angular/src/app/directives/replace/index.ts b/web/angular/src/app/directives/replace/index.ts deleted file mode 100755 index 8720adf..0000000 --- a/web/angular/src/app/directives/replace/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './replace.directive'; diff --git a/web/angular/src/app/directives/replace/replace.directive.ts b/web/angular/src/app/directives/replace/replace.directive.ts deleted file mode 100755 index d5ca81e..0000000 --- a/web/angular/src/app/directives/replace/replace.directive.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Directive, ElementRef, OnInit } from '@angular/core'; - -@Directive({ - // tslint:disable-next-line:max-line-length - selector: '[appHostReplace], app-aside, app-breadcrumbs, app-footer, app-header, app-sidebar, app-sidebar-footer, app-sidebar-form, app-sidebar-header, app-sidebar-minimizer, app-sidebar-nav, app-sidebar-nav-dropdown, app-sidebar-nav-item, app-sidebar-nav-link, app-sidebar-nav-title' -}) -export class ReplaceDirective implements OnInit { - - constructor(private el: ElementRef) { } - - // wait for the component to render completely - ngOnInit() { - const nativeElement: HTMLElement = this.el.nativeElement; - const parentElement: HTMLElement = nativeElement.parentElement; - // move all children out of the element - while (nativeElement.firstChild) { - parentElement.insertBefore(nativeElement.firstChild, nativeElement); - } - // remove the empty element(the host) - parentElement.removeChild(nativeElement); - } -} diff --git a/web/angular/src/app/directives/sidebar/index.ts b/web/angular/src/app/directives/sidebar/index.ts deleted file mode 100755 index aeb5775..0000000 --- a/web/angular/src/app/directives/sidebar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './sidebar.directive'; diff --git a/web/angular/src/app/directives/sidebar/sidebar.directive.ts b/web/angular/src/app/directives/sidebar/sidebar.directive.ts deleted file mode 100755 index 956465b..0000000 --- a/web/angular/src/app/directives/sidebar/sidebar.directive.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { Directive, HostListener } from '@angular/core'; - -/** -* Allows the sidebar to be toggled via click. -*/ -@Directive({ - selector: '[appSidebarToggler]' -}) -export class SidebarToggleDirective { - constructor() { } - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - document.querySelector('body').classList.toggle('sidebar-hidden'); - } -} - -@Directive({ - selector: '[appSidebarMinimizer]' -}) -export class SidebarMinimizeDirective { - constructor() { } - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - document.querySelector('body').classList.toggle('sidebar-minimized'); - } -} - -@Directive({ - selector: '[appBrandMinimizer]' -}) -export class BrandMinimizeDirective { - constructor() { } - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - document.querySelector('body').classList.toggle('brand-minimized'); - } -} - -@Directive({ - selector: '[appMobileSidebarToggler]' -}) -export class MobileSidebarToggleDirective { - constructor() { } - - // Check if element has class - private hasClass(target: any, elementClassName: string) { - return new RegExp('(\\s|^)' + elementClassName + '(\\s|$)').test(target.className); - } - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - document.querySelector('body').classList.toggle('sidebar-mobile-show'); - } -} - -/** -* Allows the off-canvas sidebar to be closed via click. -*/ -@Directive({ - selector: '[appSidebarClose]' -}) -export class SidebarOffCanvasCloseDirective { - constructor() { } - - // Check if element has class - private hasClass(target: any, elementClassName: string) { - return new RegExp('(\\s|^)' + elementClassName + '(\\s|$)').test(target.className); - } - - // Toggle element class - private toggleClass(elem: any, elementClassName: string) { - let newClass = ' ' + elem.className.replace( /[\t\r\n]/g, ' ' ) + ' '; - if (this.hasClass(elem, elementClassName)) { - while (newClass.indexOf(' ' + elementClassName + ' ') >= 0 ) { - newClass = newClass.replace( ' ' + elementClassName + ' ' , ' ' ); - } - elem.className = newClass.replace(/^\s+|\s+$/g, ''); - } else { - elem.className += ' ' + elementClassName; - } - } - - @HostListener('click', ['$event']) - toggleOpen($event: any) { - $event.preventDefault(); - - if (this.hasClass(document.querySelector('body'), 'sidebar-off-canvas')) { - this.toggleClass(document.querySelector('body'), 'sidebar-opened'); - } - } -} - -export const SIDEBAR_TOGGLE_DIRECTIVES = [ - SidebarToggleDirective, - SidebarMinimizeDirective, - BrandMinimizeDirective, - SidebarOffCanvasCloseDirective, - MobileSidebarToggleDirective -]; diff --git a/web/angular/src/app/directives/use-parent-form.directive.ts b/web/angular/src/app/directives/use-parent-form.directive.ts new file mode 100644 index 0000000..a445ceb --- /dev/null +++ b/web/angular/src/app/directives/use-parent-form.directive.ts @@ -0,0 +1,32 @@ +import { Directive } from "@angular/core"; +import { NgForm, ControlContainer } from "@angular/forms"; + +/** + * Angular's template driven forms do not allow composition + * and the fallback of going to reactive froms is too + * complicated for enabling trivial form reuse of validation + * logic. + * + * This directive, taken from the github page at + * https://github.com/angular/angular/issues/9600 + * provides a clean and simple solution. + * + * The only thing that is required is to add + * use-parent-form to our children and they will + * properly attach to any enclosing ng form. + * + * @author Marcus + */ +@Directive({ + selector: '[use-parent-form]', + providers: [ + { + provide: ControlContainer, + useFactory: function(form: NgForm):NgForm { + return form; + }, + deps: [NgForm] + } + ] +}) +export class UseParentFormDirective {} \ No newline at end of file diff --git a/web/angular/src/app/guards/auth.guard.ts b/web/angular/src/app/guards/auth.guard.ts new file mode 100644 index 0000000..fdbe482 --- /dev/null +++ b/web/angular/src/app/guards/auth.guard.ts @@ -0,0 +1,107 @@ +import { Injectable } from '@angular/core'; +import { CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild } from '@angular/router'; +import { UserService, UserState, UserRole } from '../services/user.service'; +import { Observable, BehaviorSubject, Subject } from 'rxjs'; +import { ConsoleService } from '../services/console.service'; + +@Injectable() +export class AuthGuard implements CanActivate, CanActivateChild { + + private static readonly OUTSIDE: string[] = [ + "/login", "/register", "/shares", "/activate", "/reset" + ]; + + private static readonly USER: string[] = [ + "/devices", "/notices", "/privileges", "/profile", "/places" + ]; + + private static readonly ADMIN: string[] = [ + "/manage" + ]; + + private static readonly NO_USER = "/login"; + private static readonly NO_ADMIN = "/notices"; + + + + constructor(private userService: UserService, private consoleService:ConsoleService, private router: Router) { } + + canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable|boolean { + let url: string = state.url; + // known outside stuff is ok for everyone + let outside = this.isOutside(url); + this.consoleService.log("Guard: Accepting outside route: " + url); + if (outside) return true; + // handle known user and admin routes + let admin = this.isAdmin(url); + let user = this.isUser(url); + this.consoleService.log("Guard: Checking route: " + (admin?"admin":"not admin") + " " + (user?"user":"not user")); + + if (admin || user) return this.allow(url, admin); + // unknown route, go to default page + if (this.userService.state.getValue() == UserState.Available) { + this.router.navigate([AuthGuard.NO_ADMIN]); + } else { + this.router.navigate([AuthGuard.NO_USER]); + } + return false; + } + + canActivateChild(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable|boolean { + return this.canActivate(route, state); + } + + private allow(url:string, onlyAdmin:boolean): Observable|boolean { + if (this.userService.state.getValue() == UserState.Available) { + if (!onlyAdmin || this.userService.hasRole(UserRole.Admin)) { + return true; + } else { + this.router.navigate([AuthGuard.NO_ADMIN]); + return false; + } + } else if (this.userService.state.getValue() == UserState.Unavailable) { + this.userService.redirectUrl = url; + this.router.navigate([AuthGuard.NO_USER]); + return false; + } else { + let result = new Subject(); + this.userService.state.subscribe((state)=> { + if (state == UserState.Available) { + if (!onlyAdmin || this.userService.hasRole(UserRole.Admin)) { + result.next(true); + } else { + this.router.navigate([AuthGuard.NO_ADMIN]); + result.next(false); + } + } else { + this.userService.redirectUrl = url; + this.router.navigate([AuthGuard.NO_USER]); + result.next(false); + } + }) + return result; + } + } + + private isOutside(url: string): boolean { + for (let out of AuthGuard.OUTSIDE) { + if (url.startsWith(out)) return true; + } + return false; + } + + private isUser(url: string): boolean { + for (let user of AuthGuard.USER) { + if (url.startsWith(user)) return true; + } + return false; + } + + private isAdmin(url: string): boolean { + for (let admin of AuthGuard.ADMIN) { + if (url.startsWith(admin)) return true; + } + return false; + } + +} \ No newline at end of file diff --git a/web/angular/src/app/auth.interceptor.ts b/web/angular/src/app/interceptors/auth.interceptor.ts similarity index 62% rename from web/angular/src/app/auth.interceptor.ts rename to web/angular/src/app/interceptors/auth.interceptor.ts index cf4cc91..ee83758 100644 --- a/web/angular/src/app/auth.interceptor.ts +++ b/web/angular/src/app/interceptors/auth.interceptor.ts @@ -3,9 +3,9 @@ import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/com import { Observable } from 'rxjs/Observable'; import { HttpResponse } from '@angular/common/http'; import { Subject } from 'rxjs/Subject'; -import { ConsoleService } from './console.service'; -import { AuthService } from './auth.service'; +import { ConsoleService } from '../services/console.service'; import { Injector } from '@angular/core'; +import { CredentialService } from '../services/credential.service'; /** * This interceptor intercepts http requests and attaches a @@ -15,19 +15,14 @@ import { Injector } from '@angular/core'; @Injectable() export class AuthInterceptor implements HttpInterceptor { - /** - * The authentication service to get tokens. - */ - private authService: AuthService; - /** * Creates a new interceptor with the injected console service - * and auth service. + * and credentials service. * * @param consoleService The console service for logging. - * @param authService The auth service to generate auth headers. + * @param credentialService The credential service to create auth headers. */ - constructor(private consoleService: ConsoleService, private injector: Injector) { } + constructor(private consoleService: ConsoleService, private credentialService: CredentialService) { } /** * Intercepts the requests and possibly attaches an auth header. @@ -36,15 +31,7 @@ export class AuthInterceptor implements HttpInterceptor { * @param next The handler to continue the request. */ intercept(req: HttpRequest, next: HttpHandler): Observable> { - if (this.authService == null) { - // this is dumb, but by using http service in the - // auth service (indirectly through ApiClientService) - // there will be a cyclic dependency between: - // ApiClientService -> HttpClient -> AuthInterceptor -> AuthSerivce -> ApiClientService - // but it can be resolved at runtime (see https://github.com/angular/angular/issues/18224) - this.authService = this.injector.get(AuthService); - } - let authHeader = this.authService.getHeader(); + let authHeader = this.credentialService.createHeader(); let clone = req; if (authHeader != null) { this.consoleService.log("Attaching Authorization header."); diff --git a/web/angular/src/app/delay.interceptor.ts b/web/angular/src/app/interceptors/delay.interceptor.ts similarity index 94% rename from web/angular/src/app/delay.interceptor.ts rename to web/angular/src/app/interceptors/delay.interceptor.ts index 7cf471b..eba6586 100644 --- a/web/angular/src/app/delay.interceptor.ts +++ b/web/angular/src/app/interceptors/delay.interceptor.ts @@ -3,7 +3,7 @@ import {HttpEvent, HttpInterceptor, HttpHandler, HttpRequest} from '@angular/com import { Observable } from 'rxjs/Observable'; import { HttpResponse } from '@angular/common/http'; import { Subject } from 'rxjs/Subject'; -import { ConsoleService } from './console.service'; +import { ConsoleService } from '../services/console.service'; /** * An interceptor that slows down the responses of http requests @@ -51,11 +51,11 @@ export class DelayInterceptor implements HttpInterceptor { }, error => { this.consoleService.log("Scheduling error for " + req.urlWithParams); // hacky: +1 to ensure that error is sent after result - this.schedule(started + 1, ()=> delayedRequest.error(error) ); + this.schedule(started + 100, ()=> delayedRequest.error(error) ); }, () => { this.consoleService.log("Scheduling completion for " + req.urlWithParams); // hacky: +2 to ensure that completion is sent last - this.schedule(started + 2, ()=> delayedRequest.complete() ); + this.schedule(started + 200, ()=> delayedRequest.complete() ); }); return delayedRequest; } diff --git a/web/angular/src/app/layouts/drawer.component.html b/web/angular/src/app/layouts/drawer.component.html new file mode 100644 index 0000000..ac77457 --- /dev/null +++ b/web/angular/src/app/layouts/drawer.component.html @@ -0,0 +1,34 @@ + +

    Navigation

    + + + + + + + + + + + + +

    Einstellungen

    + + + + +

    Verwaltung

    + + + + + + + + + + + + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/layouts/drawer.component.ts b/web/angular/src/app/layouts/drawer.component.ts new file mode 100644 index 0000000..f0cf9f6 --- /dev/null +++ b/web/angular/src/app/layouts/drawer.component.ts @@ -0,0 +1,32 @@ +import { Component, Input, OnInit, OnDestroy } from '@angular/core'; +import { Router, RouterEvent, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs'; +import { UserService, UserRole } from '../services/user.service'; + +/** + * Shows the contents of the navigation drawer. + */ +@Component({ + selector: 'drawer', + templateUrl: './drawer.component.html' +}) +export class DrawerComponent implements OnInit, OnDestroy{ + + admin:boolean = false; + + private subscription: Subscription; + + constructor(private userService: UserService) { } + + ngOnInit():void { + this.subscription = this.userService.state.subscribe((state)=> { + this.admin = this.userService.hasRole(UserRole.Admin); + }); + } + + ngOnDestroy():void { + this.subscription.unsubscribe(); + } + +} + \ No newline at end of file diff --git a/web/angular/src/app/layouts/footer.component.html b/web/angular/src/app/layouts/footer.component.html new file mode 100644 index 0000000..339d25f --- /dev/null +++ b/web/angular/src/app/layouts/footer.component.html @@ -0,0 +1,14 @@ + +
    +
    + +
    + Impressum + © 2018 Alle Rechte vorbehalten +
    +
    +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/layouts/footer.component.ts b/web/angular/src/app/layouts/footer.component.ts new file mode 100644 index 0000000..f82cfc6 --- /dev/null +++ b/web/angular/src/app/layouts/footer.component.ts @@ -0,0 +1,13 @@ +import { Component } from '@angular/core'; + +/** + * The responsive footer of the web application + * that contains a couple of links. + */ +@Component({ + selector: 'footer', + templateUrl: './footer.component.html' +}) +export class FooterComponent { + +} diff --git a/web/angular/src/app/layouts/inside.component.html b/web/angular/src/app/layouts/inside.component.html new file mode 100644 index 0000000..cabcc39 --- /dev/null +++ b/web/angular/src/app/layouts/inside.component.html @@ -0,0 +1,26 @@ +
    + + + + + + + Maptology +
    + + +
    +
    + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/layouts/inside.component.ts b/web/angular/src/app/layouts/inside.component.ts new file mode 100644 index 0000000..1804221 --- /dev/null +++ b/web/angular/src/app/layouts/inside.component.ts @@ -0,0 +1,76 @@ +import { Component, OnInit, OnDestroy, HostListener, ViewChild } from '@angular/core'; +import { Router } from '@angular/router'; +import { UserService, UserState } from '../services/user.service'; +import { Subscription } from 'rxjs'; +import { MatSidenavContainer, MatSidenav } from '@angular/material'; + +@Component({ + selector: 'inside', + templateUrl: './inside.component.html' +}) +export class InsideComponent implements OnInit, OnDestroy { + + private static readonly DRAWER_BREAKPOINT = 960; + + private drawerSubscription: Subscription; + private routerSubscription: Subscription; + + @ViewChild(MatSidenav) drawer: MatSidenav; + + compact: boolean = false; + opened: boolean = true; + + constructor(private userService: UserService, private router: Router) { } + + ngOnInit():void { + this.updateDrawer(window.innerWidth); + this.opened = this.drawer.opened; + this.drawerSubscription = this.drawer.openedChange.subscribe((state)=>{ + this.opened = state; + }); + this.routerSubscription = this.router.events.subscribe((event)=> { + if (this.compact) this.drawer.close(); + }); + } + + @HostListener('window:resize', ['$event']) + onResize(event:Event) { + this.updateDrawer((event.target as Window).innerWidth); + + } + + toggleDrawer():void { + this.drawer.toggle(); + this.opened = this.drawer.opened; + } + + updateDrawer(width: number): void { + if (width < InsideComponent.DRAWER_BREAKPOINT && !this.compact) { + this.drawer.mode = "over"; + this.drawer.close(); + this.compact = true; + this.opened = false; + } else if (width >= InsideComponent.DRAWER_BREAKPOINT && this.compact) { + this.compact = false; + this.drawer.mode = "side" + this.drawer.open(); + this.opened = true; + } + if (this.drawer.opened != this.opened) { + if (this.opened) this.drawer.open(); + else this.drawer.close(); + } + } + + + ngOnDestroy():void { + this.drawerSubscription.unsubscribe(); + this.routerSubscription.unsubscribe(); + } + + onLogout():void { + this.userService.logout(); + this.router.navigate(["/"]); + } + +} diff --git a/web/angular/src/app/layouts/outside.component.html b/web/angular/src/app/layouts/outside.component.html new file mode 100644 index 0000000..6432adb --- /dev/null +++ b/web/angular/src/app/layouts/outside.component.html @@ -0,0 +1,18 @@ +
    + + + + Maptology +
    + + +
    +
    + +
    + +
    + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/layouts/outside.component.ts b/web/angular/src/app/layouts/outside.component.ts new file mode 100644 index 0000000..7edc95a --- /dev/null +++ b/web/angular/src/app/layouts/outside.component.ts @@ -0,0 +1,9 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'outside', + templateUrl: './outside.component.html' +}) +export class OutsideComponent { + +} diff --git a/web/angular/src/app/location.service.spec.ts b/web/angular/src/app/location.service.spec.ts deleted file mode 100755 index 44752db..0000000 --- a/web/angular/src/app/location.service.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TestBed, inject } from '@angular/core/testing'; - -import { LocationService } from './location.service'; - -describe('LocationService', () => { - beforeEach(() => { - TestBed.configureTestingModule({ - providers: [LocationService] - }); - }); - - it('should be created', inject([LocationService], (service: LocationService) => { - expect(service).toBeTruthy(); - })); -}); diff --git a/web/angular/src/app/location.service.ts b/web/angular/src/app/location.service.ts deleted file mode 100755 index 133054b..0000000 --- a/web/angular/src/app/location.service.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Injectable } from '@angular/core'; -import { LatLng } from 'leaflet'; -import { ApiClientService } from '../api/index'; -import { ConsoleService } from './console.service'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { HttpErrorResponse } from '@angular/common/http'; -import { Location } from '../api/models/location.model'; -import {HelperService} from "./Utils/helper.service"; - -@Injectable() -export class LocationService { - - randomLocations: LatLng[] = [ - new LatLng(51.45165788, 7.00388614), - new LatLng(51.46000194, 7.01869371), - new LatLng(51.45517929, 7.02048384), - new LatLng(51.45978196, 7.01042728), - new LatLng(51.46385009, 7.01619635), - new LatLng(51.44816853, 7.01816195), - new LatLng(51.45525145, 7.00986632), - new LatLng(51.45425852, 7.01005042) - ]; - - location: BehaviorSubject = new BehaviorSubject(null); - error: BehaviorSubject = new BehaviorSubject(null); - - constructor(private consoleService: ConsoleService, - private apiClientService: ApiClientService, - private helperService:HelperService) { } - - getLocation(shareId: string): void { - this.apiClientService.getShareLocation(shareId).subscribe(result => { - this.location.next(result.body); - }, error => { - this.consoleService.log(`Error finding the share with id ${shareId}.`); - this.helperService.handleError(error); - }); - } - - resetLocation() { - this.consoleService.log('LocationService reset'); - this.location = new BehaviorSubject(null); - this.error = new BehaviorSubject(null); - } -} diff --git a/web/angular/src/app/notAuth.guard.ts b/web/angular/src/app/notAuth.guard.ts deleted file mode 100644 index f790ad8..0000000 --- a/web/angular/src/app/notAuth.guard.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Injectable } from '@angular/core'; -import {CanActivate, Router, CanActivateChild} from '@angular/router'; -import {AuthService} from "./auth.service"; - -@Injectable() -export class NotAuthGuard implements CanActivateChild { - constructor( - private authService: AuthService, - private router: Router - ) { } - - // Function to determine whether user is authorized to view route - canActivateChild() { - // Check if user is logged in - if (this.authService.getLogin()) { - this.router.navigate(['/maptology']); // Return error, route to home - return false; // Return false: user not allowed to view route - } else { - return true; // Return true: user is allowed to view route - } - } -} diff --git a/web/angular/src/app/parentAuth.guard.ts b/web/angular/src/app/parentAuth.guard.ts deleted file mode 100644 index 16dea2c..0000000 --- a/web/angular/src/app/parentAuth.guard.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Injectable } from '@angular/core'; -import {Router, CanActivate, CanActivateChild} from '@angular/router'; -import {AuthService, AuthState} from "./auth.service"; - -@Injectable() -export class ParentAuthGuard implements CanActivate { - - constructor(private router: Router, private authService:AuthService) { } - - canActivate() { - if (this.authService.getLogin()) { - // logged in so return true - return true; - } - // not logged in so redirect to login page - this.router.navigate(['/pages/login']); - return false; - } -} diff --git a/web/angular/src/app/privileges.service.ts b/web/angular/src/app/privileges.service.ts deleted file mode 100644 index e711abc..0000000 --- a/web/angular/src/app/privileges.service.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Injectable } from '@angular/core'; -import { ApiClientService } from '../api/index'; -import { ConsoleService } from './console.service'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { HttpErrorResponse } from '@angular/common/http'; -import { Privilege } from '../api/models/privilege.model'; -import { PrivilegePage } from '../api/models/privilegepage.model'; - -@Injectable() -export class PrivilegesService { - - shareTokenToAddToPrivileges = ''; - - constructor(private consoleService: ConsoleService, private apiClientService: ApiClientService) { } - - getShareTokenToAdd(): string { - return this.shareTokenToAddToPrivileges; - } - - setShareTokenToAdd(newValue: string): void { - this.shareTokenToAddToPrivileges = newValue; - } -} diff --git a/web/angular/src/app/providers/paginator.provider.ts b/web/angular/src/app/providers/paginator.provider.ts new file mode 100644 index 0000000..a77b343 --- /dev/null +++ b/web/angular/src/app/providers/paginator.provider.ts @@ -0,0 +1,21 @@ +import { MatPaginatorIntl } from "@angular/material"; + +export class GermanPaginatorProvider extends MatPaginatorIntl { + + constructor() { + super(); + this.firstPageLabel = "Erste Seite"; + this.lastPageLabel = "Letzte Seite"; + this.nextPageLabel = "Nächste Seite"; + this.previousPageLabel = "Vorherige Seite"; + this.itemsPerPageLabel = "Einträge pro Seite"; + } + + getRangeLabel = (page: number, pageSize: number, length: number):string => { + if (length === 0 || pageSize === 0) { return '0 von ' + length; } + length = Math.max(length, 0); + const startIndex = page * pageSize; + const endIndex = startIndex < length ? Math.min(startIndex + pageSize, length) : startIndex + pageSize; + return startIndex + 1 + ' - ' + endIndex + ' von ' + length; + } +} \ No newline at end of file diff --git a/web/angular/src/app/console.service.ts b/web/angular/src/app/services/console.service.ts similarity index 100% rename from web/angular/src/app/console.service.ts rename to web/angular/src/app/services/console.service.ts diff --git a/web/angular/src/app/services/credential.service.ts b/web/angular/src/app/services/credential.service.ts new file mode 100644 index 0000000..f4ed197 --- /dev/null +++ b/web/angular/src/app/services/credential.service.ts @@ -0,0 +1,147 @@ +import { Injectable } from '@angular/core'; +import { ConsoleService } from './console.service'; +import { BehaviorSubject } from 'rxjs/BehaviorSubject'; +import { HttpErrorResponse } from '@angular/common/http'; + +/** + * A service to manage the user's credentials. This service only + * stores the password and login name and provides methods to + * access them. The actual user-related logic is contained in + * the UserService. Application components should not use this + * service, instead they should rely on the functions of the + * UserService. + * + * To let the stored credentials survive a page reload (without + * actually having a session on the server), the credentials are + * stored in the browser's session storage (if available). According + * to the docs, the session storage is "secure" enough to do this. + * However, since Safari does not support session storage in the + * private browsing mode, we also store the credentials in memory. + */ +@Injectable() +export class CredentialService { + + /** + * The key to store the password in the session store. + */ + private static KEY_PASSWORD = "password"; + /** + * The key to store the login in the session store. + */ + private static KEY_LOGIN = "login"; + + /** + * The login name. + */ + private login: string; + + /** + * The password. + */ + private password: string; + + constructor() { + this.loadCredentials(); + } + + /** Loads the credentials from the session store, if available. */ + private loadCredentials(): void { + if (window.sessionStorage) { + this.login = window.sessionStorage.getItem(CredentialService.KEY_LOGIN); + this.password = window.sessionStorage.getItem(CredentialService.KEY_PASSWORD); + } + } + + /** Saves the credentials to the session store, if available. */ + private saveCredentials(): void { + if (window.sessionStorage) { + if (this.isSet(this.login)) { + window.sessionStorage.setItem(CredentialService.KEY_LOGIN, this.login); + } else { + window.sessionStorage.removeItem(CredentialService.KEY_LOGIN); + } + if (this.isSet(this.password)) { + window.sessionStorage.setItem(CredentialService.KEY_PASSWORD, this.password); + } else { + window.sessionStorage.removeItem(CredentialService.KEY_PASSWORD); + } + } + } + + /** + * Returns the login name, if set. + * + * @returns The login name. + */ + getLogin(): string { + return this.login; + } + + /** + * Sets the credentials contained in the + * service to the specified login and password. + * + * @param login The login. + * @param password The password. + */ + setCredential(login: string, password: string): void { + this.login = login; + this.password = password; + this.saveCredentials(); + } + + /** + * Clears the credentials stored in the service + */ + clearCredential(): void { + this.setCredential(null, null); + } + + /** + * Determines whether the specified password + * matches the stored password. + * + * @param password The password to check. + * @returns True if the password matches. + */ + hasPassword(password: string): boolean { + return (this.password != null && this.password === password); + } + + /** Determines whether the password and login name are set. + * + * @returns True if the password and the username are set. + */ + hasCredential() { + return (this.isSet(this.login) && this.isSet(this.password)); + } + + /** + * Returns the auth header for the current username and password + * or null, if none are set or the service is not authorizing or + * authorized. + * + * @returns A basic auth header or null. + */ + createHeader(): string { + if (this.hasCredential()) { + return "Basic " + btoa(this.login + ":" + this.password); + } else { + return null; + } + } + + + /** + * Determines whether the value is set by + * checking that it is not null and has a + * length > 0. + * + * @param value The value. + */ + private isSet(value: string) { + return value != null && value.length > 0; + } + + +} diff --git a/web/angular/src/app/services/device-visit.service.ts b/web/angular/src/app/services/device-visit.service.ts new file mode 100644 index 0000000..a5cd471 --- /dev/null +++ b/web/angular/src/app/services/device-visit.service.ts @@ -0,0 +1,113 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { DataSource } from '@angular/cdk/table'; +import { Device, DevicePage, Privilege, PrivilegePage, Place, PlacePage, Visit, VisitPage } from '../../api/models'; +import { ApiClientService } from '../../api'; +import { UserService } from './user.service'; +import { CollectionViewer } from '@angular/cdk/collections'; +import { AbstractPageService } from '../utils/pagination'; +import { HttpResponse } from '@angular/common/http'; + +/** + * A service that handles visits for a particular device and time. + */ +@Injectable() +export class DeviceVisitService implements DataSource { + + readonly device = new BehaviorSubject(null); + readonly loading = new BehaviorSubject(false); + readonly date = new BehaviorSubject(new Date()); + private elements = new BehaviorSubject([]); + private places: Map = new Map(); + private loaders:number = 0; + + private id: number; + private subscriptions = 0; + + constructor(private apiClientService:ApiClientService) { + } + + getVisits():Visit[] { + return this.elements.getValue(); + } + + setDevice(id:number) { + if (this.loading.getValue()) return; + this.loading.next(true); + this.device.next(null); + this.elements.next([]); + this.id = id; + if (id != null) { + this.apiClientService.getDevice(id).subscribe((result)=>{ + this.device.next(result.body); + this.loading.next(false); + this.setDate(this.date.getValue()); + }, (error)=> { + this.id = null; + this.loading.next(false); + }); + } + } + + setDate(date:Date) { + if (this.loading.getValue()) return; + this.loading.next(true); + let d = (date==null)?new Date():new Date(date); + d.setHours(0, 0, 0, 0); + let millis = d.getTime(); + this.date.next(d); + this.elements.next([]); + this.apiClientService.getDeviceVisits(this.id, millis, 24 * 60 * 60 * 1000).subscribe((result)=>{ + this.elements.next(result.body); + this.loadPlaces(); + }, (error) => { + this.elements.next([]); + this.loading.next(false); + }); + } + + getPlace(id:number):Place { + return this.places.get(id); + } + + + private loadPlaces() { + var ids: number[] = new Array(); + for (let v of this.elements.getValue()) { + if (this.getPlace(v.place) == null) { + ids.push(v.place); + } + } + if (ids.length == 0) { + this.loading.next(false); + } else { + this.loaders = ids.length; + for (let v of ids) { + this.apiClientService.getPlace(v).subscribe((result)=> { + this.finishLoading(v, result.body); + }, (error)=>{ + this.finishLoading(v, null); + }) + } + } + } + + private finishLoading(id:number, place: Place) { + if (place) this.places.set(id, place); + this.loaders -= 1; + if (this.loaders == 0) { + this.loading.next(false); + } + } + + connect(collectionViewer: CollectionViewer): Observable { + this.subscriptions += 1; + return this.elements; + } + + disconnect(collectionViewer: CollectionViewer): void { + this.subscriptions -= 1; + } + +} diff --git a/web/angular/src/app/services/device.service.ts b/web/angular/src/app/services/device.service.ts new file mode 100644 index 0000000..b563ccb --- /dev/null +++ b/web/angular/src/app/services/device.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { DataSource } from '@angular/cdk/table'; +import { Device, DevicePage } from '../../api/models'; +import { ApiClientService } from '../../api'; +import { UserService } from './user.service'; +import { CollectionViewer } from '@angular/cdk/collections'; +import { AbstractPageService } from '../utils/pagination'; +import { HttpResponse } from '@angular/common/http'; + +/** + * A service that handles devices. + */ +@Injectable() +export class DeviceService extends AbstractPageService { + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + protected loadPage(offset: number, size: number): Observable> { + return this.apiClientService.getCurrentUserDevices(offset, size); + } + +} diff --git a/web/angular/src/app/services/manage-log.service.ts b/web/angular/src/app/services/manage-log.service.ts new file mode 100644 index 0000000..de3b619 --- /dev/null +++ b/web/angular/src/app/services/manage-log.service.ts @@ -0,0 +1,114 @@ +import { Inject, Injectable } from "@angular/core"; +import { ConsoleService } from "./console.service"; +import { BehaviorSubject, Observable } from "rxjs"; +import { DataSource } from "@angular/cdk/table"; +import { LogMessage } from "../../api/models"; +import { CollectionViewer } from "@angular/cdk/collections"; +import { CredentialService } from "./credential.service"; + +@Injectable() +export class ManageLogService implements DataSource { + + private static readonly MAXIMUM_MESSAGES = 250; + private static readonly CONSOLE_OUTPUT = false; + + readonly connecting: BehaviorSubject = new BehaviorSubject(false); + private messages: BehaviorSubject = new BehaviorSubject([]); + private subscriptions: number = 0; + private socket: WebSocket; + private timeout = null; + private buffered: LogMessage[] = []; + + constructor( + @Inject('wsdomain') private domain: string, + private consoleService: ConsoleService, + private credentialService: CredentialService) { + } + + clear(): void { + this.messages.next([]); + this.buffered = []; + if (this.timeout != null) { + clearTimeout(this.timeout); + this.timeout = null; + } + } + + connect(collectionViewer: CollectionViewer): Observable { + return this.messages; + } + + disconnect(collectionViewer: CollectionViewer): void { + // do nothing + } + + + open(): void { + if (this.connecting.getValue() || this.socket) return; + this.clear(); + this.consoleService.log("Connecting to server."); + this.connecting.next(true); + this.socket = new WebSocket(this.domain + "/log/stream"); + this.socket.addEventListener<"open">("open", (event) => { + this.create("Websocket connection opened."); + this.socket.send(this.credentialService.createHeader()); + }); + this.socket.addEventListener<"message">("message", (message) => { + if (this.connecting.getValue()) this.connecting.next(false); + let logMessage: LogMessage = JSON.parse(message.data); + // send to console, if setup + if (ManageLogService.CONSOLE_OUTPUT) this.print(logMessage); + this.add(logMessage); + }); + this.socket.addEventListener<"close">("close", (close) => { + this.connecting.next(false); + this.create("Websocket connection closed."); + }) + } + + private create(message: string) { + this.add({ + id: 0, className: "LogService", methodName: "", + loggerName: "", level: "INFO", thread: 0, + time: new Date().getTime(), trace: null, + message: message + }); + } + + private add(logMessage: LogMessage): void { + this.buffered.push(logMessage); + if (this.timeout == null) { + this.timeout = setTimeout(()=>{ this.submit() }, 500); + } + } + + private submit(): void { + // create new array and announce + let end = this.messages.getValue().length; + var start = 0; + if (length >= ManageLogService.MAXIMUM_MESSAGES - this.buffered.length) + start = end - ManageLogService.MAXIMUM_MESSAGES + this.buffered.length; + var newMessages = this.messages.getValue().slice(start, end).concat(this.buffered); + this.buffered = []; + this.messages.next(newMessages); + this.timeout = null; + } + + private print(logMessage: LogMessage): void { + var text = "[" + logMessage.id + "@" + logMessage.time + " (TRD-" + logMessage.thread + ") " + logMessage.className + "." + logMessage.methodName + "] " + logMessage.message; + if (logMessage.trace != null) { + text += "\n" + logMessage.trace; + } + this.consoleService.log(text); + } + + close(): void { + if (this.socket != null) { + this.consoleService.log("Disconnecting from server."); + this.socket.close(); + this.connecting.next(false); + this.socket = null; + } + } + +} diff --git a/web/angular/src/app/services/manage-notice.service.ts b/web/angular/src/app/services/manage-notice.service.ts new file mode 100644 index 0000000..014e725 --- /dev/null +++ b/web/angular/src/app/services/manage-notice.service.ts @@ -0,0 +1,57 @@ +import { Injectable } from "@angular/core"; +import { AbstractPageService } from "../utils/pagination"; +import { NoticePage, Notice } from "../../api/models"; +import { ApiClientService } from "../../api"; +import { Observable, BehaviorSubject, Subject } from "rxjs"; +import { HttpResponse } from "@angular/common/http"; + +/** + * A service that handles notices for admins. + */ +@Injectable() +export class ManageNoticeService extends AbstractPageService { + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + protected loadPage(offset: number, size: number): Observable> { + return this.apiClientService.getNotices(offset, size); + } + + setNotice(notice: Notice): Observable { + if (this.loading.getValue()) return new BehaviorSubject(null); + this.loading.next(true); + var call: Observable>; + if (notice.id == 0) { + call = this.apiClientService.addNotice(notice); + } else { + call = this.apiClientService.setNotice(notice.id, notice); + } + let result = new Subject(); + call.subscribe((response)=>{ + this.loading.next(false); + result.next(response.body); + this.reload(); + }, (error)=> { + this.loading.next(false); + result.next(null); + this.reload(); + }); + return result; + } + + getNotice(id: number): Observable { + if (this.loading.getValue()) return new BehaviorSubject(null); + this.loading.next(true); + let result = new Subject(); + this.apiClientService.getNotice(id).subscribe((response)=>{ + result.next(response.body); + this.loading.next(false); + }, (error)=> { + result.next(null); + this.loading.next(false); + }); + return result; + } +} \ No newline at end of file diff --git a/web/angular/src/app/services/manage-user.service.ts b/web/angular/src/app/services/manage-user.service.ts new file mode 100644 index 0000000..145ac34 --- /dev/null +++ b/web/angular/src/app/services/manage-user.service.ts @@ -0,0 +1,64 @@ +import { Injectable } from "@angular/core"; +import { AbstractPageService } from "../utils/pagination"; +import { User, UserPage } from "../../api/models"; +import { ApiClientService } from "../../api"; +import { Observable, BehaviorSubject, Subject } from "rxjs"; +import { HttpResponse } from "@angular/common/http"; + +/** + * A service that handles users for admins. + */ +@Injectable() +export class ManageUserService extends AbstractPageService { + + /** + * A search term that might be set to filter the + * results. + */ + private term: string = null; + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + protected loadPage(offset: number, size: number): Observable> { + if (this.term != null) { + return this.apiClientService.searchUsers(offset, size, this.term); + } else { + return this.apiClientService.getUsers(offset, size); + } + } + + setTerm(term: string):boolean { + if (this.loading.getValue()) return false; + if (term != null && term.trim().length > 0) { + this.term = term.trim(); + } else { + this.term = null; + } + this.getPage(0, this.page.getValue().size); + return true; + } + + getTerm(): string { + return this.term; + } + + + setUser(user: User): Observable { + if (this.loading.getValue()) return new BehaviorSubject(false); + this.loading.next(true); + let result = new Subject(); + this.apiClientService.setUser(user.id, user).subscribe((response)=>{ + result.next(true); + this.loading.next(false); + this.reload(); + }, (error)=> { + result.next(false); + this.loading.next(false); + this.reload(); + }); + return result; + } + +} diff --git a/web/angular/src/app/services/notice.service.ts b/web/angular/src/app/services/notice.service.ts new file mode 100644 index 0000000..fa8642b --- /dev/null +++ b/web/angular/src/app/services/notice.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { DataSource } from '@angular/cdk/table'; +import { Notice, NoticePage } from '../../api/models'; +import { ApiClientService } from '../../api'; +import { UserService } from './user.service'; +import { CollectionViewer } from '@angular/cdk/collections'; +import { AbstractPageService } from '../utils/pagination'; +import { HttpResponse } from '@angular/common/http'; + +/** + * A service that handles notices. + */ +@Injectable() +export class NoticeService extends AbstractPageService { + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + protected loadPage(offset: number, size: number): Observable> { + return this.apiClientService.getActiveNotices(offset, size); + } + +} diff --git a/web/angular/src/app/services/place-visit.service.ts b/web/angular/src/app/services/place-visit.service.ts new file mode 100644 index 0000000..218020b --- /dev/null +++ b/web/angular/src/app/services/place-visit.service.ts @@ -0,0 +1,55 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { DataSource } from '@angular/cdk/table'; +import { Device, DevicePage, Privilege, PrivilegePage, Place, PlacePage, Visit, VisitPage } from '../../api/models'; +import { ApiClientService } from '../../api'; +import { UserService } from './user.service'; +import { CollectionViewer } from '@angular/cdk/collections'; +import { AbstractPageService } from '../utils/pagination'; +import { HttpResponse } from '@angular/common/http'; + +/** + * A service that handles visiss for a particular place. + */ +@Injectable() +export class PlaceVisitService extends AbstractPageService { + + readonly place = new BehaviorSubject(null); + private id: number; + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + setPlace(id:number) { + if (this.id == id || this.loading.getValue()) return; + this.id = null; + this.place.next(null); + this.reload(); + if (id != null) { + this.id = id; + this.loading.next(true); + this.apiClientService.getPlace(id).subscribe((result)=>{ + this.place.next(result.body); + this.loading.next(false); + this.reload(); + }, (error)=> { + this.id = null; + this.loading.next(false); + this.reload(); + }) + } + } + + getPage(offset: number, size: number) { + if (this.loading.getValue()) return; + if (this.id == null) this.page.next(this.emptyPage()); + else super.getPage(offset, size); + } + + protected loadPage(offset: number, size: number): Observable> { + return this.apiClientService.getPlaceVisits(this.id, offset, size); + } + +} diff --git a/web/angular/src/app/services/place.service.ts b/web/angular/src/app/services/place.service.ts new file mode 100644 index 0000000..08fd12e --- /dev/null +++ b/web/angular/src/app/services/place.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { DataSource } from '@angular/cdk/table'; +import { Device, DevicePage, Privilege, PrivilegePage, Place, PlacePage } from '../../api/models'; +import { ApiClientService } from '../../api'; +import { UserService } from './user.service'; +import { CollectionViewer } from '@angular/cdk/collections'; +import { AbstractPageService } from '../utils/pagination'; +import { HttpResponse } from '@angular/common/http'; + +/** + * A service that handles privileges. + */ +@Injectable() +export class PlaceService extends AbstractPageService { + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + protected loadPage(offset: number, size: number): Observable> { + return this.apiClientService.getCurrentUserPlaces(offset, size); + } + +} diff --git a/web/angular/src/app/services/privilege.service.ts b/web/angular/src/app/services/privilege.service.ts new file mode 100644 index 0000000..afec847 --- /dev/null +++ b/web/angular/src/app/services/privilege.service.ts @@ -0,0 +1,26 @@ +import { Injectable } from '@angular/core'; +import { Subject } from 'rxjs/Subject'; +import { Observable, BehaviorSubject } from 'rxjs'; +import { DataSource } from '@angular/cdk/table'; +import { Device, DevicePage, Privilege, PrivilegePage } from '../../api/models'; +import { ApiClientService } from '../../api'; +import { UserService } from './user.service'; +import { CollectionViewer } from '@angular/cdk/collections'; +import { AbstractPageService } from '../utils/pagination'; +import { HttpResponse } from '@angular/common/http'; + +/** + * A service that handles privileges. + */ +@Injectable() +export class PrivilegeService extends AbstractPageService { + + constructor(apiClientService:ApiClientService) { + super(apiClientService); + } + + protected loadPage(offset: number, size: number): Observable> { + return this.apiClientService.getCurrentUserPrivileges(offset, size); + } + +} diff --git a/web/angular/src/app/services/user.service.ts b/web/angular/src/app/services/user.service.ts new file mode 100644 index 0000000..4c50629 --- /dev/null +++ b/web/angular/src/app/services/user.service.ts @@ -0,0 +1,231 @@ +import { Injectable } from '@angular/core'; +import { ConsoleService } from './console.service'; +import { BehaviorSubject } from 'rxjs/BehaviorSubject'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Router } from '@angular/router'; +import { User } from "../../api/models/user.model"; +import { ApiClientService } from "../../api/index"; +import { UserPassword } from '../../api/models/userpassword.model'; +import { CredentialService } from './credential.service'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { Subject } from 'rxjs'; + +/** + * The possible states of the session. + */ +export enum UserState { + /** + * The user has not tried to login or + * got logged out, e.g. by a password + * change in some other part of the app. + */ + Unavailable, + /** + * The state is currently changing, + * e.g. due to an ongoing login or + * some change that affects the session. + */ + Changing, + /** + * The user has logged in and is not + * changing. + */ + Available, + +} + +/** + * The possible roles assigned by the service. + */ +export enum UserRole { + /** The role of a regular user. */ + User = "user", + /** The role of an admin user. */ + Admin = "admin" +} + +/** + * A service to manage the user's conceptual session state. The + * service can be in one of the SessionStates. While the user is + * Authorized, the service will maintain a reference to the + * user object from the server. If the user is unauthorized, + * a possible authorization failure is available. + */ +@Injectable() +export class UserService { + + /** + * The current user, available whilte the state is Authorized. + */ + public readonly user: BehaviorSubject = new BehaviorSubject(null); + /** + * The current authorization state. + */ + public readonly state: BehaviorSubject = new BehaviorSubject(UserState.Unavailable); + /** + * The last error response, if state is Unauthorized. + */ + public readonly error: Subject = new Subject(); + + /** + * An url to redirect to after login. + */ + public redirectUrl:string; + + /** + * Creates a new service. + * + * @param consoleService The console for logging. + * @param apiClientService The api client for remote requests. + * @param credentailService The credential service to manage the username and password. + */ + constructor(private consoleService: ConsoleService, + private apiClientService: ApiClientService, + private credentailService: CredentialService) { + if (credentailService.hasCredential()) { + this.login(); + } + } + + /** Returns an error handler. */ + createErrorHandler():(e:any) => void { + return (e:any):void => { + if (e instanceof HttpErrorResponse) { + if (e.status == HttpStatusCode.FORBIDDEN) { + this.credentailService.setCredential(this.credentailService.getLogin(), null); + } + this.error.next(e); + this.state.next(UserState.Unavailable); + } else { + this.consoleService.log("Unknown error in user service."); + console.dir(e); + } + this.state.next(UserState.Unavailable); + }; + } + + /** Returns the current login, if any. + * + * @returns The current login. + */ + getLogin():string { + return this.credentailService.getLogin(); + } + + /** + * Asks the service to update the credentials. Similar to + * request login and request logout, this method will only + * do something while there is no ongoing service interaction. + * + * @param login The login name. + * @param password The password. + * @returns True if the change has been applied. + */ + setUser(login: string, password: string): boolean { + if (this.state.getValue() == UserState.Changing) return false; + this.consoleService.log("Setting user credentials."); + this.credentailService.setCredential(login, password); + this.state.next(UserState.Unavailable); + this.user.next(null); + return true; + } + + /** + * Asks the service to perform a login. If there is no + * on-going server interacton, the service will try to + * retrieve the current user's account which validates + * the credential as a side-effect. If there is an + * ongoing interaction, the call to this method will + * be ignored. + * + * @returns True if the login request has been issued. + */ + login(): boolean { + if (this.state.getValue() == UserState.Changing) return false; + this.consoleService.log("Issuing login request."); + this.state.next(UserState.Changing); + this.user.next(null); + this.apiClientService.getCurrentUser().subscribe(result => { + this.user.next(result.body); + this.state.next(UserState.Available); + }, this.createErrorHandler()); + return true; + } + + /** + * Requests a logout, that will be executed unless the + * service is currently interacting with the server. + * + * @returns True if the change has been applied. + */ + logout(): boolean { + return this.setUser(null, null); + } + + /** + * Requests a password change. + * + * @param oldPassword The old password. + * @param newPassword The new password. + * @returns True if the change has been requested. + */ + changePassword(oldPassword: string, newPassword: string): boolean { + if (!this.credentailService.hasPassword(oldPassword)) return false; + if (this.state.getValue() == UserState.Changing) return false; + this.state.next(UserState.Changing); + this.user.next(null); + this.apiClientService.setCurrentPassword({ password: newPassword }).subscribe(result => { + this.credentailService.setCredential(this.credentailService.getLogin(), newPassword); + this.user.next(result.body); + this.state.next(UserState.Available); + }, this.createErrorHandler()); + return true; + + } + + /** + * Requests a change to the user. + * + * @param user The user to change. + */ + changeUser(user: User): boolean { + if (this.state.getValue() == UserState.Changing) return false; + this.state.next(UserState.Changing); + this.user.next(null); + this.apiClientService.setCurrentUser(user).subscribe(result => { + this.user.next(result.body); + this.state.next(UserState.Available); + }, error => { + if (error instanceof HttpErrorResponse) { + if (error.status == HttpStatusCode.CONFLICT) { + this.user.next(error.error); + this.error.next(error); + this.state.next(UserState.Available) + } else { + this.createErrorHandler()(error); + } + } else { + this.createErrorHandler()(error); + } + }); + return true; + } + + /** + * If the serivce's user is available, this method will + * return whether the specified role is assigned to the + * user. If the user is not available or changing, the + * result will always be false. + * + * @param role The role to test. + * @returns True if the user is available and the role + * is assigned. + */ + hasRole(role: UserRole): boolean { + if (this.state.getValue() != UserState.Available) return false; + for (let r of this.user.getValue().roles) { + if (role === r) return true; + } + return false; + } +} diff --git a/web/angular/src/app/statistic.service.ts b/web/angular/src/app/statistic.service.ts deleted file mode 100644 index 13c01dc..0000000 --- a/web/angular/src/app/statistic.service.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Injectable } from '@angular/core'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import {Device} from "../api/models/device.model"; - -@Injectable() -export class StatisticService { - selectedDate = new BehaviorSubject(null); - selectedDevice = new BehaviorSubject(null); - - constructor() {} - - setDate(newDate:Date){ - this.selectedDate.next(newDate); - } - - setDevice(newDevice:Device){ - this.selectedDevice.next(newDevice); - } -} diff --git a/web/angular/src/app/toast.service.ts b/web/angular/src/app/toast.service.ts deleted file mode 100644 index 4aa4fc4..0000000 --- a/web/angular/src/app/toast.service.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Injectable } from '@angular/core'; -import {ToastrService} from "ngx-toastr"; - -@Injectable() -export class ToastService { - - constructor(private toastr: ToastrService) {} - - // success toast - showSuccess(title:string, message:string) { - this.toastr.success(message, title,{ - progressBar: true, - closeButton: true - }); - } - // error toast - showError(title:string, message:string){ - this.toastr.error(message, title, { - progressBar: true, - closeButton: true - }); - } - // warning toast - showWarning(title:string, message:string){ - this.toastr.warning(message, title, { - progressBar: true, - closeButton: true - }); - } -} diff --git a/web/angular/src/app/utils/formcodes.ts b/web/angular/src/app/utils/formcodes.ts new file mode 100644 index 0000000..c17c40d --- /dev/null +++ b/web/angular/src/app/utils/formcodes.ts @@ -0,0 +1,34 @@ +/** + * The error codes for standard validations. + */ +export enum FormErrorCode { + NONE = 0, + REQUIRED = 1, + PATTERN = 2, + MINLENGTH = 3, + MAXLENGTH = 4 +} + +/** + * A class that can act as base class for + * components that require error encoding. + */ +export class FormErrorEncoder { + + public readonly FormErrorCode = FormErrorCode; + + public encode(errors: any):number { + if (errors.required) { + return FormErrorCode.REQUIRED; + } else if (errors.pattern) { + return FormErrorCode.PATTERN; + } else if (errors.minlength) { + return FormErrorCode.MINLENGTH; + } else if (errors.maxlength) { + return FormErrorCode.MAXLENGTH; + } else { + return FormErrorCode.NONE; + } + } +} + diff --git a/web/angular/src/app/utils/httpcodes.ts b/web/angular/src/app/utils/httpcodes.ts new file mode 100644 index 0000000..5aabf81 --- /dev/null +++ b/web/angular/src/app/utils/httpcodes.ts @@ -0,0 +1,48 @@ +/** + * Various http status codes to avoid using + * numbers throughout the code. + */ +export enum HttpStatusCode { + CONTINUE = 100, + SWITCHING_PROTOCOLS = 101, + OK = 200, + CREATED = 201, + ACCEPTED = 202, + NON_AUTHORITATIVE_INFORMATION = 203, + NO_CONTENT = 204, + RESET_CONTENT = 205, + PARTIAL_CONTENT = 206, + MULTIPLE_CHOICES = 300, + MOVED_PERMANENTLY = 301, + FOUND = 302, + SEE_OTHER = 303, + NOT_MODIFIED = 304, + USE_PROXY = 305, + TEMPORARY_REDIRECT = 307, + BAD_REQUEST = 400, + UNAUTHORIZED = 401, + PAYMENT_REQUIRED = 402, + FORBIDDEN = 403, + NOT_FOUND = 404, + METHOD_NOT_ALLOWED = 405, + NOT_ACCEPTABLE = 406, + PROXY_AUTHENTICATION_REQUIRED = 407, + REQUEST_TIMEOUT = 408, + CONFLICT = 409, + GONE = 410, + LENGTH_REQUIRED = 411, + PRECONDITION_FAILED = 412, + REQUEST_ENTITY_TOO_LARGE = 413, + REQUEST_URI_TOO_LONG = 414, + UNSUPPORTED_MEDIA_TYPE = 415, + REQUESTED_RANGE_NOT_SATISFIABLE = 416, + EXPECTATION_FAILED = 417, + UNPROCESSABLE_ENTITY = 422, + TOO_MANY_REQUESTS = 429, + INTERNAL_SERVER_ERROR = 500, + NOT_IMPLEMENTED = 501, + BAD_GATEWAY = 502, + SERVICE_UNAVAILABLE = 503, + GATEWAY_TIMEOUT = 504, + HTTP_VERSION_NOT_SUPPORTED = 505, + } \ No newline at end of file diff --git a/web/angular/src/app/utils/languages.ts b/web/angular/src/app/utils/languages.ts new file mode 100644 index 0000000..a333281 --- /dev/null +++ b/web/angular/src/app/utils/languages.ts @@ -0,0 +1,23 @@ +/** An interface to model a language. */ +export interface Language { + /** The 2 letter code. */ + readonly value: string; + /** The title. */ + readonly title: string; + /** The reference to a flag icon. */ + readonly flag: string; +} + +/** Utility class to access all languages. */ +export class Languages { + + public static getLanguages():Language[] { + return [ + {value:"de", title:"Deutsch", flag:"assets/flags/de.svg" }, + {value:"en", title:"English", flag:"assets/flags/en.svg"}, + {value:"fr", title:"Französisch", flag:"assets/flags/fr.svg"}, + {value:"it", title:"Italienisch", flag:"assets/flags/it.svg"}, + {value:"es", title:"Spanisch", flag:"assets/flags/es.svg"}]; + } + +} diff --git a/web/angular/src/app/utils/pagination.ts b/web/angular/src/app/utils/pagination.ts new file mode 100644 index 0000000..8adad10 --- /dev/null +++ b/web/angular/src/app/utils/pagination.ts @@ -0,0 +1,88 @@ +import { DataSource } from "@angular/cdk/table"; +import { CollectionViewer } from "@angular/cdk/collections"; +import { Observable, BehaviorSubject, Subscription } from "rxjs"; +import { ApiClientService } from "../../api"; +import { HttpResponse } from '@angular/common/http'; +import { MatPaginator } from "@angular/material"; + +export interface Page { + offset: number; + size: number; + total: number; + elements:E[]; +} + +export class PaginationHandler> { + + private pageSubscription: Subscription; + private paginatorSubscription: Subscription; + + constructor(private paginator: MatPaginator, private service: AbstractPageService) { + this.pageSubscription = this.service.page.subscribe((page)=>{ + this.paginator.length = page.total; + this.paginator.pageSize = page.size; + this.paginator.pageIndex = page.offset / page.size; + }); + this.paginatorSubscription = this.paginator.page.subscribe((page)=>{ + let offset = page.pageIndex * page.pageSize; + let size = page.pageSize; + this.service.getPage(offset, size); + }); + } + + destroy() { + this.pageSubscription.unsubscribe(); + this.paginatorSubscription.unsubscribe(); + } + + +} + +export abstract class AbstractPageService> extends DataSource { + + private elements = new BehaviorSubject([]); + readonly page = new BehaviorSubject

    ({ offset: 0, size: 20, total: 0, elements: []} as P); + private subscriptions = 0; + readonly loading = new BehaviorSubject(false); + + constructor(protected apiClientService:ApiClientService) { + super(); + this.page.subscribe((page)=>{ + this.elements.next(page.elements); + }) + } + + + getPage(offset: number, size: number) { + if (this.loading.getValue()) return; + this.loading.next(true); + this.loadPage(offset, size).subscribe((result)=>{ + this.loading.next(false); + let page = result.body; + this.page.next(page); + }, (error) => { + this.loading.next(false); + this.page.next(this.emptyPage()); + }); + } + + protected abstract loadPage(offset: number, size: number): Observable>; + + reload() { + this.getPage(this.page.getValue().offset, this.page.getValue().size); + } + + connect(collectionViewer: CollectionViewer): Observable { + this.subscriptions += 1; + return this.elements; + } + + disconnect(collectionViewer: CollectionViewer): void { + this.subscriptions -= 1; + } + + protected emptyPage(): P { + return { offset: 0, size: this.page.getValue().size, total: 0, elements: []} as P; + } + +} diff --git a/web/angular/src/app/utils/snackbars.ts b/web/angular/src/app/utils/snackbars.ts new file mode 100644 index 0000000..c386bef --- /dev/null +++ b/web/angular/src/app/utils/snackbars.ts @@ -0,0 +1,30 @@ +import { MatSnackBar } from '@angular/material'; + +export class Snackbars { + + public static readonly DURATION_SHORT = 5000; + + public static readonly DURATION_LONG = 10000; + + /** + * Shows an error message that disappears after a short period of time. + * + * @param snackbar The snackbar service. + * @param message The message. + */ + public static showError(snackbar: MatSnackBar, message: string, duration?:number) { + if (duration == null) snackbar.open(message, null, { extraClasses: ["snackbar-accent"], duration: Snackbars.DURATION_SHORT}); + else snackbar.open(message, null, { extraClasses: ["snackbar-accent"], duration: duration}); + } + + /** + * Shows a permanent information message that does not disapper automatically. + * + * @param snackbar The snackbar service. + * @param message The message. + */ + public static showMessage(snackbar: MatSnackBar, message: string, duration?:number) { + if (duration != null)snackbar.open(message, null, { extraClasses: ["snackbar-primary"], duration: duration}); + else snackbar.open(message, null, { extraClasses: ["snackbar-primary"]}); + } +} \ No newline at end of file diff --git a/web/angular/src/app/views/activate.component.html b/web/angular/src/app/views/activate.component.html new file mode 100644 index 0000000..60f42c9 --- /dev/null +++ b/web/angular/src/app/views/activate.component.html @@ -0,0 +1,11 @@ +

    + + + Aktivierung + Die Aktivierung wird abgeschlossen. + + + + + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/activate.component.ts b/web/angular/src/app/views/activate.component.ts new file mode 100644 index 0000000..45dfabf --- /dev/null +++ b/web/angular/src/app/views/activate.component.ts @@ -0,0 +1,54 @@ +import { Component, OnInit } from "@angular/core"; +import { ApiClientService } from "../../api"; +import { MatDialog } from "@angular/material"; +import { ActivatedRoute, Router } from "@angular/router"; +import { MessageDialogComponent } from "../widgets/message-dialog.component"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; + +@Component({ + selector: 'activate', + templateUrl: './activate.component.html', + host: { class:'match-parent' }, + }) + export class ActivateComponent implements OnInit { + + showMessage: boolean = true; + + constructor(private apiClientService: ApiClientService, private dialog: MatDialog, private router: Router, private route: ActivatedRoute) { } + + ngOnInit(): void { + let token = this.route.snapshot.paramMap.get('token'); + if (!token) { + this.router.navigate(["/"]); + } else { + this.apiClientService.verifyUserEmail(token).subscribe((result)=>{ + this.showMessage = false; + MessageDialogComponent.open(this.dialog, { title:"Aktivierung erfolgreich", message:"Die Emailadresse wurde für Dein Konto aktiviert. Falls das die Emailadresse mit einem neuen Konto verbunden wurde, kannst du das Konto ab sofort nutzen. Falls du eine weitere Emailadresse für dein Konto freigeschaltet hast, kannst Du sie jetzt in den Kontoeinstellungen als Kontaktemailadresse setzen.", button:"Weiter"}).subscribe((close)=>{ + this.router.navigate(["/"]); + }) + }, (error)=> { + this.showMessage = false; + var message: string = "Die Aktivierung konnte nicht abeschlossen werden."; + if (error instanceof HttpErrorResponse) { + switch (error.status) { + case HttpStatusCode.BAD_REQUEST: + message = "Der Aktivierungslink ist ungültig. Falls Du ihn aus deinem Emailprogramm in die Adressleiste Deines Browsers kopiert hast, stell sicher, dass der Link vollständig ist."; + break; + case HttpStatusCode.FORBIDDEN: + message = "Der Aktivierungslink ist nicht mehr gültig. Entweder wurder er schon benutzt oder er ist abgelaufen." + break; + default: + message = "Die Aktivierung konnte nicht abgeschlossen werden (" + error.status + "). Hast Du gerade kein Netz?"; + break; + } + } + MessageDialogComponent.open(this.dialog, { title:"Aktivierung fehlgeschlagen", message:message, button:"Verstanden" }).subscribe((close)=>{ + this.router.navigate(["/"]); + }) + }) + } + } + + } + \ No newline at end of file diff --git a/web/angular/src/app/views/change.component.html b/web/angular/src/app/views/change.component.html new file mode 100644 index 0000000..fdc6dcc --- /dev/null +++ b/web/angular/src/app/views/change.component.html @@ -0,0 +1,24 @@ +
    + + + Passwort ändern + Gib einfach Dein neues Passwort ein. + + +
    + +
    +
    + + + + + + + + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/change.component.ts b/web/angular/src/app/views/change.component.ts new file mode 100644 index 0000000..987e8eb --- /dev/null +++ b/web/angular/src/app/views/change.component.ts @@ -0,0 +1,85 @@ +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router, ActivatedRoute } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; +import { LoginFieldComponent } from '../widgets/login-field.component'; +import { PasswordFieldComponent } from '../widgets/password-field.component'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { MatSnackBar, MatDialog } from '@angular/material'; +import { NgForm } from '@angular/forms'; +import { Snackbars } from '../utils/snackbars'; +import { ApiClientService } from '../../api'; +import { HttpErrorResponse } from '@angular/common/http'; +import { MessageDialogComponent } from '../widgets/message-dialog.component'; + +@Component({ + selector: 'reset', + templateUrl: './change.component.html', + host: { class: 'match-parent' } +}) +export class ChangeComponent implements OnInit, OnDestroy { + + @ViewChild(PasswordFieldComponent) passwordField: PasswordFieldComponent; + @ViewChild("changeForm") resetForm: NgForm; + + readonly idle = new BehaviorSubject(true); + + private changeSubscription: Subscription; + private token: string; + + constructor( + private apiClientService: ApiClientService, + private snackbar: MatSnackBar, + private dialog: MatDialog, + private router: Router, + private route: ActivatedRoute + ) { } + + ngOnInit() { + this.token = this.route.snapshot.paramMap.get("token"); + } + + onChange(): void { + this.snackbar.dismiss(); + if (!this.idle || !this.resetForm.valid) return; + this.setIdle(false); + this.changeSubscription = this.apiClientService.resetUserPassword(this.token, { password: this.passwordField.password }).subscribe((result) => { + this.setIdle(true); + MessageDialogComponent.open(this.dialog, { title: "Änderung erfolgreich", message: "Dein Passwort wurde erfolgreich geändert. Du musst ab sofort immer Dein neues Passwort zur Anmeldung verwenden.", button: "Verstanden" }).subscribe((close) => { + this.router.navigate(["/"]); + }); + }, (error) => { + this.setIdle(true); + var message: string = "Die Passwortänderung konnte nicht abeschlossen werden."; + if (error instanceof HttpErrorResponse) { + switch (error.status) { + case HttpStatusCode.BAD_REQUEST: + message = "Der Link zum Zurücksetzen ist ungültig. Falls Du ihn aus deinem Emailprogramm in die Adressleiste Deines Browsers kopiert hast, stell sicher, dass der Link vollständig ist."; + break; + case HttpStatusCode.FORBIDDEN: + message = "Der Link zum Zurücksetzen ist nicht mehr gültig. Entweder wurder er schon benutzt oder er ist abgelaufen." + break; + default: + message = "Die Passwortänderung konnte nicht abgeschlossen werden (" + error.status + "). Hast Du gerade kein Netz?"; + break; + } + } + MessageDialogComponent.open(this.dialog, { title: "Änderung fehlgeschlagen", message: message, button: "Verstanden" }).subscribe((close) => { + this.router.navigate(["/"]); + }); + }); + } + + private setIdle(value: boolean) { + this.passwordField.disabled = !value; + this.idle.next(value); + } + + ngOnDestroy(): void { + this.snackbar.dismiss(); + if (this.changeSubscription) this.changeSubscription.unsubscribe(); + } + + +} diff --git a/web/angular/src/app/views/components/admin-statistic/admin-statistic.component.html b/web/angular/src/app/views/components/admin-statistic/admin-statistic.component.html deleted file mode 100644 index 0c5e269..0000000 --- a/web/angular/src/app/views/components/admin-statistic/admin-statistic.component.html +++ /dev/null @@ -1 +0,0 @@ -
    Admin Statistic!
    diff --git a/web/angular/src/app/views/components/admin-statistic/admin-statistic.component.ts b/web/angular/src/app/views/components/admin-statistic/admin-statistic.component.ts deleted file mode 100644 index 060b64d..0000000 --- a/web/angular/src/app/views/components/admin-statistic/admin-statistic.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector:'app-admin-statistic', - templateUrl: './admin-statistic.component.html' -}) -export class AdminStatisticComponent { - - constructor( ) { } - -} diff --git a/web/angular/src/app/views/components/admin/admin.component.html b/web/angular/src/app/views/components/admin/admin.component.html deleted file mode 100644 index b7d461a..0000000 --- a/web/angular/src/app/views/components/admin/admin.component.html +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/web/angular/src/app/views/components/admin/admin.component.ts b/web/angular/src/app/views/components/admin/admin.component.ts deleted file mode 100644 index 06c9e90..0000000 --- a/web/angular/src/app/views/components/admin/admin.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - templateUrl: 'admin.component.html' -}) -export class AdminComponent { - - constructor( ) { } - -} diff --git a/web/angular/src/app/views/components/homepage/homepage.component.html b/web/angular/src/app/views/components/homepage/homepage.component.html deleted file mode 100755 index e4bfccf..0000000 --- a/web/angular/src/app/views/components/homepage/homepage.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
    - Hello World! -
    diff --git a/web/angular/src/app/views/components/homepage/homepage.component.ts b/web/angular/src/app/views/components/homepage/homepage.component.ts deleted file mode 100755 index 6b4204b..0000000 --- a/web/angular/src/app/views/components/homepage/homepage.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - templateUrl: 'homepage.component.html' -}) -export class HomepageComponent { - - constructor( ) { } - -} diff --git a/web/angular/src/app/views/components/map/map.component.html b/web/angular/src/app/views/components/map/map.component.html deleted file mode 100755 index 438d0b8..0000000 --- a/web/angular/src/app/views/components/map/map.component.html +++ /dev/null @@ -1,32 +0,0 @@ -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - diff --git a/web/angular/src/app/views/components/map/map.component.scss b/web/angular/src/app/views/components/map/map.component.scss deleted file mode 100755 index 2da3ff2..0000000 --- a/web/angular/src/app/views/components/map/map.component.scss +++ /dev/null @@ -1,10 +0,0 @@ -#map { - height: calc(100vh - 100px); - width: 100%; - border: 1px solid black; -} - -.map-addShare-button { - height: 100px; - width: 100%; -} diff --git a/web/angular/src/app/views/components/map/map.component.spec.ts b/web/angular/src/app/views/components/map/map.component.spec.ts deleted file mode 100755 index 9c622ec..0000000 --- a/web/angular/src/app/views/components/map/map.component.spec.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { MapComponent } from './map.component'; -import { MapInfoComponent } from '../map-info/map-info.component'; - -import { ActivatedRoute } from '@angular/router'; -import { Observable } from 'rxjs/Observable'; -import { of } from 'rxjs/observable/of'; - -describe('MapComponent', () => { - let component: MapComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [ - - ], - declarations: [ - MapComponent, - MapInfoComponent, - ActivatedRoute - ], - providers: [ - ActivatedRoute - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(MapComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/web/angular/src/app/views/components/map/map.component.ts b/web/angular/src/app/views/components/map/map.component.ts deleted file mode 100755 index b0804ba..0000000 --- a/web/angular/src/app/views/components/map/map.component.ts +++ /dev/null @@ -1,203 +0,0 @@ -import { Component, OnInit, ViewEncapsulation, ViewChild } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Location as BrowserLocation } from '@angular/common'; - -import * as L from 'leaflet'; - -import { setInterval, clearInterval } from 'timers'; -import { LocationService } from '../../../location.service'; -import { ConsoleService } from '../../../console.service'; -import { AuthService, AuthState } from '../../../auth.service'; -import { PrivilegesService } from '../../../privileges.service'; -import { Location } from '../../../../api/models/location.model'; - -import { error } from 'util'; -import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks'; -import { ToastService } from '../../../toast.service'; -import { Marker } from 'leaflet'; - - -@Component({ - selector: 'app-map', - templateUrl: './map.component.html', - styleUrls: ['./map.component.scss'], - encapsulation: ViewEncapsulation.None -}) -export class MapComponent implements OnInit, OnDestroy { - AuthState = AuthState; - - defaultLocation: L.LatLng = new L.LatLng(51.4556, 7.0116); - defaultZoom = 13; - - currentLocation: L.LatLng; - currentZoom: Number; - - zoomPanOptions: L.ZoomPanOptions = { - animate: true, - duration: 2, - easeLinearity: 0.6, - noMoveStart: true - }; - - currentShare: string; - map: L.Map; - tileLayer: L.TileLayer; - - defaultIcon = new L.Icon({ - iconUrl: require('../../../../assets/img/marker_normal.png'), - iconSize: [50, 64], // size of the icon - iconAnchor: [25, 63], // point of the icon which will correspond to marker's location - popupAnchor: [0, -50] - }); - - marker: L.Marker; - markerShown: boolean = true; - - refreshInterval; - firstPositionUpdate = true; - - @ViewChild('shareNonExistentModal') shareNonExistentModal; - @ViewChild('coordinateNullModal') coordinateNullModal; - - constructor( - private route: ActivatedRoute, - private locationService: LocationService, - private consoleService: ConsoleService, - private privilegesService: PrivilegesService, - private toastService: ToastService, - private authService: AuthService, - private browser_location: BrowserLocation, - private router: Router - ) { } - - ngOnInit() { - // Fetch share id from url - this.currentShare = this.route.snapshot.paramMap.get('id'); - - this.map = new L.Map('map'); - this.map.setView(this.defaultLocation, this.defaultZoom); - - this.tileLayer = new L.TileLayer('https://cloud.locoslab.com/carta/restful-services/tile/{z}/{x}/{y}.png', { - attribution: 'Maptology', - maxZoom: 18 - }).addTo(this.map); - - // Initialize marker - this.marker = new L.Marker(this.defaultLocation, { - icon: this.defaultIcon - }).addTo(this.map); - // this.setMapMarker(this.defaultLocation); - - // If there is a given shareId in the URL, fetch the location from the API and - // start to update every x seconds - if (this.currentShare) { - - // If there are errors display a modal dialog - this.getError().subscribe(e => { - if (e !== null) { - setTimeout(() => this.shareNonExistentModal.show()); - clearInterval(this.refreshInterval); - } - }); - - // Subscribe to location updates - this.getLocation().subscribe(l => { - if (l !== null) { - if (l.coordinate !== null) { - this.coordinateNullModal.hide(); - this.showMarker(); - - if (this.firstPositionUpdate) { - const latLang = new L.LatLng(l.coordinate.latitude, l.coordinate.longitude); - this.map.setView(latLang, this.map.getZoom()); - this.setMapMarker(latLang); - this.firstPositionUpdate = false; - } else { - this.setMapPosition(l, this.map.getZoom()); - } - } else { - this.coordinateNullModal.show(); - this.hideMarker(); - } - } - }); - - // Query the API every 2 seconds - this.refreshInterval = setInterval(() => { - this.locationService.getLocation(this.currentShare); - }, 2000); - } - } - - showMarker() { - if (!this.markerShown) { - this.marker.addTo(this.map); - this.markerShown = true; - } - } - - hideMarker() { - if (this.markerShown) { - this.marker.removeFrom(this.map); - this.markerShown = false; - } - } - - ngOnDestroy() { - if (this.refreshInterval) { - clearInterval(this.refreshInterval); - } - this.locationService.resetLocation(); - } - - setMapPosition(location: Location, zoom: number) { - const latLang = new L.LatLng(location.coordinate.latitude, location.coordinate.longitude); - this.map.panTo(latLang, this.zoomPanOptions); - this.setMapMarker(latLang); - } - - setMapMarker(latLang: L.LatLng) { - this.marker.bindPopup(`${ this.currentShare }
    Latitude: ${latLang.lat}
    Longitude: ${latLang.lng}`); - this.marker.setLatLng(latLang); - } - - setMapCircle(latLang: L.LatLng, color: string = 'red', opacity: number = 0.5, radius: number) { - const circle = new L.Circle(latLang, { - color: color, - fillColor: color, - fillOpacity: opacity, - radius: radius - }).addTo(this.map); - } - - onModalOkClick() { - this.shareNonExistentModal.hide(); - this.browser_location.back(); - } - - onSidebarToggle() { - alert('toggle'); - } - - getLocation(): BehaviorSubject { - return this.locationService.location; - } - - getError(): BehaviorSubject { - return this.locationService.error; - } - - isUserLoggedIn(): boolean { - if (this.authService.state.getValue() === AuthState.Authorized) { - return true; - } else { - return false; - } - } - - onAddShareToAccClick() { - this.privilegesService.shareTokenToAddToPrivileges = this.currentShare; - this.router.navigate(['/pages/login']); - } -} diff --git a/web/angular/src/app/views/components/place/place.component.html b/web/angular/src/app/views/components/place/place.component.html deleted file mode 100644 index 1e10536..0000000 --- a/web/angular/src/app/views/components/place/place.component.html +++ /dev/null @@ -1,34 +0,0 @@ -
    -
    -
    - - -
    -
    Besuchte Orte
    -
    -
    -
    - Besuchte Orte am {{datepickerModel | date:'fullDate'}} -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/components/place/place.component.scss b/web/angular/src/app/views/components/place/place.component.scss deleted file mode 100644 index 7378794..0000000 --- a/web/angular/src/app/views/components/place/place.component.scss +++ /dev/null @@ -1,5 +0,0 @@ -#map { - height: 50vh; - width: 100%; - border: 1px solid black; -} diff --git a/web/angular/src/app/views/components/place/place.component.ts b/web/angular/src/app/views/components/place/place.component.ts deleted file mode 100644 index f1369b5..0000000 --- a/web/angular/src/app/views/components/place/place.component.ts +++ /dev/null @@ -1,185 +0,0 @@ -import {Component, OnInit} from "@angular/core"; -import {ConsoleService} from "../../../console.service"; -import { registerLocaleData } from '@angular/common'; -import localeDe from '@angular/common/locales/de'; -import * as L from 'leaflet'; -import 'leaflet-easybutton'; -import { BsDatepickerConfig , BsLocaleService} from 'ngx-bootstrap/datepicker'; -import {ApiClientService} from "../../../../api/index"; -import {StatisticService} from "../../../statistic.service"; -import {Device} from "../../../../api/models/device.model"; -import {Visit} from "../../../../api/models/visit.model"; -import {Place} from "../../../../api/models/place.model"; -import {Subscription, Observable} from "rxjs"; -import {AuthService} from "../../../auth.service"; -import {User} from "../../../../api/models/user.model"; -import {ToastService} from "../../../toast.service"; -import {HelperService} from "../../../Utils/helper.service"; -import {HttpResponse} from "@angular/common/http"; - - -@Component({ - selector: 'app-place', - templateUrl: './place.component.html', - styleUrls: ['./place.component.scss'] -}) -export class PlaceComponent implements OnInit { - visits:Visit[] = []; - places:Place[] = []; - currentUser:User; - - //date attributes - datepickerModel: Date; - minDate: Date; - maxDate: Date; - colorTheme = 'theme-orange'; - bsConfig: Partial; - locale = 'de'; - - //map attributes - private map: L.Map; - private tileLayer: L.TileLayer; - private defaultIcon = new L.Icon({ - iconUrl: require('../../../../assets/img/marker_place.png'), - iconAnchor: [25, 63], // point of the icon which will correspond to marker's location - popupAnchor: [0, -50] // point from which the popup should open relative to the iconAnchor - }); - private markersLayer:any; - - selectedDevice:Device; - errorMessage: string = ''; - mySubscription:Subscription; - - constructor( - private authService: AuthService, - private consoleService: ConsoleService, - private toastService: ToastService, - private _localeService: BsLocaleService, - private apiClientService:ApiClientService, - private statisticService: StatisticService, - private helperService:HelperService - ) { - registerLocaleData(localeDe, 'de'); // set german calendar - this._localeService.use('de'); - } - - ngOnInit() { - // calendar config - this.bsConfig = Object.assign({}, { containerClass: this.colorTheme }); - this.datepickerModel = new Date(); // datepicker default value => current Date - this.minDate = new Date(); - this.maxDate = new Date(); // user can't select dates in future - this.getCurrentUser(); // minDate => day of users registration - - // Map config - this.map = new L.Map('map', { - 'center': [0, 0], - 'zoom': 0 - }); - this.tileLayer = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: 'Map data © OpenStreetMap contributors', - maxZoom: 18 - }).addTo(this.map); - this.markersLayer = new L.FeatureGroup().addTo(this.map); - - this.mySubscription=this.statisticService.selectedDevice.subscribe(device => { - this.resetData(); - this.selectedDevice = device; - if(device){ - this.getVisits(); - } - }); - } - - setMarkersForPlaces(){ - for(let place of this.places){ - let marker:L.Marker; - marker = new L.Marker(new L.LatLng(place.coordinate.latitude, place.coordinate.longitude), - { - icon: this.defaultIcon - }).addTo(this.markersLayer).bindPopup("
    "+place.nickname+"
    "+place.address).openPopup(); - } - this.map.fitBounds(this.markersLayer.getBounds()); - } - - getVisits(){ - var startDate = this.datepickerModel; - startDate.setHours(0); - startDate.setMinutes(0); - var duration = (24*60*60*1000); // duration = milliseconds of one day - this.apiClientService.getDeviceVisits(this.selectedDevice.id, - startDate.getTime(), duration).subscribe(result => { - this.visits = this.groupVisitsOnPlaceId(result.body); - if(this.visits.length == 0){ - this.toastService.showWarning("Warnung","Keine Standortdaten für den ausgewählten Tag/Gerät gefunden"); - }else{ - this.getPlaces(); - } - }, error=>{ - this.consoleService.log("Error during get visits."); - this.helperService.handleError(error); - }); - } - - getPlaces(){ - Observable.forkJoin( - this.visits.map(visit => this.apiClientService.getPlace(visit.place)) - ).subscribe(responseList => { - for(let response of responseList){ - this.places.push(response.body); - } - this.setMarkersForPlaces(); - }, error => { - this.consoleService.log("Error during get places."); - this.helperService.handleError(error); - }); - } - - groupVisitsOnPlaceId(visits:Visit[]):Visit[]{ - let contain = false; - let result:Visit[] = []; - visits.forEach(visit => { - for(let resultVisit of result){ - if(resultVisit.place == visit.place){ - contain = true; - break; - } - } - if(!contain){ - result.push(visit); - } - contain = false; - }); - return result; - } - - resetData(){ - this.places = []; - this.visits = []; - this.markersLayer.clearLayers(); - this.map.setZoom(0); - } - - // user methods - - getCurrentUser(){ - this.apiClientService.getCurrentUser().subscribe(result=> { - this.currentUser = result.body; - this.minDate = new Date(this.currentUser.creationTime) - }, error=>{ - this.consoleService.log("Error during get current user."); - this.helperService.handleError(error); - }); - } - - // date methods - // day changed - onDateChange() { - this.resetData(); - setTimeout(()=>{ - if(this.selectedDevice) { - this.getVisits(); - } - }, 100); - } -} diff --git a/web/angular/src/app/views/components/profile/profile.component.html b/web/angular/src/app/views/components/profile/profile.component.html deleted file mode 100755 index 6764b23..0000000 --- a/web/angular/src/app/views/components/profile/profile.component.html +++ /dev/null @@ -1,114 +0,0 @@ -
    - -
    -
    -

    - Profildaten -

    -

    - Angemeldet als: {{user.login}} -

    -

    - Name: -

    -

    - Email-Adresse: {{getCorrespondenceMail().address}} -

    -
    - -
    -
    -
    - - -
    -
    -

    Passwort ändern

    - - - - - - - - - - - - - -
    altes Passwort:
    neues Passwort:
    neues Passwort:
    - -
    - -
    - -
    -
    - - -
    -
    -

    - Email-Adresse ändern -

    - -
    -
    -
    -
    -
    -
    -
    - {{email.address}} -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    - - - - -
    -
    -
    - -
    - -
    -
    - - -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/components/profile/profile.component.ts b/web/angular/src/app/views/components/profile/profile.component.ts deleted file mode 100755 index f9e0ff0..0000000 --- a/web/angular/src/app/views/components/profile/profile.component.ts +++ /dev/null @@ -1,140 +0,0 @@ -import { Component, Input, ViewChild } from '@angular/core'; -import { AuthService } from '../../../auth.service'; -import { User } from '../../../../api/models/user.model'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { Email } from '../../../../api/models/email.model'; -import { ConsoleService } from '../../../console.service'; -import { ApiClientService } from '../../../../api'; -import {ToastService} from "../../../toast.service"; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - templateUrl: 'profile.component.html' -}) -export class ProfileComponent { - - oldPassword: string; - newPassword1: string; - newPassword2: string; - - name: string = ""; - - newEmail: string = ""; - - nameChanged: boolean = false; - emailChanged: boolean = false; - errorMessage: string = ''; - - newCorrespondenceMail: Email; - - constructor(private authService: AuthService, - private toastService: ToastService, - private consoleService: ConsoleService, - private apiClientService: ApiClientService, - private helperService:HelperService) { - this.name=this.getUser().getValue().name; - } - - - getUser(): BehaviorSubject { - return this.authService.user; - } - - onNameChanged() { - this.nameChanged=true; - } - - getCorrespondenceMail(): Email { - let emails: Email[] = this.getUser().getValue().emails; - for (let email of emails) { - if (email.correspondence) - return email; - } - } - - requestChangeName() { - let currentUser: User = this.getUser().getValue(); - currentUser.name=this.name; - this.updateUser(currentUser); - this.nameChanged=false; - } - - requestPasswordReset() { - //check old PW - if (this.authService.verifyPassword(this.oldPassword)) { - //check new PW === new PW2 - if (this.newPassword1.length < 6) { - this.toastService.showError("Neues Passwort zu kurz", "Das neue Passwort ist zu kurz. (min 6 Zeichen)"); - } else { - if (this.newPassword1 === this.newPassword2) { - this.authService.requestPasswordReset(this.newPassword2); - this.toastService.showSuccess("Passwort aktualisiert.", "Herzlichen Glückwunsch!"); - } else { - this.toastService.showError("Fehler", "Die neuen Passwörter sind nicht identisch."); - } - } - } else { - this.toastService.showError("Fehler", "Das alte Passwort ist nicht korrekt."); - } - } - - changeCorrespondenceEmail(email: Email) { - this.emailChanged = true; - this.newCorrespondenceMail = email; - } - - requestChangeCorrespondenceEmail() { - - let currentUser: User = this.getUser().getValue(); - - for (let email of currentUser.emails) { - if (email === this.newCorrespondenceMail) { - email.correspondence = true; - } else { - email.correspondence = false; - } - } - this.updateUser(currentUser); - this.emailChanged=false; - } - - updateUser(user: User) { - console.log(user); - this.consoleService.log("Put User requested."); - this.apiClientService.setCurrentUser(user).subscribe(result => { - this.consoleService.log("Put user received."); - this.toastService.showSuccess("Erfolg", "Profil erfolgreich aktualisiert!"); - this.authService.user.next(result.body); - }, error => { - this.consoleService.log("Error during update user."); - this.helperService.handleError(error); - }); - } - -//TODO: Check if mail is valid - addNewEmail() { - let newMail: Email = { - "id": 0, - "creationTime": 0, - "modificationTime": 0, - "deleted": false, - "correspondence": false, - "verified": false, - "address": this.newEmail - }; - let currentUser: User = this.getUser().getValue(); - currentUser.emails.push(newMail); - this.toastService.showWarning("Emails","Bitte überprüfe deine Emails und klicke auf den Aktivierungslink"); - this.updateUser(currentUser); - } - - deleteEmail(email: Email) { - let currentUser: User = this.getUser().getValue(); - for (let mail of currentUser.emails) { - if (mail.address === email.address) { - mail.deleted = true; - } - } - this.updateUser(currentUser); - } -} diff --git a/web/angular/src/app/views/components/shares/shares.component.html b/web/angular/src/app/views/components/shares/shares.component.html deleted file mode 100644 index 27f1cbb..0000000 --- a/web/angular/src/app/views/components/shares/shares.component.html +++ /dev/null @@ -1,63 +0,0 @@ -
    -
    -
    -
    -
    Meine Freigaben
    -
    - - - - - - - - - - - - - - - - - - - -
    -
    Seite: {{currentPage}} / {{numPages}}
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - diff --git a/web/angular/src/app/views/components/shares/shares.component.ts b/web/angular/src/app/views/components/shares/shares.component.ts deleted file mode 100644 index b7269fb..0000000 --- a/web/angular/src/app/views/components/shares/shares.component.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { Component, OnInit, Input, ViewChild } from '@angular/core'; -import { User } from '../../../../api/models/user.model'; -import { Privilege } from '../../../../api/models/privilege.model'; -import { PrivilegePage } from '../../../../api/models/privilegepage.model'; - -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; - -import { AuthService } from '../../../auth.service'; -import { PrivilegesService } from '../../../privileges.service'; -import { ToastService } from '../../../toast.service'; -import { ConsoleService } from '../../../console.service'; -import { ApiClientService } from '../../../../api/index'; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - selector: 'app-shares', - templateUrl: 'shares.component.html' -}) -export class SharesComponent implements OnInit { - - privileges: Privilege[] = []; - totalItems: number; - currentPage: number = 1; - pageSize: number = 10; - maxSize: number = 5; - numPages: number = 0; - - selectedPrivilegeId: number = 0; - - errorMessage: string; - - refreshInterval; - - @ViewChild('deletePrivilegeModal') deletePrivilegeModal; - - constructor( - private authService: AuthService, - private privilegesService: PrivilegesService, - private toastService: ToastService, - private consoleService: ConsoleService, - private apiClientService: ApiClientService, - private helperService:HelperService - ) { } - - ngOnInit() { - this.getPrivileges(this.getPageOffset(this.currentPage)); - } - - pageChanged(event: any): void { - if (event) { - this.getPrivileges(this.getPageOffset(event.page)); - } else { - this.getPrivileges(this.getPageOffset(this.currentPage)); - } - } - - getPageOffset(currentPage: number): number { - return (currentPage - 1) * 10; - } - - getPrivileges(pageOffset: number) { - this.privileges = []; - - this.apiClientService.getCurrentUserPrivileges(pageOffset, this.pageSize).subscribe(result => { - this.consoleService.log('The request was successful.'); - // console.log(result.body.elements); - this.privileges = result.body.elements; - this.totalItems = result.body.total; - - if (this.privilegesService.getShareTokenToAdd() !== '') { - this.addShareToPrivileges(); - } - }, error => { - this.consoleService.log("Error during get priviliges."); - this.helperService.handleError(error); - }); - } - - showDeletePrivilegeModal(index: number) { - // this.isModalShown = true; - this.selectedPrivilegeId = index; - this.deletePrivilegeModal.show(); - } - - hideDeletePrivilegeModal() { - this.deletePrivilegeModal.hide(); - } - - addShareToPrivileges() { - if (this.privilegesService.getShareTokenToAdd() !== '') { - const duplicateShares = this.privileges.filter((priv) => priv.token === this.privilegesService.getShareTokenToAdd()); - - // If the share is not already in the users privileges add, if not show warning - if (duplicateShares.length === 0) { - this.apiClientService.addCurrentUserPrivilege(this.privilegesService.getShareTokenToAdd()).subscribe(result => { - this.consoleService.log(`Share with token ${this.privilegesService.getShareTokenToAdd()} has been added to users privileges`); - this.toastService.showSuccess('Erfolg', `Share mit Token ${this.privilegesService.getShareTokenToAdd()} erfolgreich hinzugefügt.`); - this.privilegesService.setShareTokenToAdd(''); - - this.getPrivileges(this.getPageOffset(this.currentPage)); - }, error => { - this.consoleService.log("Error during add share to priviliges."); - this.helperService.handleError(error); - }); - } else { - this.toastService.showWarning('Doppelter Share', `Diesem Account wurde schon der Share mit dem Token ${this.privilegesService.getShareTokenToAdd()} hinzugefügt.`); - this.privilegesService.setShareTokenToAdd(''); - } - } - } - - deletePrivilege(selectedPrivilegeId: number) { - const selectedPrivilege = this.privileges[selectedPrivilegeId]; - this.consoleService.log(`Delete privilege with id ${selectedPrivilege.id}`); - this.apiClientService.deletePrivilege(selectedPrivilege.id).subscribe(result => { - this.consoleService.log('Deletion of privilege was successful'); - this.hideDeletePrivilegeModal(); - this.getPrivileges(this.getPageOffset(this.currentPage)); - }, error => { - this.consoleService.log("Error during delete privilige."); - this.helperService.handleError(error); - }); - } -} diff --git a/web/angular/src/app/views/components/statistic/statistic.component.html b/web/angular/src/app/views/components/statistic/statistic.component.html deleted file mode 100755 index e8bf8fd..0000000 --- a/web/angular/src/app/views/components/statistic/statistic.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
    - -
    - - - - diff --git a/web/angular/src/app/views/components/statistic/statistic.component.ts b/web/angular/src/app/views/components/statistic/statistic.component.ts deleted file mode 100755 index 26dad09..0000000 --- a/web/angular/src/app/views/components/statistic/statistic.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {Component, OnInit} from '@angular/core'; -import {AuthService} from "../../../auth.service"; - -@Component({ - templateUrl: './statistic.component.html' -}) -export class StatisticComponent implements OnInit{ - isAdmin:boolean = false; - - constructor(private authService:AuthService) { - } - - ngOnInit(){ - this.authService.user.subscribe(result=>{ - if(result){ - this.isAdmin = this.authService.isAdmin(); - } - }); - } -} diff --git a/web/angular/src/app/views/components/system-status/system-status.component.html b/web/angular/src/app/views/components/system-status/system-status.component.html deleted file mode 100644 index 9cb5f78..0000000 --- a/web/angular/src/app/views/components/system-status/system-status.component.html +++ /dev/null @@ -1,131 +0,0 @@ - -
    -
    -
    -
    - Server Status - -
    -
    - - - - - - - - - - - - - - - - - - - -
    ServerOSOS-VersionAnbieterVersion
    {{vmName}}{{osName}}{{osVersion}}{{vmVendor}}{{vmVendorVersion}}
    -
    -
    -
    -
    - -
    - -
    -
    -
    Betriebszeit -
    - -
    {{uptime.day}} Tage
    - -
    {{uptime.hour}} Stunden, {{uptime.minute}} Minuten, {{uptime.second}} Sek
    -
    - -
    - - -
    -
    -
    Speicher
    -
    - - -
    -
    - -
    - - -
    -
    -
    CPU Auslastung
    -
    - {{cpuLoad}} -
    - Durchschnittliche CPU Auslastung/Minute -
    - -
    -
    - - - diff --git a/web/angular/src/app/views/components/system-status/system-status.component.scss b/web/angular/src/app/views/components/system-status/system-status.component.scss deleted file mode 100644 index 8d9c3fd..0000000 --- a/web/angular/src/app/views/components/system-status/system-status.component.scss +++ /dev/null @@ -1,42 +0,0 @@ - -.modal-dialog.full-screen { - position:fixed; - width:auto; // uncomment to make the width based on the left/right attributes. - margin:auto; - left:0px; - right:0px; - top:0px; - bottom:0px; - max-width:1100px; -} - -.modal-dialog.full-screen .modal-content { - position:absolute; - left:10px; - right:10px; - top:10px; - bottom:10px; -} - -.modal-dialog.full-screen .modal-content .modal-header { - height:55px; // adjust as needed. -} - -.modal-dialog.full-screen .modal-content .modal-body { - overflow-y: auto; - position: absolute; - top: 0; - bottom: 0; - left:0; - right:0; - margin-top: 55px; // .modal-header height - margin-bottom: 80px; // .modal-footer height -} - -.modal-dialog.full-screen .modal-content .modal-footer { - height:80px; // adjust as needed. - position:absolute; - bottom:0; - left:0; - right:0; -} diff --git a/web/angular/src/app/views/components/system-status/system-status.component.ts b/web/angular/src/app/views/components/system-status/system-status.component.ts deleted file mode 100644 index 48d3d0f..0000000 --- a/web/angular/src/app/views/components/system-status/system-status.component.ts +++ /dev/null @@ -1,182 +0,0 @@ -import {Component, OnInit, OnDestroy, ViewChild, TemplateRef} from '@angular/core'; -import {LoadStatistic} from "../../../../api/models/loadstatistic.model"; -import {ApiClientService} from "../../../../api/index"; -import {ConsoleService} from "../../../console.service"; -import { registerLocaleData } from '@angular/common'; -import localeDe from '@angular/common/locales/de'; -import {SystemStatistic} from "../../../../api/models/systemstatistic.model"; -import {LogMessage} from "../../../../api/models/logmessage.model"; -import {ToastService} from "../../../toast.service"; -import { BsModalService } from 'ngx-bootstrap/modal'; -import { BsModalRef } from 'ngx-bootstrap/modal/bs-modal-ref.service'; -import {ModalOptions, ModalDirective} from "ngx-bootstrap"; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - selector:'app-system-status', - templateUrl: './system-status.component.html', - styleUrls: ['./system-status.component.scss'] -}) -export class SystemStatusComponent implements OnInit, OnDestroy{ - errorMessage: string = ''; - intervalId:any; - isLoading = false; - - serverSystemInfo:SystemStatistic; - serverLoadStatistic:LoadStatistic; - - // server system attributes - osName:string = ' '; - osVersion:string = ' '; - vmName:string = ' '; - vmVendor:string = ' '; - vmVendorVersion:string = ' '; - - // uptime attributes - uptime = { - 'day':0, - 'hour':0, - 'minute':0, - 'second':0, - 'date': new Date() - }; - - // gauge attributes - gaugeType = "arch"; - gaugeValue = 0; - gaugeLabel = "Verbrauch"; - gaugeAppendText = "MB"; - gaugeCap = "flat"; - gaugeThick = 6; - gaugeMin = 0; - gaugeMax = 0; - gaugeSize=150; - gaugeDuration=500; - forderground = "#004c93"; - - // cpu load attributes - cpuLoad:number = 0; - - // modal attributes - @ViewChild('logTemplate') logTemplate: ModalDirective; - - // log message attribute - logMessages:LogMessage[] = []; - - constructor(private apiClientService:ApiClientService, - private consoleService:ConsoleService, - private toastService:ToastService, - private modalService: BsModalService, - private helperService:HelperService) { - this.intervalId = 1; - registerLocaleData(localeDe, 'de'); // set german calendar - this.getLoadStatistic(); - } - - ngOnInit() { - this.getServerInfo(); - this.intervalId = setInterval(() => { - this.getLoadStatistic(); - }, 3000); - } - - ngOnDestroy() { - if (this.intervalId) { - clearInterval(this.intervalId); - } - this.logMessages = []; - } - - getServerInfo(){ - this.apiClientService.getSystemStatistic().subscribe(result=>{ - this.serverSystemInfo = result.body; - this.osName = this.serverSystemInfo.osName; - this.osVersion = this.serverSystemInfo.osVersion; - this.vmName = this.serverSystemInfo.vmName; - this.vmVendor = this.serverSystemInfo.vmVendor; - this.vmVendorVersion = this.serverSystemInfo.vmVersion; - }, error=>{ - this.consoleService.log("Error during get system statistics."); - this.helperService.handleError(error); - }); - } - - getLoadStatistic(){ - if(this.intervalId){ - this.apiClientService.getLoadStatistic().subscribe(result=>{ - this.serverLoadStatistic = result.body; - // init gauge chart - if(this.gaugeMax <= 0){ - this.gaugeMax = Math.round(this.serverLoadStatistic.maxHeapSize/1000000); - } - this.gaugeValue = Math.round(this.serverLoadStatistic.usedHeapSize/1000000); - // init uptime - const convertedUptime = this.convertMS(this.serverLoadStatistic.uptime); - this.uptime.day = convertedUptime.d; - this.uptime.hour = convertedUptime.h; - this.uptime.minute = convertedUptime.m; - this.uptime.second = convertedUptime.s; - this.uptime.date = new Date(Date.now()-this.serverLoadStatistic.uptime); - // init cpu load - this.cpuLoad = +result.body.cpuLoad.toFixed(2); - }, error=>{ - this.consoleService.log("Error during get load statistics."); - this.helperService.handleError(error); - }); - } - } - - getLogMessages(){ - this.isLoading = true; - var tempMessageId=0; - if(this.logMessages.length != 0){ - tempMessageId = this.logMessages[this.logMessages.length-1].id+1; - } - this.apiClientService.getLogMessages(tempMessageId).subscribe(result =>{ - if(result.body.length != 0){ - this.logMessages = this.logMessages.concat(result.body); - } else { - // no more log messages - this.toastService.showWarning("Warning","There are no more messages!"); - } - this.isLoading = false; - }, error => { - this.consoleService.log("Error during get log messages."); - this.helperService.handleError(error); - this.isLoading = false; - }); - } - - // Modal methods - hideLogModal(){ - this.logTemplate.hide(); - this.logMessages = []; - } - - openLogModal() { - this.getLogMessages(); - this.logTemplate.show(); - } - - // helper method - convertMS(ms) { - var d, h, m, s; - s = Math.floor(ms / 1000); - m = Math.floor(s / 60); - s = s % 60; - h = Math.floor(m / 60); - m = m % 60; - d = Math.floor(h / 24); - h = h % 24; - return { d: d, h: h, m: m, s: s }; - } - - getColor(logLevel) { - switch (logLevel) { - case 'ERROR': - return 'red'; - default: - return 'black'; - } - } -} diff --git a/web/angular/src/app/views/components/user-devices/user-devices.component.html b/web/angular/src/app/views/components/user-devices/user-devices.component.html deleted file mode 100644 index a8a4cc9..0000000 --- a/web/angular/src/app/views/components/user-devices/user-devices.component.html +++ /dev/null @@ -1,54 +0,0 @@ -
    -
    -
    -
    -
    Nutzergeräte
    -
    -
    - Das aktuell ausgewählte Gerät: - {{selectedDevice.device}} - Kein Gerät ausgewählt -
    - - - - - - - - - - - - - - - - - - - - - - - -
    -
    Seite: {{bigCurrentPage}} / {{numPages}}
    -
    - -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/components/user-devices/user-devices.component.ts b/web/angular/src/app/views/components/user-devices/user-devices.component.ts deleted file mode 100644 index e859d2e..0000000 --- a/web/angular/src/app/views/components/user-devices/user-devices.component.ts +++ /dev/null @@ -1,66 +0,0 @@ -import {ConsoleService} from "../../../console.service"; -import {ApiClientService} from "../../../../api/index"; -import {OnInit, Component} from "@angular/core"; -import {Device} from "../../../../api/models/device.model"; -import {StatisticService} from "../../../statistic.service"; -import {ToastService} from "../../../toast.service"; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - selector: 'app-user-devices', - templateUrl: './user-devices.component.html' -}) -export class UserDevicesComponent implements OnInit { - maxSize: number = 5; // load - bigTotalItems: number = 0; // device count - bigCurrentPage: number = 1; // pageOffset currentPage -1 - numPages: number = 0; // all pages count - pageSize: number = 5; // device count in table - - deviceList: Device[]; // device list for table - selectedDevice:Device; - errorMessage: string = ''; - - constructor(private consoleService: ConsoleService, - private apiClientService: ApiClientService, - private toastService: ToastService, - private statisticService:StatisticService, - private helperService:HelperService) { - } - - ngOnInit() { - this.getDevice(this.getPageOffset(this.bigCurrentPage)); - } - - // Pagination Methods - pageChanged(event: any): void { - this.getDevice(event); - } - - getPageOffset(currentPage: number): number { - return (currentPage - 1) * 10; - } - - // update selected device - selectDevice(selectedNr:number){ - this.selectedDevice = this.deviceList[selectedNr]; - this.statisticService.setDevice(this.selectedDevice); - } - - getDevice(pageOffset:number){ - this.apiClientService.getCurrentUserDevices(pageOffset, this.pageSize).subscribe(result => { - this.consoleService.log("Load devices received."); - this.deviceList = result.body.elements; - this.bigTotalItems = result.body.total; - // the first load of this page - if(!this.selectedDevice && this.deviceList){ - this.selectedDevice = this.deviceList[0]; - this.statisticService.setDevice(this.selectedDevice); - } - }, error => { - this.consoleService.log("Error during get device."); - this.helperService.handleError(error); - }); - } - -} diff --git a/web/angular/src/app/views/components/user-management/user-management.component.html b/web/angular/src/app/views/components/user-management/user-management.component.html deleted file mode 100644 index 03104be..0000000 --- a/web/angular/src/app/views/components/user-management/user-management.component.html +++ /dev/null @@ -1,109 +0,0 @@ -
    -
    -
    -
    -
    User Management
    -
    -
    - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    Seite: {{bigCurrentPage}} / {{numPages}}
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - diff --git a/web/angular/src/app/views/components/user-management/user-management.component.ts b/web/angular/src/app/views/components/user-management/user-management.component.ts deleted file mode 100644 index 0b42b34..0000000 --- a/web/angular/src/app/views/components/user-management/user-management.component.ts +++ /dev/null @@ -1,148 +0,0 @@ -import {Component, OnInit, ViewChild} from '@angular/core'; -import {ConsoleService} from "../../../console.service"; -import {ApiClientService} from "../../../../api/index"; -import {User} from "../../../../api/models/user.model"; -import {ToastService} from "../../../toast.service"; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - selector: 'app-user-management', - templateUrl: 'user-management.component.html' -}) -export class UserManagementComponent implements OnInit{ - - maxSize: number = 5; // load - bigTotalItems: number = 0; // user count - bigCurrentPage: number = 1; // pageOffset currentPage -1 - numPages: number = 0; // all pages count - - pageSize:number = 10; // user count in table - - userList:User[]; // user list for table - searchString:string=''; - isSearch:boolean = false; - - selectedUserId:number = 0; // Id to delete user - errorMessage:string = ''; - - @ViewChild('deleteUserModal') deleteUserModal; - @ViewChild('reactiveUserModal') reactiveUserModal; - isModalShown: boolean = false; - - constructor(private consoleService: ConsoleService, - private apiClientService:ApiClientService, - private toastService: ToastService, - private helperService:HelperService) {} - - ngOnInit(){ - this.getUser(this.getPageOffset(this.bigCurrentPage)); - } - - // Pagination Methods - pageChanged(event: any): void { - this.loadUsers(event); - } - - getPageOffset(currentPage:number):number{ - return (currentPage-1)*10; - } - - loadUsers(event?: any){ - if(this.searchString == ''){ - if(this.isSearch){ - this.isSearch = false; - this.bigCurrentPage = 1; - this.getUser(this.getPageOffset(this.bigCurrentPage)); - }else{ - if(event){ - this.getUser(this.getPageOffset(event.page)); - }else{ - this.getUser(this.getPageOffset(this.bigCurrentPage)); - } - } - }else{ - if(this.isSearch){ - if(event){ - this.searchUser(this.searchString, this.getPageOffset(event.page)); - }else{ - this.searchUser(this.searchString, this.getPageOffset(this.bigCurrentPage)); - } - }else{ - this.isSearch = true; - this.bigCurrentPage = 1; - this.searchUser(this.searchString, this.getPageOffset(this.bigCurrentPage)); - } - } - } - - //Modal Methods - showDeleteUserModal(index:number){ - this.isModalShown = true; - this.selectedUserId = index; - this.deleteUserModal.show(); - } - - showReactiveUserModal(index:number){ - this.isModalShown = true; - this.selectedUserId = index; - this.reactiveUserModal.show(); - } - - hideModal(){ - this.reactiveUserModal.hide(); - this.deleteUserModal.hide(); - this.isModalShown=false; - } - - // Request Methods - reactiveOrDeleteUser(){ - console.log("reactive or delete user"); - const tempUser:User = this.userList[this.selectedUserId]; - tempUser.deleted = !tempUser.deleted; - this.updateUser(tempUser); - } - - addOrDeleteRole(){ - this.consoleService.log("updated role"); - this.toastService.showWarning("Warning","The change role function is not implemented yet 😃"); - } - - searchUser(searchString:string, pageOffset:number){ - this.consoleService.log("searched for username= "+searchString); - this.apiClientService.searchUsers(pageOffset, this.pageSize, searchString).subscribe(result => { - this.consoleService.log("Load user received."); - this.userList = result.body.elements; - this.bigTotalItems = result.body.total; - if(this.userList.length ==0){ - this.toastService.showWarning("Warning", "No users found!"); - } - }, error => { - this.consoleService.log("Error during search user."); - this.helperService.handleError(error); - }); - } - - getUser(pageOffset:number){ - this.apiClientService.getUsers(pageOffset, this.pageSize).subscribe(result => { - this.consoleService.log("Load user received."); - this.userList = result.body.elements; - this.bigTotalItems = result.body.total; - }, error => { - this.consoleService.log("Error during get user."); - this.helperService.handleError(error); - }); - } - - updateUser(user:User){ - this.consoleService.log("Put User requested."); - this.apiClientService.setUser(user.id, user).subscribe(result => { - this.consoleService.log("Put user received."); - this.loadUsers(); - this.toastService.showSuccess("Success", "User "+result.body.name +" changed successful!"); - }, error => { - this.consoleService.log("Error during update user."); - this.helperService.handleError(error); - }); - this.hideModal(); - } -} diff --git a/web/angular/src/app/views/device-location.component.html b/web/angular/src/app/views/device-location.component.html new file mode 100644 index 0000000..20a617c --- /dev/null +++ b/web/angular/src/app/views/device-location.component.html @@ -0,0 +1,84 @@ + + + + + + smartphoneGerät + +
    + ID + {{ id }} +
    + +
    + Hersteller + {{ d.manufacturer }} +
    +
    + Model + {{ d.model }} +
    +
    + Betriebssystem + {{ d.os }} +
    +
    + Registrierung + {{ d.creationTime | date:'short' }} +
    +
    + Aktualisierung + {{ d.modificationTime | date:'short' }} +
    +
    + + + + + + + + +
    + + + + my_locationStandort + + +
    + Zeit + {{ l.timestamp | date:'short' }} +
    +
    + Status + {{ l.availability }} +
    + +
    + Längengrad + {{ l.coordinate.longitude }} +
    +
    + Breitengrad + {{ l.coordinate.latitude }} +
    +
    +
    + + + + + + + + +
    +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/device-location.component.ts b/web/angular/src/app/views/device-location.component.ts new file mode 100644 index 0000000..1547abd --- /dev/null +++ b/web/angular/src/app/views/device-location.component.ts @@ -0,0 +1,83 @@ +import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit } from "@angular/core"; +import { ApiClientService } from "../../api"; +import { MatDialog, MatSnackBar } from "@angular/material"; +import { ActivatedRoute, Router } from "@angular/router"; +import { MessageDialogComponent } from "../widgets/message-dialog.component"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; +import { Subscription, BehaviorSubject } from "rxjs"; +import { Device, Location } from "../../api/models"; +import { Snackbars } from "../utils/snackbars"; +import * as L from 'leaflet'; +import { TileMapComponent } from "../widgets/tile-map.component"; +import { MarkerMapComponent } from "../widgets/marker-map.component"; + +@Component({ + selector: 'device-location', + templateUrl: './device-location.component.html', + host: { class:'match-parent' }, + }) + export class DeviceLocationComponent implements OnInit, OnDestroy { + + @ViewChild(MarkerMapComponent) map: MarkerMapComponent; + + id: string; + + device = new BehaviorSubject(null); + location = new BehaviorSubject(null); + + private deviceSubscription: Subscription; + private locationSubscription: Subscription; + + constructor( + private snackbar: MatSnackBar, + private apiClientService: ApiClientService, + private route: ActivatedRoute + ) { } + + ngOnInit() { + this.id = this.route.snapshot.paramMap.get("id"); + this.updateDevice(); + this.updateLocation(); + } + + isUpdatingDevice():boolean { + return this.deviceSubscription != null; + } + + isUpdatingLocation():boolean { + return this.locationSubscription != null; + } + + updateDevice():void { + if (this.deviceSubscription) return; + this.deviceSubscription = this.apiClientService.getDevice(parseInt(this.id, 10)).subscribe((result)=>{ + this.device.next(result.body); + this.deviceSubscription = null; + }, (error)=>{ + Snackbars.showError(this.snackbar, "Die Geräteinformationen konnten nicht geladen werden."); + this.deviceSubscription = null; + }); + } + + updateLocation():void { + if (this.locationSubscription) return; + this.locationSubscription = this.apiClientService.getDeviceLocation(parseInt(this.id, 10)).subscribe((result)=>{ + this.location.next(result.body); + this.map.setMarkerPosition(result.body.coordinate); + this.locationSubscription = null; + }, (error)=>{ + Snackbars.showError(this.snackbar, "Der Standort konte nicht abgerufen werden."); + this.locationSubscription = null; + this.map.setMarkerPosition(null); + }); + } + + + ngOnDestroy() { + if (this.deviceSubscription) this.deviceSubscription.unsubscribe(); + if (this.locationSubscription) this.locationSubscription.unsubscribe(); + } + + } + \ No newline at end of file diff --git a/web/angular/src/app/views/device-visits.component.html b/web/angular/src/app/views/device-visits.component.html new file mode 100644 index 0000000..f80120d --- /dev/null +++ b/web/angular/src/app/views/device-visits.component.html @@ -0,0 +1,116 @@ + + + + + + smartphoneGerät + +
    + ID + {{ id }} +
    + +
    + Hersteller + {{ d.manufacturer }} +
    +
    + Model + {{ d.model }} +
    +
    + Betriebssystem + {{ d.os }} +
    +
    + Registrierung + {{ d.creationTime | date:'short' }} +
    +
    + Aktualisierung + {{ d.modificationTime | date:'short' }} +
    +
    + + + + + + + + +
    + + + + beenhereBesuche + + + + + + + Ort + + {{ getPlaceName(element.place) }} + + + + + +
    Von - Bis
    +
    + +
    {{element.beginTime | date:'shortTime' }} - {{element.endTime | date:'shortTime' }}
    +
    +
    + + + + Aktionen + + + + + + + + + + +
    + + + + + + + + + + + + + +
    + + +
    +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/device-visits.component.ts b/web/angular/src/app/views/device-visits.component.ts new file mode 100644 index 0000000..189995a --- /dev/null +++ b/web/angular/src/app/views/device-visits.component.ts @@ -0,0 +1,236 @@ +import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit } from "@angular/core"; +import { ApiClientService } from "../../api"; +import { MatDialog, MatSnackBar, MatDatepicker, MatDatepickerInputEvent } from "@angular/material"; +import { ActivatedRoute, Router } from "@angular/router"; +import { MessageDialogComponent } from "../widgets/message-dialog.component"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; +import { Subscription, BehaviorSubject } from "rxjs"; +import { Device, Location, Visit } from "../../api/models"; +import { Snackbars } from "../utils/snackbars"; +import * as L from 'leaflet'; +import { TileMapComponent } from "../widgets/tile-map.component"; +import { MarkerMapComponent } from "../widgets/marker-map.component"; +import { DeviceVisitService } from "../services/device-visit.service"; +import { DataSource } from "@angular/cdk/table"; +import { ConfirmationDialogComponent } from "../widgets/confirmation-dialog.component"; +import { FormControl } from "@angular/forms"; + +@Component({ + selector: 'device-visits', + templateUrl: './device-visits.component.html', + host: { class:'match-parent' }, + }) + export class DeviceVisitsComponent implements OnInit, AfterViewInit, OnDestroy { + + private static readonly COLORS: string[] = [ "#ffebee", "#ffcdd2", "#ef9a9a", "#e57373", "#ef5350", "#f44336", "#e53935", "#d32f2f", "#c62828", "#b71c1c" ] + private static readonly DAY = 24 * 60 * 60 * 1000; + + @ViewChild(MarkerMapComponent) map: MarkerMapComponent; + + displayedColumns = [ 'place', 'time', 'actions']; + + id: string; + + maxDate = new Date(); + minDate = new Date(); + selectedDate = new Date(); + device: BehaviorSubject; + dataSource: DataSource; + loading: BehaviorSubject + date: BehaviorSubject + deleting = new BehaviorSubject(false); + + private places: L.CircleMarker[] = []; + + private dateSubscription: Subscription; + private deviceSubscription: Subscription; + private loadingSubscription: Subscription; + + constructor( + private snackbar: MatSnackBar, + private dialog: MatDialog, + private apiClientService: ApiClientService, + private deviceVisitSerivce: DeviceVisitService, + private route: ActivatedRoute + ) { + this.dataSource = deviceVisitSerivce; + this.device = deviceVisitSerivce.device; + this.loading = deviceVisitSerivce.loading; + this.date = deviceVisitSerivce.date; + } + + reload() { + this.deviceVisitSerivce.setDevice(+this.id); + } + + setDate(date: Date) { + this.deviceVisitSerivce.setDate(date); + } + + onNextDay() { + this.setDate(new Date(this.selectedDate.getTime() + DeviceVisitsComponent.DAY)); + } + + hasNextDay():boolean { + let next = this.selectedDate.getTime() + DeviceVisitsComponent.DAY; + return this.maxDate.getTime() >= next; + } + + onPreviousDay() { + this.setDate(new Date(this.selectedDate.getTime() - DeviceVisitsComponent.DAY)); + } + + + hasPreviousDay(): boolean { + let next = this.selectedDate.getTime() - DeviceVisitsComponent.DAY; + return this.minDate.getTime() <= next; + } + + onDateChange(event: MatDatepickerInputEvent) { + this.setDate(event.value); + } + + ngOnInit() { + this.id = this.route.snapshot.paramMap.get("id"); + this.deviceVisitSerivce.setDevice(+this.id); + this.dateSubscription = this.date.subscribe((date)=> { + this.selectedDate = date; + }); + this.deviceSubscription = this.device.subscribe((device)=> { + if (device == null) { + this.minDate = new Date(); + this.maxDate = new Date(); + } else { + this.minDate = new Date(device.creationTime); + this.maxDate = new Date(); + } + this.minDate.setHours(0, 0, 0, 0); + this.maxDate.setHours(23, 59, 59, 999); + }); + } + + ngAfterViewInit() { + this.loadingSubscription = this.loading.subscribe((load)=>{ + if (load) this.clearPlaces(); + else this.createPlaces(); + }); + } + + + ngOnDestroy() { + this.dateSubscription.unsubscribe(); + this.deviceSubscription.unsubscribe(); + this.loadingSubscription.unsubscribe(); + } + + getPlaceName(id:number):string { + let place = this.deviceVisitSerivce.getPlace(id); + if (!place) { + return "" + id; + } else if (place.nickname) { + return place.nickname; + } else if (place.address) { + return place.address; + } else { + return "" + place.id; + } + } + + onDelete(id:number):void { + ConfirmationDialogComponent.open(this.dialog, { + title:"Besuch löschen?", + message:"Möchtest Du den Besuch wirklich löschen? Diesen Vorgang kannst Du nicht mehr rückgängig machen.", + positive: "Ja", + negative: "Nein" + }).subscribe((result) => { + if (result != null && result.confirmed) { + this.doDelete(id); + } + }); + } + + private doDelete(id:number):void { + this.deleting.next(true); + this.apiClientService.deleteVisit(id).subscribe((result) => { + this.deleting.next(false); + this.deviceVisitSerivce.setDevice(+this.id); + Snackbars.showMessage(this.snackbar, "Der Besuch wurde erfolgreich gelöscht.", Snackbars.DURATION_SHORT); + }, (error) => { + this.deleting.next(false); + this.deviceVisitSerivce.setDevice(+this.id); + Snackbars.showError(this.snackbar, "Der Besuch konnte nicht gelöscht werden. Hast Du gerade kein Netz?"); + }) + } + + onSelectPlace(id: number):void { + let place = this.deviceVisitSerivce.getPlace(id); + if (!place) { + Snackbars.showError(this.snackbar, "Der Ort konnte nicht geladen werden."); + this.map.setPinPosition(null); + } else { + this.map.setPinPosition(place.coordinate); + } + } + + + private createPlaces():void { + // compute the total and individual stay duration + let sel = new Date(this.selectedDate); + sel.setHours(0, 0, 0, 0); + let min = sel.getTime(); + sel.setHours(23, 59, 59, 999); + let max = sel.getTime(); + let placeDurations = new Map(); + var totalDuration = 0; + for (let v of this.deviceVisitSerivce.getVisits()) { + let begin = Math.min(max, Math.max(min, v.beginTime)); + let end = Math.min(max, Math.max(min, v.endTime)); + var duration = end - begin; + totalDuration += duration; + if (placeDurations.has(v.place)) { + duration += placeDurations.get(v.place); + } + placeDurations.set(v.place, duration); + } + var latlngs:([number, number])[] = new Array(); + // create circles for places + placeDurations.forEach((v, k)=> { + let place = this.deviceVisitSerivce.getPlace(k); + if (place != null) { + let pos = new L.LatLng(place.coordinate.latitude, place.coordinate.longitude); + latlngs.push([ place.coordinate.latitude, place.coordinate.longitude]); + let circle = L.circleMarker(pos, { + radius: 36, + fillColor: this.getColor(v, totalDuration), + fill: true, + stroke: true, + weight: 4, + color: "#d50000" + }) + this.places.push(circle); + circle.addTo(this.map.map.map); + } + }); + if (latlngs.length > 0) { + let bounds = new L.LatLngBounds(latlngs); + this.map.map.map.fitBounds(bounds); + } + } + + private getColor(duration:number, total:number) { + if (total == 0) return DeviceVisitsComponent.COLORS[5]; + let fraction = Math.round((duration * 10) / total); + let index = Math.max(0, Math.min(DeviceVisitsComponent.COLORS.length, fraction)); + return DeviceVisitsComponent.COLORS[index]; + } + + private clearPlaces(): void { + for (let c of this.places) { + c.remove(); + } + this.places = []; + } + + } + \ No newline at end of file diff --git a/web/angular/src/app/views/devices.component.html b/web/angular/src/app/views/devices.component.html new file mode 100644 index 0000000..d3b4125 --- /dev/null +++ b/web/angular/src/app/views/devices.component.html @@ -0,0 +1,67 @@ +
    + + devices + Geräte + +
    + + + + + + + ID + {{element.id}} + + + + Betriebssystem + + {{getOsIcon(element.os)}} + + + + + Hersteller + {{element.manufacturer}} + + + + Model + {{element.model}} + + + + Registrierung + {{element.creationTime | date:'short' }} + + + + Aktualisierung + {{element.modificationTime | date:'short' }} + + + Aktionen + + + + + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/devices.component.ts b/web/angular/src/app/views/devices.component.ts new file mode 100644 index 0000000..1e37932 --- /dev/null +++ b/web/angular/src/app/views/devices.component.ts @@ -0,0 +1,76 @@ +import {Component, ViewChild, OnInit, OnDestroy} from '@angular/core'; +import {MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar} from '@angular/material'; +import { DeviceService } from '../services/device.service'; +import { Device, DevicePage } from '../../api/models'; +import { DataSource } from '@angular/cdk/table'; +import { Subscription, BehaviorSubject } from 'rxjs'; +import { PaginationHandler } from '../utils/pagination'; +import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component'; +import { ApiClientService } from '../../api'; +import { Snackbars } from '../utils/snackbars'; + +@Component({ + selector: 'devices', + templateUrl: 'devices.component.html', + host: { class:'match-parent' } +}) +export class DevicesComponent implements OnInit, OnDestroy{ + + displayedColumns = ['id', 'os', 'manufacturer', 'model', "creationTime", "modificationTime", "actions"]; + dataSource: DataSource; + private pageHandler: PaginationHandler; + readonly loading:BehaviorSubject; + readonly deleting = new BehaviorSubject(true); + + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor( + private apiClientService: ApiClientService, + private deviceSerivce: DeviceService, + private snackbar: MatSnackBar, + private dialog:MatDialog) { + this.dataSource = deviceSerivce; + this.loading = deviceSerivce.loading; + } + + ngOnInit() { + this.pageHandler = new PaginationHandler(this.paginator, this.deviceSerivce); + this.deviceSerivce.reload(); + } + + ngOnDestroy() { + this.pageHandler.destroy(); + } + + getOsIcon(os: string): string { + if (os === "ANDROID") return "android"; + else return "smartphone"; + } + + onDelete(id:number):void { + ConfirmationDialogComponent.open(this.dialog, { + title:"Gerät löschen?", + message:"Möchtest Du das Gerät wirklich löschen? Dieser Vorgang löscht auch die Besuche des Geräts und Du kannst ihn nicht mehr rückgängig machen.", + positive: "Ja", + negative: "Nein" + }).subscribe((result) => { + if (result != null && result.confirmed) { + this.doDelete(id); + } + }); + } + + private doDelete(id:number):void { + this.deleting.next(true); + this.apiClientService.deleteDevice(id).subscribe((result) => { + this.deleting.next(false); + this.deviceSerivce.reload(); + Snackbars.showMessage(this.snackbar, "Das Gerät wurde erfolgreich gelöscht.", Snackbars.DURATION_SHORT); + }, (error) => { + this.deleting.next(false); + this.deviceSerivce.reload(); + Snackbars.showError(this.snackbar, "Das Gerät konnte nicht gelöscht werden. Hast Du gerade kein Netz?"); + }) + } + +} \ No newline at end of file diff --git a/web/angular/src/app/views/edit-notice.component.html b/web/angular/src/app/views/edit-notice.component.html new file mode 100644 index 0000000..a12399d --- /dev/null +++ b/web/angular/src/app/views/edit-notice.component.html @@ -0,0 +1,130 @@ +
    + + message + Hinweis {{ isNew()?"erstellen":"bearbeiten" }} +
    + + +
    +
    + + +
    + +
    +
    + +
    + + + Inhalt + Hier kannst Du den Inhalt des Hinweises ändern. + + + + + + + + + +
    +
    + + + + +
    + + + +
    +
    +
    +
    + + + + add_circle_outline + +
    + + +
    +
    +
    +
    +
    +
    + + Einstellungen + Hier kannst Du die Art der Veröffentlichung einstellen. + +
    +
    + + + + + + + + +
    + +
    + +
    + + Veröffentlichen + + + Ankündigen + +
    + +
    +
    +
    + notifications_active + + + +
    +
    + notifications_none + + + +
    +
    +
    +
    +
    + + +
    +
    Erstellung
    +
    {{ notice.creationTime | date:'short' }}
    +
    +
    + Änderung +
    {{ notice.modificationTime | date:'short' }}
    +
    +
    +
    +
    +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/edit-notice.component.ts b/web/angular/src/app/views/edit-notice.component.ts new file mode 100644 index 0000000..755d80e --- /dev/null +++ b/web/angular/src/app/views/edit-notice.component.ts @@ -0,0 +1,180 @@ +import {Component, ViewChild, OnInit, OnDestroy, ViewEncapsulation} from '@angular/core'; +import {MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar} from '@angular/material'; +import { DeviceService } from '../services/device.service'; +import { Notice, NoticePage, Message } from '../../api/models'; +import { DataSource } from '@angular/cdk/table'; +import { Subscription, BehaviorSubject } from 'rxjs'; +import { PaginationHandler } from '../utils/pagination'; +import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component'; +import { ApiClientService } from '../../api'; +import { Snackbars } from '../utils/snackbars'; +import { ManageUserService } from '../services/manage-user.service'; +import { FormErrorEncoder } from '../utils/formcodes'; +import { NgForm } from '@angular/forms'; +import { ManageNoticeService } from '../services/manage-notice.service'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Languages, Language } from '../utils/languages'; + +@Component({ + selector: 'edit-notice', + templateUrl: 'edit-notice.component.html', + host: { class:'match-parent' }, + encapsulation: ViewEncapsulation.None, + styles: [ ".mat-tab-label { width: 65px !important; min-width: 0px !important } "] +}) +export class EditNoticeComponent extends FormErrorEncoder implements OnInit, OnDestroy { + + readonly languages = Languages.getLanguages(); + + readonly loading:BehaviorSubject; + id: string; + notice:Notice; + private loadSubscription:Subscription; + messages:Map = new Map(); + expirationDate: Date; + expirationTime: string; + + constructor( + private mangeNoticeService: ManageNoticeService, + private router: Router, + private route: ActivatedRoute, + private snackbar: MatSnackBar, + private dialog:MatDialog) { + super(); + this.loading = mangeNoticeService.loading; + } + + ngOnInit() { + this.id = this.route.snapshot.paramMap.get("id"); + if (!this.isNew()) { + this.loadSubscription = this.mangeNoticeService.getNotice(+this.id).subscribe((notice)=> { + if (notice == null) { + Snackbars.showError(this.snackbar, "Der Hinweis konnte nicht geladen werden."); + this.router.navigate(["/manage/notices"]); + } else { + this.setNotice(notice); + } + }); + } else { + let date = new Date(); + date.setHours(0); + date.setMinutes(0); + date.setSeconds(0); + date.setMilliseconds(0); + date.setMonth(date.getMonth() + 12); + this.setNotice({ + announced:false, + creationTime: 0, + deleted: false, + expirationTime: date.getTime(), + id: 0, + maximumVersion: 0, + minimumVersion: 0, + messages: [], + modificationTime: 0, + published: false + }); + } + } + + isNew():boolean { + return +this.id == 0; + } + + ngOnDestroy() { + if (this.loadSubscription != null) this.loadSubscription.unsubscribe(); + } + + + setNotice(notice: Notice):void { + if (notice.id != +this.id) { + this.router.navigate(["/manage/notices/" + notice.id]); + } else { + this.notice = notice; + this.messages = new Map(); + for (let m of notice.messages) { + this.messages.set(m.language, m); + } + let date = new Date(notice.expirationTime); + this.expirationDate = date; + let min = date.getMinutes(); + this.expirationTime = ((min<10)?"0":"") + date.getHours() + ":" + ((min<10)?"0":"") + min; + console.log("Expt: " + this.expirationTime); + } + } + + getOtherLanguages(): Language[] { + var missing: Language[] = []; + for (let lang of this.languages) { + if (!this.messages.has(lang.value)) { + missing.push(lang); + } + } + return missing; + } + + hasAllLanguages():boolean { + for (let lang of this.languages) { + if (! this.messages.has(lang.value)) return false; + } + return true; + } + + onAddLanguage(lang: string):void { + var message:Message = { language:lang, title:"", body:""} as Message; + for (let m of this.notice.messages) { + if (m.language == lang) { + message = m; + } + } + this.messages.set(lang, message); + } + + onDeleteLanguage(lang: string):void { + this.messages.delete(lang); + } + + + + onSave():void { + this.notice.messages = []; + this.messages.forEach((m:Message,k:string)=> { + this.notice.messages.push(m); + }); + if (this.notice.minimumVersion == null) this.notice.minimumVersion = 0; + if (this.notice.maximumVersion == null) this.notice.maximumVersion = 0; + let exp = new Date(this.expirationDate); + let time = this.getExpirationTime(); + exp.setHours(time.h); + exp.setMinutes(time.m); + exp.setSeconds(0); + exp.setMilliseconds(0); + this.notice.expirationTime = exp.getTime(); + this.updateNotice(this.notice); + } + + private getExpirationTime(): {h:number, m:number} { + var result = { h: 0, m: 0}; + if (this.expirationTime == null || this.expirationTime.indexOf(":") == -1) { + this.expirationTime = "0:00"; + } + let idx = this.expirationTime.indexOf(":"); + result.h = +this.expirationTime.substring(0, idx); + result.m = +this.expirationTime.substring(idx + 1); + return result; + } + + + private updateNotice(notice:Notice) { + this.mangeNoticeService.setNotice(notice).subscribe((result)=> { + if (result != null) { + Snackbars.showMessage(this.snackbar, "Der Hinweis wurde erfolgreich gespeichert.", Snackbars.DURATION_SHORT); + this.setNotice(result); + } else { + Snackbars.showError(this.snackbar, "Der Hinweis konnte nicht gespeicher werden.") + } + }); + + } + +} \ No newline at end of file diff --git a/web/angular/src/app/views/login.component.html b/web/angular/src/app/views/login.component.html new file mode 100644 index 0000000..d90c9ec --- /dev/null +++ b/web/angular/src/app/views/login.component.html @@ -0,0 +1,41 @@ +
    + + + Anmelden + Mit Deinem Konto kannst Du hier auf Deine Daten zugreifen. + + +
    + + +
    +
    + +
    + + + + + + + Passwort vergessen? +
    +
    + + Noch kein Konto? + Kein Problem! + +

    Hol Dir einfach ein Konto und registriere Dein Gerät. Dann kannst Du von überall aus auf Deinen Standort und Deine besuchten + Orte zugreifen!

    +
    + + + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/login.component.ts b/web/angular/src/app/views/login.component.ts new file mode 100644 index 0000000..7cffe52 --- /dev/null +++ b/web/angular/src/app/views/login.component.ts @@ -0,0 +1,80 @@ +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; +import { LoginFieldComponent } from '../widgets/login-field.component'; +import { PasswordFieldComponent } from '../widgets/password-field.component'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { MatSnackBar } from '@angular/material'; +import { NgForm } from '@angular/forms'; +import { Snackbars } from '../utils/snackbars'; + +@Component({ + selector: 'login', + templateUrl: './login.component.html', + host: { class:'match-parent' }, +}) +export class LoginComponent implements OnInit, OnDestroy { + + UserState = UserState; + + @ViewChild(LoginFieldComponent) loginField: LoginFieldComponent; + @ViewChild(PasswordFieldComponent) passwordField: PasswordFieldComponent; + @ViewChild("loginForm") loginForm: NgForm; + + login:string; + password:string; + + readonly idle = new BehaviorSubject(false); + + private stateSubscription: Subscription; + private errorSubscription: Subscription; + + constructor(private userService: UserService, private snackbar: MatSnackBar, private router: Router) { + this.login = userService.getLogin(); + } + + ngOnInit(): void { + this.stateSubscription = this.userService.state.subscribe((state)=> { + if (state === UserState.Available) { + this.idle.next(false); + var url = "/notices"; + if (this.userService.redirectUrl != null) { + url = this.userService.redirectUrl; + this.userService.redirectUrl = null; + } + this.router.navigateByUrl(url); + } else { + this.idle.next(state !== UserState.Changing); + this.loginField.disabled=! this.idle.getValue(); + this.loginField.disabled=! this.idle.getValue(); + } + }); + this.errorSubscription = this.userService.error.subscribe((error)=> { + this.password = ""; + if (error.status === HttpStatusCode.FORBIDDEN) { + Snackbars.showError(this.snackbar, "Zugriff verweigert. Prüf Deine Eingaben und versuchs nochmal."); + } else { + Snackbars.showError(this.snackbar, "Fehler bei der Anmeldung (" + error.status + "). Hast Du gerade kein Netz?"); + } + }); + } + + onLogin():void { + this.snackbar.dismiss(); + if (!this.idle || !this.loginForm.valid) return; + this.login = this.loginField.login; + this.password = this.passwordField.password; + this.userService.setUser(this.login, this.password); + this.userService.login(); + } + + ngOnDestroy():void { + this.snackbar.dismiss(); + this.stateSubscription.unsubscribe(); + this.errorSubscription.unsubscribe(); + } + + +} diff --git a/web/angular/src/app/views/manage-log.component.html b/web/angular/src/app/views/manage-log.component.html new file mode 100644 index 0000000..dc29c41 --- /dev/null +++ b/web/angular/src/app/views/manage-log.component.html @@ -0,0 +1,71 @@ + + subject + Logs +
    + + + +
    +
    +
    +
    + + + + + + ID + {{element.id}} + + + Zeit + {{ element.time | date:'shortDate' }} {{ element.time | date:'H:mm:ss.SSS' }} + + + Thread + {{element.thread}} + + + Level + {{ getLevel(element.level) }} + + + Class +
    {{ getClassName(element.className) }}
    +
    + + Method + {{ element.methodName }} + + + Message + {{element.message}} + + + Trace + + + error + + + + + Aktionen + + + + + + +
    + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/manage-log.component.ts b/web/angular/src/app/views/manage-log.component.ts new file mode 100644 index 0000000..56d67e0 --- /dev/null +++ b/web/angular/src/app/views/manage-log.component.ts @@ -0,0 +1,83 @@ +import { Component, OnInit, OnDestroy } from "@angular/core"; +import { BehaviorSubject, Observable } from "rxjs"; +import { DataSource } from "@angular/cdk/table"; +import { LogMessage } from "../../api/models"; +import { CollectionViewer } from "@angular/cdk/collections"; +import { ManageLogService } from "../services/manage-log.service"; +import { LogDialogComponent } from "../widgets/log-dialog.component"; +import { MatDialog } from "@angular/material"; + +@Component({ + selector: 'manage-log', + templateUrl: './manage-log.component.html', + host: { class: 'match-parent' }, +}) +export class ManageLogComponent implements OnInit, OnDestroy { + + displayedColumns = [ 'id', 'time', 'level', 'thread', 'className', 'message', 'trace', 'actions']; + + readonly connecting: BehaviorSubject; + readonly dataSource: DataSource; + connected: boolean; + + constructor(private logService: ManageLogService, private dialog: MatDialog) { + this.connecting = logService.connecting; + this.dataSource = logService; + } + + ngOnInit():void { + this.logService.open(); + this.connected = true; + } + + ngOnDestroy():void { + this.connected = false; + this.logService.close(); + } + + onConnect():void { + this.connected = true; + this.logService.close(); + this.logService.open(); + } + + onDisconnect():void { + this.connected = false; + this.logService.close(); + } + + onClear():void { + this.logService.clear(); + } + + getClassName(name: string) { + let idx = name.lastIndexOf("."); + if (idx == -1) return name; + else return name.substring(idx + 1); + } + + getLevel(level: string) { + if (level == 'ERROR') { + return "error" + } else if (level == 'SEVERE') { + return "error_outline" + } else if (level == 'INFO') { + return "info_outline"; + } else { + return "panorama_fish_eye"; + } + } + + getColor(level: string):string { + if (level == 'ERROR' || level == 'SEVERE') { + return "accent"; + } else { + return null; + } + } + + onShow(message: LogMessage): void { + LogDialogComponent.open(this.dialog, message); + } + +} diff --git a/web/angular/src/app/views/manage-notices.component.html b/web/angular/src/app/views/manage-notices.component.html new file mode 100644 index 0000000..b9651ce --- /dev/null +++ b/web/angular/src/app/views/manage-notices.component.html @@ -0,0 +1,98 @@ +
    + + forum + Hinweise +
    + + +
    +
    +
    + + + + + + + ID + {{element.id}} + + + + Sprachen + + + + + + + + + + + Erstellung + {{element.creationTime | date:'short' }} + + + + Aktualisierung + {{element.modificationTime | date:'short' }} + + + + Ablauf + {{element.expirationTime | date:'short' }} + + + + Titel + {{ getTitle(element) }} + + + + Veröffentlicht + + {{ element.published?"check_box":"check_box_outline_blank" }} + + + + + Push (Min/Max) + + {{ element.announced?"notifications_active":"notifications_none" }} + ({{ element.minimumVersion}}/{{element.maximumVersion}}) + + + + + + + + Aktionen + + + + + + + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/manage-notices.component.ts b/web/angular/src/app/views/manage-notices.component.ts new file mode 100644 index 0000000..2ca4444 --- /dev/null +++ b/web/angular/src/app/views/manage-notices.component.ts @@ -0,0 +1,97 @@ +import {Component, ViewChild, OnInit, OnDestroy} from '@angular/core'; +import {MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar} from '@angular/material'; +import { DeviceService } from '../services/device.service'; +import { Notice, NoticePage } from '../../api/models'; +import { DataSource } from '@angular/cdk/table'; +import { Subscription, BehaviorSubject } from 'rxjs'; +import { PaginationHandler } from '../utils/pagination'; +import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component'; +import { ApiClientService } from '../../api'; +import { Snackbars } from '../utils/snackbars'; +import { ManageUserService } from '../services/manage-user.service'; +import { FormErrorEncoder } from '../utils/formcodes'; +import { NgForm } from '@angular/forms'; +import { ManageNoticeService } from '../services/manage-notice.service'; + +@Component({ + selector: 'manage-notices', + templateUrl: 'manage-notices.component.html', + host: { class:'match-parent' } +}) +export class ManageNoticesComponent extends FormErrorEncoder implements OnInit, OnDestroy { + + readonly languages:{ value:string, title:string}[] = [ + {value:"de", title:"Deutsch"}, + {value:"en", title:"English"}, + {value:"fr", title:"Französisch"}, + {value:"it", title:"Italienisch"}, + {value:"es", title:"Spanisch"}]; + + language: string = "de"; + + displayedColumns = ['id', 'published', 'announced', 'languages', 'title', "creationTime", "expirationTime", "modificationTime", "actions"]; + dataSource: DataSource; + private pageHandler: PaginationHandler; + readonly loading:BehaviorSubject; + + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor( + private mangeNoticeService: ManageNoticeService, + private snackbar: MatSnackBar, + private dialog:MatDialog) { + super(); + this.dataSource = mangeNoticeService; + this.loading = mangeNoticeService.loading; + } + + ngOnInit() { + this.pageHandler = new PaginationHandler(this.paginator, this.mangeNoticeService); + this.mangeNoticeService.reload(); + } + + ngOnDestroy() { + this.pageHandler.destroy(); + } + + getTitle(notice: Notice): string { + for (let m of notice.messages) { + if (m.language == this.language) { + return m.title; + } + } + return ""; + } + + hasLanguage(notice:Notice, lang:string) { + for (let m of notice.messages) { + if (m.language == lang) return true; + } + return false; + } + + + onDelete(notice: Notice):void { + if (this.loading.getValue()) return; + notice.deleted = true; + this.updateNotice(notice); + } + + onRestore(notice: Notice):void { + if (this.loading.getValue()) return; + notice.deleted = false; + this.updateNotice(notice); + } + + private updateNotice(notice:Notice) { + this.mangeNoticeService.setNotice(notice).subscribe((result)=> { + if (result != null) { + Snackbars.showMessage(this.snackbar, "Die Änderung wurde erfolgreich durchgeführt.", Snackbars.DURATION_SHORT); + } else { + Snackbars.showError(this.snackbar, "Die Änderung konnte nicht durchgeführt werden.") + } + }); + + } + +} \ No newline at end of file diff --git a/web/angular/src/app/views/manage-system.component.html b/web/angular/src/app/views/manage-system.component.html new file mode 100644 index 0000000..8ba97db --- /dev/null +++ b/web/angular/src/app/views/manage-system.component.html @@ -0,0 +1,176 @@ +
    + + equalizer + System + +
    + + + Auslastung + Zeigt die durchschnittliche CPU-Auslastung der letzten Minute an. + + + +
    + +
    +
    + + +
    + Betriebszeit + {{ getUptime(load.uptime) }} +
    +
    +
    +
    +
    + + Speicher + Zeigt den genutzen Haldenspeicher zum Zeitpunkt der Anfrage an. + + +
    + +
    +
    + + +
    + Maximale Haldengröße + {{ getMemory(load.maxHeapSize) }} +
    +
    +
    +
    +
    +
    +
    + + + Ausstattung + Zeigt die Hardware- und Softwareausstattung des Rechners an. + + + + +

    + computer Betriebssystem

    + + Name + {{ system.osName }} + + + + Architektur + {{ system.osArchitecture }} + + + + Version + {{ system.osVersion }} + +

    + widgets Java Virtual Machine

    + + Name + {{ system.vmName }} + + + + Spezifikation + {{ system.vmSpecification }} + + + + Hersteller + {{ system.vmVendor }} + + + + Version + {{ system.vmVersion }} + + +

    + delete Garbage Collector

    + + Ausführungen + {{ load.gcCount }} + + + + Dauer + {{ load.gcDuration }} ms + +
    +

    + power_settings_new Rechenleistung

    + + Prozessoren + {{ system.processors }} + +
    +
    + +
    +
    + + Datenbestand + Zeigt die vorhandenen Datenbankeinträge für alle Entitäten an. + + + + + + + + Entität + {{element.name}} + + + + +
    Summe
    +
    + +
    {{ element.total }}
    +
    +
    + + + +
    Aktiv
    +
    + +
    {{ element.total - element.deleted }}
    +
    +
    + + + + +
    Gelöscht
    +
    + +
    {{ element.deleted }}
    +
    +
    + + + +
    + +
    +
    +
    + +
    + +
    +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/manage-system.component.ts b/web/angular/src/app/views/manage-system.component.ts new file mode 100644 index 0000000..9897076 --- /dev/null +++ b/web/angular/src/app/views/manage-system.component.ts @@ -0,0 +1,140 @@ +import { Component, OnInit, OnDestroy } from "@angular/core"; +import { SystemStatistic, EntityStatistic, LoadStatistic } from "../../api/models"; +import { ApiClientService } from "../../api"; +import { Subscription, Observable, BehaviorSubject } from "rxjs"; +import { DataSource } from "@angular/cdk/table"; +import { CollectionViewer } from "@angular/cdk/collections"; + +@Component({ + selector: 'manage-system', + templateUrl: './manage-system.component.html', + host: { class: 'match-parent' }, +}) +export class ManageSystemComponent implements OnInit, OnDestroy { + + private static readonly TIMEOUT_ERROR = 10000; + private static readonly TIMEOUT_LOAD = 5000; + private static readonly TIMEOUT_ENTITY = 60000; + + system: SystemStatistic; + readonly entities = new EntityDataSource(); + load: LoadStatistic; + + private loadSubscription: Subscription; + private entitySubscription: Subscription; + private systemSubscription: Subscription; + + private loadTimer:any = null; + private entityTimer: any = null; + private systemTimer: any = null; + + constructor(private apiClientService: ApiClientService) { } + + ngOnInit() { + this.loadSubscription = this.updateLoad(); + this.entitySubscription = this.updateEntities(); + this.systemSubscription = this.updateSystem(); + } + + ngOnDestroy() { + this.loadSubscription.unsubscribe(); + this.entitySubscription.unsubscribe(); + this.systemSubscription.unsubscribe(); + if (this.loadTimer != null) clearTimeout(this.loadTimer); + if (this.entityTimer != null) clearTimeout(this.entityTimer); + if (this.systemTimer != null) clearTimeout(this.systemTimer); + } + + hasEntities():boolean { + return this.entities.entities.getValue().length == 0; + } + + private updateLoad(): Subscription { + return this.apiClientService.getLoadStatistic().subscribe((result)=>{ + this.load = result.body; + this.loadTimer = setTimeout(()=>this.loadSubscription = this.updateLoad(),ManageSystemComponent.TIMEOUT_LOAD); + },(error)=>{ + this.loadTimer = setTimeout(()=>this.loadSubscription = this.updateLoad(),ManageSystemComponent.TIMEOUT_ERROR); + }); + } + + private updateEntities(): Subscription { + return this.apiClientService.getEntityStatistics().subscribe((result)=>{ + this.entities.entities.next(result.body); + this.entityTimer = setTimeout(()=>this.entitySubscription = this.updateEntities(), ManageSystemComponent.TIMEOUT_ENTITY); + }, (error)=>{ + this.entityTimer = setTimeout(()=>this.entitySubscription = this.updateEntities(), ManageSystemComponent.TIMEOUT_ERROR); + }); + } + + private updateSystem(): Subscription { + return this.apiClientService.getSystemStatistic().subscribe((result)=>{ + this.system = result.body; + }, (error)=> { + this.systemTimer = setTimeout(()=>this.systemSubscription = this.updateSystem(), ManageSystemComponent.TIMEOUT_ERROR); + }); + } + + canGetCpuLoad(): boolean { + return this.system != null && this.load != null; + } + + getCpuLoad():number { + return (this.load.cpuLoad / Math.max(1, this.system.processors) * 100) + } + + getMemory(bytes: number):string { + let megabytes = Math.floor(bytes / (1024*1024)); + let gb = Math.floor(megabytes / 1000); + let mb = megabytes - (gb * 1000); + var memory = ""; + if (gb > 0) { + memory += gb + (gb==1?" Gigabyte ":" Gigabytes "); + } + memory += mb + (mb==1?" Megabyte":" Megabytes"); + return memory; + } + + getUptime(uptime:number):string { + let time = this.getTime(uptime); + var result = ""; + if (time.d > 0) { + result += time.d + (time.d>1?" Tage ":" Tag "); + } + if (time.d > 0 || time.h > 0) { + result += time.h + (time.h==1?" Stunde ":" Stunden "); + } + if (time.d > 0 || time.h > 0 || time.m > 0) { + result += time.m + (time.m==1?" Minute ":" Minuten "); + } + result += time.s + (time.s==1?" Sekunde":" Sekunden"); + return result; + } + + private getTime(ms:number): {d:number, h:number, m: number, s: number} { + var d, h, m, s; + s = Math.floor(ms / 1000); + m = Math.floor(s / 60); + s = s % 60; + h = Math.floor(m / 60); + m = m % 60; + d = Math.floor(h / 24); + h = h % 24; + return { d: d, h: h, m: m, s: s }; + } + + +} + +class EntityDataSource implements DataSource { + + entities = new BehaviorSubject([]); + + connect(collectionViewer: CollectionViewer): Observable { + return this.entities; + } + disconnect(collectionViewer: CollectionViewer): void { + // do nothing + } + +} \ No newline at end of file diff --git a/web/angular/src/app/views/manage-users.component.html b/web/angular/src/app/views/manage-users.component.html new file mode 100644 index 0000000..c39c266 --- /dev/null +++ b/web/angular/src/app/views/manage-users.component.html @@ -0,0 +1,108 @@ +
    + + people + Nutzer +
    +
    +
    + + + + + Ein Suchbegriff ist erforderlich. + Dein Suchbegriff enthält ein ungültiges Zeichen. + + + +
    +
    + +
    + +
    +
    + + + + + + + ID + {{element.id}} + + + + Typ + + + security + + + face + + + + + + Kontonname + {{ element.login }} + + + + Emailadresse + {{ getCorrespondence(element) }} + + + + Nutzername + {{element.name}} + + + + Registrierung + {{element.creationTime | date:'short' }} + + + + Aktualisierung + {{element.modificationTime | date:'short' }} + + + Aktionen + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/manage-users.component.ts b/web/angular/src/app/views/manage-users.component.ts new file mode 100644 index 0000000..cab9d6c --- /dev/null +++ b/web/angular/src/app/views/manage-users.component.ts @@ -0,0 +1,118 @@ +import {Component, ViewChild, OnInit, OnDestroy} from '@angular/core'; +import {MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar} from '@angular/material'; +import { DeviceService } from '../services/device.service'; +import { Device, DevicePage, User, UserPage } from '../../api/models'; +import { DataSource } from '@angular/cdk/table'; +import { Subscription, BehaviorSubject } from 'rxjs'; +import { PaginationHandler } from '../utils/pagination'; +import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component'; +import { ApiClientService } from '../../api'; +import { Snackbars } from '../utils/snackbars'; +import { ManageUserService } from '../services/manage-user.service'; +import { FormErrorEncoder } from '../utils/formcodes'; +import { NgForm } from '@angular/forms'; +import { UserRole, UserService } from '../services/user.service'; + +@Component({ + selector: 'manage-users', + templateUrl: 'manage-users.component.html', + host: { class:'match-parent' } +}) +export class ManageUsersComponent extends FormErrorEncoder implements OnInit, OnDestroy{ + + @ViewChild('searchForm') searchForm:NgForm; + + displayedColumns = ['type', 'id', 'login', 'name', 'email', "creationTime", "modificationTime", "actions"]; + dataSource: DataSource; + private pageHandler: PaginationHandler; + readonly loading:BehaviorSubject; + term: string; + + + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor( + private apiClientService: ApiClientService, + private userService: UserService, + private manageUserService: ManageUserService, + private snackbar: MatSnackBar, + private dialog:MatDialog) { + super(); + this.dataSource = manageUserService; + this.loading = manageUserService.loading; + this.term = manageUserService.getTerm(); + } + + ngOnInit() { + this.pageHandler = new PaginationHandler(this.paginator, this.manageUserService); + this.manageUserService.reload(); + } + + ngOnDestroy() { + this.pageHandler.destroy(); + } + + getCorrespondence(user: User):string { + for (let email of user.emails) { + if (email.correspondence) return email.address; + } + return null; + } + + onSearch():void { + if (this.searchForm.invalid || this.loading.getValue()) return; + this.manageUserService.setTerm(this.term); + } + + isAdmin(user: User):boolean { + for (let r of user.roles) { + if (r == UserRole.Admin) return true; + } + return false; + } + + isSelf(user: User):boolean { + return user.id === this.userService.user.getValue().id; + } + + onDelete(user: User):void { + if (this.loading.getValue()) return; + user.deleted = true; + this.updateUser(user); + } + + onRestore(user: User):void { + if (this.loading.getValue()) return; + user.deleted = false; + this.updateUser(user); + } + + makeAdmin(user: User):void { + if (this.loading.getValue()) return; + let i = user.roles.indexOf(UserRole.Admin); + if (i != -1) return; + user.roles.push(UserRole.Admin); + this.updateUser(user); + } + + makeUser(user: User): void { + if (this.loading.getValue()) return; + let i = user.roles.indexOf(UserRole.Admin); + if (i == -1) return; + user.roles.splice(i, 1); + this.updateUser(user); + } + + + private updateUser(user:User) { + this.manageUserService.setUser(user).subscribe((result)=> { + if (result) { + Snackbars.showMessage(this.snackbar, "Die Kontoänderung wurde erfolgreich durchgeführt.", Snackbars.DURATION_SHORT); + } else { + Snackbars.showError(this.snackbar, "Die Kontoänderung konnte nicht durchgeführt werden.") + } + }); + + } + +} \ No newline at end of file diff --git a/web/angular/src/app/views/notices.component.html b/web/angular/src/app/views/notices.component.html new file mode 100644 index 0000000..4990f4c --- /dev/null +++ b/web/angular/src/app/views/notices.component.html @@ -0,0 +1,20 @@ + +
    + +
    +
    + +
    + + message + Neues + +
    + + + + + +
    +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/notices.component.ts b/web/angular/src/app/views/notices.component.ts new file mode 100644 index 0000000..8a8d12e --- /dev/null +++ b/web/angular/src/app/views/notices.component.ts @@ -0,0 +1,43 @@ +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; +import { LoginFieldComponent } from '../widgets/login-field.component'; +import { PasswordFieldComponent } from '../widgets/password-field.component'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { MatSnackBar } from '@angular/material'; +import { NgForm } from '@angular/forms'; +import { Snackbars } from '../utils/snackbars'; +import { NoticeService } from '../services/notice.service'; +import { NoticePage, Notice } from '../../api/models'; + +@Component({ + selector: 'notices', + templateUrl: './notices.component.html', + host: { class: 'match-parent' }, +}) +export class NoticesComponent implements OnInit { + + loading: BehaviorSubject = new BehaviorSubject(true); + page: BehaviorSubject; + language: string = "de"; + + constructor(private noticeService: NoticeService) { + this.page = noticeService.page; + this.loading = noticeService.loading; + } + + ngOnInit() { + this.noticeService.reload(); + } + + canShow(notice: Notice, language: String) { + for (let m of notice.messages) { + if (m.language === language) return true; + } + console.dir(notice); + return false; + } + +} diff --git a/web/angular/src/app/views/pages/login/login.component.html b/web/angular/src/app/views/pages/login/login.component.html deleted file mode 100755 index 8efb671..0000000 --- a/web/angular/src/app/views/pages/login/login.component.html +++ /dev/null @@ -1,62 +0,0 @@ -
    -
    -
    -
    -
    -
    -
    -

    Login

    -

    In Account einloggen

    -
    - - -
    - -
    -
    - Bitte Loginnamen eingeben -
    -
    - -
    - - -
    - -
    -
    - Bitte Passwort eingeben -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - - Lädt -
    -
    -
    -
    -
    -
    -
    -

    Registrieren

    -

    Wenn du deine Statistiken oder die von dir besuchten Orte sehen möchtest registriere dich

    - -
    -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/pages/login/login.component.ts b/web/angular/src/app/views/pages/login/login.component.ts deleted file mode 100755 index 95cef65..0000000 --- a/web/angular/src/app/views/pages/login/login.component.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; -import { ConsoleService } from '../../../console.service'; -import { AuthService, AuthState } from '../../../auth.service'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import {User} from "../../../../api/models/user.model"; -import { Router } from '@angular/router'; - -@Component({ - templateUrl: 'login.component.html' -}) -export class LoginComponent implements OnInit { - /** - * This is dumb but since the template does not know AuthState, we cannot use it in html, - * e.g. to select upon the enum's value in an ngSwitch directive. As a workaround, we can - * define a field pointing to the enum. Thus, we can reference the enum through the field. - * If we use the same name, it looks even somewhat ok in html. - * - * See https://www.gurustop.net/blog/2016/05/24/how-to-use-typescript-enum-with-angular2/ - */ - AuthState = AuthState; - - login: string; - password: string; - - constructor(private consoleService: ConsoleService, private authService: AuthService, private router: Router) { } - - ngOnInit() { - this.login = this.authService.getLogin(); - } - - - getUser(): BehaviorSubject { - return this.authService.user; - } - - getAuthState(): BehaviorSubject { - return this.authService.state; - } - - getError(): BehaviorSubject { - return this.authService.error; - } - - requestLogin(): void { - this.authService.setCredential(this.login, this.password); - this.authService.requestLogin(); - } - - requestLogout(): void { - this.authService.requestLogout(); - this.login = null; - this.password = null; - } - - registerButton() { - this.router.navigate(['/pages/register']); - } - - forgotPassword() { - this.router.navigate(['/pages/reset']); - } - - loginOnEnter($event: KeyboardEvent): void { - if($event.keyCode===13){ - this.requestLogin(); - } - } -} - diff --git a/web/angular/src/app/views/pages/register/register.component.html b/web/angular/src/app/views/pages/register/register.component.html deleted file mode 100755 index 4b7233c..0000000 --- a/web/angular/src/app/views/pages/register/register.component.html +++ /dev/null @@ -1,87 +0,0 @@ -
    -
    -
    -
    -
    -
    -

    Registrieren

    -

    Account erstellen

    - -
    - - -
    -
    -
    - Namen angeben -
    -
    - Nur Buchstaben und Leerzeichen erlaubt. (max. 64 Zeichen) -
    -
    - -
    - - -
    -
    -
    - Bitte Loginnamen angeben -
    -
    - Nur Buchstaben und Zahlen erlaubt. (min. 5 und max. 32 Zeichen) -
    -
    - -
    - @ - -
    -
    -
    - Bitte Email-Adresse angeben -
    -
    - Falsches Format (z.B. max@mustermann.de) -
    -
    - -
    - - -
    -
    -
    - Bitte Passwort angeben -
    -
    - Password muss Groß- und Kleinbuchstaben, eine Zahl enhalten und muss mindestens 8 Zeichen lang sein -
    -
    - -
    - - -
    - -
    - -
    -
    -

    - - Lädt... -

    -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/pages/register/register.component.ts b/web/angular/src/app/views/pages/register/register.component.ts deleted file mode 100755 index 485ac66..0000000 --- a/web/angular/src/app/views/pages/register/register.component.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { Component } from '@angular/core'; -import {ConsoleService} from "../../../console.service"; -import {ApiClientService} from "../../../../api/index"; -import {UserRegistration} from "../../../../api/models/userregistration.model"; -import { Router } from '@angular/router'; -import { Subject } from 'rxjs/Subject'; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - templateUrl: 'register.component.html' -}) -export class RegisterComponent { - - public loading: boolean = false; - public isRegistered: boolean = false; - - name: string; - email: string; - login: string; - password: string; - - error: Subject = new Subject(); - - constructor(private consoleService: ConsoleService, - private apiClientService:ApiClientService, - private router: Router, - private helperService:HelperService) { } - - ngOnInit() { - } - - getError(): Subject { - return this.error; - } - - hasReload(): boolean { - return (!this.loading); - } - - registerUser(): void { - this.loading = true; - const user:UserRegistration = { - name: this.name, - email: this.email, - login: this.login, - password: this.password - }; - - this.consoleService.log("User registration with name" + user.name + " requested."); - this.error.next(null); - - this.apiClientService.registerUser(user).subscribe(result => { - this.consoleService.log("User registration received."); - this.loading = false; - this.isRegistered = true; - this.router.navigate(['/pages/login']); - return user; - }, error => { - this.consoleService.log("Error during register user."); - this.helperService.handleError(error); - this.loading = false; - }); - } - - loginButton() { - this.router.navigate(['/pages/login']); - } -} diff --git a/web/angular/src/app/views/pages/reset-password-email/reset-password-email.component.html b/web/angular/src/app/views/pages/reset-password-email/reset-password-email.component.html deleted file mode 100644 index d6e5a2e..0000000 --- a/web/angular/src/app/views/pages/reset-password-email/reset-password-email.component.html +++ /dev/null @@ -1,38 +0,0 @@ -
    -
    -
    -
    -
    -
    -

    Passwort vergessen?

    -

    Loginnamen eingeben um das Passwort zurückzusetzen

    Ein Link zum Zurücksetzen deines Passworts wird an deine Email-Adresse gesendet

    -
    - - -
    -
    -
    - Bitte Loginnamen eingeben -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -

    - - Lädt... -

    -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/pages/reset-password-email/reset-password-email.component.ts b/web/angular/src/app/views/pages/reset-password-email/reset-password-email.component.ts deleted file mode 100644 index 4825f6a..0000000 --- a/web/angular/src/app/views/pages/reset-password-email/reset-password-email.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Component } from '@angular/core'; -import {ConsoleService} from "../../../console.service"; -import {ApiClientService} from "../../../../api/index"; -import { Router } from '@angular/router'; -import { Subject } from 'rxjs/Subject'; -import {HttpErrorResponse} from "@angular/common/http"; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - templateUrl: 'reset-password-email.component.html' -}) -export class ResetPasswordEmailComponent { - - public loading: boolean = false; - login: string; - - error: Subject = new Subject(); - - constructor(private consoleService: ConsoleService, - private apiClientService:ApiClientService, - private router: Router, - private helperService:HelperService) { } - - ngOnInit() { - } - - getError(): Subject { - return this.error; - } - - hasReload(): boolean { - return (!this.loading); - } - - resetPassword(): void { - this.loading = true; - this.consoleService.log("Password reset from User '" + this.login + "' requested."); - this.error.next(null); - - const text:string = this.login; - - this.apiClientService.resetUser(text).subscribe(result => { - this.consoleService.log("Password reset received."); - this.loading = false; - this.router.navigate(['/pages/login']); - }, error => { - this.consoleService.log("Error during reset password."); - this.helperService.handleError(error); - this.loading = false; - }); - } - - backToLogin() { - this.router.navigate(['/pages/login']); - } -} diff --git a/web/angular/src/app/views/pages/reset-password/reset-password.component.html b/web/angular/src/app/views/pages/reset-password/reset-password.component.html deleted file mode 100644 index 535079a..0000000 --- a/web/angular/src/app/views/pages/reset-password/reset-password.component.html +++ /dev/null @@ -1,52 +0,0 @@ -
    -
    -
    -
    -
    -
    -

    Reset Password

    -

    Enter your new password

    - - -
    - - -
    -
    -
    - Please provide your password. -
    -
    - -
    - - -
    -
    -
    - Please provide your password. -
    -
    -
    -
    - Your password and confirmation password do not match. -
    -
    -
    - - -
    -
    -
    -
    -

    - - Loading... -

    -
    -
    -
    -
    -
    -
    -
    diff --git a/web/angular/src/app/views/pages/reset-password/reset-password.component.ts b/web/angular/src/app/views/pages/reset-password/reset-password.component.ts deleted file mode 100644 index 5f79956..0000000 --- a/web/angular/src/app/views/pages/reset-password/reset-password.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component } from '@angular/core'; -import {ConsoleService} from "../../../console.service"; -import {ApiClientService} from "../../../../api/index"; -import {Router, ActivatedRoute} from '@angular/router'; -import { Subject } from 'rxjs/Subject'; -import {UserPassword} from "../../../../api/models/userpassword.model"; -import { ToastService } from '../../../toast.service'; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - templateUrl: 'reset-password.component.html' -}) -export class ResetPasswordComponent { - - public loading: boolean = false; - token:string; - password: string; - passwordConfirm: string; - - error: Subject = new Subject(); - - constructor(private consoleService: ConsoleService, - private apiClientService:ApiClientService, - private router: Router, - private route: ActivatedRoute, - private toastService: ToastService, - private helperService:HelperService) { } - - ngOnInit() { - // Fetch token from url - this.token = this.route.snapshot.paramMap.get('token'); - } - - getError(): Subject { - return this.error; - } - - hasReload(): boolean { - return (!this.loading); - } - - resetPassword(): void { - this.loading = true; - this.toastService.showSuccess("Passwort zurücksetzen", "Bitte schaue in deine Emails"); - this.error.next(null); - const userPassword: UserPassword = { password : this.password }; - this.apiClientService.resetUserPassword(this.token, userPassword).subscribe(result => { - this.consoleService.log("Password reset received."); - this.loading = false; - this.router.navigate(['/pages/login']); - }, error => { - this.consoleService.log("Error during reset password."); - this.helperService.handleError(error); - this.loading = false; - }); - } -} - diff --git a/web/angular/src/app/views/pages/verify-email/verify-email.component.html b/web/angular/src/app/views/pages/verify-email/verify-email.component.html deleted file mode 100755 index 0723d93..0000000 --- a/web/angular/src/app/views/pages/verify-email/verify-email.component.html +++ /dev/null @@ -1,39 +0,0 @@ -
    -
    -
    -
    - - -
    -

    Herzlich willkommen bei Maptology!

    - -

    Deine Email wurde erfolgreich verifiziert!

    -

    Sie werden in Kürze zum Login weitergeleitet...

    -
    - - -
    -

    403

    -

    Oops! Token nicht gültig.

    -

    {{errorMessage}}

    -
    - - -
    -
    -

    - - Loading... -

    -
    -
    - -
    -
    -
    -
    - - - - - diff --git a/web/angular/src/app/views/pages/verify-email/verify-email.component.scss b/web/angular/src/app/views/pages/verify-email/verify-email.component.scss deleted file mode 100755 index e69de29..0000000 diff --git a/web/angular/src/app/views/pages/verify-email/verify-email.component.spec.ts b/web/angular/src/app/views/pages/verify-email/verify-email.component.spec.ts deleted file mode 100755 index 342dfb0..0000000 --- a/web/angular/src/app/views/pages/verify-email/verify-email.component.spec.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { VerifyEmailComponent } from './verify-email.component'; - -import { AuthService } from '../auth.service'; -import { ConsoleService } from '../console.service'; -import { ApiClientService } from '../../api/index'; - -import { HttpClientModule } from '@angular/common/http'; - - -describe('VerifyEmailComponent', () => { - let component: VerifyEmailComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ - VerifyEmailComponent - ], - imports: [ - HttpClientModule - ], - providers: [ - AuthService, - ConsoleService, - ApiClientService - ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(VerifyEmailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/web/angular/src/app/views/pages/verify-email/verify-email.component.ts b/web/angular/src/app/views/pages/verify-email/verify-email.component.ts deleted file mode 100755 index 554f650..0000000 --- a/web/angular/src/app/views/pages/verify-email/verify-email.component.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Component, OnInit, ViewEncapsulation } from '@angular/core'; -import {ActivatedRoute, Router} from "@angular/router"; -import {ConsoleService} from "../../../console.service"; -import {ApiClientService} from "../../../../api/index"; -import {HelperService} from "../../../Utils/helper.service"; - -@Component({ - selector: 'app-verify-email', - templateUrl: 'verify-email.component.html', - styleUrls: ['verify-email.component.scss'], - encapsulation: ViewEncapsulation.None -}) -export class VerifyEmailComponent implements OnInit { - token:string; - public loading: boolean = false; - errorMessage: string; - verified:boolean = false; - - constructor(private consoleService: ConsoleService, - private route: ActivatedRoute, - private apiClientService:ApiClientService, - private router: Router) { } - - ngOnInit() { - // Fetch token from url - this.token = this.route.snapshot.paramMap.get('token'); - this.verifyEmail(); - } - - verifyEmail() { - this.loading = true; - this.apiClientService.verifyUserEmail(this.token).subscribe(result => { - this.consoleService.log("Email verification received."); - this.verified = true; - this.loading = false; - setTimeout(() => { - this.router.navigate(['/pages/login']); - }, 3000); - }, error => { - this.consoleService.log(error); - this.loading = false; - this.verified = false; - this.errorMessage = "Entweder ist der Token falsch eingegeben oder der Token ist nicht mehr gütlig"; - }); - } -} diff --git a/web/angular/src/app/views/place-visits.component.html b/web/angular/src/app/views/place-visits.component.html new file mode 100644 index 0000000..6d2de0a --- /dev/null +++ b/web/angular/src/app/views/place-visits.component.html @@ -0,0 +1,92 @@ + + + + + + placeOrt + +
    + ID + {{ id }} +
    + +
    + Bezeichnung + {{ p.name }} +
    +
    + Adresse + {{ p.address }} +
    +
    + Längengrad + {{ p.coordinate.latitude | number:'1.5-5' }} +
    +
    + Breitengrad + {{ p.coordinate.latitude | number:'1.5-5' }} +
    +
    + + + + + + + + +
    + + + + beenhereBesuche + + + + + + + ID + {{element.id}} + + + + Beginn + {{element.beginTime | date:'short' }} + + + + Ende + {{element.endTime | date:'short' }} + + + + Gerät + {{ element.device }} + + + + Aktionen + + + + + + + + + + + + + + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/place-visits.component.ts b/web/angular/src/app/views/place-visits.component.ts new file mode 100644 index 0000000..12b72e5 --- /dev/null +++ b/web/angular/src/app/views/place-visits.component.ts @@ -0,0 +1,104 @@ +import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit } from "@angular/core"; +import { ApiClientService } from "../../api"; +import { MatDialog, MatSnackBar, MatPaginator } from "@angular/material"; +import { ActivatedRoute, Router } from "@angular/router"; +import { MessageDialogComponent } from "../widgets/message-dialog.component"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; +import { Subscription, BehaviorSubject } from "rxjs"; +import { Device, Location, Place, VisitPage, Visit } from "../../api/models"; +import { Snackbars } from "../utils/snackbars"; +import * as L from 'leaflet'; +import { TileMapComponent } from "../widgets/tile-map.component"; +import { MarkerMapComponent } from "../widgets/marker-map.component"; +import { PlaceVisitService } from "../services/place-visit.service"; +import { Page, PaginationHandler } from "../utils/pagination"; +import { ConfirmationDialogComponent } from "../widgets/confirmation-dialog.component"; + +@Component({ + selector: 'place-visits', + templateUrl: './place-visits.component.html', + host: { class:'match-parent' }, + }) + export class PlaceVisitsComponent implements OnInit, AfterViewInit, OnDestroy { + + @ViewChild(MarkerMapComponent) map: MarkerMapComponent; + @ViewChild(MatPaginator) paginator: MatPaginator; + + displayedColumns = [ 'device', 'start', 'end', 'actions']; + + id: string; + readonly loading: BehaviorSubject; + readonly place: BehaviorSubject; + readonly page: BehaviorSubject; + readonly deleting = new BehaviorSubject(false); + private paginationHandler: PaginationHandler; + private placeSubscription: Subscription; + + + constructor( + private apiClientService: ApiClientService, + private snackbar: MatSnackBar, + private dialog: MatDialog, + protected placeService: PlaceVisitService, + private route: ActivatedRoute + ) { + this.loading = placeService.loading; + this.page = placeService.page; + this.place = placeService.place; + } + + reloadPlace() { + this.placeService.setPlace(null); + this.placeService.setPlace(+this.id); + } + + ngOnInit() { + this.id = this.route.snapshot.paramMap.get("id"); + this.placeService.setPlace(+this.id); + this.paginationHandler = new PaginationHandler(this.paginator, this.placeService); + } + + ngAfterViewInit() { + this.placeSubscription = this.place.subscribe((place)=> { + if (place) { + this.map.setPinPosition(place.coordinate); + } else { + this.map.setPinPosition(null); + } + }); + } + + ngOnDestroy() { + this.paginationHandler.destroy(); + this.placeSubscription.unsubscribe(); + } + + onDelete(id:number):void { + ConfirmationDialogComponent.open(this.dialog, { + title:"Besuch löschen?", + message:"Möchtest Du den Besuch wirklich löschen? Diesen Vorgang kannst Du nicht mehr rückgängig machen.", + positive: "Ja", + negative: "Nein" + }).subscribe((result) => { + if (result != null && result.confirmed) { + this.doDelete(id); + } + }); + } + + private doDelete(id:number):void { + this.deleting.next(true); + this.apiClientService.deleteVisit(id).subscribe((result) => { + this.deleting.next(false); + this.placeService.reload(); + Snackbars.showMessage(this.snackbar, "Der Besuch wurde erfolgreich gelöscht.", Snackbars.DURATION_SHORT); + }, (error) => { + this.deleting.next(false); + this.placeService.reload(); + Snackbars.showError(this.snackbar, "Der Besuch konnte nicht gelöscht werden. Hast Du gerade kein Netz?"); + }) + } + + } + \ No newline at end of file diff --git a/web/angular/src/app/views/places.component.html b/web/angular/src/app/views/places.component.html new file mode 100644 index 0000000..9495f05 --- /dev/null +++ b/web/angular/src/app/views/places.component.html @@ -0,0 +1,62 @@ +
    + + pie_chart_outlined + Orte + +
    + + + + + + ID + {{element.id}} + + + Adresse + {{element.address}} + + + Name + {{element.nickname}} + + + Längengrad + {{element.coordinate.longitude | number:'1.5-5' }} + + + Breitengrad + {{element.coordinate.latitude | number:'1.5-5' }} + + + Erstellung + {{element.creationTime | date:'short' }} + + + Änderung + {{element.modificationTime | date:'short'}} + + + Aktionen + + + + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/places.component.ts b/web/angular/src/app/views/places.component.ts new file mode 100644 index 0000000..b35e51a --- /dev/null +++ b/web/angular/src/app/views/places.component.ts @@ -0,0 +1,87 @@ +import {Component, ViewChild, OnInit, OnDestroy} from '@angular/core'; +import {MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar} from '@angular/material'; +import { Privilege, PrivilegePage, PlacePage, Place } from '../../api/models'; +import { DataSource } from '@angular/cdk/table'; +import { Subscription, BehaviorSubject } from 'rxjs'; +import { PaginationHandler } from '../utils/pagination'; +import { PlaceService } from '../services/place.service'; +import { NicknameDialogComponent } from '../widgets/nickname-dialog.component'; +import { ConfirmationDialogComponent } from '../widgets/confirmation-dialog.component'; +import { ApiClientService } from '../../api'; +import { Snackbars } from '../utils/snackbars'; + +@Component({ + selector: 'places', + templateUrl: 'places.component.html', + host: { class:'match-parent' } +}) +export class PlacesComponent implements OnInit, OnDestroy{ + + displayedColumns = ['id', 'address', 'nickname', 'longitude', 'latitude', 'creationTime', "modificationTime", "actions"]; + dataSource: DataSource; + loading: BehaviorSubject; + deleting = new BehaviorSubject(false); + private pageHandler: PaginationHandler; + + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor( + private apiClientService: ApiClientService, + private placeService: PlaceService, + private snackbar: MatSnackBar, + private dialog: MatDialog) { + this.dataSource = placeService; + this.loading = placeService.loading; + } + + ngOnInit() { + this.pageHandler = new PaginationHandler(this.paginator, this.placeService); + this.placeService.reload(); + } + + ngOnDestroy() { + this.pageHandler.destroy(); + } + + onRename(id: number) { + if (this.loading.getValue()) return; + let p = this.placeService.page.getValue(); + for (let place of p.elements) { + if (place.id === id) { + NicknameDialogComponent.open(this.dialog, place).subscribe((result)=>{ + if (result) this.placeService.reload(); + }); + break; + } + } + } + + onDelete(id:number):void { + ConfirmationDialogComponent.open(this.dialog, { + title:"Ort löschen?", + message:"Möchtest Du den Ort wirklich löschen? Dieser Vorgang löscht auch alle Besuche an diesem Ort und Du kannst ihn nicht mehr rückgängig machen.", + positive: "Ja", + negative: "Nein" + }).subscribe((result) => { + if (result != null && result.confirmed) { + this.doDelete(id); + } + }); + } + + private doDelete(id:number):void { + this.deleting.next(true); + this.apiClientService.deletePlace(id).subscribe((result) => { + this.deleting.next(false); + this.placeService.reload(); + Snackbars.showMessage(this.snackbar, "Der Ort wurde erfolgreich gelöscht.", Snackbars.DURATION_SHORT); + }, (error) => { + this.deleting.next(false); + this.placeService.reload(); + Snackbars.showError(this.snackbar, "Der Ort konnte nicht gelöscht werden. Hast Du gerade kein Netz?"); + }) + } + + + +} \ No newline at end of file diff --git a/web/angular/src/app/views/privileges.component.html b/web/angular/src/app/views/privileges.component.html new file mode 100644 index 0000000..53a6466 --- /dev/null +++ b/web/angular/src/app/views/privileges.component.html @@ -0,0 +1,68 @@ +
    + + share + Freigaben +
    + +
    + +
    +
    + + + + + + + ID + {{element.id}} + + + + Schlüssel + {{element.token}} + + + + Erstellung + {{element.creationTime | date:'short' }} + + + + Nachricht + {{element.shareInfo.message}} + + + + Ziel + {{element.shareInfo.destination}} + + + + Ablauf + {{element.shareInfo.expirationTime | date:'short'}} + + + + Aktionen + + + + + + + + + + + + +
    + +
    \ No newline at end of file diff --git a/web/angular/src/app/views/privileges.component.ts b/web/angular/src/app/views/privileges.component.ts new file mode 100644 index 0000000..f4b195f --- /dev/null +++ b/web/angular/src/app/views/privileges.component.ts @@ -0,0 +1,103 @@ +import { Component, ViewChild, OnInit, OnDestroy } from '@angular/core'; +import { MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar } from '@angular/material'; +import { PrivilegeService } from '../services/privilege.service'; +import { Privilege, PrivilegePage } from '../../api/models'; +import { DataSource } from '@angular/cdk/table'; +import { Subscription, BehaviorSubject } from 'rxjs'; +import { PaginationHandler } from '../utils/pagination'; +import { ShareDialogComponent } from '../widgets/share-dialog.component'; +import { ConfirmationDialogComponent } from '../widgets/confirmation-dialog.component'; +import { ApiClientService } from '../../api'; +import { Snackbars } from '../utils/snackbars'; +import { ActivatedRoute, Route, Router } from '@angular/router'; + +@Component({ + selector: 'privileges', + templateUrl: 'privileges.component.html', + host: { class: 'match-parent' } +}) +export class PrivilegesComponent implements OnInit, OnDestroy { + + displayedColumns = ['id', 'token', 'creationTime', 'message', 'destination', "expirationTime", "actions"]; + dataSource: DataSource; + private pageHandler: PaginationHandler; + readonly deleting = new BehaviorSubject(false); + readonly loading:BehaviorSubject; + + private addSubscription: Subscription; + + @ViewChild(MatPaginator) paginator: MatPaginator; + + constructor( + private apiClientService: ApiClientService, + private privilegeService: PrivilegeService, + private router: Router, + private activatedRoute: ActivatedRoute, + private snackbar: MatSnackBar, + private dialog: MatDialog + ) { + this.loading = privilegeService.loading; + this.dataSource = privilegeService; + } + + ngOnInit() { + console.log("init"); + let token = this.activatedRoute.snapshot.paramMap.get("add"); + this.pageHandler = new PaginationHandler(this.paginator, this.privilegeService); + this.privilegeService.reload(); + if (token != null) { + this.router.navigate(["/privileges"], { replaceUrl: true }); + this.addSubscription = this.privilegeService.loading.subscribe((value)=> { + if (!value) { + this.onAdd(token); + this.addSubscription.unsubscribe(); + this.addSubscription = null; + } + }); + } + + } + + ngOnDestroy() { + this.pageHandler.destroy(); + if (this.addSubscription) this.addSubscription.unsubscribe(); + } + + onAdd(link?:string): void { + ShareDialogComponent.open(this.dialog, link).subscribe((result) => { + if (result) { + this.privilegeService.reload(); + } + }) + } + + onDelete(id: number): void { + if (this.loading.getValue() || this.deleting.getValue()) return; + ConfirmationDialogComponent.open(this.dialog, { + title: "Freigabe löschen?", + message: "Möchtest Du die Freigabe wirklich löschen? Diesen Vorgang kannst Du nicht mehr rückgängig machen.", + positive: "Ja", + negative: "Nein" + }).subscribe((result) => { + if (result != null && result.confirmed) { + this.doDelete(id); + } + }); + } + + private doDelete(id: number) { + this.deleting.next(true); + this.apiClientService.deletePrivilege(id).subscribe((result) => { + this.deleting.next(false); + this.privilegeService.reload(); + Snackbars.showMessage(this.snackbar, "Die Freigabe wurde erfolgreich gelöscht.", Snackbars.DURATION_SHORT); + }, (error) => { + this.deleting.next(false); + this.privilegeService.reload(); + Snackbars.showError(this.snackbar, "Die Freigabe konnte nicht gelöscht werden. Hast Du gerade kein Netz?"); + }) + } + + + +} \ No newline at end of file diff --git a/web/angular/src/app/views/register.component.html b/web/angular/src/app/views/register.component.html new file mode 100644 index 0000000..20f3d36 --- /dev/null +++ b/web/angular/src/app/views/register.component.html @@ -0,0 +1,27 @@ +
    + + + Registrieren + Gib Deine Daten ein und lege ein neues Konto an. + + +
    + + + + +
    +
    + + + + + + + + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/register.component.ts b/web/angular/src/app/views/register.component.ts new file mode 100644 index 0000000..6e2ea29 --- /dev/null +++ b/web/angular/src/app/views/register.component.ts @@ -0,0 +1,88 @@ +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; +import { LoginFieldComponent } from '../widgets/login-field.component'; +import { PasswordFieldComponent } from '../widgets/password-field.component'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { MatSnackBar, MatDialog } from '@angular/material'; +import { NgForm } from '@angular/forms'; +import { NameFieldComponent } from '../widgets/name-field.component'; +import { EmailFieldComponent } from '../widgets/email-field.component'; +import { UserRegistration } from '../../api/models'; +import { ApiClientService} from '../../api/index'; +import { HttpErrorResponse } from '@angular/common/http'; +import { Snackbars } from '../utils/snackbars'; +import { MessageDialogComponent } from '../widgets/message-dialog.component'; + +@Component({ + selector: 'register', + templateUrl: './register.component.html', + host: { class:'match-parent' }, +}) +export class RegisterComponent implements OnDestroy { + + @ViewChild(LoginFieldComponent) loginField: LoginFieldComponent; + @ViewChild(PasswordFieldComponent) passwordField: PasswordFieldComponent; + @ViewChild(NameFieldComponent) nameField: NameFieldComponent; + @ViewChild(EmailFieldComponent) emailField: EmailFieldComponent; + @ViewChild("registerForm") registerForm: NgForm; + + readonly idle = new BehaviorSubject(true); + + registration: UserRegistration = { login:"", name:"", email:"", password:"" } + + private registrationSubscription: Subscription; + + constructor(private apiClientService:ApiClientService, private snackbar: MatSnackBar, private router: Router, private dialog: MatDialog) { } + + onRegister():void { + this.snackbar.dismiss(); + if (!this.idle || !this.registerForm.valid) return; + this.setIdle(false); + this.registration = { + login:this.loginField.login, + name:this.nameField.name, + password:this.passwordField.password, + email:this.emailField.email + } + this.registrationSubscription = this.apiClientService.registerUser(this.registration).subscribe((response)=>{ + this.setIdle(true); + MessageDialogComponent.open(this.dialog, { title: "Einrichtung erfolgreich", message: "Das Konto wurde eingerichtet. Bevor Du Dein Konto nutzen kannst, musst Du es aktivieren. Wir haben Dir eine Email mit einem Aktivierungslink zugeschickt. Bitte sieh in Deinem Postfach nach. Falls die Email lange nicht ankommt, schau auch mal in Deinen Spamordner!", button: "Verstanden" }).subscribe((e) => { + this.router.navigate(["/"]); + }); + this.registrationSubscription = null; + }, (error)=>{ + this.registrationSubscription = null; + if (error instanceof HttpErrorResponse) { + var message = ""; + switch (error.status) { + case HttpStatusCode.CONFLICT: + message = "Der Kontoname ist bereits vergeben. Such Dir bitte einen anderen aus."; + break; + default: + message = "Fehler bei der Registrierung (" + error.status + "). Hast du gerade kein Netz?"; + break; + } + this.setIdle(true); + Snackbars.showError(this.snackbar, message); + } + }); + } + + private setIdle(idle: boolean):void { + this.loginField.disabled = !idle; + this.emailField.disabled = !idle; + this.passwordField.disabled = !idle; + this.nameField.disabled = !idle; + this.idle.next(idle); + } + + ngOnDestroy():void { + if (this.registrationSubscription) this.registrationSubscription.unsubscribe(); + this.snackbar.dismiss(); + } + + +} diff --git a/web/angular/src/app/views/reset.component.html b/web/angular/src/app/views/reset.component.html new file mode 100644 index 0000000..d936555 --- /dev/null +++ b/web/angular/src/app/views/reset.component.html @@ -0,0 +1,24 @@ +
    + + + Passwort zurücksetzen + Gib Deinen Kontonamen an um Dein Passwort zurückzusetzen. + + +
    + +
    +
    + + + + + + + + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/reset.component.ts b/web/angular/src/app/views/reset.component.ts new file mode 100644 index 0000000..7ef848a --- /dev/null +++ b/web/angular/src/app/views/reset.component.ts @@ -0,0 +1,72 @@ +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; +import { LoginFieldComponent } from '../widgets/login-field.component'; +import { PasswordFieldComponent } from '../widgets/password-field.component'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { MatSnackBar, MatDialog } from '@angular/material'; +import { NgForm } from '@angular/forms'; +import { Snackbars } from '../utils/snackbars'; +import { ApiClientService } from '../../api'; +import { HttpErrorResponse } from '@angular/common/http'; +import { MessageDialogComponent } from '../widgets/message-dialog.component'; + +@Component({ + selector: 'reset', + templateUrl: './reset.component.html', + host: { class: 'match-parent' }, +}) +export class ResetComponent implements OnInit, OnDestroy { + + @ViewChild(LoginFieldComponent) loginField: LoginFieldComponent; + @ViewChild("resetForm") resetForm: NgForm; + + readonly idle = new BehaviorSubject(true); + + private resetSubscription: Subscription; + + login: string; + + constructor(private userService: UserService, private apiClientService: ApiClientService, private snackbar: MatSnackBar, private dialog: MatDialog, private router: Router) { } + + ngOnInit(): void { + this.login = this.userService.getLogin(); + } + + onReset(): void { + this.snackbar.dismiss(); + if (!this.idle || !this.resetForm.valid) return; + this.setIdle(false); + this.resetSubscription = this.apiClientService.resetUser(this.loginField.login).subscribe((result) => { + this.setIdle(true); + MessageDialogComponent.open(this.dialog, { title: "Passwort zurückgesetzt", message: "Wir haben Dir einen Link an Deine Kontaktemailadresse versandt, mit dem Du Dein Passwort ändern kannst. Falls Dir Dein Passwort wieder einfällt, kannst Du die Email einfach löschen.", button: "Verstanden" }).subscribe((close) => { + this.router.navigate(["/"]); + }); + }, (error) => { + this.setIdle(true); + if (error instanceof HttpErrorResponse) { + if (error.status === HttpStatusCode.NOT_FOUND) { + Snackbars.showError(this.snackbar, "Konto nicht gefunden. Bitte prüfe Deinen Kontonamen und versuchs nochmal."); + } else { + Snackbars.showError(this.snackbar, "Fehler beim Zurücksetzen (" + error.status + "). Hast Du gerade kein Netz?"); + } + } else { + Snackbars.showError(this.snackbar, "Fehler beim Zurücksetzen. Hast Du gerade kein Netz?"); + } + }); + } + + private setIdle(value: boolean) { + this.loginField.disabled = !value; + this.idle.next(value); + } + + ngOnDestroy(): void { + this.snackbar.dismiss(); + if (this.resetSubscription) this.resetSubscription.unsubscribe(); + } + + +} diff --git a/web/angular/src/app/views/share.component.html b/web/angular/src/app/views/share.component.html new file mode 100644 index 0000000..bf80b20 --- /dev/null +++ b/web/angular/src/app/views/share.component.html @@ -0,0 +1,85 @@ + + + + + + shareFreigabe + +
    + Token + {{ token }} +
    + + +
    + Nachricht + {{ in.message }} +
    +
    + +
    + Ziel + {{ in.destination }} +
    +
    +
    + Ablauf + {{ in.expirationTime | date:'short' }} +
    +
    + + + + + + + + +
    + + + + my_locationStandort + + +
    + Zeit + {{ l.timestamp | date:'short' }} +
    +
    + Status + {{ l.availability }} +
    + +
    + Längengrad + {{ l.coordinate.longitude }} +
    +
    + Breitengrad + {{ l.coordinate.latitude }} +
    +
    +
    + + + + + + + + +
    +
    + +
    + +
    +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/share.component.ts b/web/angular/src/app/views/share.component.ts new file mode 100644 index 0000000..2b96ca8 --- /dev/null +++ b/web/angular/src/app/views/share.component.ts @@ -0,0 +1,97 @@ +import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit } from "@angular/core"; +import { ApiClientService } from "../../api"; +import { MatDialog, MatSnackBar } from "@angular/material"; +import { ActivatedRoute, Router } from "@angular/router"; +import { MessageDialogComponent } from "../widgets/message-dialog.component"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; +import { Subscription, BehaviorSubject } from "rxjs"; +import { Device, Location, ShareInfo } from "../../api/models"; +import { Snackbars } from "../utils/snackbars"; +import * as L from 'leaflet'; +import { TileMapComponent } from "../widgets/tile-map.component"; +import { MarkerMapComponent } from "../widgets/marker-map.component"; + +@Component({ + selector: 'share', + templateUrl: './share.component.html', + host: { class:'match-parent' }, + }) + export class ShareComponent implements AfterViewInit, OnDestroy { + + @ViewChild(MarkerMapComponent) map: MarkerMapComponent; + + token: string; + + info = new BehaviorSubject(null); + location = new BehaviorSubject(null); + + private infoSubscription: Subscription; + private locationSubscription: Subscription; + + constructor( + private snackbar: MatSnackBar, + private apiClientService: ApiClientService, + private router: Router, + private route: ActivatedRoute + ) { } + + ngOnInit() { + this.token = this.route.snapshot.paramMap.get("token"); + this.updateInfo(); + } + + ngAfterViewInit() { + } + + isUpdatingInfo():boolean { + return this.infoSubscription != null; + } + + isUpdatingLocation():boolean { + return this.infoSubscription != null || this.locationSubscription != null; + } + + isOutside():boolean { + if (this.route.parent != null) { + return this.route.parent.snapshot.url[0].path != "privileges"; + } + return false; + } + + addShare():void { + this.router.navigate(["/privileges", { add: this.token}]); + } + + updateInfo():void { + if (this.infoSubscription) return; + this.infoSubscription = this.apiClientService.getShareInfo(this.token).subscribe((result)=>{ + this.info.next(result.body); + this.infoSubscription = null; + this.updateLocation(); + }, (error)=>{ + Snackbars.showError(this.snackbar, "Die Freigabe konnte nicht abgerufen werden."); + this.infoSubscription = null; + }); + } + + updateLocation():void { + if (this.locationSubscription) return; + this.locationSubscription = this.apiClientService.getShareLocation(this.token).subscribe((result)=>{ + this.location.next(result.body); + this.map.setMarkerPosition(result.body.coordinate); + this.locationSubscription = null; + }, (error)=>{ + Snackbars.showError(this.snackbar, "Der Standort konte nicht abgerufen werden."); + this.map.setMarkerPosition(null); + this.locationSubscription = null; + }); + } + + ngOnDestroy() { + if (this.locationSubscription) this.locationSubscription.unsubscribe(); + if (this.infoSubscription) this.infoSubscription.unsubscribe(); + } + + } + \ No newline at end of file diff --git a/web/angular/src/app/views/user.component.html b/web/angular/src/app/views/user.component.html new file mode 100644 index 0000000..8f40792 --- /dev/null +++ b/web/angular/src/app/views/user.component.html @@ -0,0 +1,93 @@ + +
    + + perm_identity + Konto + +
    + + + Informationen ändern + Hier kannst Du Deine Kontaktinformationen ändern. + + +
    + + + + + {{ correspondence.address }} + + + + {{ email.verified?"mail":"send" }}{{email.address}} + + + + +
    +
    + + + +
    + + Passwort ändern + Hier kannst Du Dein Passwort ändern. + +
    + + +
    +
    + + + +
    +
    +
    + + Emailadresse hinzufügen + Hier kannst Du eine neue Emailadresse registrieren. + +
    + +
    +
    + + + +
    + + Emailadresse löschen + Hier kannst Du ungenutze Emailadressen löschen. + + + + + {{ e.address }} + + + + + +
    + +
    +
    + +
    + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/views/user.component.ts b/web/angular/src/app/views/user.component.ts new file mode 100644 index 0000000..6fc9150 --- /dev/null +++ b/web/angular/src/app/views/user.component.ts @@ -0,0 +1,121 @@ +import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; +import { LoginFieldComponent } from '../widgets/login-field.component'; +import { PasswordFieldComponent } from '../widgets/password-field.component'; +import { HttpStatusCode } from '../utils/httpcodes'; +import { MatSnackBar, MatDialog, MatSelect, MatOption } from '@angular/material'; +import { NgForm } from '@angular/forms'; +import { Snackbars } from '../utils/snackbars'; +import { User, Email } from '../../api/models'; +import { NameFieldComponent } from '../widgets/name-field.component'; +import { EmailFieldComponent } from '../widgets/email-field.component'; +import { Observable } from 'rxjs'; +import { MessageDialogComponent } from '../widgets/message-dialog.component'; + +@Component({ + selector: 'user', + templateUrl: './user.component.html', + host: { class:'match-parent' }, +}) +export class UserComponent implements OnInit, OnDestroy { + + @ViewChild(NameFieldComponent) nameField: NameFieldComponent; + @ViewChild(MatSelect) emailSelect: MatSelect; + + // add email + @ViewChild(EmailFieldComponent) emailField: EmailFieldComponent; + + // change passwords + @ViewChild("oldPassword") oldPasswordField: PasswordFieldComponent; + @ViewChild("newPassword") newPasswordField: PasswordFieldComponent; + + readonly idle = new BehaviorSubject(true); + + correspondence: Email; + emails: Email[] = []; + + user: BehaviorSubject; + private userSubscription: Subscription; + + constructor(private userService: UserService, private snackbar: MatSnackBar, private dialog: MatDialog, private router: Router) { + this.user = userService.user; + } + + ngOnInit(): void { + this.userSubscription = this.userService.user.subscribe((user)=>{ + this.idle.next(user != null); + this.correspondence = this.getCorrespondence(); + this.emails = this.getEmails(); + }); + } + + ngOnDestroy():void { + this.userSubscription.unsubscribe(); + } + + private getEmails():Email[] { + if (this.user.getValue() == null) return []; + return this.user.getValue().emails.sort((a, b)=>{ + return a.address.localeCompare(b.address); + }); + } + + private getCorrespondence():Email { + if (this.user.getValue() == null) return null; + for (let email of this.user.getValue().emails) { + if (email.correspondence) return email; + } + return null; + } + + onAddEmail() { + if (this.user.getValue() == null) return; + let u = this.user.getValue(); + let email = this.emailField.email; + for (var i = 0, s = u.emails.length; i < s; i++) { + if (u.emails[i].address === email) { + Snackbars.showError(this.snackbar, "Die Emailadresse ist bereits registriert.", Snackbars.DURATION_SHORT); + this.emailField.email = ""; + return; + } + } + u.emails.push({address:email, id:0, correspondence: false, creationTime: 0, modificationTime: 0, deleted: false, verified: false}); + this.userService.changeUser(u); + } + + onChangePassword() { + if (this.user.getValue() == null) return; + if (!this.userService.changePassword(this.oldPasswordField.password, this.newPasswordField.password)) { + this.oldPasswordField.password = ""; + this.newPasswordField.password = ""; + MessageDialogComponent.open(this.dialog, {title:"Passwort falsch", message: "Dein derzeitiges Passwort stimmt nicht mit Deiner Eingabe überein. Bitte prüfe deine Eingabe und versuchs nochmal."}); + } + } + + onChangeUser() { + if (this.user.getValue() == null) return; + let u = this.user.getValue(); + u.name = this.nameField.name; + let id = this.correspondence.id; + for (var i = 0, s = u.emails.length; i < s; i++) { + u.emails[i].correspondence = (u.emails[i].id === id); + } + this.userService.changeUser(u); + } + + onDeleteEmail(id:number) { + if (this.user.getValue() == null) return; + let u = this.user.getValue(); + for (var i = 0, s = u.emails.length; i < s; i++) { + if (u.emails[i].id === id) { + u.emails[i].deleted = true; + this.userService.changeUser(u); + return; + } + } + } + +} diff --git a/web/angular/src/app/widgets/confirmation-dialog.component.html b/web/angular/src/app/widgets/confirmation-dialog.component.html new file mode 100644 index 0000000..6b14841 --- /dev/null +++ b/web/angular/src/app/widgets/confirmation-dialog.component.html @@ -0,0 +1,14 @@ + + warning{{title}} + {{message}} + + + + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/confirmation-dialog.component.ts b/web/angular/src/app/widgets/confirmation-dialog.component.ts new file mode 100644 index 0000000..f88ffd6 --- /dev/null +++ b/web/angular/src/app/widgets/confirmation-dialog.component.ts @@ -0,0 +1,55 @@ +import { Component, Inject } from "@angular/core"; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from "@angular/material"; +import { Observable } from 'rxjs'; + +export interface ConfirmationDialogData { + title:string; + message:string; + positive?:string; + negative?:string; +} + +export interface ConfirmationDialogResult { + confirmed:boolean; +} + + +@Component({ + selector: 'confirmation-dialog', + templateUrl: 'confirmation-dialog.component.html', + }) + export class ConfirmationDialogComponent { + + title: String; + message: String; + positive: String; + negative: String; + + constructor(public dialog: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: ConfirmationDialogData) { + this.title = data.title; + this.message = data.message; + this.positive = data.positive; + this.negative = data.negative; + if (!this.positive) this.positive = "OK"; + if (!this.negative) this.negative = "Abbrechen"; + } + + onClose(): void { + this.dialog.close({ confirmed: false}); + } + + onAccept(): void { + this.dialog.close({confirmed: true}); + } + + public static open(dialog: MatDialog, d: ConfirmationDialogData, w?:string):Observable { + if (w == null) w = "450px"; + let ref = dialog.open(ConfirmationDialogComponent, { + width: w, + data: d + }); + return ref.afterClosed(); + } + + } \ No newline at end of file diff --git a/web/angular/src/app/widgets/email-field.component.html b/web/angular/src/app/widgets/email-field.component.html new file mode 100644 index 0000000..cc220af --- /dev/null +++ b/web/angular/src/app/widgets/email-field.component.html @@ -0,0 +1,10 @@ + + + {{emailField.value?.length || 0}}/90 + + + Deine Emailadresse ist erforderlich. + Deine Emailadresse ist ungültig. + + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/email-field.component.ts b/web/angular/src/app/widgets/email-field.component.ts new file mode 100644 index 0000000..85579dd --- /dev/null +++ b/web/angular/src/app/widgets/email-field.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit, OnDestroy, Input } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; + +/** + * A validated field that enables a user to enter the + * email. The email will be available through the + * components name which also acts as an input. + */ +@Component({ + selector: 'email-field', + templateUrl: './email-field.component.html' +}) +export class EmailFieldComponent extends FormErrorEncoder { + + /** + * The email address. + */ + @Input() email:string; + /** + * Disables the field. + */ + @Input() disabled:boolean; +} diff --git a/web/angular/src/app/widgets/language-select.component.html b/web/angular/src/app/widgets/language-select.component.html new file mode 100644 index 0000000..b869d8e --- /dev/null +++ b/web/angular/src/app/widgets/language-select.component.html @@ -0,0 +1,10 @@ +
    + + + + + {{ lang.title }} + + + +
    diff --git a/web/angular/src/app/widgets/language-select.component.ts b/web/angular/src/app/widgets/language-select.component.ts new file mode 100644 index 0000000..96a17b4 --- /dev/null +++ b/web/angular/src/app/widgets/language-select.component.ts @@ -0,0 +1,15 @@ +import { Language, Languages } from "../utils/languages"; +import { Input, Component, Output, EventEmitter } from "@angular/core"; + +@Component({ + selector: 'language-select', + templateUrl: 'language-select.component.html', + }) +export class LanguageSelectComponent { + + @Input() languages: Language[] = Languages.getLanguages(); + + @Input() value: string = "de"; + + @Output() change: EventEmitter = new EventEmitter(); +} \ No newline at end of file diff --git a/web/angular/src/app/widgets/log-dialog.component.html b/web/angular/src/app/widgets/log-dialog.component.html new file mode 100644 index 0000000..1afcbd5 --- /dev/null +++ b/web/angular/src/app/widgets/log-dialog.component.html @@ -0,0 +1,49 @@ + + subjectLogeintrag + +
    + ID + {{ message.id }} +
    +
    + Thread + {{ message.thread }} +
    +
    + Zeit + {{ message.time | date:'shortDate' }} {{ message.time | date:'H:mm:ss.SSS' }} +
    +
    + Level + {{ message.level }} +
    +
    + Logger + {{ message.loggerName }} +
    +
    + Class + {{ message.className }} +
    +
    + Method + {{ message.methodName }} +
    + +
    + Message + {{ message.message }} +
    +
    + Trace + {{ message.trace }} +
    + +
    + + + +
    \ No newline at end of file diff --git a/web/angular/src/app/widgets/log-dialog.component.ts b/web/angular/src/app/widgets/log-dialog.component.ts new file mode 100644 index 0000000..05341c5 --- /dev/null +++ b/web/angular/src/app/widgets/log-dialog.component.ts @@ -0,0 +1,31 @@ +import { Component, Inject } from "@angular/core"; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from "@angular/material"; +import { Observable } from 'rxjs'; +import { LogMessage } from "../../api/models"; + +@Component({ + selector: 'log-dialog', + templateUrl: 'log-dialog.component.html', + }) + export class LogDialogComponent { + + message: LogMessage; + + constructor(public dialog: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: LogMessage) { + this.message = data; + } + + onClose(): void { + this.dialog.close(); + } + + public static open(dialog: MatDialog, d: LogMessage, w?:string):Observable { + let ref = dialog.open(LogDialogComponent, { + width: w, + data: d + }); + return ref.afterClosed(); + } + + } \ No newline at end of file diff --git a/web/angular/src/app/widgets/login-field.component.html b/web/angular/src/app/widgets/login-field.component.html new file mode 100644 index 0000000..96a3771 --- /dev/null +++ b/web/angular/src/app/widgets/login-field.component.html @@ -0,0 +1,11 @@ + + + {{loginField.value?.length || 0}}/32 + + + Der Kontoname ist erforderlich. + Der Kontoname enthält ein ungültiges Zeichen. + Der Kontoname ist zu kurz. + + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/login-field.component.ts b/web/angular/src/app/widgets/login-field.component.ts new file mode 100644 index 0000000..6b91266 --- /dev/null +++ b/web/angular/src/app/widgets/login-field.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit, OnDestroy, Input } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; + +/** + * A validated field that enables a user to enter the + * login name. The name will be available through the + * components login which also acts as an input. + */ +@Component({ + selector: 'login-field', + templateUrl: './login-field.component.html' +}) +export class LoginFieldComponent extends FormErrorEncoder { + + /** + * The login name + */ + @Input() login:string; + /** + * Disables the field. + */ + @Input() disabled:boolean; +} diff --git a/web/angular/src/app/widgets/marker-map.component.html b/web/angular/src/app/widgets/marker-map.component.html new file mode 100644 index 0000000..069b3f6 --- /dev/null +++ b/web/angular/src/app/widgets/marker-map.component.html @@ -0,0 +1,6 @@ +
    + +
    + +
    +
    \ No newline at end of file diff --git a/web/angular/src/app/widgets/marker-map.component.ts b/web/angular/src/app/widgets/marker-map.component.ts new file mode 100644 index 0000000..bbf22ea --- /dev/null +++ b/web/angular/src/app/widgets/marker-map.component.ts @@ -0,0 +1,72 @@ +import { Component, OnInit, OnDestroy, ViewChild, AfterContentInit, AfterViewInit } from "@angular/core"; +import { ApiClientService } from "../../api"; +import { MatDialog, MatSnackBar } from "@angular/material"; +import { ActivatedRoute, Router } from "@angular/router"; +import { MessageDialogComponent } from "../widgets/message-dialog.component"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; +import { Subscription, BehaviorSubject } from "rxjs"; +import { Device, Location } from "../../api/models"; +import { Snackbars } from "../utils/snackbars"; +import * as L from 'leaflet'; +import { TileMapComponent } from "../widgets/tile-map.component"; + +@Component({ + selector: 'marker-map', + templateUrl: './marker-map.component.html', + host: { class: 'match-parent' }, +}) +export class MarkerMapComponent implements AfterViewInit { + + @ViewChild(TileMapComponent) map: TileMapComponent; + + private marker: L.Marker; + private markerPosition: { latitude: number, longitude: number }; + private pin: L.Marker; + private pinPosition: { latitude: number, longitude: number}; + + constructor() { } + + ngAfterViewInit() { + this.marker = new L.Marker(new L.LatLng(0, 0), { icon: this.map.iconNormal }); + this.updateMarker(); + this.pin = new L.Marker(new L.LatLng(0, 0), { icon: this.map.iconPin }); + this.updatePin(); + } + + setMarkerPosition(position: { latitude: number, longitude: number }) { + this.markerPosition = position; + this.updateMarker(); + } + + private updateMarker() { + if (!this.marker) return; + if (this.markerPosition == null) { + this.marker.remove(); + } else { + let c = new L.LatLng(this.markerPosition.latitude, this.markerPosition.longitude); + this.marker.setLatLng(c); + this.marker.addTo(this.map.map); + this.map.map.setView(c, 15); + } + } + + setPinPosition(position: { latitude: number, longitude: number }) { + this.pinPosition = position; + this.updatePin(); + } + + private updatePin() { + if (!this.pin) return; + if (this.pinPosition == null) { + this.pin.remove(); + } else { + let c = new L.LatLng(this.pinPosition.latitude, this.pinPosition.longitude); + this.pin.setLatLng(c); + this.pin.addTo(this.map.map); + this.map.map.setView(c, 15); + } + } + + +} diff --git a/web/angular/src/app/widgets/message-dialog.component.html b/web/angular/src/app/widgets/message-dialog.component.html new file mode 100644 index 0000000..ded673f --- /dev/null +++ b/web/angular/src/app/widgets/message-dialog.component.html @@ -0,0 +1,10 @@ + + {{title}} + {{message}} + + + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/message-dialog.component.ts b/web/angular/src/app/widgets/message-dialog.component.ts new file mode 100644 index 0000000..d7815b0 --- /dev/null +++ b/web/angular/src/app/widgets/message-dialog.component.ts @@ -0,0 +1,42 @@ +import { Component, Inject } from "@angular/core"; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from "@angular/material"; +import { Observable } from 'rxjs'; + +export interface MessageDialogData { + title:string; + message:string; + button?:string; +} + +@Component({ + selector: 'message-dialog', + templateUrl: 'message-dialog.component.html', + }) + export class MessageDialogComponent { + + title: String; + message: String; + button: String; + + constructor(public dialog: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: MessageDialogData) { + this.title = data.title; + this.message = data.message; + this.button = data.button; + if (!this.button) this.button = "OK"; + } + + onClose(): void { + this.dialog.close(); + } + + public static open(dialog: MatDialog, d: MessageDialogData, w?:string):Observable { + if (w == null) w = "450px"; + let ref = dialog.open(MessageDialogComponent, { + width: w, + data: d + }); + return ref.afterClosed(); + } + + } \ No newline at end of file diff --git a/web/angular/src/app/widgets/name-field.component.html b/web/angular/src/app/widgets/name-field.component.html new file mode 100644 index 0000000..2887460 --- /dev/null +++ b/web/angular/src/app/widgets/name-field.component.html @@ -0,0 +1,10 @@ + + + {{nameField.value?.length || 0}}/64 + + + Dein Name ist erforderlich. + Dein Name enthält ein ungültiges Zeichen. + + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/name-field.component.ts b/web/angular/src/app/widgets/name-field.component.ts new file mode 100644 index 0000000..7767a03 --- /dev/null +++ b/web/angular/src/app/widgets/name-field.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit, OnDestroy, Input } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; + +/** + * A validated field that enables a user to enter the + * human name. The name will be available through the + * components name which also acts as an input. + */ +@Component({ + selector: 'name-field', + templateUrl: './name-field.component.html' +}) +export class NameFieldComponent extends FormErrorEncoder { + + /** + * The human name + */ + @Input() name:string; + /** + * Disables the field. + */ + @Input() disabled:boolean; +} diff --git a/web/angular/src/app/widgets/nickname-dialog.component.html b/web/angular/src/app/widgets/nickname-dialog.component.html new file mode 100644 index 0000000..dfb3bb2 --- /dev/null +++ b/web/angular/src/app/widgets/nickname-dialog.component.html @@ -0,0 +1,35 @@ + + + Ort benennen + Gib einen Namen für den Ort ein. + + +
    + + + {{nameField.value?.length || 0}} / 140 + + + Dein Name enthält ein ungültiges Zeichen. + + + +
    +
    + + + + + + + + + +
    \ No newline at end of file diff --git a/web/angular/src/app/widgets/nickname-dialog.component.ts b/web/angular/src/app/widgets/nickname-dialog.component.ts new file mode 100644 index 0000000..c152303 --- /dev/null +++ b/web/angular/src/app/widgets/nickname-dialog.component.ts @@ -0,0 +1,74 @@ +import { Component, Inject, ViewChild } from "@angular/core"; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatSnackBar } from "@angular/material"; +import { Observable, Subscription } from 'rxjs'; +import { NgForm } from "@angular/forms"; +import { ApiClientService } from "../../api"; +import { Snackbars } from "../utils/snackbars"; +import { FormErrorEncoder } from "../utils/formcodes"; +import { Place } from "../../api/models"; +import { HttpErrorResponse } from "@angular/common/http"; +import { HttpStatusCode } from "../utils/httpcodes"; + +@Component({ + selector: 'nickname-dialog', + templateUrl: 'nickname-dialog.component.html', + }) + export class NicknameDialogComponent extends FormErrorEncoder { + + @ViewChild("nameForm") nameForm: NgForm; + + name: String; + private place: Place; + private subscription: Subscription; + + constructor( + public snackbar: MatSnackBar, + public apiClientService: ApiClientService, + public dialog: MatDialogRef, + @Inject(MAT_DIALOG_DATA) data: Place + ) { + super(); + this.place = data; + this.name = data.nickname; + } + + isLoading():boolean{ + return this.subscription != null; + } + + onClose(): void { + this.dialog.close(false); + } + + onAccept(): void { + if (this.nameForm.invalid || this.subscription) return; + this.place.nickname = this.name.trim(); + this.subscription = this.apiClientService.setPlace(this.place.id, this.place).subscribe((result)=>{ + this.subscription = null; + this.dialog.close(true); + Snackbars.showMessage(this.snackbar, "Der Ort wurde erfolgreich umbenannt.", Snackbars.DURATION_SHORT); + }, (error)=>{ + this.subscription = null; + if (error instanceof HttpErrorResponse) { + if (error.status == HttpStatusCode.CONFLICT && error.error) { + this.place = JSON.parse(error.error) as Place; + this.name = this.place.nickname; + Snackbars.showError(this.snackbar, "Der Ort wurde bereits verändert. Falls du die Änderung überschreiben möchtest, gib den Namen nochmal ein."); + return; + } + } + Snackbars.showError(this.snackbar, "Der Ort konnte nicht umbennant werden."); + this.dialog.close(true); + }); + } + + public static open(dialog: MatDialog, data: Place, w?:string):Observable { + if (w == null) w = "450px"; + let ref = dialog.open(NicknameDialogComponent, { + data: data, + width: w + }); + return ref.afterClosed(); + } + + } \ No newline at end of file diff --git a/web/angular/src/app/widgets/notice-card.component.html b/web/angular/src/app/widgets/notice-card.component.html new file mode 100644 index 0000000..fcf7a85 --- /dev/null +++ b/web/angular/src/app/widgets/notice-card.component.html @@ -0,0 +1,10 @@ + + + + chat_bubble_outline {{ getTitle() }} + {{ getTimeLabel() }} {{ notice.modificationTime | date:'short' }} + + + {{ getBody() }} + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/notice-card.component.ts b/web/angular/src/app/widgets/notice-card.component.ts new file mode 100644 index 0000000..4f9c574 --- /dev/null +++ b/web/angular/src/app/widgets/notice-card.component.ts @@ -0,0 +1,56 @@ +import { Notice, Message } from "../../api/models"; +import { Input, Component } from "@angular/core"; + +@Component({ + selector: 'notice-card', + templateUrl: './notice-card.component.html' + }) + export class NoticeCardComponent { + + /** + * The notice bound to the card. + */ + @Input() notice:Notice; + + /** + * The preferred language to display. + */ + @Input() language: string; + + /** The label for the modificatin time. */ + @Input() modifiedLabel: string = "Aktualsiert am"; + + /** The label for the creation time. */ + @Input() createdLabel: string = "Veröffentlicht am"; + + getTimeLabel(): string { + if (this.notice.modificationTime == this.notice.creationTime) { + return this.createdLabel; + } else { + return this.modifiedLabel; + } + } + + getTitle(): string { + let m = this.getMessage(); + if (m == null) return ""; + else return m.title; + } + + getBody(): string { + let m = this.getMessage(); + if (m == null) return ""; + else return m.body; + } + + private getMessage(): Message { + for (let m of this.notice.messages) { + if (m.language == this.language) { + return m; + } + } + return null; + } + +} + \ No newline at end of file diff --git a/web/angular/src/app/widgets/password-field.component.html b/web/angular/src/app/widgets/password-field.component.html new file mode 100644 index 0000000..bec8fb1 --- /dev/null +++ b/web/angular/src/app/widgets/password-field.component.html @@ -0,0 +1,11 @@ + + + {{hide ? 'visibility' : 'visibility_off'}} + {{passwordField.value?.length || 0}} + + + Das Passwort ist erforderlich. + Das Passwort ist zu kurz. + + + \ No newline at end of file diff --git a/web/angular/src/app/widgets/password-field.component.ts b/web/angular/src/app/widgets/password-field.component.ts new file mode 100644 index 0000000..fafed7a --- /dev/null +++ b/web/angular/src/app/widgets/password-field.component.ts @@ -0,0 +1,46 @@ +import { Component, OnInit, OnDestroy, Input } from '@angular/core'; +import { UserState, UserService } from '../services/user.service'; +import { BehaviorSubject, Subscription } from 'rxjs'; +import { Router } from '@angular/router'; +import { FormErrorCode, FormErrorEncoder } from '../utils/formcodes'; + +/** + * A validated field that enables a user to enter the + * login name. The name will be available through the + * components login which also acts as an input. + */ +@Component({ + selector: 'password-field', + templateUrl: './password-field.component.html' +}) +export class PasswordFieldComponent extends FormErrorEncoder { + + /** + * Hide or show the password. + */ + hide:boolean = true; + + /** + * The password bound to the component. + */ + @Input() password:string; + /** + * Disables the field. + */ + @Input() disabled:boolean; + + /** + * The name of the field + */ + @Input() name:string = "password"; + + /** + * The label for the field. + */ + @Input() label:string = "Passwort"; + + /** + * The hint for the field. + */ + @Input() hint:string = "Passwort eingeben"; +} diff --git a/web/angular/src/app/widgets/profile-button.component.html b/web/angular/src/app/widgets/profile-button.component.html new file mode 100644 index 0000000..a786da3 --- /dev/null +++ b/web/angular/src/app/widgets/profile-button.component.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/web/angular/src/app/widgets/profile-button.component.ts b/web/angular/src/app/widgets/profile-button.component.ts new file mode 100644 index 0000000..31065b4 --- /dev/null +++ b/web/angular/src/app/widgets/profile-button.component.ts @@ -0,0 +1,26 @@ +import { Component, Input, OnInit, OnDestroy } from '@angular/core'; +import { Router, RouterEvent, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs'; +import { UserService } from '../services/user.service'; + +/** + * Implements a responsive profile button for the toolbar. + */ +@Component({ + selector: 'profile-button', + templateUrl: './profile-button.component.html' +}) +export class ProfileButtonComponent { + + /** + * The login name. + */ + login: string; + + constructor(private userService: UserService) { + this.login = userService.getLogin(); + } + + + +} diff --git a/web/angular/src/app/widgets/share-dialog.component.html b/web/angular/src/app/widgets/share-dialog.component.html new file mode 100644 index 0000000..fbbd8b7 --- /dev/null +++ b/web/angular/src/app/widgets/share-dialog.component.html @@ -0,0 +1,36 @@ + + + Freigabe hinzufügen + Kopiere einen Freigabelink in das Feld um ihn zu speichern. + + +
    + + + {{linkField.value?.length || 0}} + + + Ein Freigabelink ist erforderlich. + Der Freigabelink ist ungültig. + + + +
    +
    + + + + + + + + + +
    \ No newline at end of file diff --git a/web/angular/src/app/widgets/share-dialog.component.ts b/web/angular/src/app/widgets/share-dialog.component.ts new file mode 100644 index 0000000..61cd41c --- /dev/null +++ b/web/angular/src/app/widgets/share-dialog.component.ts @@ -0,0 +1,61 @@ +import { Component, Inject, ViewChild } from "@angular/core"; +import { MatDialogRef, MAT_DIALOG_DATA, MatDialog, MatSnackBar } from "@angular/material"; +import { Observable, Subscription } from 'rxjs'; +import { NgForm } from "@angular/forms"; +import { ApiClientService } from "../../api"; +import { Snackbars } from "../utils/snackbars"; +import { FormErrorEncoder } from "../utils/formcodes"; + +@Component({ + selector: 'share-dialog', + templateUrl: 'share-dialog.component.html', + }) + export class ShareDialogComponent extends FormErrorEncoder { + + @ViewChild("shareForm") shareForm: NgForm; + + link: String; + private subscription: Subscription; + + constructor( + public snackbar: MatSnackBar, + public apiClientService: ApiClientService, + public dialog: MatDialogRef, + @Inject(MAT_DIALOG_DATA) data: string + ) { + super(); + this.link = data; + } + + isLoading():boolean{ + return this.subscription != null; + } + + onClose(): void { + this.dialog.close(false); + } + + onAccept(): void { + if (this.shareForm.invalid || this.subscription) return; + var token = this.link.trim(); + let idx = token.lastIndexOf("/"); + if (idx != -1) token = token.substring(idx + 1); + this.subscription = this.apiClientService.addCurrentUserPrivilege(token).subscribe((result)=>{ + this.subscription = null; + this.dialog.close(true); + Snackbars.showMessage(this.snackbar, "Die Freigabe wurde erfolgreich hinzugefügt.", Snackbars.DURATION_SHORT); + }, (error)=>{ + this.subscription = null; + Snackbars.showError(this.snackbar, "Die Freigabe konnte nicht erstellt werden. Hast Du den Freigabelink vollständig eingegeben?"); + }); + } + + public static open(dialog: MatDialog, link?:string, w?:string):Observable { + let ref = dialog.open(ShareDialogComponent, { + data: (link)?link:"", + width: w + }); + return ref.afterClosed(); + } + + } \ No newline at end of file diff --git a/web/angular/src/app/widgets/tile-map.component.html b/web/angular/src/app/widgets/tile-map.component.html new file mode 100644 index 0000000..b8efc81 --- /dev/null +++ b/web/angular/src/app/widgets/tile-map.component.html @@ -0,0 +1 @@ +
    \ No newline at end of file diff --git a/web/angular/src/app/widgets/tile-map.component.ts b/web/angular/src/app/widgets/tile-map.component.ts new file mode 100644 index 0000000..391a0f5 --- /dev/null +++ b/web/angular/src/app/widgets/tile-map.component.ts @@ -0,0 +1,79 @@ +import { Component, OnInit } from "@angular/core"; +import * as L from 'leaflet'; + +@Component({ + selector: 'tile-map', + templateUrl: './tile-map.component.html' +}) +export class TileMapComponent implements OnInit { + + private static readonly DEFAULT_LOCATION = new L.LatLng(51.461663, 7.016645); + private static readonly DEFAULT_ZOOM = 13; + private static readonly DEFAULT_TILE_URL = 'https://cloud.locoslab.com/carta/restful-services/tile/{z}/{x}/{y}.png'; + private static readonly DEFAULT_ICON_SCALE = 0.2; + + + private static readonly DEFAULT_PIN_URL = "assets/markers/marker_pin.png"; + private static readonly DEFAULT_NORMAL_URL = "assets/markers/marker_normal.png"; + private static readonly DEFAULT_SELECTED_URL = "assets/markers/marker_selected.png"; + private static readonly DEFAULT_SHADOW_URL = "assets/markers/marker_shadow.png"; + + map: L.Map; + layer: L.TileLayer; + + readonly iconNormal: L.Icon; + readonly iconSelected: L.Icon; + readonly iconPin: L.Icon; + + constructor() { + this.iconNormal = this.createMarkerIcon(TileMapComponent.DEFAULT_NORMAL_URL); + this.iconSelected = this.createMarkerIcon(TileMapComponent.DEFAULT_NORMAL_URL); + this.iconPin = this.createPinIcon(TileMapComponent.DEFAULT_PIN_URL); + + } + + ngOnInit() { + this.map = new L.Map('map'); + this.map.setView(TileMapComponent.DEFAULT_LOCATION, TileMapComponent.DEFAULT_ZOOM); + this.layer = new L.TileLayer(TileMapComponent.DEFAULT_TILE_URL, { + attribution: 'Maptology', + maxZoom: 18 + }).addTo(this.map); + } + + private createMarkerIcon(url: string):L.Icon { + let href = this.getBaseHref(); + return new L.Icon({ + iconUrl: href + url, + shadowUrl: href + TileMapComponent.DEFAULT_SHADOW_URL, + iconAnchor: [this.scale(100), this.scale(293)], + iconSize: [this.scale(200), this.scale(293)], + shadowAnchor: [this.scale(140), this.scale(330)], + shadowSize: [this.scale(280), this.scale(379)] + }); + } + + private createPinIcon(url: string):L.Icon { + let href = this.getBaseHref(); + return new L.Icon({ + iconUrl: href + url, + iconAnchor: [this.scale(100), this.scale(100)], + iconSize: [this.scale(200), this.scale(200)], + }); + } + + private getBaseHref():string{ + let bases = document.getElementsByTagName('base'); + let baseHref = null; + if (bases.length > 0) baseHref = bases[0].href; + if (baseHref == null) baseHref = "/"; + return baseHref; + } + + private scale(v:number):number { + return v * TileMapComponent.DEFAULT_ICON_SCALE; + } + + + +} \ No newline at end of file diff --git a/web/angular/src/app/widgets/toolbar-button.component.html b/web/angular/src/app/widgets/toolbar-button.component.html new file mode 100644 index 0000000..47bb5f8 --- /dev/null +++ b/web/angular/src/app/widgets/toolbar-button.component.html @@ -0,0 +1,25 @@ + +
    + + + + + + +
    \ No newline at end of file diff --git a/web/angular/src/app/widgets/toolbar-button.component.ts b/web/angular/src/app/widgets/toolbar-button.component.ts new file mode 100644 index 0000000..8d4ea22 --- /dev/null +++ b/web/angular/src/app/widgets/toolbar-button.component.ts @@ -0,0 +1,78 @@ +import { Component, Input, OnInit, OnDestroy } from '@angular/core'; +import { Router, RouterEvent, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs'; + +/** + * Implements a responsive button for the toolbar + * that consists of an icon, text and a link. + * Optionally, it can be disabled and it is possible + * to set a color. If a color is used, the button + * will raise as well. If no color is provided, the + * button will be flat. + */ +@Component({ + selector: 'toolbar-button', + templateUrl: './toolbar-button.component.html' +}) +export class ToolbarButtonComponent implements OnInit, OnDestroy { + + /** + * The title of the button. + */ + @Input() title: string; + /** + * The icon of the button which should + * be a character or ligature of the material + * icon font. + */ + @Input() icon: string; + /** + * The router link that is activated by the + * button. + */ + @Input() link: string; + /** + * Enables or disables the button. + */ + @Input() disabled: boolean; + /** + * The color (e.g. "accent") which will also + * raise the button, if set. + */ + @Input() color: string; + + /** + * Determines whether the button is shown. + */ + visible: boolean; + + /** + * The subscription to the router. + */ + private routerSubscription: Subscription; + + /** + * Creates a new button. + * + * @param router The router. + */ + constructor(private router: Router) { } + + ngOnInit() { + this.routerSubscription = this.router.events.subscribe((event) => { + if (event instanceof NavigationEnd) { + this.updateVisibility(); + } + }); + this.updateVisibility(); + } + + private updateVisibility():void { + this.visible = (this.router.url !== this.link); + } + + ngOnDestroy() { + this.routerSubscription.unsubscribe(); + } + +} diff --git a/web/angular/src/assets/.npmignore b/web/angular/src/assets/.npmignore deleted file mode 100755 index e69de29..0000000 diff --git a/web/angular/src/assets/flags/de.svg b/web/angular/src/assets/flags/de.svg new file mode 100644 index 0000000..8bb7bc5 --- /dev/null +++ b/web/angular/src/assets/flags/de.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/web/angular/src/assets/flags/en.svg b/web/angular/src/assets/flags/en.svg new file mode 100644 index 0000000..2eda612 --- /dev/null +++ b/web/angular/src/assets/flags/en.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/web/angular/src/assets/flags/es.svg b/web/angular/src/assets/flags/es.svg new file mode 100644 index 0000000..b9fb04b --- /dev/null +++ b/web/angular/src/assets/flags/es.svg @@ -0,0 +1,581 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/web/angular/src/assets/flags/fr.svg b/web/angular/src/assets/flags/fr.svg new file mode 100644 index 0000000..de83a9f --- /dev/null +++ b/web/angular/src/assets/flags/fr.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/web/angular/src/assets/flags/it.svg b/web/angular/src/assets/flags/it.svg new file mode 100644 index 0000000..210983b --- /dev/null +++ b/web/angular/src/assets/flags/it.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/web/angular/src/assets/fonts/MaterialIcons-Regular.eot b/web/angular/src/assets/fonts/MaterialIcons-Regular.eot new file mode 100644 index 0000000..70508eb Binary files /dev/null and b/web/angular/src/assets/fonts/MaterialIcons-Regular.eot differ diff --git a/web/angular/src/assets/fonts/MaterialIcons-Regular.ttf b/web/angular/src/assets/fonts/MaterialIcons-Regular.ttf new file mode 100644 index 0000000..7015564 Binary files /dev/null and b/web/angular/src/assets/fonts/MaterialIcons-Regular.ttf differ diff --git a/web/angular/src/assets/fonts/MaterialIcons-Regular.woff b/web/angular/src/assets/fonts/MaterialIcons-Regular.woff new file mode 100644 index 0000000..b648a3e Binary files /dev/null and b/web/angular/src/assets/fonts/MaterialIcons-Regular.woff differ diff --git a/web/angular/src/assets/fonts/MaterialIcons-Regular.woff2 b/web/angular/src/assets/fonts/MaterialIcons-Regular.woff2 new file mode 100644 index 0000000..9fa2112 Binary files /dev/null and b/web/angular/src/assets/fonts/MaterialIcons-Regular.woff2 differ diff --git a/web/angular/src/assets/fonts/RobotoLatin-Regular.eot b/web/angular/src/assets/fonts/RobotoLatin-Regular.eot new file mode 100644 index 0000000..a0780d6 Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoLatin-Regular.eot differ diff --git a/web/angular/src/assets/fonts/RobotoLatin-Regular.ttf b/web/angular/src/assets/fonts/RobotoLatin-Regular.ttf new file mode 100644 index 0000000..b91bf3f Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoLatin-Regular.ttf differ diff --git a/web/angular/src/assets/fonts/RobotoLatin-Regular.woff b/web/angular/src/assets/fonts/RobotoLatin-Regular.woff new file mode 100644 index 0000000..92dfacc Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoLatin-Regular.woff differ diff --git a/web/angular/src/assets/fonts/RobotoLatin-Regular.woff2 b/web/angular/src/assets/fonts/RobotoLatin-Regular.woff2 new file mode 100644 index 0000000..7e854e6 Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoLatin-Regular.woff2 differ diff --git a/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.eot b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.eot new file mode 100644 index 0000000..550df22 Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.eot differ diff --git a/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.ttf b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.ttf new file mode 100644 index 0000000..27363d1 Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.ttf differ diff --git a/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.woff b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.woff new file mode 100644 index 0000000..0ea5db8 Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.woff differ diff --git a/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.woff2 b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.woff2 new file mode 100644 index 0000000..6163de7 Binary files /dev/null and b/web/angular/src/assets/fonts/RobotoMonoLatin-Regular.woff2 differ diff --git a/web/angular/src/assets/icons/favicon-114x114.png b/web/angular/src/assets/icons/favicon-114x114.png new file mode 100644 index 0000000..e04bab4 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-114x114.png differ diff --git a/web/angular/src/assets/icons/favicon-120x120.png b/web/angular/src/assets/icons/favicon-120x120.png new file mode 100644 index 0000000..62eeb52 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-120x120.png differ diff --git a/web/angular/src/assets/icons/favicon-144x144.png b/web/angular/src/assets/icons/favicon-144x144.png new file mode 100644 index 0000000..2248778 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-144x144.png differ diff --git a/web/angular/src/assets/icons/favicon-152x152.png b/web/angular/src/assets/icons/favicon-152x152.png new file mode 100644 index 0000000..99a7c69 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-152x152.png differ diff --git a/web/angular/src/assets/icons/favicon-16x16.png b/web/angular/src/assets/icons/favicon-16x16.png new file mode 100644 index 0000000..528122a Binary files /dev/null and b/web/angular/src/assets/icons/favicon-16x16.png differ diff --git a/web/angular/src/assets/icons/favicon-180x180.png b/web/angular/src/assets/icons/favicon-180x180.png new file mode 100644 index 0000000..bf8d033 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-180x180.png differ diff --git a/web/angular/src/assets/icons/favicon-192x192.png b/web/angular/src/assets/icons/favicon-192x192.png new file mode 100644 index 0000000..36c6bb9 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-192x192.png differ diff --git a/web/angular/src/assets/icons/favicon-32x32.png b/web/angular/src/assets/icons/favicon-32x32.png new file mode 100644 index 0000000..4206bea Binary files /dev/null and b/web/angular/src/assets/icons/favicon-32x32.png differ diff --git a/web/angular/src/assets/icons/favicon-57x57.png b/web/angular/src/assets/icons/favicon-57x57.png new file mode 100644 index 0000000..b843db4 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-57x57.png differ diff --git a/web/angular/src/assets/icons/favicon-60x60.png b/web/angular/src/assets/icons/favicon-60x60.png new file mode 100644 index 0000000..c7a7244 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-60x60.png differ diff --git a/web/angular/src/assets/icons/favicon-72x72.png b/web/angular/src/assets/icons/favicon-72x72.png new file mode 100644 index 0000000..a64db65 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-72x72.png differ diff --git a/web/angular/src/assets/icons/favicon-76x76.png b/web/angular/src/assets/icons/favicon-76x76.png new file mode 100644 index 0000000..c43019b Binary files /dev/null and b/web/angular/src/assets/icons/favicon-76x76.png differ diff --git a/web/angular/src/assets/icons/favicon-96x96.png b/web/angular/src/assets/icons/favicon-96x96.png new file mode 100644 index 0000000..a90d662 Binary files /dev/null and b/web/angular/src/assets/icons/favicon-96x96.png differ diff --git a/web/angular/src/assets/icons/home.svg b/web/angular/src/assets/icons/home.svg new file mode 100644 index 0000000..a0188d4 --- /dev/null +++ b/web/angular/src/assets/icons/home.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/web/angular/src/assets/img/avatars/1.jpg b/web/angular/src/assets/img/avatars/1.jpg deleted file mode 100755 index 0b08703..0000000 Binary files a/web/angular/src/assets/img/avatars/1.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/2.jpg b/web/angular/src/assets/img/avatars/2.jpg deleted file mode 100755 index e736709..0000000 Binary files a/web/angular/src/assets/img/avatars/2.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/3.jpg b/web/angular/src/assets/img/avatars/3.jpg deleted file mode 100755 index caf9a7e..0000000 Binary files a/web/angular/src/assets/img/avatars/3.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/4.jpg b/web/angular/src/assets/img/avatars/4.jpg deleted file mode 100755 index 97f6769..0000000 Binary files a/web/angular/src/assets/img/avatars/4.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/5.jpg b/web/angular/src/assets/img/avatars/5.jpg deleted file mode 100755 index 82b025f..0000000 Binary files a/web/angular/src/assets/img/avatars/5.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/6.jpg b/web/angular/src/assets/img/avatars/6.jpg deleted file mode 100755 index 1d2b884..0000000 Binary files a/web/angular/src/assets/img/avatars/6.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/7.jpg b/web/angular/src/assets/img/avatars/7.jpg deleted file mode 100755 index 2903cd2..0000000 Binary files a/web/angular/src/assets/img/avatars/7.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/avatars/8.jpg b/web/angular/src/assets/img/avatars/8.jpg deleted file mode 100755 index 3a5eba9..0000000 Binary files a/web/angular/src/assets/img/avatars/8.jpg and /dev/null differ diff --git a/web/angular/src/assets/img/favicon.png b/web/angular/src/assets/img/favicon.png deleted file mode 100755 index 7f62aff..0000000 Binary files a/web/angular/src/assets/img/favicon.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/ASEAN.png b/web/angular/src/assets/img/flags/ASEAN.png deleted file mode 100755 index 1fb1b91..0000000 Binary files a/web/angular/src/assets/img/flags/ASEAN.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Afghanistan.png b/web/angular/src/assets/img/flags/Afghanistan.png deleted file mode 100755 index 2575b8a..0000000 Binary files a/web/angular/src/assets/img/flags/Afghanistan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/African Union.png b/web/angular/src/assets/img/flags/African Union.png deleted file mode 100755 index 85b268e..0000000 Binary files a/web/angular/src/assets/img/flags/African Union.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Albania.png b/web/angular/src/assets/img/flags/Albania.png deleted file mode 100755 index 2e16c3b..0000000 Binary files a/web/angular/src/assets/img/flags/Albania.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Algeria.png b/web/angular/src/assets/img/flags/Algeria.png deleted file mode 100755 index 69477f0..0000000 Binary files a/web/angular/src/assets/img/flags/Algeria.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/American Samoa.png b/web/angular/src/assets/img/flags/American Samoa.png deleted file mode 100755 index b0d4cdc..0000000 Binary files a/web/angular/src/assets/img/flags/American Samoa.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Andorra.png b/web/angular/src/assets/img/flags/Andorra.png deleted file mode 100755 index e753cd6..0000000 Binary files a/web/angular/src/assets/img/flags/Andorra.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Angola.png b/web/angular/src/assets/img/flags/Angola.png deleted file mode 100755 index 97ae963..0000000 Binary files a/web/angular/src/assets/img/flags/Angola.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Anguilla.png b/web/angular/src/assets/img/flags/Anguilla.png deleted file mode 100755 index 7a6ac04..0000000 Binary files a/web/angular/src/assets/img/flags/Anguilla.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Antarctica.png b/web/angular/src/assets/img/flags/Antarctica.png deleted file mode 100755 index a97b355..0000000 Binary files a/web/angular/src/assets/img/flags/Antarctica.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Antigua & Barbuda.png b/web/angular/src/assets/img/flags/Antigua & Barbuda.png deleted file mode 100755 index cfc157a..0000000 Binary files a/web/angular/src/assets/img/flags/Antigua & Barbuda.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Arab League.png b/web/angular/src/assets/img/flags/Arab League.png deleted file mode 100755 index 646a3f7..0000000 Binary files a/web/angular/src/assets/img/flags/Arab League.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Argentina.png b/web/angular/src/assets/img/flags/Argentina.png deleted file mode 100755 index 62d1518..0000000 Binary files a/web/angular/src/assets/img/flags/Argentina.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Armenia.png b/web/angular/src/assets/img/flags/Armenia.png deleted file mode 100755 index f4f9bae..0000000 Binary files a/web/angular/src/assets/img/flags/Armenia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Aruba.png b/web/angular/src/assets/img/flags/Aruba.png deleted file mode 100755 index 0083ef6..0000000 Binary files a/web/angular/src/assets/img/flags/Aruba.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Australia.png b/web/angular/src/assets/img/flags/Australia.png deleted file mode 100755 index 8937404..0000000 Binary files a/web/angular/src/assets/img/flags/Australia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Austria.png b/web/angular/src/assets/img/flags/Austria.png deleted file mode 100755 index fe66fef..0000000 Binary files a/web/angular/src/assets/img/flags/Austria.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Azerbaijan.png b/web/angular/src/assets/img/flags/Azerbaijan.png deleted file mode 100755 index 1850abc..0000000 Binary files a/web/angular/src/assets/img/flags/Azerbaijan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bahamas.png b/web/angular/src/assets/img/flags/Bahamas.png deleted file mode 100755 index 753fc83..0000000 Binary files a/web/angular/src/assets/img/flags/Bahamas.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bahrain.png b/web/angular/src/assets/img/flags/Bahrain.png deleted file mode 100755 index c45c7b4..0000000 Binary files a/web/angular/src/assets/img/flags/Bahrain.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bangladesh.png b/web/angular/src/assets/img/flags/Bangladesh.png deleted file mode 100755 index 8ef2443..0000000 Binary files a/web/angular/src/assets/img/flags/Bangladesh.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Barbados.png b/web/angular/src/assets/img/flags/Barbados.png deleted file mode 100755 index d440d41..0000000 Binary files a/web/angular/src/assets/img/flags/Barbados.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Belarus.png b/web/angular/src/assets/img/flags/Belarus.png deleted file mode 100755 index ce75c73..0000000 Binary files a/web/angular/src/assets/img/flags/Belarus.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Belgium.png b/web/angular/src/assets/img/flags/Belgium.png deleted file mode 100755 index 1d3df4c..0000000 Binary files a/web/angular/src/assets/img/flags/Belgium.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Belize.png b/web/angular/src/assets/img/flags/Belize.png deleted file mode 100755 index 4a9aea0..0000000 Binary files a/web/angular/src/assets/img/flags/Belize.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Benin.png b/web/angular/src/assets/img/flags/Benin.png deleted file mode 100755 index af46063..0000000 Binary files a/web/angular/src/assets/img/flags/Benin.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bermuda.png b/web/angular/src/assets/img/flags/Bermuda.png deleted file mode 100755 index 880d965..0000000 Binary files a/web/angular/src/assets/img/flags/Bermuda.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bhutan.png b/web/angular/src/assets/img/flags/Bhutan.png deleted file mode 100755 index db0372e..0000000 Binary files a/web/angular/src/assets/img/flags/Bhutan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bolivia.png b/web/angular/src/assets/img/flags/Bolivia.png deleted file mode 100755 index a28f060..0000000 Binary files a/web/angular/src/assets/img/flags/Bolivia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bosnia & Herzegovina.png b/web/angular/src/assets/img/flags/Bosnia & Herzegovina.png deleted file mode 100755 index 806d05d..0000000 Binary files a/web/angular/src/assets/img/flags/Bosnia & Herzegovina.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Botswana.png b/web/angular/src/assets/img/flags/Botswana.png deleted file mode 100755 index 9a06843..0000000 Binary files a/web/angular/src/assets/img/flags/Botswana.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Brazil.png b/web/angular/src/assets/img/flags/Brazil.png deleted file mode 100755 index 47a007f..0000000 Binary files a/web/angular/src/assets/img/flags/Brazil.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Brunei.png b/web/angular/src/assets/img/flags/Brunei.png deleted file mode 100755 index 650cca6..0000000 Binary files a/web/angular/src/assets/img/flags/Brunei.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Bulgaria.png b/web/angular/src/assets/img/flags/Bulgaria.png deleted file mode 100755 index c130192..0000000 Binary files a/web/angular/src/assets/img/flags/Bulgaria.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Burkina Faso.png b/web/angular/src/assets/img/flags/Burkina Faso.png deleted file mode 100755 index 13ff132..0000000 Binary files a/web/angular/src/assets/img/flags/Burkina Faso.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Burundi.png b/web/angular/src/assets/img/flags/Burundi.png deleted file mode 100755 index 15e76aa..0000000 Binary files a/web/angular/src/assets/img/flags/Burundi.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/CARICOM.png b/web/angular/src/assets/img/flags/CARICOM.png deleted file mode 100755 index 19dfeae..0000000 Binary files a/web/angular/src/assets/img/flags/CARICOM.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/CIS.png b/web/angular/src/assets/img/flags/CIS.png deleted file mode 100755 index 809c026..0000000 Binary files a/web/angular/src/assets/img/flags/CIS.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cambodja.png b/web/angular/src/assets/img/flags/Cambodja.png deleted file mode 100755 index 65b4c06..0000000 Binary files a/web/angular/src/assets/img/flags/Cambodja.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cameroon.png b/web/angular/src/assets/img/flags/Cameroon.png deleted file mode 100755 index 32eccee..0000000 Binary files a/web/angular/src/assets/img/flags/Cameroon.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Canada.png b/web/angular/src/assets/img/flags/Canada.png deleted file mode 100755 index bfff414..0000000 Binary files a/web/angular/src/assets/img/flags/Canada.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cape Verde.png b/web/angular/src/assets/img/flags/Cape Verde.png deleted file mode 100755 index 103043c..0000000 Binary files a/web/angular/src/assets/img/flags/Cape Verde.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cayman Islands.png b/web/angular/src/assets/img/flags/Cayman Islands.png deleted file mode 100755 index f2a6b6c..0000000 Binary files a/web/angular/src/assets/img/flags/Cayman Islands.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Central African Republic.png b/web/angular/src/assets/img/flags/Central African Republic.png deleted file mode 100755 index 3f0b501..0000000 Binary files a/web/angular/src/assets/img/flags/Central African Republic.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Chad.png b/web/angular/src/assets/img/flags/Chad.png deleted file mode 100755 index c74a4a4..0000000 Binary files a/web/angular/src/assets/img/flags/Chad.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Chile.png b/web/angular/src/assets/img/flags/Chile.png deleted file mode 100755 index 3e76462..0000000 Binary files a/web/angular/src/assets/img/flags/Chile.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/China.png b/web/angular/src/assets/img/flags/China.png deleted file mode 100755 index d0da550..0000000 Binary files a/web/angular/src/assets/img/flags/China.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Colombia.png b/web/angular/src/assets/img/flags/Colombia.png deleted file mode 100755 index da19e53..0000000 Binary files a/web/angular/src/assets/img/flags/Colombia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Commonwealth.png b/web/angular/src/assets/img/flags/Commonwealth.png deleted file mode 100755 index aa0d8ab..0000000 Binary files a/web/angular/src/assets/img/flags/Commonwealth.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Comoros.png b/web/angular/src/assets/img/flags/Comoros.png deleted file mode 100755 index 051fc5a..0000000 Binary files a/web/angular/src/assets/img/flags/Comoros.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Congo-Brazzaville.png b/web/angular/src/assets/img/flags/Congo-Brazzaville.png deleted file mode 100755 index f8c0b25..0000000 Binary files a/web/angular/src/assets/img/flags/Congo-Brazzaville.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Congo-Kinshasa(Zaire).png b/web/angular/src/assets/img/flags/Congo-Kinshasa(Zaire).png deleted file mode 100755 index be42ea0..0000000 Binary files a/web/angular/src/assets/img/flags/Congo-Kinshasa(Zaire).png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cook Islands.png b/web/angular/src/assets/img/flags/Cook Islands.png deleted file mode 100755 index 7c432c8..0000000 Binary files a/web/angular/src/assets/img/flags/Cook Islands.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Costa Rica.png b/web/angular/src/assets/img/flags/Costa Rica.png deleted file mode 100755 index 44a3073..0000000 Binary files a/web/angular/src/assets/img/flags/Costa Rica.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cote d'Ivoire.png b/web/angular/src/assets/img/flags/Cote d'Ivoire.png deleted file mode 100755 index 1fee82c..0000000 Binary files a/web/angular/src/assets/img/flags/Cote d'Ivoire.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Croatia.png b/web/angular/src/assets/img/flags/Croatia.png deleted file mode 100755 index 4cb4ea7..0000000 Binary files a/web/angular/src/assets/img/flags/Croatia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cuba.png b/web/angular/src/assets/img/flags/Cuba.png deleted file mode 100755 index 4e3cf29..0000000 Binary files a/web/angular/src/assets/img/flags/Cuba.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Cyprus.png b/web/angular/src/assets/img/flags/Cyprus.png deleted file mode 100755 index df22c03..0000000 Binary files a/web/angular/src/assets/img/flags/Cyprus.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Czech Republic.png b/web/angular/src/assets/img/flags/Czech Republic.png deleted file mode 100755 index 31f9ad9..0000000 Binary files a/web/angular/src/assets/img/flags/Czech Republic.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Denmark.png b/web/angular/src/assets/img/flags/Denmark.png deleted file mode 100755 index 3f4dac3..0000000 Binary files a/web/angular/src/assets/img/flags/Denmark.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Djibouti.png b/web/angular/src/assets/img/flags/Djibouti.png deleted file mode 100755 index 8f32f74..0000000 Binary files a/web/angular/src/assets/img/flags/Djibouti.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Dominica.png b/web/angular/src/assets/img/flags/Dominica.png deleted file mode 100755 index e70b1a4..0000000 Binary files a/web/angular/src/assets/img/flags/Dominica.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Dominican Republic.png b/web/angular/src/assets/img/flags/Dominican Republic.png deleted file mode 100755 index ca2d40a..0000000 Binary files a/web/angular/src/assets/img/flags/Dominican Republic.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Ecuador.png b/web/angular/src/assets/img/flags/Ecuador.png deleted file mode 100755 index 4913cec..0000000 Binary files a/web/angular/src/assets/img/flags/Ecuador.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Egypt.png b/web/angular/src/assets/img/flags/Egypt.png deleted file mode 100755 index ee9fef0..0000000 Binary files a/web/angular/src/assets/img/flags/Egypt.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/El Salvador.png b/web/angular/src/assets/img/flags/El Salvador.png deleted file mode 100755 index adf8750..0000000 Binary files a/web/angular/src/assets/img/flags/El Salvador.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/England.png b/web/angular/src/assets/img/flags/England.png deleted file mode 100755 index 22fb06b..0000000 Binary files a/web/angular/src/assets/img/flags/England.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Equatorial Guinea.png b/web/angular/src/assets/img/flags/Equatorial Guinea.png deleted file mode 100755 index 13d3c92..0000000 Binary files a/web/angular/src/assets/img/flags/Equatorial Guinea.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Eritrea.png b/web/angular/src/assets/img/flags/Eritrea.png deleted file mode 100755 index 5f38c52..0000000 Binary files a/web/angular/src/assets/img/flags/Eritrea.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Estonia.png b/web/angular/src/assets/img/flags/Estonia.png deleted file mode 100755 index 3eadb29..0000000 Binary files a/web/angular/src/assets/img/flags/Estonia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Ethiopia.png b/web/angular/src/assets/img/flags/Ethiopia.png deleted file mode 100755 index b29191f..0000000 Binary files a/web/angular/src/assets/img/flags/Ethiopia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/European Union.png b/web/angular/src/assets/img/flags/European Union.png deleted file mode 100755 index 18c86da..0000000 Binary files a/web/angular/src/assets/img/flags/European Union.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Faroes.png b/web/angular/src/assets/img/flags/Faroes.png deleted file mode 100755 index 1bfb68e..0000000 Binary files a/web/angular/src/assets/img/flags/Faroes.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Fiji.png b/web/angular/src/assets/img/flags/Fiji.png deleted file mode 100755 index d96b232..0000000 Binary files a/web/angular/src/assets/img/flags/Fiji.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Finland.png b/web/angular/src/assets/img/flags/Finland.png deleted file mode 100755 index 97d47a9..0000000 Binary files a/web/angular/src/assets/img/flags/Finland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/France.png b/web/angular/src/assets/img/flags/France.png deleted file mode 100755 index 12318d4..0000000 Binary files a/web/angular/src/assets/img/flags/France.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Gabon.png b/web/angular/src/assets/img/flags/Gabon.png deleted file mode 100755 index bb1f634..0000000 Binary files a/web/angular/src/assets/img/flags/Gabon.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Gambia.png b/web/angular/src/assets/img/flags/Gambia.png deleted file mode 100755 index e4bee6c..0000000 Binary files a/web/angular/src/assets/img/flags/Gambia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Georgia.png b/web/angular/src/assets/img/flags/Georgia.png deleted file mode 100755 index fb293a0..0000000 Binary files a/web/angular/src/assets/img/flags/Georgia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Germany.png b/web/angular/src/assets/img/flags/Germany.png deleted file mode 100755 index 77e9338..0000000 Binary files a/web/angular/src/assets/img/flags/Germany.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Ghana.png b/web/angular/src/assets/img/flags/Ghana.png deleted file mode 100755 index 16ddfb4..0000000 Binary files a/web/angular/src/assets/img/flags/Ghana.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Gibraltar.png b/web/angular/src/assets/img/flags/Gibraltar.png deleted file mode 100755 index 3d3b66d..0000000 Binary files a/web/angular/src/assets/img/flags/Gibraltar.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Greece.png b/web/angular/src/assets/img/flags/Greece.png deleted file mode 100755 index b00fd5a..0000000 Binary files a/web/angular/src/assets/img/flags/Greece.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Greenland.png b/web/angular/src/assets/img/flags/Greenland.png deleted file mode 100755 index 8dc87f4..0000000 Binary files a/web/angular/src/assets/img/flags/Greenland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Grenada.png b/web/angular/src/assets/img/flags/Grenada.png deleted file mode 100755 index 26be61e..0000000 Binary files a/web/angular/src/assets/img/flags/Grenada.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guadeloupe.png b/web/angular/src/assets/img/flags/Guadeloupe.png deleted file mode 100755 index 53dca17..0000000 Binary files a/web/angular/src/assets/img/flags/Guadeloupe.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guam.png b/web/angular/src/assets/img/flags/Guam.png deleted file mode 100755 index f1d6b7a..0000000 Binary files a/web/angular/src/assets/img/flags/Guam.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guatemala.png b/web/angular/src/assets/img/flags/Guatemala.png deleted file mode 100755 index e5580e9..0000000 Binary files a/web/angular/src/assets/img/flags/Guatemala.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guernsey.png b/web/angular/src/assets/img/flags/Guernsey.png deleted file mode 100755 index 0514cc9..0000000 Binary files a/web/angular/src/assets/img/flags/Guernsey.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guinea-Bissau.png b/web/angular/src/assets/img/flags/Guinea-Bissau.png deleted file mode 100755 index d097a28..0000000 Binary files a/web/angular/src/assets/img/flags/Guinea-Bissau.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guinea.png b/web/angular/src/assets/img/flags/Guinea.png deleted file mode 100755 index f71c621..0000000 Binary files a/web/angular/src/assets/img/flags/Guinea.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Guyana.png b/web/angular/src/assets/img/flags/Guyana.png deleted file mode 100755 index 76eabd9..0000000 Binary files a/web/angular/src/assets/img/flags/Guyana.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Haiti.png b/web/angular/src/assets/img/flags/Haiti.png deleted file mode 100755 index 325cef0..0000000 Binary files a/web/angular/src/assets/img/flags/Haiti.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Honduras.png b/web/angular/src/assets/img/flags/Honduras.png deleted file mode 100755 index 1f327f1..0000000 Binary files a/web/angular/src/assets/img/flags/Honduras.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Hong Kong.png b/web/angular/src/assets/img/flags/Hong Kong.png deleted file mode 100755 index 46208e0..0000000 Binary files a/web/angular/src/assets/img/flags/Hong Kong.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Hungary.png b/web/angular/src/assets/img/flags/Hungary.png deleted file mode 100755 index af757c6..0000000 Binary files a/web/angular/src/assets/img/flags/Hungary.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Iceland.png b/web/angular/src/assets/img/flags/Iceland.png deleted file mode 100755 index 33d68dd..0000000 Binary files a/web/angular/src/assets/img/flags/Iceland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/India.png b/web/angular/src/assets/img/flags/India.png deleted file mode 100755 index e0a8865..0000000 Binary files a/web/angular/src/assets/img/flags/India.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Indonezia.png b/web/angular/src/assets/img/flags/Indonezia.png deleted file mode 100755 index ed42d1f..0000000 Binary files a/web/angular/src/assets/img/flags/Indonezia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Iran.png b/web/angular/src/assets/img/flags/Iran.png deleted file mode 100755 index 70da4fc..0000000 Binary files a/web/angular/src/assets/img/flags/Iran.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Iraq.png b/web/angular/src/assets/img/flags/Iraq.png deleted file mode 100755 index cdd0c4f..0000000 Binary files a/web/angular/src/assets/img/flags/Iraq.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Ireland.png b/web/angular/src/assets/img/flags/Ireland.png deleted file mode 100755 index 74219ab..0000000 Binary files a/web/angular/src/assets/img/flags/Ireland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Islamic Conference.png b/web/angular/src/assets/img/flags/Islamic Conference.png deleted file mode 100755 index cc4aa3b..0000000 Binary files a/web/angular/src/assets/img/flags/Islamic Conference.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Isle of Man.png b/web/angular/src/assets/img/flags/Isle of Man.png deleted file mode 100755 index 9478023..0000000 Binary files a/web/angular/src/assets/img/flags/Isle of Man.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Israel.png b/web/angular/src/assets/img/flags/Israel.png deleted file mode 100755 index 3ba7553..0000000 Binary files a/web/angular/src/assets/img/flags/Israel.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Italy.png b/web/angular/src/assets/img/flags/Italy.png deleted file mode 100755 index c31017e..0000000 Binary files a/web/angular/src/assets/img/flags/Italy.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Jamaica.png b/web/angular/src/assets/img/flags/Jamaica.png deleted file mode 100755 index e79cf2a..0000000 Binary files a/web/angular/src/assets/img/flags/Jamaica.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Japan.png b/web/angular/src/assets/img/flags/Japan.png deleted file mode 100755 index 29c45d5..0000000 Binary files a/web/angular/src/assets/img/flags/Japan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Jersey.png b/web/angular/src/assets/img/flags/Jersey.png deleted file mode 100755 index b8f5ba6..0000000 Binary files a/web/angular/src/assets/img/flags/Jersey.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Jordan.png b/web/angular/src/assets/img/flags/Jordan.png deleted file mode 100755 index b627a5c..0000000 Binary files a/web/angular/src/assets/img/flags/Jordan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Kazakhstan.png b/web/angular/src/assets/img/flags/Kazakhstan.png deleted file mode 100755 index 8980ad9..0000000 Binary files a/web/angular/src/assets/img/flags/Kazakhstan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Kenya.png b/web/angular/src/assets/img/flags/Kenya.png deleted file mode 100755 index e3d7f12..0000000 Binary files a/web/angular/src/assets/img/flags/Kenya.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Kiribati.png b/web/angular/src/assets/img/flags/Kiribati.png deleted file mode 100755 index 5d286d2..0000000 Binary files a/web/angular/src/assets/img/flags/Kiribati.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Kosovo.png b/web/angular/src/assets/img/flags/Kosovo.png deleted file mode 100755 index 1d46286..0000000 Binary files a/web/angular/src/assets/img/flags/Kosovo.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Kuwait.png b/web/angular/src/assets/img/flags/Kuwait.png deleted file mode 100755 index 8d7adb1..0000000 Binary files a/web/angular/src/assets/img/flags/Kuwait.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Kyrgyzstan.png b/web/angular/src/assets/img/flags/Kyrgyzstan.png deleted file mode 100755 index cf2d885..0000000 Binary files a/web/angular/src/assets/img/flags/Kyrgyzstan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Laos.png b/web/angular/src/assets/img/flags/Laos.png deleted file mode 100755 index f3b2309..0000000 Binary files a/web/angular/src/assets/img/flags/Laos.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Latvia.png b/web/angular/src/assets/img/flags/Latvia.png deleted file mode 100755 index 6ace36d..0000000 Binary files a/web/angular/src/assets/img/flags/Latvia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Lebanon.png b/web/angular/src/assets/img/flags/Lebanon.png deleted file mode 100755 index 854717e..0000000 Binary files a/web/angular/src/assets/img/flags/Lebanon.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Lesotho.png b/web/angular/src/assets/img/flags/Lesotho.png deleted file mode 100755 index 9af5c4a..0000000 Binary files a/web/angular/src/assets/img/flags/Lesotho.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Liberia.png b/web/angular/src/assets/img/flags/Liberia.png deleted file mode 100755 index cadfec1..0000000 Binary files a/web/angular/src/assets/img/flags/Liberia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Libya.png b/web/angular/src/assets/img/flags/Libya.png deleted file mode 100755 index 8176ad5..0000000 Binary files a/web/angular/src/assets/img/flags/Libya.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Liechtenshein.png b/web/angular/src/assets/img/flags/Liechtenshein.png deleted file mode 100755 index 4661f3d..0000000 Binary files a/web/angular/src/assets/img/flags/Liechtenshein.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Lithuania.png b/web/angular/src/assets/img/flags/Lithuania.png deleted file mode 100755 index 875dd3f..0000000 Binary files a/web/angular/src/assets/img/flags/Lithuania.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Luxembourg.png b/web/angular/src/assets/img/flags/Luxembourg.png deleted file mode 100755 index cef746a..0000000 Binary files a/web/angular/src/assets/img/flags/Luxembourg.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Macao.png b/web/angular/src/assets/img/flags/Macao.png deleted file mode 100755 index e413fa5..0000000 Binary files a/web/angular/src/assets/img/flags/Macao.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Macedonia.png b/web/angular/src/assets/img/flags/Macedonia.png deleted file mode 100755 index 0bc9151..0000000 Binary files a/web/angular/src/assets/img/flags/Macedonia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Madagascar.png b/web/angular/src/assets/img/flags/Madagascar.png deleted file mode 100755 index 31e6d84..0000000 Binary files a/web/angular/src/assets/img/flags/Madagascar.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Malawi.png b/web/angular/src/assets/img/flags/Malawi.png deleted file mode 100755 index b96d0ad..0000000 Binary files a/web/angular/src/assets/img/flags/Malawi.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Malaysia.png b/web/angular/src/assets/img/flags/Malaysia.png deleted file mode 100755 index 92686c2..0000000 Binary files a/web/angular/src/assets/img/flags/Malaysia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Maldives.png b/web/angular/src/assets/img/flags/Maldives.png deleted file mode 100755 index 92472ec..0000000 Binary files a/web/angular/src/assets/img/flags/Maldives.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Mali.png b/web/angular/src/assets/img/flags/Mali.png deleted file mode 100755 index 189bff7..0000000 Binary files a/web/angular/src/assets/img/flags/Mali.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Malta.png b/web/angular/src/assets/img/flags/Malta.png deleted file mode 100755 index a93f9ee..0000000 Binary files a/web/angular/src/assets/img/flags/Malta.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Marshall Islands.png b/web/angular/src/assets/img/flags/Marshall Islands.png deleted file mode 100755 index 1d15869..0000000 Binary files a/web/angular/src/assets/img/flags/Marshall Islands.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Martinique.png b/web/angular/src/assets/img/flags/Martinique.png deleted file mode 100755 index f2b7be4..0000000 Binary files a/web/angular/src/assets/img/flags/Martinique.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Mauritania.png b/web/angular/src/assets/img/flags/Mauritania.png deleted file mode 100755 index fcf1b44..0000000 Binary files a/web/angular/src/assets/img/flags/Mauritania.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Mauritius.png b/web/angular/src/assets/img/flags/Mauritius.png deleted file mode 100755 index e4c0b7d..0000000 Binary files a/web/angular/src/assets/img/flags/Mauritius.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Mexico.png b/web/angular/src/assets/img/flags/Mexico.png deleted file mode 100755 index f0557d0..0000000 Binary files a/web/angular/src/assets/img/flags/Mexico.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Micronesia.png b/web/angular/src/assets/img/flags/Micronesia.png deleted file mode 100755 index 02cf424..0000000 Binary files a/web/angular/src/assets/img/flags/Micronesia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Moldova.png b/web/angular/src/assets/img/flags/Moldova.png deleted file mode 100755 index 344855a..0000000 Binary files a/web/angular/src/assets/img/flags/Moldova.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Monaco.png b/web/angular/src/assets/img/flags/Monaco.png deleted file mode 100755 index bda53b1..0000000 Binary files a/web/angular/src/assets/img/flags/Monaco.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Mongolia.png b/web/angular/src/assets/img/flags/Mongolia.png deleted file mode 100755 index 83b7542..0000000 Binary files a/web/angular/src/assets/img/flags/Mongolia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Montenegro.png b/web/angular/src/assets/img/flags/Montenegro.png deleted file mode 100755 index 5142918..0000000 Binary files a/web/angular/src/assets/img/flags/Montenegro.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Montserrat.png b/web/angular/src/assets/img/flags/Montserrat.png deleted file mode 100755 index a799545..0000000 Binary files a/web/angular/src/assets/img/flags/Montserrat.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Morocco.png b/web/angular/src/assets/img/flags/Morocco.png deleted file mode 100755 index c1bb970..0000000 Binary files a/web/angular/src/assets/img/flags/Morocco.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Mozambique.png b/web/angular/src/assets/img/flags/Mozambique.png deleted file mode 100755 index 07c0a8a..0000000 Binary files a/web/angular/src/assets/img/flags/Mozambique.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Myanmar(Burma).png b/web/angular/src/assets/img/flags/Myanmar(Burma).png deleted file mode 100755 index 2deafe1..0000000 Binary files a/web/angular/src/assets/img/flags/Myanmar(Burma).png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/NATO.png b/web/angular/src/assets/img/flags/NATO.png deleted file mode 100755 index d651f06..0000000 Binary files a/web/angular/src/assets/img/flags/NATO.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Namibia.png b/web/angular/src/assets/img/flags/Namibia.png deleted file mode 100755 index 9d14ed3..0000000 Binary files a/web/angular/src/assets/img/flags/Namibia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Nauru.png b/web/angular/src/assets/img/flags/Nauru.png deleted file mode 100755 index f763397..0000000 Binary files a/web/angular/src/assets/img/flags/Nauru.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Nepal.png b/web/angular/src/assets/img/flags/Nepal.png deleted file mode 100755 index f011adc..0000000 Binary files a/web/angular/src/assets/img/flags/Nepal.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Netherlands Antilles.png b/web/angular/src/assets/img/flags/Netherlands Antilles.png deleted file mode 100755 index e4f171f..0000000 Binary files a/web/angular/src/assets/img/flags/Netherlands Antilles.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Netherlands.png b/web/angular/src/assets/img/flags/Netherlands.png deleted file mode 100755 index d5ea768..0000000 Binary files a/web/angular/src/assets/img/flags/Netherlands.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/New Caledonia.png b/web/angular/src/assets/img/flags/New Caledonia.png deleted file mode 100755 index dc3e9e1..0000000 Binary files a/web/angular/src/assets/img/flags/New Caledonia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/New Zealand.png b/web/angular/src/assets/img/flags/New Zealand.png deleted file mode 100755 index ef474ad..0000000 Binary files a/web/angular/src/assets/img/flags/New Zealand.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Nicaragua.png b/web/angular/src/assets/img/flags/Nicaragua.png deleted file mode 100755 index ad8ab44..0000000 Binary files a/web/angular/src/assets/img/flags/Nicaragua.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Niger.png b/web/angular/src/assets/img/flags/Niger.png deleted file mode 100755 index 06a7c08..0000000 Binary files a/web/angular/src/assets/img/flags/Niger.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Nigeria.png b/web/angular/src/assets/img/flags/Nigeria.png deleted file mode 100755 index 899e0be..0000000 Binary files a/web/angular/src/assets/img/flags/Nigeria.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/North Korea.png b/web/angular/src/assets/img/flags/North Korea.png deleted file mode 100755 index f51a2bf..0000000 Binary files a/web/angular/src/assets/img/flags/North Korea.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Northern Cyprus.png b/web/angular/src/assets/img/flags/Northern Cyprus.png deleted file mode 100755 index cb34657..0000000 Binary files a/web/angular/src/assets/img/flags/Northern Cyprus.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Northern Ireland.png b/web/angular/src/assets/img/flags/Northern Ireland.png deleted file mode 100755 index c0eafdf..0000000 Binary files a/web/angular/src/assets/img/flags/Northern Ireland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Norway.png b/web/angular/src/assets/img/flags/Norway.png deleted file mode 100755 index 2b03236..0000000 Binary files a/web/angular/src/assets/img/flags/Norway.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/OPEC.png b/web/angular/src/assets/img/flags/OPEC.png deleted file mode 100755 index 5d9c242..0000000 Binary files a/web/angular/src/assets/img/flags/OPEC.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Olimpic Movement.png b/web/angular/src/assets/img/flags/Olimpic Movement.png deleted file mode 100755 index 71d97ae..0000000 Binary files a/web/angular/src/assets/img/flags/Olimpic Movement.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Oman.png b/web/angular/src/assets/img/flags/Oman.png deleted file mode 100755 index 111b114..0000000 Binary files a/web/angular/src/assets/img/flags/Oman.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Pakistan.png b/web/angular/src/assets/img/flags/Pakistan.png deleted file mode 100755 index 1630f55..0000000 Binary files a/web/angular/src/assets/img/flags/Pakistan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Palau.png b/web/angular/src/assets/img/flags/Palau.png deleted file mode 100755 index 21a45c4..0000000 Binary files a/web/angular/src/assets/img/flags/Palau.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Palestine.png b/web/angular/src/assets/img/flags/Palestine.png deleted file mode 100755 index 6f654e3..0000000 Binary files a/web/angular/src/assets/img/flags/Palestine.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Panama.png b/web/angular/src/assets/img/flags/Panama.png deleted file mode 100755 index e39849d..0000000 Binary files a/web/angular/src/assets/img/flags/Panama.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Papua New Guinea.png b/web/angular/src/assets/img/flags/Papua New Guinea.png deleted file mode 100755 index 7b0d0ee..0000000 Binary files a/web/angular/src/assets/img/flags/Papua New Guinea.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Paraguay.png b/web/angular/src/assets/img/flags/Paraguay.png deleted file mode 100755 index d8cc505..0000000 Binary files a/web/angular/src/assets/img/flags/Paraguay.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Peru.png b/web/angular/src/assets/img/flags/Peru.png deleted file mode 100755 index f971a35..0000000 Binary files a/web/angular/src/assets/img/flags/Peru.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Philippines.png b/web/angular/src/assets/img/flags/Philippines.png deleted file mode 100755 index d025d4d..0000000 Binary files a/web/angular/src/assets/img/flags/Philippines.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Poland.png b/web/angular/src/assets/img/flags/Poland.png deleted file mode 100755 index 7a71804..0000000 Binary files a/web/angular/src/assets/img/flags/Poland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Portugal.png b/web/angular/src/assets/img/flags/Portugal.png deleted file mode 100755 index 5b39073..0000000 Binary files a/web/angular/src/assets/img/flags/Portugal.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Puerto Rico.png b/web/angular/src/assets/img/flags/Puerto Rico.png deleted file mode 100755 index 146ca81..0000000 Binary files a/web/angular/src/assets/img/flags/Puerto Rico.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Qatar.png b/web/angular/src/assets/img/flags/Qatar.png deleted file mode 100755 index 1dd1183..0000000 Binary files a/web/angular/src/assets/img/flags/Qatar.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Red Cross.png b/web/angular/src/assets/img/flags/Red Cross.png deleted file mode 100755 index fd79967..0000000 Binary files a/web/angular/src/assets/img/flags/Red Cross.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Reunion.png b/web/angular/src/assets/img/flags/Reunion.png deleted file mode 100755 index 8087909..0000000 Binary files a/web/angular/src/assets/img/flags/Reunion.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Romania.png b/web/angular/src/assets/img/flags/Romania.png deleted file mode 100755 index b8cdad8..0000000 Binary files a/web/angular/src/assets/img/flags/Romania.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Russia.png b/web/angular/src/assets/img/flags/Russia.png deleted file mode 100755 index a5b9528..0000000 Binary files a/web/angular/src/assets/img/flags/Russia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Rwanda.png b/web/angular/src/assets/img/flags/Rwanda.png deleted file mode 100755 index f6f5163..0000000 Binary files a/web/angular/src/assets/img/flags/Rwanda.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Saint Lucia.png b/web/angular/src/assets/img/flags/Saint Lucia.png deleted file mode 100755 index 987e1f0..0000000 Binary files a/web/angular/src/assets/img/flags/Saint Lucia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Samoa.png b/web/angular/src/assets/img/flags/Samoa.png deleted file mode 100755 index e671ebb..0000000 Binary files a/web/angular/src/assets/img/flags/Samoa.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/San Marino.png b/web/angular/src/assets/img/flags/San Marino.png deleted file mode 100755 index 92bd72b..0000000 Binary files a/web/angular/src/assets/img/flags/San Marino.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Sao Tome & Principe.png b/web/angular/src/assets/img/flags/Sao Tome & Principe.png deleted file mode 100755 index b5187c6..0000000 Binary files a/web/angular/src/assets/img/flags/Sao Tome & Principe.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Saudi Arabia.png b/web/angular/src/assets/img/flags/Saudi Arabia.png deleted file mode 100755 index 9630e83..0000000 Binary files a/web/angular/src/assets/img/flags/Saudi Arabia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Scotland.png b/web/angular/src/assets/img/flags/Scotland.png deleted file mode 100755 index 4ac5281..0000000 Binary files a/web/angular/src/assets/img/flags/Scotland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Senegal.png b/web/angular/src/assets/img/flags/Senegal.png deleted file mode 100755 index 13c9365..0000000 Binary files a/web/angular/src/assets/img/flags/Senegal.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Serbia(Yugoslavia).png b/web/angular/src/assets/img/flags/Serbia(Yugoslavia).png deleted file mode 100755 index b2afcf5..0000000 Binary files a/web/angular/src/assets/img/flags/Serbia(Yugoslavia).png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Seychelles.png b/web/angular/src/assets/img/flags/Seychelles.png deleted file mode 100755 index de605e6..0000000 Binary files a/web/angular/src/assets/img/flags/Seychelles.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Sierra Leone.png b/web/angular/src/assets/img/flags/Sierra Leone.png deleted file mode 100755 index 47b26eb..0000000 Binary files a/web/angular/src/assets/img/flags/Sierra Leone.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Singapore.png b/web/angular/src/assets/img/flags/Singapore.png deleted file mode 100755 index 4b88785..0000000 Binary files a/web/angular/src/assets/img/flags/Singapore.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Slovakia.png b/web/angular/src/assets/img/flags/Slovakia.png deleted file mode 100755 index 418c786..0000000 Binary files a/web/angular/src/assets/img/flags/Slovakia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Slovenia.png b/web/angular/src/assets/img/flags/Slovenia.png deleted file mode 100755 index cfa83b5..0000000 Binary files a/web/angular/src/assets/img/flags/Slovenia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Solomon Islands.png b/web/angular/src/assets/img/flags/Solomon Islands.png deleted file mode 100755 index f1ffebb..0000000 Binary files a/web/angular/src/assets/img/flags/Solomon Islands.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Somalia.png b/web/angular/src/assets/img/flags/Somalia.png deleted file mode 100755 index 6a02c72..0000000 Binary files a/web/angular/src/assets/img/flags/Somalia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Somaliland.png b/web/angular/src/assets/img/flags/Somaliland.png deleted file mode 100755 index d44f580..0000000 Binary files a/web/angular/src/assets/img/flags/Somaliland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/South Africa.png b/web/angular/src/assets/img/flags/South Africa.png deleted file mode 100755 index d1920de..0000000 Binary files a/web/angular/src/assets/img/flags/South Africa.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/South Korea.png b/web/angular/src/assets/img/flags/South Korea.png deleted file mode 100755 index 13e27e1..0000000 Binary files a/web/angular/src/assets/img/flags/South Korea.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Spain.png b/web/angular/src/assets/img/flags/Spain.png deleted file mode 100755 index 38b66bc..0000000 Binary files a/web/angular/src/assets/img/flags/Spain.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Sri Lanka.png b/web/angular/src/assets/img/flags/Sri Lanka.png deleted file mode 100755 index 2a7d925..0000000 Binary files a/web/angular/src/assets/img/flags/Sri Lanka.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/St Kitts & Nevis.png b/web/angular/src/assets/img/flags/St Kitts & Nevis.png deleted file mode 100755 index 75f3ed2..0000000 Binary files a/web/angular/src/assets/img/flags/St Kitts & Nevis.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/St Vincent & the Grenadines.png b/web/angular/src/assets/img/flags/St Vincent & the Grenadines.png deleted file mode 100755 index e633360..0000000 Binary files a/web/angular/src/assets/img/flags/St Vincent & the Grenadines.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Sudan.png b/web/angular/src/assets/img/flags/Sudan.png deleted file mode 100755 index 3a37985..0000000 Binary files a/web/angular/src/assets/img/flags/Sudan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Suriname.png b/web/angular/src/assets/img/flags/Suriname.png deleted file mode 100755 index cb4a87a..0000000 Binary files a/web/angular/src/assets/img/flags/Suriname.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Swaziland.png b/web/angular/src/assets/img/flags/Swaziland.png deleted file mode 100755 index 3585ac0..0000000 Binary files a/web/angular/src/assets/img/flags/Swaziland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Sweden.png b/web/angular/src/assets/img/flags/Sweden.png deleted file mode 100755 index 2c9bd9d..0000000 Binary files a/web/angular/src/assets/img/flags/Sweden.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Switzerland.png b/web/angular/src/assets/img/flags/Switzerland.png deleted file mode 100755 index 223154d..0000000 Binary files a/web/angular/src/assets/img/flags/Switzerland.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Syria.png b/web/angular/src/assets/img/flags/Syria.png deleted file mode 100755 index 0584c20..0000000 Binary files a/web/angular/src/assets/img/flags/Syria.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Tahiti(French Polinesia).png b/web/angular/src/assets/img/flags/Tahiti(French Polinesia).png deleted file mode 100755 index cbc56d0..0000000 Binary files a/web/angular/src/assets/img/flags/Tahiti(French Polinesia).png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Taiwan.png b/web/angular/src/assets/img/flags/Taiwan.png deleted file mode 100755 index 956d853..0000000 Binary files a/web/angular/src/assets/img/flags/Taiwan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Tajikistan.png b/web/angular/src/assets/img/flags/Tajikistan.png deleted file mode 100755 index 09a7907..0000000 Binary files a/web/angular/src/assets/img/flags/Tajikistan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Tanzania.png b/web/angular/src/assets/img/flags/Tanzania.png deleted file mode 100755 index f0e1f39..0000000 Binary files a/web/angular/src/assets/img/flags/Tanzania.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Thailand.png b/web/angular/src/assets/img/flags/Thailand.png deleted file mode 100755 index 8f3b5e7..0000000 Binary files a/web/angular/src/assets/img/flags/Thailand.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Timor-Leste.png b/web/angular/src/assets/img/flags/Timor-Leste.png deleted file mode 100755 index 296fba0..0000000 Binary files a/web/angular/src/assets/img/flags/Timor-Leste.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Togo.png b/web/angular/src/assets/img/flags/Togo.png deleted file mode 100755 index 5a100b1..0000000 Binary files a/web/angular/src/assets/img/flags/Togo.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Tonga.png b/web/angular/src/assets/img/flags/Tonga.png deleted file mode 100755 index f62ba37..0000000 Binary files a/web/angular/src/assets/img/flags/Tonga.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Trinidad & Tobago.png b/web/angular/src/assets/img/flags/Trinidad & Tobago.png deleted file mode 100755 index cf85660..0000000 Binary files a/web/angular/src/assets/img/flags/Trinidad & Tobago.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Tunisia.png b/web/angular/src/assets/img/flags/Tunisia.png deleted file mode 100755 index d867a5e..0000000 Binary files a/web/angular/src/assets/img/flags/Tunisia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Turkey.png b/web/angular/src/assets/img/flags/Turkey.png deleted file mode 100755 index 0398e54..0000000 Binary files a/web/angular/src/assets/img/flags/Turkey.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Turkmenistan.png b/web/angular/src/assets/img/flags/Turkmenistan.png deleted file mode 100755 index e3c50ed..0000000 Binary files a/web/angular/src/assets/img/flags/Turkmenistan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Turks and Caicos Islands.png b/web/angular/src/assets/img/flags/Turks and Caicos Islands.png deleted file mode 100755 index fc66ef0..0000000 Binary files a/web/angular/src/assets/img/flags/Turks and Caicos Islands.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Tuvalu.png b/web/angular/src/assets/img/flags/Tuvalu.png deleted file mode 100755 index 3a403a6..0000000 Binary files a/web/angular/src/assets/img/flags/Tuvalu.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/USA.png b/web/angular/src/assets/img/flags/USA.png deleted file mode 100755 index 48c448f..0000000 Binary files a/web/angular/src/assets/img/flags/USA.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Uganda.png b/web/angular/src/assets/img/flags/Uganda.png deleted file mode 100755 index 744d39d..0000000 Binary files a/web/angular/src/assets/img/flags/Uganda.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Ukraine.png b/web/angular/src/assets/img/flags/Ukraine.png deleted file mode 100755 index 78e4945..0000000 Binary files a/web/angular/src/assets/img/flags/Ukraine.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/United Arab Emirates.png b/web/angular/src/assets/img/flags/United Arab Emirates.png deleted file mode 100755 index 1161375..0000000 Binary files a/web/angular/src/assets/img/flags/United Arab Emirates.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/United Nations.png b/web/angular/src/assets/img/flags/United Nations.png deleted file mode 100755 index 6b5f639..0000000 Binary files a/web/angular/src/assets/img/flags/United Nations.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/United-Kingdom.png b/web/angular/src/assets/img/flags/United-Kingdom.png deleted file mode 100755 index 3853f5e..0000000 Binary files a/web/angular/src/assets/img/flags/United-Kingdom.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Uruguay.png b/web/angular/src/assets/img/flags/Uruguay.png deleted file mode 100755 index 0eddedc..0000000 Binary files a/web/angular/src/assets/img/flags/Uruguay.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Uzbekistan.png b/web/angular/src/assets/img/flags/Uzbekistan.png deleted file mode 100755 index 97ade3f..0000000 Binary files a/web/angular/src/assets/img/flags/Uzbekistan.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Vanutau.png b/web/angular/src/assets/img/flags/Vanutau.png deleted file mode 100755 index ff6cbef..0000000 Binary files a/web/angular/src/assets/img/flags/Vanutau.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Vatican City.png b/web/angular/src/assets/img/flags/Vatican City.png deleted file mode 100755 index c344e8b..0000000 Binary files a/web/angular/src/assets/img/flags/Vatican City.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Venezuela.png b/web/angular/src/assets/img/flags/Venezuela.png deleted file mode 100755 index 8ba69c4..0000000 Binary files a/web/angular/src/assets/img/flags/Venezuela.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Viet Nam.png b/web/angular/src/assets/img/flags/Viet Nam.png deleted file mode 100755 index c9368df..0000000 Binary files a/web/angular/src/assets/img/flags/Viet Nam.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Virgin Islands British.png b/web/angular/src/assets/img/flags/Virgin Islands British.png deleted file mode 100755 index eb22e44..0000000 Binary files a/web/angular/src/assets/img/flags/Virgin Islands British.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Virgin Islands US.png b/web/angular/src/assets/img/flags/Virgin Islands US.png deleted file mode 100755 index 13be807..0000000 Binary files a/web/angular/src/assets/img/flags/Virgin Islands US.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Wales.png b/web/angular/src/assets/img/flags/Wales.png deleted file mode 100755 index 3c49345..0000000 Binary files a/web/angular/src/assets/img/flags/Wales.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Western Sahara.png b/web/angular/src/assets/img/flags/Western Sahara.png deleted file mode 100755 index 5eb501c..0000000 Binary files a/web/angular/src/assets/img/flags/Western Sahara.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Yemen.png b/web/angular/src/assets/img/flags/Yemen.png deleted file mode 100755 index 987a212..0000000 Binary files a/web/angular/src/assets/img/flags/Yemen.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Zambia.png b/web/angular/src/assets/img/flags/Zambia.png deleted file mode 100755 index 639c3ac..0000000 Binary files a/web/angular/src/assets/img/flags/Zambia.png and /dev/null differ diff --git a/web/angular/src/assets/img/flags/Zimbabwe.png b/web/angular/src/assets/img/flags/Zimbabwe.png deleted file mode 100755 index 39106df..0000000 Binary files a/web/angular/src/assets/img/flags/Zimbabwe.png and /dev/null differ diff --git a/web/angular/src/assets/img/icon_launcher.png b/web/angular/src/assets/img/icon_launcher.png deleted file mode 100644 index c06b067..0000000 Binary files a/web/angular/src/assets/img/icon_launcher.png and /dev/null differ diff --git a/web/angular/src/assets/img/logo-symbol.png b/web/angular/src/assets/img/logo-symbol.png deleted file mode 100755 index 7f62aff..0000000 Binary files a/web/angular/src/assets/img/logo-symbol.png and /dev/null differ diff --git a/web/angular/src/assets/img/logo.png b/web/angular/src/assets/img/logo.png deleted file mode 100755 index 98a1946..0000000 Binary files a/web/angular/src/assets/img/logo.png and /dev/null differ diff --git a/web/angular/src/assets/img/marker_normal.png b/web/angular/src/assets/img/marker_normal.png deleted file mode 100644 index 01f2f91..0000000 Binary files a/web/angular/src/assets/img/marker_normal.png and /dev/null differ diff --git a/web/angular/src/assets/img/marker_place.png b/web/angular/src/assets/img/marker_place.png deleted file mode 100644 index 3bb06fa..0000000 Binary files a/web/angular/src/assets/img/marker_place.png and /dev/null differ diff --git a/web/angular/src/assets/markers/marker_dark.png b/web/angular/src/assets/markers/marker_dark.png new file mode 100644 index 0000000..67ac47e Binary files /dev/null and b/web/angular/src/assets/markers/marker_dark.png differ diff --git a/web/angular/src/assets/markers/marker_normal.png b/web/angular/src/assets/markers/marker_normal.png new file mode 100644 index 0000000..8a181ad Binary files /dev/null and b/web/angular/src/assets/markers/marker_normal.png differ diff --git a/web/angular/src/assets/markers/marker_pin.png b/web/angular/src/assets/markers/marker_pin.png new file mode 100644 index 0000000..3bf0be4 Binary files /dev/null and b/web/angular/src/assets/markers/marker_pin.png differ diff --git a/web/angular/src/assets/markers/marker_shadow.png b/web/angular/src/assets/markers/marker_shadow.png new file mode 100644 index 0000000..2a22586 Binary files /dev/null and b/web/angular/src/assets/markers/marker_shadow.png differ diff --git a/web/angular/src/environments/environment.ts b/web/angular/src/environments/environment.ts index 00313f1..b7f639a 100755 --- a/web/angular/src/environments/environment.ts +++ b/web/angular/src/environments/environment.ts @@ -1,7 +1,7 @@ // The file contents for the current environment will overwrite these during build. // The build system defaults to the dev environment which uses `environment.ts`, but if you do // `ng build --env=prod` then `environment.prod.ts` will be used instead. -// The list of which env maps to which file can be found in `angular-cli.json`. +// The list of which env maps to which file can be found in `.angular-cli.json`. export const environment = { production: false diff --git a/web/angular/src/favicon.ico b/web/angular/src/favicon.ico index 8081c7c..2ebfa0d 100644 Binary files a/web/angular/src/favicon.ico and b/web/angular/src/favicon.ico differ diff --git a/web/angular/src/fonts.scss b/web/angular/src/fonts.scss new file mode 100644 index 0000000..3a77091 --- /dev/null +++ b/web/angular/src/fonts.scss @@ -0,0 +1,69 @@ +/** + * Setup of self-hosted material icons font. + * + * http://google.github.io/material-design-icons/#icon-font-for-the-web + */ +@font-face { + font-family: 'Material Icons'; + font-style: normal; + font-weight: 400; + src: url(assets/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ + src: local('Material Icons'), + local('MaterialIcons-Regular'), + url(/assets/fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(/assets/fonts/MaterialIcons-Regular.woff) format('woff'), + url(/assets/fonts/MaterialIcons-Regular.ttf) format('truetype'); + } + +.material-icons { + font-family: 'Material Icons'; + font-weight: normal; + font-style: normal; + font-size: 24px; /* Preferred icon size */ + display: inline-block; + line-height: 1; + text-transform: none; + letter-spacing: normal; + word-wrap: normal; + white-space: nowrap; + direction: ltr; + + /* Support for all WebKit browsers. */ + -webkit-font-smoothing: antialiased; + /* Support for Safari and Chrome. */ + text-rendering: optimizeLegibility; + + /* Support for Firefox. */ + -moz-osx-font-smoothing: grayscale; + + /* Support for IE. */ + font-feature-settings: 'liga'; + } + +/** + * Setup of self-hosted roboto font. + * + * https://google-webfonts-helper.herokuapp.com/fonts/roboto?subsets=latin + */ + @font-face { + font-family: 'Roboto'; + font-style: normal; + font-weight: 400; + src: url('/assets/fonts/RobotoLatin-Regular.eot'); /* IE9 Compat Modes */ + src: local('Roboto'), local('Roboto-Regular'), + url('/assets/fonts/RobotoLatin-Regular.woff2') format('woff2'), /* Super Modern Browsers */ + url('/assets/fonts/RobotoLatin-Regular.woff') format('woff'), /* Modern Browsers */ + url('/assets/fonts/RobotoLatin-Regular.ttf') format('truetype'), /* Safari, Android, iOS */ + } + + /* roboto-mono-regular - latin */ +@font-face { + font-family: 'Roboto Mono'; + font-style: normal; + font-weight: 400; + src: url('/assets/fonts/RobotoMonoLatin-Regular.eot'); /* IE9 Compat Modes */ + src: local('Roboto Mono'), local('RobotoMono-Regular'), + url('/assets/fonts/RobotoMonoLatin-Regular.woff2') format('woff2'), /* Super Modern Browsers */ + url('/assets/fonts/RobotoMonoLatin-Regular.woff') format('woff'), /* Modern Browsers */ + url('/assets/fonts/RobotoMonoLatin-Regular.ttf') format('truetype'), /* Safari, Android, iOS */ +} \ No newline at end of file diff --git a/web/angular/src/img/favicon.png b/web/angular/src/img/favicon.png deleted file mode 100755 index 7f62aff..0000000 Binary files a/web/angular/src/img/favicon.png and /dev/null differ diff --git a/web/angular/src/img/icon_launcher.png b/web/angular/src/img/icon_launcher.png deleted file mode 100644 index c06b067..0000000 Binary files a/web/angular/src/img/icon_launcher.png and /dev/null differ diff --git a/web/angular/src/img/logo-symbol.png b/web/angular/src/img/logo-symbol.png deleted file mode 100755 index 7f62aff..0000000 Binary files a/web/angular/src/img/logo-symbol.png and /dev/null differ diff --git a/web/angular/src/img/logo.png b/web/angular/src/img/logo.png deleted file mode 100755 index 98a1946..0000000 Binary files a/web/angular/src/img/logo.png and /dev/null differ diff --git a/web/angular/src/index.html b/web/angular/src/index.html index 6cf706a..8fde556 100755 --- a/web/angular/src/index.html +++ b/web/angular/src/index.html @@ -1,46 +1,34 @@ - + + - - - - Maptology + Maptology + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + - + \ No newline at end of file diff --git a/web/angular/src/main.ts b/web/angular/src/main.ts index 91ec6da..a7ea96c 100644 --- a/web/angular/src/main.ts +++ b/web/angular/src/main.ts @@ -4,6 +4,8 @@ import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; +import 'hammerjs'; + if (environment.production) { enableProdMode(); } diff --git a/web/angular/src/polyfills.ts b/web/angular/src/polyfills.ts index 20d4075..af84770 100644 --- a/web/angular/src/polyfills.ts +++ b/web/angular/src/polyfills.ts @@ -52,10 +52,23 @@ import 'core-js/es7/reflect'; **/ // import 'web-animations-js'; // Run `npm install --save web-animations-js`. +/** + * By default, zone.js will patch all possible macroTask and DomEvents + * user can disable parts of macroTask/DomEvents patch by setting following flags + */ + // (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame + // (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick + // (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames + + /* + * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js + * with the following flag, it will bypass `zone.js` patch for IE/Edge + */ +// (window as any).__Zone_enable_cross_context_check = true; /*************************************************************************************************** - * Zone JS is required by Angular itself. + * Zone JS is required by default for Angular itself. */ import 'zone.js/dist/zone'; // Included with Angular CLI. @@ -64,13 +77,3 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. /*************************************************************************************************** * APPLICATION IMPORTS */ - -/** - * Date, currency, decimal and percent pipes. - * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 - */ -// import 'intl'; // Run `npm install --save intl`. -/** - * Need to import at least one locale-data with intl. - */ -// import 'intl/locale-data/jsonp/en'; diff --git a/web/angular/src/scss/_bootstrap-variables.scss b/web/angular/src/scss/_bootstrap-variables.scss deleted file mode 100755 index 954d343..0000000 --- a/web/angular/src/scss/_bootstrap-variables.scss +++ /dev/null @@ -1,121 +0,0 @@ -// Bootstrap overrides - -// -// Color system -// - -$white: #fff; -$gray-100: #f0f3f5; -$gray-200: #c2cfd6; -$gray-300: #a4b7c1; -$gray-400: #869fac; -$gray-500: #678898; -$gray-600: #536c79; -$gray-700: #3e515b; -$gray-800: #29363d; -$gray-900: #151b1e; -$black: #000 !default; - -$blue: #20a8d8; -$indigo: #6610f2 !default; -$purple: #6f42c1 !default; -$pink: #e83e8c !default; -$red: #f86c6b; -$orange: #f8cb00; -$yellow: #ffc107 !default; -$green: #4dbd74; -$teal: #20c997 !default; -$cyan: #63c2de; - -$primary: #01579b; -$primary-light: #4f83cc; -$primary-dark: #002f6c; - -$secondary: #f9a825; -$secondary-light: #ffd95a; -$secondary-dark: #c17900; - -$colors: ( - blue: $blue, - indigo: $indigo, - purple: $purple, - pink: $pink, - red: $red, - orange: $orange, - yellow: $yellow, - green: $green, - teal: $teal, - cyan: $cyan, - white: $white, - gray: $gray-600, - gray-dark: $gray-800 -); - -$theme-colors: ( - primary: $primary, //$blue, - primary-light: $primary-light, //did not exist - primary-dark: $primary-dark, //did not exist - secondary: $secondary, //$gray-300, - secondary-light: $secondary-light,//did not exist - secondary-dark: $secondary-dark,//did not exist - success: $green, - info: $cyan, - warning: $secondary-dark, - danger: $red, - light: $gray-100, - dark: $gray-800 -); - -// Options -// -// Quickly modify global styling by enabling or disabling optional features. - -$enable-transitions: true; -$enable-rounded: false; - -// Body -// -// Settings for the `` element. - -$body-bg: #e4e5e6; - -// Typography -// -// Font, line-height, and color for body text, headings, and more. - -$font-size-base: 0.875rem; - -// Breadcrumbs - -$breadcrumb-bg: #fff; -$breadcrumb-margin-bottom: 1.5rem; - -// Cards - -$card-border-color: $gray-200; -$card-cap-bg: $gray-100; - -// Dropdowns - -$dropdown-padding-y: 0; -$dropdown-border-color: $gray-200; -$dropdown-divider-bg: $gray-100; - -// Buttons - -$btn-secondary-border: $gray-300; - -// Progress bars - -$progress-bg: $gray-100; - -// Tables - -$table-bg-accent: $gray-100; -$table-bg-hover: $gray-100; - -// Forms - -$input-group-addon-bg: $gray-100; -$input-border-color: $gray-200; -$input-group-addon-border-color: $gray-200; diff --git a/web/angular/src/scss/_core-variables.scss b/web/angular/src/scss/_core-variables.scss deleted file mode 100755 index df3271d..0000000 --- a/web/angular/src/scss/_core-variables.scss +++ /dev/null @@ -1,5 +0,0 @@ -// core overrides -@import "node_modules/bootstrap/scss/functions"; -//CUSTOMCOLORS -$sidebar-nav-link-active-icon-color: theme-color("secondary") !default; -$sidebar-nav-link-icon-color: theme-color("secondary-dark") !default; diff --git a/web/angular/src/scss/_custom.scss b/web/angular/src/scss/_custom.scss deleted file mode 100755 index 15d367a..0000000 --- a/web/angular/src/scss/_custom.scss +++ /dev/null @@ -1 +0,0 @@ -// Here you can add other styles diff --git a/web/angular/src/scss/core/_animate.scss b/web/angular/src/scss/core/_animate.scss deleted file mode 100755 index c0a244b..0000000 --- a/web/angular/src/scss/core/_animate.scss +++ /dev/null @@ -1,27 +0,0 @@ -// scss-lint:disable all -.animated { - animation-duration: 1s; - // animation-fill-mode: both; -} - -.animated.infinite { - animation-iteration-count: infinite; -} - -.animated.hinge { - animation-duration: 2s; -} - -@keyframes fadeIn { - from { - opacity: 0; - } - - to { - opacity: 1; - } -} - -.fadeIn { - animation-name: fadeIn; -} diff --git a/web/angular/src/scss/core/_aside.scss b/web/angular/src/scss/core/_aside.scss deleted file mode 100755 index fc71e42..0000000 --- a/web/angular/src/scss/core/_aside.scss +++ /dev/null @@ -1,64 +0,0 @@ -.aside-menu { - z-index: $zindex-sticky - 1; - width: $aside-menu-width; - color: $aside-menu-color; - background: $aside-menu-bg; - @include borders($aside-menu-borders); - - .nav-tabs { - border-color: $border-color; - .nav-link { - padding: $aside-menu-nav-padding-y $aside-menu-nav-padding-x; - color: $body-color; - border-top: 0; - &.active { - color: theme-color("primary"); - border-right-color: $border-color; - border-left-color: $border-color; - } - } - .nav-item:first-child { - .nav-link { - border-left: 0; - } - } - } - - .tab-content { - position: relative; - overflow-x: hidden; - overflow-y: auto; - border: 0; - border-top: 1px solid $border-color; - -ms-overflow-style: -ms-autohiding-scrollbar; - - &::-webkit-scrollbar { - width: 10px; - margin-left: -10px; - -webkit-appearance: none; - } - - // &::-webkit-scrollbar-button { } - - &::-webkit-scrollbar-track { - background-color: lighten($aside-menu-bg, 5%); - border-right: 1px solid darken($aside-menu-bg, 5%); - border-left: 1px solid darken($aside-menu-bg, 5%); - } - - // &::-webkit-scrollbar-track-piece { } - - &::-webkit-scrollbar-thumb { - height: 50px; - background-color: darken($aside-menu-bg, 10%); - background-clip: content-box; - border-color: transparent; - border-style: solid; - border-width: 1px 2px; - } - - .tab-pane { - padding: 0; - } - } -} diff --git a/web/angular/src/scss/core/_avatars.scss b/web/angular/src/scss/core/_avatars.scss deleted file mode 100755 index 623016e..0000000 --- a/web/angular/src/scss/core/_avatars.scss +++ /dev/null @@ -1,51 +0,0 @@ -.img-avatar { - border-radius: 50em; -} - -.avatar { - $width: 36px; - $status-width: 10px; - @include avatar($width,$status-width); -} - -.avatar.avatar-xs { - $width: 20px; - $status-width: 8px; - @include avatar($width,$status-width); -} - -.avatar.avatar-sm { - $width: 24px; - $status-width: 8px; - @include avatar($width,$status-width); -} - -.avatar.avatar-lg { - $width: 72px; - $status-width: 12px; - @include avatar($width,$status-width); -} - -.avatars-stack { - .avatar.avatar-xs { - margin-right: -10px; - } - - // .avatar.avatar-sm { - // - // } - - .avatar { - margin-right: -15px; - transition: margin-left $layout-transition-speed, margin-right $layout-transition-speed; - - &:hover { - margin-right: 0 !important; - } - } - - // .avatar.avatar-lg { - // - // } - -} diff --git a/web/angular/src/scss/core/_badge.scss b/web/angular/src/scss/core/_badge.scss deleted file mode 100755 index 3104885..0000000 --- a/web/angular/src/scss/core/_badge.scss +++ /dev/null @@ -1,3 +0,0 @@ -.badge-pill { - border-radius: $badge-pill-border-radius; -} diff --git a/web/angular/src/scss/core/_breadcrumb-menu.scss b/web/angular/src/scss/core/_breadcrumb-menu.scss deleted file mode 100755 index dbbe07e..0000000 --- a/web/angular/src/scss/core/_breadcrumb-menu.scss +++ /dev/null @@ -1,35 +0,0 @@ -.breadcrumb-menu { - margin-left: auto; - - &::before { - display: none; - } - - .btn-group { - vertical-align: top; - } - - .btn { - padding: 0 $input-btn-padding-x; - color: $text-muted; - vertical-align: top; - border: 0; - - &:hover, &.active { - color: $body-color; - background: transparent; - } - } - - .open { - .btn { - color: $body-color; - background: transparent; - } - } - - .dropdown-menu { - min-width: 180px; - line-height: $line-height-base; - } -} diff --git a/web/angular/src/scss/core/_breadcrumb.scss b/web/angular/src/scss/core/_breadcrumb.scss deleted file mode 100755 index d8a003d..0000000 --- a/web/angular/src/scss/core/_breadcrumb.scss +++ /dev/null @@ -1,4 +0,0 @@ -.breadcrumb { - position: relative; - @include borders($breadcrumb-borders); -} diff --git a/web/angular/src/scss/core/_buttons.scss b/web/angular/src/scss/core/_buttons.scss deleted file mode 100755 index 7ab4953..0000000 --- a/web/angular/src/scss/core/_buttons.scss +++ /dev/null @@ -1,575 +0,0 @@ -button { - cursor: pointer; -} - -.btn { - .badge { - position: absolute; - top: 2px; - right: 6px; - font-size: 9px; - } -} - -.btn-transparent { - color: #fff; - background-color: transparent; - border-color: transparent; -} - -.btn { - [class^="icon-"], [class*=" icon-"] { - display: inline-block; - margin-top: -2px; - vertical-align: middle; - } -} - -.btn-facebook, -.btn-twitter, -.btn-linkedin, -.btn-flickr, -.btn-tumblr, -.btn-xing, -.btn-github, -.btn-html5, -.btn-openid, -.btn-stack-overflow, -.btn-youtube, -.btn-css3, -.btn-dribbble, -.btn-google-plus, -.btn-instagram, -.btn-pinterest, -.btn-vk, -.btn-yahoo, -.btn-behance, -.btn-dropbox, -.btn-reddit, -.btn-spotify, -.btn-vine, -.btn-foursquare, -.btn-vimeo { - position: relative; - overflow: hidden; - color: #fff !important; - text-align: center; - - &::before { - position: absolute; - top: 0; - left: 0; - display: block; - font-family: "FontAwesome"; - font-style: normal; - font-weight: normal; - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; - } - - &:hover { - color: #fff; - } - - &.icon { - - span { - display: none; - } - } - - &.text { - &::before { - display: none; - } - - span { - margin-left: 0 !important; - } - } - @include button-social-size($input-btn-padding-y, $input-btn-padding-x, $font-size-base, $line-height-base, $btn-border-radius); - - &.btn-lg { - @include button-social-size($input-btn-padding-y-lg, $input-btn-padding-x-lg, $font-size-lg, $line-height-lg, $btn-border-radius-lg); - } - - &.btn-sm { - @include button-social-size($input-btn-padding-y-sm, $input-btn-padding-x-sm, $font-size-sm, $line-height-sm, $btn-border-radius-sm); - } - -} - -.btn-facebook { - $color: $facebook; - - background: $color; - &::before { - content: "\f09a"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-twitter { - $color: $twitter; - - background: $color; - &::before { - content: "\f099"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-linkedin { - $color: $linkedin; - - background: $color; - &::before { - content: "\f0e1"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-flickr { - $color: $flickr; - - background: $color; - &::before { - content: "\f16e"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-tumblr { - $color: $tumblr; - - background: $color; - &::before { - content: "\f173"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-xing { - $color: $xing; - - background: $color; - &::before { - content: "\f168"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-github { - $color: $github; - - background: $color; - &::before { - content: "\f09b"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-html5 { - $color: $html5; - - background: $color; - &::before { - content: "\f13b"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-openid { - $color: $openid; - - background: $color; - &::before { - content: "\f19b"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-stack-overflow { - $color: $stack-overflow; - - background: $color; - &::before { - content: "\f16c"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-css3 { - $color: $css3; - - background: $color; - &::before { - content: "\f13c"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-youtube { - $color: $youtube; - - background: $color; - &::before { - content: "\f167"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-dribbble { - $color: $dribbble; - - background: $color; - &::before { - content: "\f17d"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-google-plus { - $color: $google-plus; - - background: $color; - &::before { - content: "\f0d5"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-instagram { - $color: $instagram; - - background: $color; - &::before { - content: "\f16d"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-pinterest { - $color: $pinterest; - - background: $color; - &::before { - content: "\f0d2"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-vk { - $color: $vk; - - background: $color; - &::before { - content: "\f189"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-yahoo { - $color: $yahoo; - - background: $color; - &::before { - content: "\f19e"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-behance { - $color: $behance; - - background: $color; - &::before { - content: "\f1b4"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-dropbox { - $color: $dropbox; - - background: $color; - &::before { - content: "\f16b"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-reddit { - $color: $reddit; - - background: $color; - &::before { - content: "\f1a1"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-spotify { - $color: $spotify; - - background: $color; - &::before { - content: "\f1bc"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-vine { - $color: $vine; - - background: $color; - &::before { - content: "\f1ca"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-foursquare { - $color: $foursquare; - - background: $color; - &::before { - content: "\f180"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} - -.btn-vimeo { - $color: $vimeo; - - background: $color; - &::before { - content: "\f194"; - background: darken($color, 5%); - - } - - &:hover { - background: darken($color, 5%); - - &::before { - background: darken($color, 10%); - } - } -} diff --git a/web/angular/src/scss/core/_callout.scss b/web/angular/src/scss/core/_callout.scss deleted file mode 100755 index b98ebac..0000000 --- a/web/angular/src/scss/core/_callout.scss +++ /dev/null @@ -1,55 +0,0 @@ -.callout { - position: relative; - padding: 0 $spacer; - margin: $spacer 0; - border: 0 solid $border-color; - border-left-width: .25rem; - - @if $enable-rounded { - border-radius: .25rem; - } - - .chart-wrapper { - position: absolute; - top: 10px; - left: 50%; - float: right; - width: 50%; - } -} - -.callout-bordered { - border: 1px solid $border-color; - border-left-width: .25rem; -} -.callout code { - border-radius: .25rem; -} -.callout h4 { - margin-top: 0; - margin-bottom: .25rem; -} -.callout p:last-child { - margin-bottom: 0; -} -.callout + .callout { - margin-top: - .25rem; -} - -.callout-default { - border-left-color: $text-muted; - - h4 { - color: $text-muted; - } -} - -@each $color, $value in $theme-colors { - .callout-#{$color} { - border-left-color: $value; - - h4 { - color: $value; - } - } -} diff --git a/web/angular/src/scss/core/_card.scss b/web/angular/src/scss/core/_card.scss deleted file mode 100755 index 20e57a8..0000000 --- a/web/angular/src/scss/core/_card.scss +++ /dev/null @@ -1,193 +0,0 @@ -.card { - margin-bottom: 1.5 * $spacer; - - // Cards with color accent - @each $color, $value in $theme-colors { - &.bg-#{$color} { - border-color: darken($value, 12.5%); - .card-header { - background-color: darken($value, 3%); - border-color: darken($value, 12.5%); - } - } - } -} - -.text-white .text-muted { - color: rgba(255,255,255,.6) !important; -} - -.card-header { - - .icon-bg { - display: inline-body; - padding: $card-spacer-y $card-spacer-x !important; - margin-top: -$card-spacer-y; - margin-right: $card-spacer-x; - margin-bottom: -$card-spacer-y; - margin-left: -$card-spacer-x; - line-height: inherit; - color: $card-icon-color; - vertical-align: bottom; - background: $card-icon-bg; - border-right: $card-border-width solid $card-border-color; - } - - .nav.nav-tabs { - margin-top: -$card-spacer-y; - margin-bottom: -$card-spacer-y; - border-bottom: 0; - - .nav-item { - border-top: 0; - } - - .nav-link { - padding: $card-spacer-y $card-spacer-x / 2; - color: $text-muted; - border-top: 0; - - &.active { - color: $body-color; - background: #fff; - } - } - } - - &.card-header-inverse { - color: #fff; - } - - .btn { - margin-top: - $input-btn-padding-y; - } - .btn-sm { - margin-top: - $input-btn-padding-y-sm; - } - .btn-lg { - margin-top: - $input-btn-padding-y-lg; - } -} -// -.card-footer { - - ul { - display: table; - width: 100%; - padding: 0; - margin: 0; - table-layout: fixed; - - li { - display: table-cell; - padding: 0 $card-spacer-x; - text-align: center; - } - } -} - -[class*="card-outline-"] { - .card-body { - background: #fff !important; - } - - &.card-outline-top { - border-top-width: 2px; - border-right-color: $border-color; - border-bottom-color: $border-color; - border-left-color: $border-color; - } -} - -// Cards with color accent -@each $color, $value in $theme-colors { - .card-accent-#{$color} { - @include card-accent-variant($value); - } -} - -// Card Actions -.card-header { - > i { - margin-right: $spacer / 2; - } - .card-actions { - position: absolute; - top: 0; - right: 0; - //height: inherit; - - a, button { - display: block; - float: left; - width: 50px; - padding: $card-spacer-y 0; - margin: 0 !important; - color: $body-color; - text-align: center; - background: transparent; - border: 0; - border-left: 1px solid $border-color; - box-shadow: 0; - - &:hover { - text-decoration: none; - } - - [class^="icon-"], [class*=" icon-"] { - display: inline-body; - vertical-align: middle; - } - - i { - display: inline-body; - transition: .4s; - } - - .r180 { - transform: rotate(180deg); - } - } - - .input-group { - width: 230px; - margin: 6px; - - .input-group-addon { - background: #fff; - } - - input { - border-left: 0; - } - } - } -} - -.card-full { - margin-top: - $spacer; - margin-right: - $grid-gutter-width / 2; - margin-left: - $grid-gutter-width / 2; - border: 0; - border-bottom: $card-border-width solid $border-color; -} - -@include media-breakpoint-up(sm) { - .card-columns { - - &.cols-2 { - column-count: 2; - } - } -} - -.card { - &.drag, .drag { - cursor: move; - } -} - -.card-placeholder { - background: rgba(0,0,0,.025); - border: 1px dashed $gray-300; -} diff --git a/web/angular/src/scss/core/_charts.scss b/web/angular/src/scss/core/_charts.scss deleted file mode 100755 index 0e7a3c2..0000000 --- a/web/angular/src/scss/core/_charts.scss +++ /dev/null @@ -1,9 +0,0 @@ -.chart-wrapper { - canvas { - width: 100% !important; - } -} -// scss-lint:disable QualifyingElement -base-chart.chart { - display: block !important; -} diff --git a/web/angular/src/scss/core/_dropdown-menu-right.scss b/web/angular/src/scss/core/_dropdown-menu-right.scss deleted file mode 100755 index 4f19546..0000000 --- a/web/angular/src/scss/core/_dropdown-menu-right.scss +++ /dev/null @@ -1,8 +0,0 @@ -// Temp fix for reactstrap -.app-header { - .navbar-nav { - .dropdown-menu-right { - right: auto; - } - } -} diff --git a/web/angular/src/scss/core/_dropdown.scss b/web/angular/src/scss/core/_dropdown.scss deleted file mode 100755 index 564e4df..0000000 --- a/web/angular/src/scss/core/_dropdown.scss +++ /dev/null @@ -1,69 +0,0 @@ -// Links, buttons, and more within the dropdown menu -.dropdown-item { - position: relative; - padding: 10px 20px; - border-bottom: 1px solid $dropdown-border-color; - - &:last-child { - border-bottom: 0; - } - - i { - display: inline-block; - width: 20px; - margin-right: 10px; - margin-left: -10px; - color: $dropdown-border-color; - text-align: center; - } - - .badge { - position: absolute; - right: 10px; - margin-top: 2px; - } -} - -// Dropdown section headers -.dropdown-header { - padding: 8px 20px; - background: $dropdown-divider-bg; - border-bottom: 1px solid $dropdown-border-color; - - .btn { - margin-top: -7px; - color: $dropdown-header-color; - - &:hover { - color: $body-color; - } - - &.pull-right { - margin-right: -20px; - } - } -} - -.dropdown-menu-lg { - width: 250px; -} -.app-header { - .navbar-nav { - .dropdown-menu { - position: absolute; - } - // Menu positioning - // - // Add extra class to `.dropdown-menu` to flip the alignment of the dropdown - // menu with the parent. - .dropdown-menu-right { - right: 0; - left: auto; // Reset the default from `.dropdown-menu` - } - - .dropdown-menu-left { - right: auto; - left: 0; - } - } -} diff --git a/web/angular/src/scss/core/_footer.scss b/web/angular/src/scss/core/_footer.scss deleted file mode 100755 index e01595a..0000000 --- a/web/angular/src/scss/core/_footer.scss +++ /dev/null @@ -1,9 +0,0 @@ -.app-footer { - display: flex; - flex-wrap: wrap; - align-items: center; - padding: 0 $spacer; - color: $footer-color; - background: $footer-bg; - @include borders($footer-borders); -} diff --git a/web/angular/src/scss/core/_grid.scss b/web/angular/src/scss/core/_grid.scss deleted file mode 100755 index 0d0963c..0000000 --- a/web/angular/src/scss/core/_grid.scss +++ /dev/null @@ -1,15 +0,0 @@ -.row.row-equal { - padding-right: ($grid-gutter-width / 4); - padding-left: ($grid-gutter-width / 4); - margin-right: ($grid-gutter-width / -2); - margin-left: ($grid-gutter-width / -2); - - [class*="col-"] { - padding-right: ($grid-gutter-width / 4); - padding-left: ($grid-gutter-width / 4); - } -} - -.main .container-fluid { - padding: 0 30px; -} diff --git a/web/angular/src/scss/core/_input-group.scss b/web/angular/src/scss/core/_input-group.scss deleted file mode 100755 index 23b2512..0000000 --- a/web/angular/src/scss/core/_input-group.scss +++ /dev/null @@ -1,6 +0,0 @@ -.input-group-addon, -.input-group-btn { - min-width: 40px; - white-space: nowrap; - vertical-align: middle; // Match the inputs -} diff --git a/web/angular/src/scss/core/_layout.scss b/web/angular/src/scss/core/_layout.scss deleted file mode 100755 index 8a05003..0000000 --- a/web/angular/src/scss/core/_layout.scss +++ /dev/null @@ -1,384 +0,0 @@ -// IE10&11 Flexbox fix -@media all and (-ms-high-contrast:none) { - html { - display: flex; - flex-direction: column; - } -} - -// app-dashboard and app-root are Angular2+ selectors. You can add here your own selectors if you need. -.app, -app-dashboard, -app-root { - display: flex; - flex-direction: column; - min-height: 100vh; -} - -.app-header { - flex: 0 0 $navbar-height; -} - -.app-footer { - flex: 0 0 $footer-height; -} - -.app-body { - display: flex; - flex-direction: row; - flex-grow: 1; - overflow-x: hidden; - - .main { - flex: 1; - min-width: 0; - } - - .sidebar { - // $sidebar-width is the width of the columns - flex: 0 0 $sidebar-width; - // put the nav on the left - order: -1; - } - - .aside-menu { - // $aside-menu-width is the width of the columns - flex: 0 0 $aside-menu-width; - } -} - -// -// header -// -.header-fixed { - .app-header { - position: fixed; - z-index: $zindex-sticky; - width: 100%; - } - .app-body { - margin-top: $navbar-height; - } -} - -// -// Sidebar -// -.sidebar-hidden { - .sidebar { - margin-left: - $sidebar-width; - } -} - -.sidebar-fixed { - .sidebar { - position: fixed; - z-index: $zindex-sticky - 1; - width: $sidebar-width; - height: calc(100vh - #{$navbar-height}); - // margin-top: - $navbar-height; - - // .sidebar-nav { - // height: calc(100vh - #{$navbar-height}); - // } - } - - .main, .app-footer { - margin-left: $sidebar-width; - } - - &.sidebar-hidden { - .main, .app-footer { - margin-left: 0; - } - } -} - -.sidebar-off-canvas { - .sidebar { - position: fixed; - z-index: $zindex-sticky - 1; - height: calc(100vh - #{$navbar-height}); - } -} - -@include media-breakpoint-up(lg) { - .sidebar-compact { - .sidebar { - flex: 0 0 $sidebar-compact-width; - } - - &.sidebar-hidden { - .sidebar { - margin-left: - $sidebar-compact-width; - } - } - - &.sidebar-fixed { - .main, .app-footer { - margin-left: $sidebar-compact-width; - } - - .sidebar { - width: $sidebar-compact-width; - } - - &.sidebar-hidden { - .main, .app-footer { - margin-left: 0; - } - } - } - } - - .sidebar-minimized { - .sidebar { - flex: 0 0 $sidebar-minimized-width; - } - - &.sidebar-hidden { - .sidebar { - margin-left: - $sidebar-minimized-width; - } - } - - &.sidebar-fixed { - .main, .app-footer { - margin-left: $sidebar-minimized-width; - } - - .sidebar { - width: $sidebar-minimized-width; - } - - &.sidebar-hidden { - .main, .app-footer { - margin-left: 0; - } - } - } - } -} - -// -// Aside Menu -// -.aside-menu-hidden { - .aside-menu { - margin-right: - $aside-menu-width; - } -} - -.aside-menu-fixed { - .aside-menu { - position: fixed; - right: 0; - height: 100%; - - .tab-content { - height: calc(100vh - #{$aside-menu-nav-padding-y * 2 + $font-size-base} - #{$navbar-height}); - } - } - - .main, .app-footer { - margin-right: $aside-menu-width; - } - - &.aside-menu-hidden { - .main, .app-footer { - margin-right: 0; - } - } -} - -.aside-menu-off-canvas { - .aside-menu { - position: fixed; - right: 0; - z-index: $zindex-sticky - 1; - height: 100%; - - .tab-content { - height: calc(100vh - #{$aside-menu-nav-padding-y * 2 + $font-size-base} - #{$navbar-height}); - } - } -} - -// -// Breadcrumb -// -.breadcrumb-fixed { - .main { - $breadcrumb-height: 2 * $breadcrumb-padding-y + $font-size-base + 1.5 * $spacer; - padding-top: $breadcrumb-height; - } - - .breadcrumb { - position: fixed; - top: $navbar-height; - right: 0; - left: 0; - z-index: $zindex-sticky - 2; - } - - // if sidebar + main + aside - .main:nth-child(2) { - .breadcrumb { - right: $aside-menu-width; - left: $sidebar-width; - } - } - - // if sidebar + main - .main:first-child { - .breadcrumb { - right: $aside-menu-width; - left: 0; - } - } - - // if main + aside - .main:last-child { - .breadcrumb { - right: 0; - } - } - - &.sidebar-minimized { - .main .breadcrumb { - left: $sidebar-minimized-width; - } - } - - &.sidebar-hidden, &.sidebar-off-canvas { - .main .breadcrumb { - left: 0; - } - } - - &.aside-menu-hidden, &.aside-menu-off-canvas { - .main .breadcrumb { - right: 0; - } - } -} - -// -// Footer -// -.footer-fixed { - .app-footer { - position: fixed; - right: 0; - bottom: 0; - left: 0; - z-index: $zindex-sticky; - height: $footer-height; - } - - .app-body { - margin-bottom: $footer-height; - } -} - -// -// Animations -// -.app-header, -.app-footer, -.sidebar, -.main, -.aside-menu { - transition: margin-left $layout-transition-speed, margin-right $layout-transition-speed, width $layout-transition-speed, flex $layout-transition-speed; -} -.sidebar-nav { - transition: width $layout-transition-speed; -} -.breadcrumb { - transition: left $layout-transition-speed, right $layout-transition-speed, width $layout-transition-speed; -} - -// -// Mobile layout -// - -@include media-breakpoint-down(md) { - .app-header.navbar { - position: fixed !important; - z-index: $zindex-sticky; - width: 100%; - text-align: center; - background-color: $navbar-brand-bg; - @include borders($navbar-brand-border); - - .navbar-toggler { - @if (lightness( $navbar-brand-bg ) > 40) { - color: $navbar-color; - } @else { - color: #fff; - } - } - - .navbar-brand { - position: absolute; - left: 50%; - margin-left: - ($navbar-brand-width / 2); - } - } - - .app-body { - margin-top: $navbar-height; - } - - .breadcrumb-fixed { - .main:nth-child(2) .breadcrumb { - right: auto; - left: auto; - width: 100%; - } - } - - .sidebar { - position: fixed; - z-index: $zindex-sticky - 1; - width: $mobile-sidebar-width; - height: calc(100vh - #{$navbar-height}); - margin-left: - $mobile-sidebar-width; - - .sidebar-nav, - .nav { - width: $mobile-sidebar-width; - min-height: calc(100vh - #{$navbar-height}); - } - - .sidebar-minimizer { - display: none; - } - } - - .main, .app-footer { - margin-left: 0 !important; - } - - // .aside-menu { - // margin-right: - $aside-menu-width; - // } - - .sidebar-hidden { - .sidebar { - margin-left: - $mobile-sidebar-width; - } - } - - .sidebar-mobile-show { - .sidebar { - width: $mobile-sidebar-width; - margin-left: 0; - } - - .main { - margin-right: - $mobile-sidebar-width !important; - margin-left: $mobile-sidebar-width !important; - } - } -} diff --git a/web/angular/src/scss/core/_loading.scss b/web/angular/src/scss/core/_loading.scss deleted file mode 100755 index 3e409fb..0000000 --- a/web/angular/src/scss/core/_loading.scss +++ /dev/null @@ -1,128 +0,0 @@ -// Angular Version -// Make clicks pass-through -// scss-lint:disable all -#loading-bar, -#loading-bar-spinner { - -webkit-pointer-events: none; - pointer-events: none; - -moz-transition: 350ms linear all; - -o-transition: 350ms linear all; - -webkit-transition: 350ms linear all; - transition: 350ms linear all; -} - -#loading-bar.ng-enter, -#loading-bar.ng-leave.ng-leave-active, -#loading-bar-spinner.ng-enter, -#loading-bar-spinner.ng-leave.ng-leave-active { - opacity: 0; -} - -#loading-bar.ng-enter.ng-enter-active, -#loading-bar.ng-leave, -#loading-bar-spinner.ng-enter.ng-enter-active, -#loading-bar-spinner.ng-leave { - opacity: 1; -} - -#loading-bar .bar { - position: fixed; - top: 0; - left: 0; - z-index: 20002; - width: 100%; - height: 2px; - background: theme-color("primary"); - border-top-right-radius: 1px; - border-bottom-right-radius: 1px; - -moz-transition: width 350ms; - -o-transition: width 350ms; - -webkit-transition: width 350ms; - transition: width 350ms; -} - -// Fancy blur effect -#loading-bar .peg { - position: absolute; - top: 0; - right: 0; - width: 70px; - height: 2px; - -moz-border-radius: 100%; - -webkit-border-radius: 100%; - border-radius: 100%; - -moz-box-shadow: #29d 1px 0 6px 1px; - -ms-box-shadow: #29d 1px 0 6px 1px; - -webkit-box-shadow: #29d 1px 0 6px 1px; - box-shadow: #29d 1px 0 6px 1px; - opacity: .45; -} - -#loading-bar-spinner { - position: fixed; - top: 10px; - left: 10px; - z-index: 10002; - display: block; -} - -#loading-bar-spinner .spinner-icon { - width: 14px; - height: 14px; - - border: solid 2px transparent; - border-top-color: #29d; - border-left-color: #29d; - border-radius: 50%; - - -moz-animation: loading-bar-spinner 400ms linear infinite; - -ms-animation: loading-bar-spinner 400ms linear infinite; - -o-animation: loading-bar-spinner 400ms linear infinite; - -webkit-animation: loading-bar-spinner 400ms linear infinite; - animation: loading-bar-spinner 400ms linear infinite; -} - -@-webkit-keyframes loading-bar-spinner { - 0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } - 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } -} -@-moz-keyframes loading-bar-spinner { - 0% { -moz-transform: rotate(0deg); transform: rotate(0deg); } - 100% { -moz-transform: rotate(360deg); transform: rotate(360deg); } -} -@-o-keyframes loading-bar-spinner { - 0% { -o-transform: rotate(0deg); transform: rotate(0deg); } - 100% { -o-transform: rotate(360deg); transform: rotate(360deg); } -} -@-ms-keyframes loading-bar-spinner { - 0% { -ms-transform: rotate(0deg); transform: rotate(0deg); } - 100% { -ms-transform: rotate(360deg); transform: rotate(360deg); } -} -@keyframes loading-bar-spinner { - 0% { transform: rotate(0deg); transform: rotate(0deg); } - 100% { transform: rotate(360deg); transform: rotate(360deg); } -} - -//Ajax & Static Version -.pace { - -webkit-pointer-events: none; - pointer-events: none; - - -moz-user-select: none; - -webkit-user-select: none; - user-select: none; -} - -.pace-inactive { - display: none; -} - -.pace .pace-progress { - position: fixed; - top: 0; - right: 100%; - z-index: 2000; - width: 100%; - height: 2px; - background: theme-color("primary"); -} diff --git a/web/angular/src/scss/core/_mixins.scss b/web/angular/src/scss/core/_mixins.scss deleted file mode 100755 index 153f1d3..0000000 --- a/web/angular/src/scss/core/_mixins.scss +++ /dev/null @@ -1,116 +0,0 @@ -@mixin button-social-size($padding-y, $padding-x, $font-size, $line-height, $border-radius) { - padding: $padding-y $padding-x; - font-size: $font-size; - line-height: $line-height; - border: 0; - @include border-radius($border-radius); - - &::before { - width: ($padding-y * 2) + ($font-size * $line-height); - height: ($padding-y * 2) + ($font-size * $line-height); - padding: $padding-y 0; - font-size: $font-size; - line-height: $line-height; - @include border-radius($border-radius); - } - - span { - margin-left: ($padding-y * 2) + ($font-size * $line-height); - } - - &.icon { - width: ($padding-y * 2) + ($font-size * $line-height); - height: ($padding-y * 2) + ($font-size * $line-height); - } -} - -@mixin avatar($width, $status-width) { - position: relative; - display: inline-block; - width: $width; - - .img-avatar { - width: $width; - height: $width; - } - - .avatar-status { - position: absolute; - right: 0; - bottom: 0; - display: block; - width: $status-width; - height: $status-width; - border: 1px solid #fff; - border-radius: 50em; - } -} - -@mixin borders($borders) { - @each $border in $borders { - $direction: nth($border, 1); - @if $direction == "all" { - $size: map-get(map-get($borders, $direction), size); - $style: map-get(map-get($borders, $direction), style); - $color: map-get(map-get($borders, $direction), color); - border: $size $style $color; - } @else if $direction == "top" { - $size: map-get(map-get($borders, $direction), size); - $style: map-get(map-get($borders, $direction), style); - $color: map-get(map-get($borders, $direction), color); - border-top: $size $style $color; - } @else if $direction == "right" { - $size: map-get(map-get($borders, $direction), size); - $style: map-get(map-get($borders, $direction), style); - $color: map-get(map-get($borders, $direction), color); - border-right: $size $style $color; - } @else if $direction == "bottom" { - $size: map-get(map-get($borders, $direction), size); - $style: map-get(map-get($borders, $direction), style); - $color: map-get(map-get($borders, $direction), color); - border-bottom: $size $style $color; - } @else if $direction == "left" { - $size: map-get(map-get($borders, $direction), size); - $style: map-get(map-get($borders, $direction), style); - $color: map-get(map-get($borders, $direction), color); - border-left: $size $style $color; - } - } -} - -@mixin sidebar-width($borders, $width) { - $sidebar-width: $width; - - @each $border in $borders { - $direction: nth($border, 1); - @if $direction == "all" { - $size: map-get(map-get($borders, $direction), size); - $sidebar-width: ($sidebar-width - (2 * $size)); - } @else if $direction == "right" { - $size: map-get(map-get($borders, $direction), size); - $sidebar-width: $sidebar-width - $size; - } @else if $direction == "left" { - $size: map-get(map-get($borders, $direction), size); - $sidebar-width: $sidebar-width - $size; - } - width: $sidebar-width; - } -} - -@mixin bg-variant($parent, $color) { - #{$parent} { - @include border-radius($card-border-radius-inner $card-border-radius-inner $card-border-radius-inner $card-border-radius-inner); - color: #fff !important; - background-color: $color !important; - } - a#{$parent} { - @include hover-focus { - background-color: darken($color, 10%); - } - } -} - -@mixin card-accent-variant($color) { - border-top-width: 2px; - border-top-color: $color; -} diff --git a/web/angular/src/scss/core/_mobile.scss b/web/angular/src/scss/core/_mobile.scss deleted file mode 100755 index e69de29..0000000 diff --git a/web/angular/src/scss/core/_modal.scss b/web/angular/src/scss/core/_modal.scss deleted file mode 100755 index 1c44ddd..0000000 --- a/web/angular/src/scss/core/_modal.scss +++ /dev/null @@ -1,13 +0,0 @@ -@each $color, $value in $theme-colors { - .modal-#{$color} { - - .modal-content { - border-color: $value; - } - - .modal-header { - color: #fff; - background-color: $value; - } - } -} diff --git a/web/angular/src/scss/core/_nav.scss b/web/angular/src/scss/core/_nav.scss deleted file mode 100755 index ba1d64b..0000000 --- a/web/angular/src/scss/core/_nav.scss +++ /dev/null @@ -1,32 +0,0 @@ -.nav-tabs { - .nav-link { - color: $gray-600; - &.active { - color: $gray-800; - background: #fff; - border-color: $border-color; - border-bottom-color: #fff; - &:focus { - background: #fff; - border-color: $border-color; - border-bottom-color: #fff; - } - } - } -} - -.tab-content { - margin-top: -1px; - background: #fff; - border: 1px solid $border-color; - .tab-pane { - padding: $spacer; - } -} - -.card-block { - .tab-content { - margin-top: 0; - border: 0; - } -} diff --git a/web/angular/src/scss/core/_navbar.scss b/web/angular/src/scss/core/_navbar.scss deleted file mode 100755 index 1f52222..0000000 --- a/web/angular/src/scss/core/_navbar.scss +++ /dev/null @@ -1,127 +0,0 @@ -.app-header.navbar { - position: relative; - flex-direction: row; - height: $navbar-height; - padding: 0; - margin: 0; - background-color: $navbar-bg; - @include borders($navbar-border); - - .navbar-brand { - display: inline-block; - width: $navbar-brand-width; - height: $navbar-height; - padding: $navbar-padding-y $navbar-padding-x; - margin-right: 0; - background-color: $navbar-brand-bg; - //background-image: $navbar-brand-logo; - background-repeat: no-repeat; - background-position: center center; - background-size: $navbar-brand-logo-size; - @include borders($navbar-brand-border); - } - - .navbar-toggler { - min-width: 50px; - padding: $navbar-toggler-padding-y 0; - - &:hover .navbar-toggler-icon { - background-image: $navbar-toggler-icon-hover; - } - } - - .navbar-toggler-icon { - height: 23px; - background-image: $navbar-toggler-icon; - } - - .navbar-nav { - flex-direction: row; - align-items: center; - } - - .nav-item { - position: relative; - min-width: 50px; - margin: 0 !important; - text-align: center; - - button { - margin: 0 auto; - } - - .nav-link { - padding-top: 0; - padding-bottom: 0; - background: 0; - border: 0; - - .badge { - position: absolute; - top: 50%; - left: 50%; - margin-top: -16px; - margin-left: 0; - } - - > .img-avatar { - height: $navbar-height - 20px; - margin: 0 10px; - } - } - } - - .dropdown-menu { - padding-bottom: 0; - line-height: $line-height-base; - } - - .dropdown-item { - min-width: 180px; - } -} - -.navbar-brand { - color: $navbar-active-color; - - @include hover-focus { - color: $navbar-active-color; - } -} - -.navbar-nav { - .nav-link { - color: $navbar-color; - - @include hover-focus { - color: $navbar-hover-color; - } - } - - .open > .nav-link, - .active > .nav-link, - .nav-link.open, - .nav-link.active { - @include plain-hover-focus { - color: $navbar-active-color; - } - } -} - -.navbar-divider { - background-color: rgba(0,0,0,.075); -} - -@include media-breakpoint-up(lg) { - .brand-minimized { - .app-header.navbar { - .navbar-brand { - width: $navbar-brand-minimized-width; - background-color: $navbar-brand-minimized-bg; - //background-image: $navbar-brand-minimized-logo; - background-size: $navbar-brand-minimized-logo-size; - @include borders($navbar-brand-minimized-border); - } - } - } -} diff --git a/web/angular/src/scss/core/_others.scss b/web/angular/src/scss/core/_others.scss deleted file mode 100755 index 381baab..0000000 --- a/web/angular/src/scss/core/_others.scss +++ /dev/null @@ -1,4 +0,0 @@ -// scss-lint:disable QualifyingElement -hr.transparent { - border-top: 1px solid transparent; -} diff --git a/web/angular/src/scss/core/_progress.scss b/web/angular/src/scss/core/_progress.scss deleted file mode 100755 index 65f56dd..0000000 --- a/web/angular/src/scss/core/_progress.scss +++ /dev/null @@ -1,15 +0,0 @@ -.progress-xs { - height: 4px; -} - -.progress-sm { - height: 8px; -} - -// White progress bar -.progress-white { - background-color: rgba(255,255,255,.2) !important; - .progress-bar { - background-color: #fff; - } -} diff --git a/web/angular/src/scss/core/_rtl.scss b/web/angular/src/scss/core/_rtl.scss deleted file mode 100755 index 28db385..0000000 --- a/web/angular/src/scss/core/_rtl.scss +++ /dev/null @@ -1,281 +0,0 @@ -// -// RTL Support -// -// scss-lint:disable NestingDepth, SelectorDepth -*[dir="rtl"] { - direction: rtl; - unicode-bidi: embed; - - ul { - -webkit-padding-start: 0; - } - - table tr th { - text-align: right; - } - - // Breadcrumb - - .breadcrumb-item { - float: right; - } - - .breadcrumb-menu { - right: auto; - left: $breadcrumb-padding-x; - } - - // Dropdown - .dropdown-item { - text-align: right; - - i { - margin-right: -10px; - margin-left: 10px; - } - - .badge { - right: auto; - left: 10px; - } - } - - // - // Sidebar - // - .sidebar-hidden { - .sidebar { - margin-right: - $sidebar-width; - } - } - - .sidebar-fixed { - .main, .app-footer { - margin-right: $sidebar-width; - } - - &.sidebar-hidden { - .main, .app-footer { - margin-right: 0; - } - } - } - - .sidebar-minimized { - .sidebar { - flex: 0 0 $sidebar-minimized-width; - } - - &.sidebar-hidden { - .sidebar { - margin-right: - $sidebar-minimized-width; - margin-left: 0; - } - } - - &.sidebar-fixed { - .main, .app-footer { - margin-right: $sidebar-minimized-width; - } - - &.sidebar-hidden { - .main, .app-footer { - margin-left: 0; - } - } - } - } - - // - // Aside Menu - // - .aside-menu-hidden { - .aside-menu { - margin-right: 0; - margin-left: - $aside-menu-width; - } - } - - .aside-menu-fixed { - .aside-menu { - right: auto; - left: 0; - } - - .main, .app-footer { - //margin-right: 0; - margin-left: $aside-menu-width; - } - - &.aside-menu-hidden { - .main, .app-footer { - margin-left: 0; - } - } - } - - .aside-menu-off-canvas { - .aside-menu { - position: fixed; - right: 0; - z-index: $zindex-sticky - 1; - height: 100%; - - .tab-content { - height: calc(100vh - #{$aside-menu-nav-padding-y * 2 + $font-size-base} - #{$navbar-height}); - } - } - } - - // Sidebar Menu - .sidebar { - .sidebar-nav { - .nav { - .nav-item { - .nav-link { - direction: rtl; - i { - margin: 0 0 0 ($sidebar-nav-link-padding-x / 2); - } - .badge { - float: left; - margin-top: 2px; - // margin-left: 10px; - } - &.nav-dropdown-toggle { - &::before { - position: absolute; - right: auto !important; - left: $sidebar-nav-link-padding-x; - transform: rotate(180deg); - } - } - } - &.nav-dropdown { - &.open { - > .nav-link.nav-dropdown-toggle::before { - transform: rotate(270deg); - } - } - } - } - } - } - } - - .sidebar-minimized .sidebar { - .nav-link { - padding-right: 0; - i { - float: right; - padding: 0; - margin: 0; - } - .badge { - right: auto; - left: 15px; - } - } - .nav > .nav-dropdown { - - &:hover { - > .nav-dropdown-items { - right: $sidebar-minimized-width; - left: 0; - } - } - } - } - - // Horizontal bars - .horizontal-bars { - - li { - - .bars { - padding-right: 100px; - padding-left: 0; - - .progress:first-child { - margin-bottom: 2px; - } - } - } - - &.type-2 { - - li { - - i { - margin-right: 5px; - margin-left: $spacer; - } - - .value { - float: left; - font-weight: 600; - } - - .bars { - padding: 0; - } - } - } - } - - // Icon list - .icons-list { - - li { - position: relative; - height: 40px; - vertical-align: middle; - - i { - float: right; - } - - .desc { - margin-right: 50px; - margin-left: 0; - } - - .value { - right: auto; - left: 45px; - text-align: left; - - strong { - display: block; - margin-top: -3px; - } - } - - .actions { - right: auto; - left: 10px; - } - } - } - - // Callouts - .callout { - border: 0 solid $border-color; - border-right-width: .25rem; - - @each $color, $value in $theme-colors { - &.callout-#{$color} { - border-right-color: $value; - } - } - - .chart-wrapper { - left: 0; - float: left; - } - } - - .callout-default { - border-right-color: $text-muted; - } -} diff --git a/web/angular/src/scss/core/_sidebar.scss b/web/angular/src/scss/core/_sidebar.scss deleted file mode 100755 index b77cd5f..0000000 --- a/web/angular/src/scss/core/_sidebar.scss +++ /dev/null @@ -1,454 +0,0 @@ -// scss-lint:disable NestingDepth, SelectorDepth -.sidebar { - display: flex; - flex-direction: column; - padding: $sidebar-padding; - color: $sidebar-color; - background: $sidebar-bg; - @include borders($sidebar-borders); - - .sidebar-close { - position: absolute; - right: 0; - display: none; - padding: 0 $spacer; - font-size: 24px; - font-weight: 800; - line-height: $navbar-height; - color: $sidebar-color; - background: 0; - border: 0; - opacity: .8; - - &:hover { - opacity: 1; - } - } - - // Will be added soon - // .sidebar-brand { } - - .sidebar-header { - flex: 0 0 $sidebar-header-height; - padding: $sidebar-header-padding-y $sidebar-header-padding-x; - text-align: center; - background: $sidebar-header-bg; - } - - .sidebar-form .form-control { - color: $sidebar-form-color; - background: $sidebar-form-bg; - border: $sidebar-form-border; - - &::placeholder { - color: $sidebar-form-placeholder-color; - } - } - - .sidebar-nav { - position: relative; - flex: 1; - overflow-x: hidden; - overflow-y: auto; - -ms-overflow-style: -ms-autohiding-scrollbar; - @include sidebar-width($sidebar-borders, $sidebar-width); - - &::-webkit-scrollbar { - position: absolute; - width: 10px; - margin-left: -10px; - -webkit-appearance: none; - } - - &::-webkit-scrollbar-track { - background-color: lighten($sidebar-bg, 5%); - border-right: 1px solid darken($sidebar-bg, 5%); - border-left: 1px solid darken($sidebar-bg, 5%); - } - - &::-webkit-scrollbar-thumb { - height: 50px; - background-color: darken($sidebar-bg, 10%); - background-clip: content-box; - border-color: transparent; - border-style: solid; - border-width: 1px 2px; - } - } - - .nav { - @include sidebar-width($sidebar-borders, $sidebar-width); - flex-direction: column; - min-height: 100%; - } - - .nav-title { - padding: $sidebar-nav-title-padding-y $sidebar-nav-title-padding-x; - font-size: 11px; - font-weight: 600; - color: $sidebar-nav-title-color; - text-transform: uppercase; - } - - .nav-divider, .divider { - height: 10px; - } - - .nav-item { - position: relative; - margin: 0; - transition: background .3s ease-in-out; - } - - .nav-dropdown-items { - max-height: 0; - padding: 0; - margin: 0; - overflow-y: hidden; - transition: max-height .3s ease-in-out; - - .nav-item { - padding: 0; - list-style: none; - } - } - - .nav-link { - display: block; - padding: $sidebar-nav-link-padding-y $sidebar-nav-link-padding-x; - color: $sidebar-nav-link-color; - text-decoration: none; - background: $sidebar-nav-link-bg; - @include borders($sidebar-nav-link-borders); - @if $enable-sidebar-nav-rounded { - border-radius: $border-radius; - } - - i { - display: inline-block; - width: 20px; - margin: 0 ($sidebar-nav-link-padding-x / 2) 0 0; - font-size: 14px; - color: $sidebar-nav-link-icon-color; - text-align: center; - } - - .badge { - float: right; - margin-top: 2px; - } - - &.active { - color: $sidebar-nav-link-active-color; - background: $sidebar-nav-link-active-bg; - @include borders($sidebar-nav-link-active-borders); - - i { - color: $sidebar-nav-link-active-icon-color; - } - } - - &:hover { - color: $sidebar-nav-link-hover-color; - background: $sidebar-nav-link-hover-bg; - @include borders($sidebar-nav-link-hover-borders); - - i { - color: $sidebar-nav-link-hover-icon-color; - } - - &.nav-dropdown-toggle::before { - background-image: $sidebar-nav-dropdown-indicator-hover; - } - } - - @each $color, $value in $theme-colors { - &.nav-link-#{$color} { - background: $value; - i { - color: rgba(255,255,255,.7); - } - &:hover { - background: darken($value,5%) !important; - i { - color: #fff; - } - } - } - } - } - - // ex. Components - .nav-dropdown-toggle { - position: relative; - - &::before { - position: absolute; - top: 50%; - right: $sidebar-nav-link-padding-x; - display: block; - width: 8px; - height: 8px; - padding: 0; - margin-top: -4px; - content: ""; - background-image: $sidebar-nav-dropdown-indicator; - background-repeat: no-repeat; - background-position: center; - transition: transform .3s; - } - } - - // ex.