55 Commits
Author SHA1 Message Date
handte 08db82b1f7 Release 1.0.5
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 11:01:02 +02:00
handte fcd899f25f Change carta urls to point to local installation.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-08-13 10:21:52 +02:00
Marcus Handte 85c026fa8f Upgrade gradle, plugins, android dependencies and angular code generator.
LocationBasedServices/maptology/pipeline/head This commit looks good
Upgrade gralde to latest version recommended by android studio.
Remove outdated android options in gradle properties.
Upgrade outdated gradle plugins to support npm downloads.
Upgrade android app dependencies to latest versions.
Make logger service constants static final.
Replace angular client generator with swagger codegen.
Adapt angular code to new client.
Integrate proxy config and basehref into angular cli configuration.
Change jenkinsfile to only deploy releases.
Change jenkinsfile to use gradle wrapper instead of fixed version.
Remove dots from user emails to not confuse simple email clients.
2020-06-20 10:28:43 +02:00
handte 8f7aeec0ab Update deployment location, add tools.
LocationBasedServices/maptology/pipeline/head This commit looks good
2020-05-01 00:10:59 +02:00
handte d3ba3f570a Rename public tables.
LocationBasedServices/maptology/master This commit looks good
2020-04-23 23:24:44 +02:00
handte 3c63e9530f Rename timestamp columns.
LocationBasedServices/maptology/master This commit looks good
2020-04-23 22:23:56 +02:00
handte cc66a682f0 Added column length definitions.
LocationBasedServices/maptology/master This commit looks good
2020-04-23 21:27:06 +02:00
Adriano Markovic f5691ef3a3 [66] #REFACTOR 'layout: user'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
LocationBasedServices/maptology/master This commit looks good
{Added css flex classes.}
2020-03-18 13:04:09 +01:00
Adriano Markovic 8e3dc80fb8 [66] #REFACTOR 'layout: tables'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Revised layouts and solved linter issues with time-sheet.service.ts.}
2020-02-26 16:24:27 +01:00
Adriano Markovic 20108b282d [66] #REFACTOR 'layout: user'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Layout revised.}
2020-02-26 13:24:50 +01:00
Adriano Markovic aac6c5f5f3 [66] #REFACTOR 'layout: export'
{Revised the layout of the exort component.}
2020-02-26 12:05:52 +01:00
Adriano Markovic 3b644cece3 [66] #REFACTOR 'Layout: tables'
{Table view layout revised.}
2020-02-26 11:36:05 +01:00
Adriano Markovic 6b5f01a573 [66] #REFACTOR 'layout: privileges'
{Layout revised. Added content-layout.}
2020-02-26 11:13:07 +01:00
Adriano Markovic 98212476f4 Removed old templates. 2020-02-26 10:36:08 +01:00
Adriano Markovic eac84438f1 [66] #REFACTOR 'Component Renamed' 2020-02-26 10:34:01 +01:00
Adriano Markovic dfacfd4ff4 [66] #REFACTOR 'layout: notices'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Revised layout.}
2020-02-25 21:06:56 +01:00
Adriano Markovic 301578f241 [66] #REFACTOR 'layout: timesheet'
{Revised layout.}
2020-02-25 21:05:59 +01:00
Adriano Markovic 41dc0030c3 [misc] #REFACTOR 'layout: drawer'
{Moved the timesheet nav button up.}
2020-02-25 21:04:46 +01:00
Adriano Markovic 73ea8185a4 [66] #IMPLEMENT 'layout: header'
{Implemented the layout header layout and revised the basic layout.}
2020-02-25 21:03:52 +01:00
Adriano Markovic ff89c9a7cc [66] #REFACTOR 'component:time-sheet'
LocationBasedServices/maptology/angular-layout-refactoring This commit looks good
{Layout revised.}
2020-02-19 22:08:28 +01:00
Adriano Markovic 7451e492c6 [66] #IMPLEMENT 'component:basic-layout'
{Basic layout component added and global stylesheet revised. }
2020-02-19 22:07:04 +01:00
Adriano Markovic cf1cdb653b [65] #CLEANUP
LocationBasedServices/maptology/master This commit looks good
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
2020-02-14 19:59:21 +01:00
Adriano Markovic 850f8add53 [ng9-UPG] 'Update ngx-gauge' 2020-02-14 19:31:29 +01:00
Adriano Markovic 0d577ee938 [ng9-UPG] 'Update @angular/flex-layout' 2020-02-14 19:25:31 +01:00
Adriano Markovic fc7f9f0ed4 [ng9-UPG] 'Update @angular/material' 2020-02-14 19:16:15 +01:00
Adriano Markovic 6d140284fa [ng9-UPG] 'Update core & cli to Angular 9' 2020-02-14 18:40:29 +01:00
Adriano Markovic 4e31cdcad7 [ng9-UPG] 'Update core@8 & cli@8' 2020-02-14 18:07:07 +01:00
Adriano Markovic 2d1bf8a3bc Merge branch 'angular-time-sheet-feature'
LocationBasedServices/maptology/master This commit looks good
2020-02-14 17:28:27 +01:00
Adriano Markovic c49fe8fcb4 #REFACTOR 'Drawer Component'
{Changed mat-list -> mat-nav-list.}
2020-02-14 17:23:19 +01:00
Adriano Markovic cf74b4fdc8 [65] #IMPLEMENT 'Time capping function'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{- Finished the time capping functionality which subtracts the break time from the working time if there has been no time gaps.
 - Documented and cleaned up the code.}
2020-02-14 16:37:16 +01:00
Adriano Markovic bf90db3620 [65] #REFACTOR 'Layout and Service'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{- Layout completely revised. Responsivness is now done through flex box.
 - TimeSheetService functions cleaned up.}
2020-02-14 02:04:39 +01:00
Adriano Markovic 6bd1076e75 [65] #IMPLEMENT 'Export Functionality'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{- Export function added (.csv, .json).
 - Minor fixes in layout and code. }
2020-02-12 23:52:14 +01:00
Adriano Markovic 0772ea42d8 [65] #FIX 'function: TimeSheetData Accumulation'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{Fixed the issue with the wrong accumulation of the time sheet data.}
2020-02-11 15:13:09 +01:00
Adriano Markovic 751f3f17e6 [65] #REFACTORE 'service:TimeSheetService'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Refactored mapV2TsByDay method.
  Used higher-order array methods to map visits to time sheets. }
2020-01-28 15:39:10 +01:00
Adriano Markovic 7885c7bb3c [65] #FIX 'service:TimeSheetService'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Problem with wrong calculated working time after grouping data by days fixed. }
2020-01-27 01:09:56 +01:00
Adriano Markovic 899b651ab1 [65] #FIX 'service:TimeSheetService'
{ Fixed problem with overlapping days. }
2020-01-26 22:28:54 +01:00
Adriano Markovic 4d40e47492 [65] #IMPLEMENT 'service:TimeSheetService'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Adde a single and grouped mapping functionality to the time sheet table. }
2020-01-22 23:08:12 +01:00
Adriano Markovic 281831dbc9 [65] #IMPLEMENT 'service:TimeSheetService'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Started implementing the service for the time sheet feature and revised the layout. }
2020-01-21 22:25:27 +01:00
Adriano Markovic 2e9107dbc0 [65] #REFACTORE 2020-01-16 16:57:20 +01:00
Adriano Markovic fa4714169a [65] #IMPLEMENT 'component:PlacesDialog'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Implemented dialog widget for picking out places which are returned to the time-sheet view as a list. }
2020-01-16 04:58:41 +01:00
Adriano Markovic 3ff2bf8d21 [misc] #FIX 'localization'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Fixed label naming }
2020-01-15 08:20:06 +01:00
Marcus Handte b728be2f86 Migrate to jakarta-ee 8 apis.
LocationBasedServices/maptology/master This commit looks good
2020-01-09 23:55:16 +01:00
Adriano Markovic d10ceef29b [65] #IMPLEMENT 'component:TimeSheet'
LocationBasedServices/maptology/angular-time-sheet-feature This commit looks good
{ Created the TimeSheetComponent and the .html-Layout }
2020-01-09 00:27:36 +01:00
Adriano Markovic 92f7027ca4 Added localization to the chart widget of the devices-position view.
LocationBasedServices/maptology/master This commit looks good
2020-01-07 08:16:11 +01:00
Adriano Markovic afe4776f59 Merge branch 'master' of https://project.nes.uni-due.de/gitea/lbs/maptology
LocationBasedServices/maptology/master This commit looks good
2020-01-05 21:27:58 +01:00
Adriano Markovic 06fb703f31 Implemented chart widget and added it to the device-positions view. 2020-01-05 21:27:33 +01:00
Marcus Handte a1fc342862 Add documenation and cleanup code.
LocationBasedServices/maptology/master This commit looks good
2019-12-05 21:19:07 +01:00
Marcus Handte ac06575858 Added simple analysis tools.
LocationBasedServices/maptology/master This commit looks good
2019-12-05 21:16:48 +01:00
handte 58485d2db2 Add missing version to ejb jar manifest.
LocationBasedServices/maptology/master This commit looks good
2019-11-30 23:49:51 +01:00
handte 0abb3e2663 Fix api version and description.
LocationBasedServices/maptology/master This commit looks good
2019-11-30 23:31:03 +01:00
handte 9c2934926f Updated and customized swagger ui.
LocationBasedServices/maptology/master This commit looks good
2019-11-30 23:00:44 +01:00
Marcus Handte 9a9bc07051 Change url and redeploy.
LocationBasedServices/maptology/master This commit looks good
2019-11-30 12:53:34 +01:00
handte bf635a00ed Fix url.
LocationBasedServices/maptology/master This commit looks good
2019-11-30 12:28:54 +01:00
handte 4c5ff0d9e1 Update swagger ui.
LocationBasedServices/maptology/master This commit looks good
2019-11-30 12:17:45 +01:00
Marcus Handte 80f3195e32 Update to 1.0.5-SNAPSHOT.
LocationBasedServices/maptology/master This commit looks good
2019-11-26 16:19:18 +01:00
152 changed files with 19148 additions and 1255 deletions
Vendored
+9 -7
View File
@@ -7,8 +7,8 @@ node {
def gradleInfo
def server = Artifactory.server 'project.nes.uni-due.de'
def gradleBuild = Artifactory.newGradleBuild()
gradleBuild.tool = 'gradle-5.5.1'
gradleBuild.usesPlugin = true
gradleBuild.useWrapper = true
environment {
ANDROID_SDK_ROOT = '/var/lib/android-sdk'
@@ -21,6 +21,7 @@ node {
}
def version = ''
def release = false
// configure the deployer based on the version
stage('Configure') {
@@ -28,10 +29,11 @@ node {
println "Version is: '${version}'"
if (version.endsWith("-SNAPSHOT")) {
println "Using internal-snapshots for publication."
gradleBuild.deployer server: server, repo: 'internal-snapshots'
gradleBuild.deployer server: server, repo: 'internal-snapshots'
} else {
println "Using internal-releases for publication."
gradleBuild.deployer server: server, repo: 'internal-releases'
gradleBuild.deployer server: server, repo: 'internal-releases'
release = true
}
}
@@ -57,13 +59,13 @@ node {
// deploy the build output on the server
stage ('Deploy') {
if (env.BRANCH_NAME == "master") {
if (env.BRANCH_NAME == "master" && release) {
withCredentials([sshUserPrivateKey(credentialsId: "maptology-server-key", keyFileVariable: "keyfile")]) {
sh "scp -i ${keyfile} site-ear/build/libs/site-ear-${version}.ear wildfly@srv.nes.uni-due.de:/opt/wildfly-17-maptology/standalone/deployments/maptology.ear"
sh "scp -i ${keyfile} android-app/build/outputs/apk/release/*.apk wildfly@srv.nes.uni-due.de:/opt/android/maptology/"
sh "scp -i ${keyfile} site-ear/build/libs/site-ear-${version}.ear wildfly@apps.nes.uni-due.de:/opt/wildfly-17-maptology/standalone/deployments/maptology.ear"
sh "scp -i ${keyfile} android-app/build/outputs/apk/release/*.apk wildfly@apps.nes.uni-due.de:/opt/android/maptology/"
}
} else {
echo "Skipping deployment for non-master branch."
echo "Skipping deployment for non-master branch or non-release build."
}
}
+7 -7
View File
@@ -3,12 +3,12 @@ description = "Maptology Android App"
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(":android-feign")
implementation "androidx.legacy:legacy-support-v4:${versionAndroidx}"
implementation "androidx.appcompat:appcompat:${versionAndroidx}"
implementation "androidx.preference:preference:${versionAndroidx}"
implementation "androidx.cardview:cardview:${versionAndroidx}"
implementation "androidx.recyclerview:recyclerview:${versionAndroidx}"
implementation "com.google.android.material:material:${versionAndroidx}"
implementation "androidx.legacy:legacy-support-v4:${versionAndroidxLegacy}"
implementation "androidx.appcompat:appcompat:${versionAndroidxCompat}"
implementation "androidx.preference:preference:${versionAndroidxPreference}"
implementation "androidx.cardview:cardview:${versionAndroidxCard}"
implementation "androidx.recyclerview:recyclerview:${versionAndroidxRecycler}"
implementation "com.google.android.material:material:${versionAndroidxMaterial}"
implementation "com.google.android.gms:play-services-oss-licenses:${versionPlay}"
testImplementation "junit:junit:${versionJunit}"
testImplementation "org.robolectric:robolectric:${versionRobolectric}"
@@ -27,7 +27,7 @@ android {
applicationId "com.maptology.android.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 9
versionCode 10
versionName "${version}"
buildConfigField "long", "BUILD_TIME", System.currentTimeMillis() + "L"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -34,22 +34,22 @@ public class LoggerService extends AbstractService {
/**
* The key for the detailed gps data.
*/
private String METADATA_GPS = "gps";
private static final String METADATA_GPS = "gps";
/**
* The key for the acceleration sensor.
*/
private String METADATA_ACCELEROMETER = "accel";
private static final String METADATA_ACCELEROMETER = "accel";
/**
* The key for the gyroscope.
*/
private String METADATA_GYROSCOPE = "gyro";
private static final String METADATA_GYROSCOPE = "gyro";
/**
* The key for the magnetometer.
*/
private String METADATA_MAGNETOMETER = "magnet";
private static final String METADATA_MAGNETOMETER = "magnet";
/**
* The notification id of the foreground service indicator.
@@ -547,7 +547,7 @@ public class LoggerService extends AbstractService {
public void setRegistered(boolean registered) {
this.registered = registered;
}
};
}
/**
@@ -613,9 +613,8 @@ public class LoggerService extends AbstractService {
@Override
public void onSensorChanged(SensorEvent event) {
long prev = 0;
if (data.size() > 0) {
prev = data.get(data.size() - 1)[0];
long prev = data.get(data.size() - 1)[0];
long diff = event.timestamp / 1000 - prev;
if (diff / 1000 < SAMPLING_DELAY_SENSOR) return;
}
@@ -3,6 +3,8 @@ package com.maptology.android.app.fragment;
import java.util.ArrayList;
import java.util.List;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.locoslab.android.leafless.IMapStateListener;
import com.locoslab.android.leafless.ITouchListener;
import com.locoslab.android.leafless.MapOptions;
@@ -31,18 +33,16 @@ import com.maptology.android.feign.model.Coordinate;
import android.database.Cursor;
import android.os.Bundle;
import android.os.Handler;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.fragment.app.FragmentTransaction;
import androidx.collection.LongSparseArray;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.LongSparseArray;
import androidx.fragment.app.FragmentTransaction;
/**
* A fragment that displays a map.
@@ -288,7 +288,7 @@ public class MapFragment extends AbstractFragment {
// apply the state
getRepository().mapState.getValue().applyTo(map);
// add a tile layer
map.addLayer(new TileLayer(new TileLayerOptions("https://cloud.locoslab.com/carta/restful-services/tile/{z}/{x}/{y}.png")));
map.addLayer(new TileLayer(new TileLayerOptions("https://www.maptology.com/carta/tile/{z}/{x}/{y}.png")));
// add map interaction
map.addShortTapListener(new ITouchListener() {
@Override
@@ -461,7 +461,7 @@ public class MapFragment extends AbstractFragment {
getRepository().mapMode.setValue(MapMode.values()[code]);
}
/**
* Applies the current map mode.
*/
+10 -5
View File
@@ -1,8 +1,8 @@
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.10.0'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.0.Fixed'
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.2'
classpath 'org.handte.gradle:gradle-android-eclipse:1.0.0'
}
@@ -28,12 +28,12 @@ allprojects {
// set version for our project
group = 'com.maptology'
version = '1.0.4'
version = '1.0.5'
// set versions for our libraries
ext {
// api dependencies
versionJavaee = '7.0'
versionJavaee = '8.0.0'
versionJaxb = '2.3.1'
versionAnnotation = '1.3.2'
versionSwagger = '1.5.22'
@@ -51,7 +51,12 @@ allprojects {
versionThorntail = '2.5.0.Final'
// android stuff
versionAndroidx = '1.0.0'
versionAndroidxCompat = '1.2.0'
versionAndroidxLegacy = '1.0.0'
versionAndroidxPreference = '1.1.1'
versionAndroidxCard = '1.0.0'
versionAndroidxRecycler = '1.1.0'
versionAndroidxMaterial = '1.2.0'
versionRobolectric = '4.3.1'
versionPlay = '17.0.0'
versionAndroidxTest = '1.2.0'
+7 -7
View File
@@ -6,8 +6,8 @@ description = 'Maptology Common Api'
dependencies {
testCompile "junit:junit:${versionJunit}"
compileOnly "javax.xml.bind:jaxb-api:${versionJaxb}"
compileOnly "javax:javaee-api:${versionJavaee}"
compile "javax.xml.bind:jaxb-api:${versionJaxb}"
compileOnly "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
compileOnly "io.swagger:swagger-annotations:${versionSwagger}"
compileOnly "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
}
@@ -34,21 +34,21 @@ swagger {
'com.maptology.api.history.IHistoryService'
]
schemes = [ 'http', 'https']
host = 'localhost'
host = 'www.maptology.com'
basePath = '/api'
info {
title = 'Maptology Service'
version = "${version}"
description = 'Maptology Service'
version = project.version
description = 'The application programming interface of Maptology.'
termsOfService = 'https://maptology.com/terms-of-service'
contact {
email = 'nes-admin@uni-due.de'
name = 'NES Universität Duisburg-Essen'
name = 'Networked Embedded Systems'
url = 'https://www.nes.uni-due.de'
}
license {
url = 'https://www.maptology.com/license'
name = 'Proprietary'
name = 'Maptology License'
}
}
swaggerFileName = 'maptology'
-1
View File
@@ -1,3 +1,2 @@
android.enableJetifier=true
android.useAndroidX=true
android.enableR8=true
+2 -2
View File
@@ -1,6 +1,6 @@
#Sun Jul 21 19:24:12 CEST 2019
#Sat Jun 20 07:42:08 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
+5 -4
View File
@@ -1,12 +1,12 @@
description = 'Maptology Service Ejb'
dependencies {
compileOnly "javax:javaee-api:${versionJavaee}"
compileOnly "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
compileOnly "com.fasterxml.jackson.core:jackson-annotations:${versionJackson}"
compile project(':common-api')
compile project(':service-geocode')
testCompile "javax:javaee-api:${versionJavaee}"
testCompile "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
testCompile "javax.xml.bind:jaxb-api:${versionJaxb}"
testCompile "com.fasterxml.jackson.core:jackson-databind:${versionJackson}"
testCompile "junit:junit:${versionJunit}"
@@ -26,7 +26,8 @@ jar {
'Created-By' : "Gradle ${gradle.gradleVersion}",
'Build-Jdk' : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
'Build-OS' : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}",
'Implementation-Build' : "${System.properties['jenkins.build.number']}"
'Implementation-Build' : "${System.properties['jenkins.build.number']}",
'Implementation-Version' : project.version
)
}
}
}
@@ -31,7 +31,7 @@ public class LocationConverter extends AbstractConverter<LocationEntity, Locatio
public Location convert(LocationEntity source) {
Location result = create();
result.setAvailability(source.getAvailability());
result.setTimestamp(source.getTimestamp());
result.setTimestamp(source.getMeasurementTime());
result.setCoordinate(convert(source.getCoordinate()));
return result;
}
@@ -58,7 +58,7 @@ public class PositionConverter extends AbstractConverter<PositionEntity, Positio
p.setOs(source.getOs());
p.setProvider(source.getProvider());
p.setSpeed(source.getSpeed());
p.setTimestamp(source.getTimestamp());
p.setTimestamp(source.getMeasurementTime());
p.setVersion(source.getVersion());
return p;
}
@@ -2,6 +2,7 @@ package com.maptology.service.entity;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.EnumType;
@@ -18,7 +19,7 @@ import javax.persistence.UniqueConstraint;
/**
* The entity that represents codes sent out to the user.
*
*
* @author Marcus
*/
@Entity
@@ -35,31 +36,32 @@ public class CodeEntity extends AbstractEntity {
* Serialization version.
*/
private static final long serialVersionUID = 2477619107225809934L;
/**
* The email to which a code has been sent.
*/
@ManyToOne
@JoinColumn(name="email_id")
private EmailEntity email;
/**
* The type of code that has been sent out.
*/
@Enumerated(EnumType.ORDINAL)
private CodeType type;
/**
* The value of the code.
*/
@Column(length = 100)
private String value;
/**
* The time when the code expires.
*/
private long expirationTime;
/**
* Returns the email.
*
@@ -131,10 +133,10 @@ public class CodeEntity extends AbstractEntity {
public void setExpirationTime(long expirationTime) {
this.expirationTime = expirationTime;
}
/**
* Finds a code by value.
*
*
* @param em The entity manager.
* @param value The value to search for.
* @return The code entity.
@@ -148,10 +150,10 @@ public class CodeEntity extends AbstractEntity {
return null;
}
}
/**
* Returns the active codes of the specified type
*
*
* @param em The entity manager.
* @param email The email to lookup.
* @param type The type.
@@ -163,5 +165,5 @@ public class CodeEntity extends AbstractEntity {
q.setParameter("email", email);
return q.getResultList();
}
}
@@ -1,5 +1,6 @@
package com.maptology.service.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@@ -10,7 +11,7 @@ import javax.validation.constraints.Pattern;
/**
* An entity to manage email addresses of users.
*
*
* @author Marcus
*/
@Entity
@@ -29,19 +30,20 @@ public class EmailEntity extends AbstractEntity {
@ManyToOne
@JoinColumn(name="user_id")
private UserEntity user;
/**
* The actual email address.
*/
@NotNull
@Pattern(regexp=".+@.+\\..+", message="Invalid email address format.")
@Column(length = 100)
private String address;
/**
* A flag to determine whether this email is verified.
*/
private boolean verified;
/**
* A flag to determine whether this email is the primary email.
*/
@@ -119,5 +121,5 @@ public class EmailEntity extends AbstractEntity {
this.correspondence = correspondence;
}
}
@@ -23,10 +23,10 @@ import com.maptology.api.location.Availability;
@Entity
@Table(name = "location",
indexes = {
@Index(columnList = "timestamp", unique = false)
@Index(columnList = "measurementTime", unique = false)
})
public class LocationEntity extends AbstractEntity {
/**
* The serialization version.
*/
@@ -37,7 +37,7 @@ public class LocationEntity extends AbstractEntity {
*/
@ManyToOne(fetch = FetchType.LAZY)
private DeviceEntity device;
/**
* The (un-) availability information for the entity.
*/
@@ -47,8 +47,8 @@ public class LocationEntity extends AbstractEntity {
/**
* The measurement time of the location.
*/
private long timestamp;
private long measurementTime;
/**
* The (optional) coordinate of the location.
*/
@@ -96,21 +96,21 @@ public class LocationEntity extends AbstractEntity {
}
/**
* Returns the timestamp.
* Returns the measurementTime.
*
* @return The timestamp.
* @return The measurementTime.
*/
public long getTimestamp() {
return timestamp;
public long getMeasurementTime() {
return measurementTime;
}
/**
* Sets the timestamp.
* Sets the measurementTime.
*
* @param timestamp The timestamp to set.
* @param measurementTime The measurementTime to set.
*/
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
public void setMeasurementTime(long measurementTime) {
this.measurementTime = measurementTime;
}
/**
@@ -130,5 +130,5 @@ public class LocationEntity extends AbstractEntity {
public void setCoordinate(EmbeddedCoordinate coordinate) {
this.coordinate = coordinate;
}
}
@@ -15,14 +15,14 @@ import javax.persistence.Table;
import javax.validation.constraints.NotNull;
/**
* Represents metadata attached to a position. The metadata consist of
* a tag-value pair. The value is stored as a clob to allow large metadata
* items.
*
* Represents metadata attached to a position. The metadata consist of
* a tag-value pair. The value is stored as a clob to allow large metadata
* items.
*
* @author Marcus
*/
@Entity
@Table(name = "metadata",
@Table(name = "public_metadata",
indexes = {
@Index(columnList = "tag", unique = false)
})
@@ -31,7 +31,7 @@ import javax.validation.constraints.NotNull;
@IdClass(MetadataId.class)
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class MetadataEntity {
/**
* The reference to the position.
*/
@@ -40,7 +40,7 @@ public class MetadataEntity {
@JoinColumn(name = "position_id")
@ManyToOne(optional = false)
private PositionEntity position;
/**
* The tag to determine the metadata type.
*/
@@ -48,12 +48,12 @@ public class MetadataEntity {
@NotNull
@Column(name="tag", length = 64)
private String tag;
/**
* The value with the actual metadata.
*/
@Lob
@Column(name="value")
@Lob
@Column(name="value")
private String value;
/**
@@ -108,6 +108,6 @@ public class MetadataEntity {
*/
public void setValue(String value) {
this.value = value;
}
}
}
@@ -37,20 +37,20 @@ import com.maptology.api.location.Availability;
/**
* Represents a stored location that has been made available
* for research purposes.
*
*
* @author Marcus
*/
@Entity
@Table(name = "position",
@Table(name = "public_position",
indexes = {
@Index(columnList = "creationTime,timestamp", unique = false),
@Index(columnList = "device,timestamp", unique = false)
@Index(columnList = "creationTime,measurementTime", unique = false),
@Index(columnList = "device,measurementTime", unique = false)
})
@NamedQueries({
@NamedQuery(name="findAllPositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p order by p.id asc"),
@NamedQuery(name="getLastPosition", lockMode=LockModeType.NONE, query="select max(p.creationTime) from PositionEntity p"),
@NamedQuery(name="countPositions", lockMode=LockModeType.NONE, query="select count(p) from PositionEntity p"),
@NamedQuery(name="findDeviceRangePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.timestamp>=:minTime and p.timestamp<=:maxTime and p.device in :devices order by p.device, p.timestamp asc"),
@NamedQuery(name="findDeviceRangePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.measurementTime>=:minTime and p.measurementTime<=:maxTime and p.device in :devices order by p.device, p.measurementTime asc"),
@NamedQuery(name="findDevicePositions", lockMode=LockModeType.NONE, query="select p from PositionEntity p where p.device=:device order by p.id asc"),
@NamedQuery(name="countDevicePositions", lockMode=LockModeType.NONE, query="select count(p) from PositionEntity p where p.device=:device"),
@NamedQuery(name="getLastDevicePosition", lockMode=LockModeType.NONE, query="select max(p.creationTime) from PositionEntity p where p.device=:device")
@@ -68,7 +68,7 @@ public class PositionEntity {
* The id of the device.
*/
private long device;
/**
* The (un-) availability information for the entity.
*/
@@ -87,17 +87,17 @@ public class PositionEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator = "pid_generator")
private long id;
/**
* The creation time of the position item.
*/
private long creationTime;
/**
* The measurement time of the location.
*/
private long timestamp;
private long measurementTime;
/**
* The (optional) coordinate of the location.
*/
@@ -107,43 +107,43 @@ public class PositionEntity {
@AttributeOverride(name="longitude", column=@Column(nullable=true))
})
private EmbeddedCoordinate coordinate;
/**
* The accuracy in meters.
*/
private Double accuracy;
/**
* The altitude in meters.
*/
private Double altitude;
/**
* The speed in m/s.
*/
private Double speed;
/**
* The bearing in degree.
*/
private Double bearing;
/**
* The location provider.
*/
private String provider;
/**
* The app version.
*/
private int version;
/**
* Additional meta data collected for the position.
*/
@OneToMany(mappedBy = "position", fetch = FetchType.LAZY)
private Set<MetadataEntity> metadata = new HashSet<>();
/**
* Automatically sets the creation date.
*/
@@ -225,21 +225,21 @@ public class PositionEntity {
}
/**
* Returns the timestamp.
* Returns the measurementTime.
*
* @return The timestamp.
* @return The measurementTime.
*/
public long getTimestamp() {
return timestamp;
public long getMeasurementTime() {
return measurementTime;
}
/**
* Sets the timestamp.
* Sets the measurementTime.
*
* @param timestamp The timestamp to set.
* @param measurementTime The measurementTime to set.
*/
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
public void setMeasurementTime(long measurementTime) {
this.measurementTime = measurementTime;
}
/**
@@ -367,7 +367,7 @@ public class PositionEntity {
public void setVersion(int version) {
this.version = version;
}
/**
* Returns the metadata.
*
@@ -388,7 +388,7 @@ public class PositionEntity {
/**
* Returns the last creation time of the position.
*
*
* @param em The entity manager.
* @return The maximum time stamp of creation times.
*/
@@ -402,11 +402,11 @@ public class PositionEntity {
return 0;
}
}
/**
* Returns the number of positions stored.
*
*
* @param em The entity manager.
* @return The number of positions.
*/
@@ -420,10 +420,10 @@ public class PositionEntity {
return 0;
}
}
/**
* Finds all positions for the page.
*
*
* @param em The entity manager.
* @param page The page config.
* @return The positions for the page.
@@ -434,11 +434,11 @@ public class PositionEntity {
q.setMaxResults(page.getSize());
return q.getResultList();
}
/**
* Returns the last creation date of a position for the device.
*
*
* @param em The entity manager.
* @param device The device to search.
* @return The creation time stamp of the last position for the device.
@@ -454,11 +454,11 @@ public class PositionEntity {
return 0;
}
}
/**
* Returns the number of positions for a device.
*
*
* @param em The entity manager.
* @param device The device to search.
* @return The number of positions.
@@ -474,10 +474,10 @@ public class PositionEntity {
return 0;
}
}
/**
* Returns a page of positions for the device.
*
*
* @param em The entity manager.
* @param device The device.
* @param page The page.
@@ -490,10 +490,10 @@ public class PositionEntity {
q.setMaxResults(page.getSize());
return q.getResultList();
}
/**
* Find the positions for a certain set of devices in the specified time range.
*
*
* @param em The entity manager.
* @param devices The devices to search.
* @param start The minimum time to return (inclusive) in epoch milliseconds.
@@ -507,5 +507,5 @@ public class PositionEntity {
q.setParameter("maxTime", start + duration);
return q.getResultList();
}
}
@@ -2,6 +2,7 @@ package com.maptology.service.entity;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.FetchType;
@@ -16,7 +17,7 @@ import javax.validation.constraints.NotNull;
/**
* An entity to define user roles.
*
*
* @author Marcus
*/
@Entity
@@ -36,12 +37,14 @@ public class RoleEntity extends AbstractEntity {
* The name of the role.
*/
@NotNull
@Column(length = 100)
private String name;
/**
* A human readable description of the role.
*/
@NotNull
@Column(length = 100)
private String description;
/**
@@ -94,10 +97,10 @@ public class RoleEntity extends AbstractEntity {
public Set<UserEntity> getUsers() {
return users;
}
/**
* Finds a role with a given name.
*
*
* @param name The name.
* @param em The entity manager.
* @return The role or null, if it does not exist.
@@ -82,14 +82,14 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
Collections.sort(unprocessed, new Comparator<LocationEntity>() {
@Override
public int compare(LocationEntity o1, LocationEntity o2) {
return Long.compare(o1.getTimestamp(), o2.getTimestamp());
return Long.compare(o1.getMeasurementTime(), o2.getMeasurementTime());
}
});
VisitEntity lastVisit = device.getVisit();
LocationEntity lastLocation = device.getLocation();
for (ReleasedLocation location: update.getLocations()) {
// check for too old updates (should not happen for a working client)
if (lastLocation != null && location.getTimestamp() < lastLocation.getTimestamp()) {
if (lastLocation != null && location.getTimestamp() < lastLocation.getMeasurementTime()) {
log.log(Level.SEVERE, "Received an out-of-order location update from device " + device.getId() + ", ignoring it.");
continue;
}
@@ -143,7 +143,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
lastLocation = new LocationEntity();
lastLocation.setAvailability(location.getAvailability());
lastLocation.setDevice(device);
lastLocation.setTimestamp(location.getTimestamp());
lastLocation.setMeasurementTime(location.getTimestamp());
Coordinate c = location.getCoordinate();
if (c != null) {
lastLocation.setCoordinate(new EmbeddedCoordinate(c.getLongitude(), c.getLatitude()));
@@ -440,7 +440,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
last = in.get(i);
} else if (last != null) {
// if we have a reference and current does not have coordinate
if (last.getTimestamp() - next.getTimestamp() > maxTime) {
if (last.getMeasurementTime() - next.getMeasurementTime() > maxTime) {
// ... remove everything that is too old
for (int j = i; j >= 0; j--) {
out.add(0, in.remove(j));
@@ -461,7 +461,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
private static Long getFirst(List<LocationEntity> in) {
for (int i = 0, s = in.size(); i < s; i++) {
if (in.get(i).getCoordinate() != null) {
return in.get(i).getTimestamp();
return in.get(i).getMeasurementTime();
}
}
return null;
@@ -476,7 +476,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
private static Long getLast(List<LocationEntity> in) {
for (int i = in.size() - 1; i >= 0; i--) {
if (in.get(i).getCoordinate() != null) {
return in.get(i).getTimestamp();
return in.get(i).getMeasurementTime();
}
}
return null;
@@ -535,7 +535,7 @@ public class LocationSessionBean extends AbstractPrincipalSessionBean {
*/
private static boolean isTooOld(LocationEntity current, Location next, long maxDuration) {
if (current == null || current.getAvailability() == Availability.IDLE) return false;
return (next.getTimestamp() - current.getTimestamp() > maxDuration);
return (next.getTimestamp() - current.getMeasurementTime() > maxDuration);
}
@@ -97,7 +97,7 @@ public class PositionSessionBean implements IPositionSessionBean {
p.setOs(device.getOs());
p.setProvider(location.getProvider());
p.setSpeed(location.getSpeed());
p.setTimestamp(location.getTimestamp());
p.setMeasurementTime(location.getTimestamp());
p.setVersion(location.getVersion());
HashSet<MetadataEntity> metadata = new HashSet<>();
if (location.getMetadata() != null) {
@@ -257,7 +257,7 @@ public class PositionSessionBean implements IPositionSessionBean {
p.setOs(location.getOs());
p.setProvider(location.getProvider());
p.setSpeed(location.getSpeed());
p.setTimestamp(location.getTimestamp());
p.setMeasurementTime(location.getTimestamp());
p.setVersion(location.getVersion());
em.persist(p);
if (p.getMetadata() != null) {
@@ -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/activate/${token}.
https://www.maptology.com/app/activate/${token}
If you did not request the association, simply delete this email
or contact us.
@@ -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/activate/${token}.
visiting https://www.maptology.com/app/activate/${token}
If you did not request the account, simply delete this email or
contact us.
@@ -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/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.
@@ -8,7 +8,7 @@ import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine;
/**
* A simple builder for the geocoder service.
*
*
* @author Marcus
*/
public class GeocoderBuilder {
@@ -16,26 +16,26 @@ public class GeocoderBuilder {
/**
* The default url.
*/
public static final String GEOCODER_URL = "https://cloud.locoslab.com/carta/restful-services";
public static final String GEOCODER_URL = "https://www.maptology.com/carta";
/**
* The url of the service.
*/
public String url = GEOCODER_URL;
/**
* The socket timeout in seconds.
*/
public Long socketTimeout = null;
/**
* The connection timeout in seconds.
*/
public Long connectionTimeout = null;
/**
* Sets the url.
*
*
* @param url The url to set.
* @return The builder.
*/
@@ -43,10 +43,10 @@ public class GeocoderBuilder {
this.url = url;
return this;
}
/**
* Sets the connection timeout in seconds.
*
*
* @param seconds The connection timeout in seconds.
* @return The builder.
*/
@@ -54,10 +54,10 @@ public class GeocoderBuilder {
this.connectionTimeout = seconds;
return this;
}
/**
* Sets the socket timeout in seconds.
*
*
* @param seconds The socket timeout in seconds.
* @return The builder.
*/
Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

+52 -94
View File
@@ -1,103 +1,61 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
<head>
<meta charset="UTF-8">
<title>Maptology Api</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
*,
*:before,
*:after
{
box-sizing: inherit;
}
<body>
body
{
margin:0;
background: #fffcf7;
}
</style>
</head>
<script>
if(window.navigator.userAgent.indexOf("Edge") > -1) {
console.log("Removing native Edge fetch implementation")
window.fetch = undefined
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "swagger.json",
dom_id: '#swagger-ui',
validatorUrl: null,
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
// End Swagger UI call region
window.ui = ui
}
</script>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "swagger.json",
dom_id: '#swagger-ui',
deepLinking: true,
validatorUrl: null,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</body>
</html>
@@ -1,5 +1,6 @@
<!doctype html>
<html lang="en-US">
<title>Swagger UI: OAuth2 Redirect</title>
<body onload="run()">
</body>
</html>
@@ -45,11 +46,18 @@
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: "Authorization failed: no accessCode received from the server"
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"swagger-ui.css","sourceRoot":""}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8
View File
@@ -0,0 +1,8 @@
description = 'Maptology Service Tool'
dependencies {
compile project(':common-api')
compile "org.jboss.resteasy:resteasy-client:${versionResteasy}"
compile "org.jboss.resteasy:resteasy-jackson2-provider:${versionResteasy}"
testCompile "junit:junit:${versionJunit}"
}
@@ -0,0 +1,131 @@
package com.maptology.tool;
import java.util.ArrayList;
import java.util.List;
/**
* A delta compression codec based on Google's WGS84 encoder that
* supports multiple data streams to encode other data than latitude
* and longitude values. Callers must supply the number of streams
* encoded in the data and the streams must exhibit the same number
* of data items.
*
* @author Marcus
*/
public class DeltaCodec {
/**
* The number of streams to encode or decode.
*/
private int streams;
/**
* Creates a delta compressor for the specified number of streams.
*
* @param streams The number of streams to encode in the string.
*/
public DeltaCodec(int streams) {
this.streams = streams;
}
/**
* Returns the number of streams expected by this codec.
*
* @return The number of streams.
*/
public int getStreams() {
return streams;
}
/**
* Encodes a list of values into a string.
*
* @param values The values consisting of arrays that represent
* the individual streams.
* @return The string.
*/
public String encode(List<long[]> values) {
StringBuilder builder = new StringBuilder();
long[] previous = new long[streams];
for (int i = 0, s = values.size(); i < s; i++) {
long[] current = values.get(i);
for (int j = 0; j < streams; j++) {
long delta = current[j] - previous[j];
builder.append(encodeSignedNumber(delta));
previous[j] = current[j];
}
}
return builder.toString();
}
/**
* Extracts the list of data from an encoded string.
*
* @param encoded The encoded string.
* @param data An optional list of data items to be reused
* to avoid object allocations. Can be null.
* @return The list of data items representing the streams.
*/
public List<long[]> decode(String encoded, List<long[]> data) {
List<long[]> list = new ArrayList<>();
int index = 0;
int length = encoded.length();
long[] current = new long[streams];
while (index < length) {
long[] next;
if (data != null && data.size() > 0) {
next = data.remove(0);
} else {
next = new long[streams];
}
long c;
for (int i = 0; i < streams; i++) {
long shift = 0;
long result = 0;
do {
c = encoded.charAt(index++) - 63;
result |= (c & 0x1f) << shift;
shift += 5;
} while (c >= 0x20);
long delta = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
current[i] += delta;
next[i] = current[i];
}
list.add(next);
}
return list;
}
/**
* Encodes a signed number as string.
*
* @param num The number.
* @return The string.
*/
private static String encodeSignedNumber(long num) {
long sgn_num = num << 1;
if (num < 0) {
sgn_num = ~(sgn_num);
}
return (encodeNumber(sgn_num));
}
/**
* Encodes an unsigned number as string.
*
* @param num The number.
* @return The string.
*/
private static String encodeNumber(long num) {
StringBuilder encodeString = new StringBuilder();
while (num >= 0x20) {
int nextValue = (int)(0x20 | (num & 0x1f)) + 63;
encodeString.append((char) (nextValue));
num >>= 5;
}
num += 63;
encodeString.append((char) (num));
return encodeString.toString();
}
}
@@ -0,0 +1,103 @@
/**
*
*/
package com.maptology.tool;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Scanner;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.maptology.api.PageConfig;
import com.maptology.api.position.IPositionService;
import com.maptology.api.position.Position;
import com.maptology.api.position.PositionPage;
import com.maptology.api.user.IUserService;
import com.maptology.api.user.User;
/**
* Downloads all data available for a particular device.
*
* @author Marcus
*/
public class DownloadDeviceData {
/**
* Runs the program.
*
* @param args Ignored.
* @throws Exception Thrown if something fails.
*/
public static void main(String[] args) throws Exception {
Scanner scanner = new Scanner(System.in);
IPositionService positionService = null;
User user = null;
while (user == null) {
String username = null;
while (username == null || username.length() == 0) {
System.out.println("Username: ");
username = scanner.nextLine().trim();
}
String password = null;
while (password == null || password.length() == 0) {
System.out.println("Password: ");
password = scanner.nextLine().trim();
}
IUserService userService = ToolUtilities.getProxy(IUserService.class, username, password);
Response r = userService.getCurrentUser();
if (r.getStatusInfo() == Status.OK) {
user = r.readEntity(User.class);
positionService = ToolUtilities.getProxy(IPositionService.class, username, password);
} else {
System.out.println("Login failed.");
}
}
scanner.close();
System.out.println("Using user: " + user.getName());
ObjectMapper mapper = new ObjectMapper();
File folder = new File(ToolUtilities.OUTPUT_FOLDER);
folder.mkdirs();
System.out.println("Using output folder: " + folder.getAbsolutePath());
for (long device: ToolUtilities.DEVICES) {
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(folder, "device-" + device + ".json")), StandardCharsets.UTF_8));
System.out.println("Downloading device positions for: " + device);
int offset = 0;
int remaining = 0;
int count = 0;
do {
System.out.println("Downloading page for offset: " + offset);
Response r = positionService.getDevicePositions(device, new PageConfig(offset, 100), true);
if (r.getStatusInfo() == Status.OK) {
PositionPage page = r.readEntity(PositionPage.class);
List<Position> positions = page.getElements();
for (Position p: positions) {
writer.write(mapper.writeValueAsString(p));
writer.newLine();
}
offset += page.getSize();
remaining = page.getTotal() - offset;
count += positions.size();
} else {
System.out.println("Fetch failed.");
System.exit(1);
}
} while (remaining > 0);
writer.close();
System.out.println("Downloaded " + count + " positions.");
}
System.out.println("Download complete.");
}
}
@@ -0,0 +1,71 @@
package com.maptology.tool;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.maptology.api.position.Position;
import com.maptology.tool.util.DeltaCodec;
/**
* Generates the polyline of a particular device by decoding
* the gps data and if available, the metadata.
*
* @author Marcus
*/
public class GenerateDevicePolyline {
/**
* Runs the program.
*
* @param args Ignored.
* @throws Exception Thrown if something fails.
*/
public static void main(String[] args) throws Exception {
ObjectMapper mapper = new ObjectMapper();
File folder = new File(ToolUtilities.OUTPUT_FOLDER);
for (long device: ToolUtilities.DEVICES) {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(folder, "device-" + device + ".json")), StandardCharsets.UTF_8));
String line = null;
while ((line = reader.readLine()) != null) {
Position position = mapper.readValue(line, Position.class);
if (position.getCoordinate() != null) {
StringBuilder b = new StringBuilder();
if (position.getMetadata().containsKey("gps")) {
DeltaCodec codec = new DeltaCodec(11);
List<long[]> result = codec.decode(position.getMetadata().get("gps"), new ArrayList<long[]>());
for (long[] value: result) {
b.append("[" + value[3] * (double)10e-8 + ", " + value[2] * (double)10e-8 + "], ");
}
// compute some statistics
double mdx = 0;
long mtx = 0;
double asx = 0;
for (int i = 1; i < result.size(); i++) {
long[] x = result.get(i - 1);
long[] y = result.get(i);
double d = ToolUtilities.getDistance(x[2] * (double)10e-8, x[3] * (double)10e-8, y[2] * (double)10e-8, y[3] * (double)10e-8);
mdx = Math.max(mdx, d);
mtx = Math.max(mtx, Math.abs(x[0] - y[0]));
if (y[0] - x[0] > 0)
asx += (d * 1000 / (y[0] - x[0])) / (result.size() - 1);
}
System.out.println(mdx + "\t" + mtx + "\t" + asx);
} else {
b.append("[" + position.getCoordinate().getLatitude() + ", " + position.getCoordinate().getLongitude() + "], ");
}
System.out.println(b.toString());
}
}
reader.close();
}
}
}
@@ -0,0 +1,50 @@
package com.maptology.tool;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.maptology.api.position.Position;
public class GenerateGPSTrace {
public static final long start = new Date(120, 0, 28, 0, 0, 0).getTime();
public static final long end = new Date(120, 2, 3, 23, 59, 59).getTime();
public static void main(String[] args) throws IOException {
System.out.println("EID,Time,Longitude,Latitude");
File folder = new File(ToolUtilities.OUTPUT_FOLDER);
File[] files = folder.listFiles();
for (File input: files) {
if (input.getName().startsWith("device-") && input.getName().endsWith(".json")) {
String deviceId = input.getName().substring(7, input.getName().length() - 5);
//System.out.println("Processing: " + deviceId);
List<Position> positions = ToolUtilities.readPositions(input);
for (Position p: positions) {
if (p.getTimestamp() < start || p.getTimestamp() > end) continue;
if (p.getCoordinate() != null) {
if (p.getMetadata().containsKey("gps")) {
DeltaCodec c = new DeltaCodec(11);
List<long[]> result = c.decode(p.getMetadata().get("gps"), new ArrayList<>());
for (long[] pos: result) {
System.out.println(deviceId + "," + pos[0] + "," + (pos[2] / 10E6) + "," + (pos[3] / 10E6));
}
} else {
System.out.println(deviceId + "," + p.getTimestamp()+ "," + p.getCoordinate().getLongitude()+ "," + p.getCoordinate().getLatitude());
}
}
}
} else {
System.out.println("Skipping: " + input.getName());
}
}
}
}
@@ -0,0 +1,105 @@
package com.maptology.tool;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jboss.resteasy.client.jaxrs.BasicAuthentication;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.maptology.api.position.Position;
/**
* The tool configuration and utilities.
*
* @author Marcus
*/
public class ToolUtilities {
/**
* The url of the maptology api.
*/
public static String API_URL = "https://www.maptology.com/api";
/**
* The devices
*/
public static long[] DEVICES = new long[] { 403330, 403336, 403340, 403345, 403349 };
/**
* The output folder to write data.
*/
public static String OUTPUT_FOLDER = "temp";
/**
* The earth's radius in meters.
*/
public static final int EARTH_RADIUS = 6371000;
/**
* Returns a proxy for the service with the specified login data.
*
* @param <T> The type of the service.
* @param service The class representing the service interface.
* @param username The user name.
* @param password The user password.
* @return The proxy for the service.
*/
public static <T> T getProxy(Class<T> service, String username, String password) {
ResteasyClientBuilder builder = new ResteasyClientBuilder();
builder.httpEngine(new URLConnectionEngine());
ResteasyClient client = builder.build();
return client.register(new BasicAuthentication(username, password)).target(API_URL).proxy(service);
}
/**
* Returns the distance in meters between the two wgs coordinates specified by
* alon, alat and blon, blat.
*
* @param alon The longitude of the first point.
* @param alat The latitude of the first point.
* @param blon The longitude of the second point.
* @param blat The latitude of the second point.
* @return The distance in meters.
*/
public static double getDistance(double alon, double alat, double blon, double blat) {
double dlong = Math.toRadians(blon - alon);
double dlat = Math.toRadians(blat - alat);
double ax = Math.pow(Math.sin(dlat / 2.0), 2) + Math.cos(Math.toRadians(alat)) * Math.cos(Math.toRadians(blat))
* Math.pow(Math.sin(dlong / 2.0), 2);
double c = 2 * Math.atan2(Math.sqrt(ax), Math.sqrt(1 - ax));
return EARTH_RADIUS * c;
}
/**
* Reads all positions from a file.
*
* @param file The file to read.
* @return The positions.
* @throws IOException Thrown if something fails.
*/
public static List<Position> readPositions(File file) throws IOException {
List<Position> result = new ArrayList<Position>();
BufferedReader r = new BufferedReader(new FileReader(file));
try {
ObjectMapper m = new ObjectMapper();
String line;
while ((line = r.readLine()) != null) {
result.add(m.readValue(line, Position.class));
}
} finally {
r.close();
}
return result;
}
}
@@ -0,0 +1,131 @@
package com.maptology.tool.util;
import java.util.ArrayList;
import java.util.List;
/**
* A delta compression codec based on Google's WGS84 encoder that
* supports multiple data streams to encode other data than latitude
* and longitude values. Callers must supply the number of streams
* encoded in the data and the streams must exhibit the same number
* of data items.
*
* @author Marcus
*/
public class DeltaCodec {
/**
* The number of streams to encode or decode.
*/
private int streams;
/**
* Creates a delta compressor for the specified number of streams.
*
* @param streams The number of streams to encode in the string.
*/
public DeltaCodec(int streams) {
this.streams = streams;
}
/**
* Returns the number of streams expected by this codec.
*
* @return The number of streams.
*/
public int getStreams() {
return streams;
}
/**
* Encodes a list of values into a string.
*
* @param values The values consisting of arrays that represent
* the individual streams.
* @return The string.
*/
public String encode(List<long[]> values) {
StringBuilder builder = new StringBuilder();
long[] previous = new long[streams];
for (int i = 0, s = values.size(); i < s; i++) {
long[] current = values.get(i);
for (int j = 0; j < streams; j++) {
long delta = current[j] - previous[j];
builder.append(encodeSignedNumber(delta));
previous[j] = current[j];
}
}
return builder.toString();
}
/**
* Extracts the list of data from an encoded string.
*
* @param encoded The encoded string.
* @param data An optional list of data items to be reused
* to avoid object allocations. Can be null.
* @return The list of data items representing the streams.
*/
public List<long[]> decode(String encoded, List<long[]> data) {
List<long[]> list = new ArrayList<>();
int index = 0;
int length = encoded.length();
long[] current = new long[streams];
while (index < length) {
long[] next;
if (data != null && data.size() > 0) {
next = data.remove(0);
} else {
next = new long[streams];
}
long c;
for (int i = 0; i < streams; i++) {
long shift = 0;
long result = 0;
do {
c = encoded.charAt(index++) - 63;
result |= (c & 0x1f) << shift;
shift += 5;
} while (c >= 0x20);
long delta = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
current[i] += delta;
next[i] = current[i];
}
list.add(next);
}
return list;
}
/**
* Encodes a signed number as string.
*
* @param num The number.
* @return The string.
*/
private static String encodeSignedNumber(long num) {
long sgn_num = num << 1;
if (num < 0) {
sgn_num = ~(sgn_num);
}
return (encodeNumber(sgn_num));
}
/**
* Encodes an unsigned number as string.
*
* @param num The number.
* @return The string.
*/
private static String encodeNumber(long num) {
StringBuilder encodeString = new StringBuilder();
while (num >= 0x20) {
int nextValue = (int)(0x20 | (num & 0x1f)) + 63;
encodeString.append((char) (nextValue));
num >>= 5;
}
num += 63;
encodeString.append((char) (num));
return encodeString.toString();
}
}
@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<title>Trace Visualization</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>
</head>
<body>
<style>
html, body {
height: 100%;
margin: 0px;
}
#mapid {
width: 100%;
height: 100%;
}
</style>
<div id="mapid"></div>
<script>
// add your points to draw into the array
var polylinePoints = [
[50.774138199999996, 7.0871493999999995], [50.774135199999996, 7.0871102], [50.7741407, 7.0871035]
];
// create a map, add polyline set view
var mymap = L.map('mapid').setView(polylinePoints[0], 13);
L.tileLayer('https://www.maptology.com/carta/tile/{z}/{x}/{y}.png', {
maxZoom: 20,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Visuals © <a href="https://www.locoslab.com/">LocosLab GmbH</a>'
}).addTo(mymap);
var polylineOptions = {
color: 'blue',
weight: 6,
opacity: 0.9
};
var polyline = new L.Polyline(polylinePoints, polylineOptions);
polyline.addTo(mymap);
</script>
</body>
</html>
+1 -1
View File
@@ -9,7 +9,7 @@ dependencies {
testCompile "junit:junit:${versionJunit}"
testCompile "org.jboss.arquillian.junit:arquillian-junit-container:${versionArquillianJunit}"
testCompile "org.wildfly.arquillian:wildfly-arquillian-container-managed:${versionArquillianContainer}"
providedCompile "javax:javaee-api:${versionJavaee}"
providedCompile "jakarta.platform:jakarta.jakartaee-api:${versionJavaee}"
providedCompile "com.fasterxml.jackson.core:jackson-databind:${versionJackson}"
providedCompile "org.jboss.resteasy:resteasy-client:${versionResteasy}"
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

+52 -94
View File
@@ -1,103 +1,61 @@
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
<head>
<meta charset="UTF-8">
<title>Maptology Api</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
*,
*:before,
*:after
{
box-sizing: inherit;
}
<body>
body
{
margin:0;
background: #fffcf7;
}
</style>
</head>
<script>
if(window.navigator.userAgent.indexOf("Edge") > -1) {
console.log("Removing native Edge fetch implementation")
window.fetch = undefined
<body>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "maptology.json",
dom_id: '#swagger-ui',
validatorUrl: null,
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
// End Swagger UI call region
window.ui = ui
}
</script>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
<defs>
<symbol viewBox="0 0 20 20" id="unlocked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
</symbol>
<symbol viewBox="0 0 20 20" id="locked">
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="close">
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow">
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
</symbol>
<symbol viewBox="0 0 20 20" id="large-arrow-down">
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="jump-to">
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
</symbol>
<symbol viewBox="0 0 24 24" id="expand">
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
</symbol>
</defs>
</svg>
<div id="swagger-ui"></div>
<script src="./swagger-ui-bundle.js"> </script>
<script src="./swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "maptology.json",
dom_id: '#swagger-ui',
deepLinking: true,
validatorUrl: null,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</body>
</html>
@@ -1,5 +1,6 @@
<!doctype html>
<html lang="en-US">
<title>Swagger UI: OAuth2 Redirect</title>
<body onload="run()">
</body>
</html>
@@ -45,11 +46,18 @@
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
(qp.error_uri ? "More info: "+qp.error_uri : "");
}
oauth2.errCb({
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: "Authorization failed: no accessCode received from the server"
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
});
}
} else {
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"swagger-ui.css","sourceRoot":""}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -7,6 +7,7 @@ include(':service-geocode')
include(':service-ejb')
include(':service-war')
include(':service-thorntail')
include(':service-tool')
include(':web-angular')
include(':web-war')
include(':site-ear')
+11 -2
View File
@@ -11,6 +11,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
@@ -27,6 +28,12 @@
},
"configurations": {
"production": {
"budgets": [
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
@@ -48,7 +55,9 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "webapp-ng:build"
"baseHref": "/app",
"browserTarget": "webapp-ng:build",
"proxyConfig": "proxy.conf.json"
},
"configurations": {
"production": {
@@ -123,7 +132,7 @@
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
"style": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
+3
View File
@@ -0,0 +1,3 @@
{
"ngVersion": "9.0.0"
}
+25 -11
View File
@@ -1,9 +1,14 @@
plugins {
id "com.moowork.node" version "1.3.1"
id 'com.github.node-gradle.node' version '2.2.4'
id 'org.hidetake.swagger.generator' version '2.18.1'
}
description = 'Maptology Web Angular'
dependencies {
swaggerCodegen 'io.swagger:swagger-codegen-cli:2.4.12'
}
node {
version = '10.16.0'
npmVersion = '6.9.0'
@@ -17,13 +22,6 @@ class IoNodeTask extends com.moowork.gradle.node.task.NodeTask {
File outputDir;
}
task genApi(type: IoNodeTask) {
script = file('node_modules/angular4-swagger-client-generator/bin/a4apigen.js')
args = ['-s', '../common-api/build/swagger/maptology.json', '-o', './src/api']
inputFile = project.file('../common-api/build/swagger/maptology.json')
outputDir = project.file('./src/api/')
}
task cleanApi(type: Delete) {
delete './src/api', './dist'
}
@@ -35,11 +33,27 @@ task ngBuild(type: IoNodeTask) {
outputDir = project.file('./dist/')
}
swaggerSources {
maptology {
inputFile = file(project(':common-api:').buildDir.path + '/swagger/maptology.json')
code {
outputDir = file("./src/api/")
language = 'typescript-angular'
configFile = file('apiconfig.json')
components = [models: true, apis: 'Default', supportingFiles: 'configuration.ts,encoder.ts,api.ts,models.ts,variables.ts']
wipeOutputDir = true
}
}
}
// require api build to access swagger definition
tasks['resolveSwaggerTemplate'].dependsOn(project(':common-api').tasks['build'])
// make sure that common api is built before generating the api
genApi.dependsOn(npmInstall)
genApi.dependsOn(project(":common-api").tasks['build'])
ngBuild.dependsOn(npmInstall)
// generate the api before running ng build
ngBuild.dependsOn("genApi")
ngBuild.dependsOn("generateSwaggerCode")
// run ng build whenever the project is built
build.dependsOn("ngBuild")
+14819
View File
File diff suppressed because it is too large Load Diff
+27 -29
View File
@@ -4,49 +4,47 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"api": "a4apigen -s ../common-api/build/swagger/maptology.json -o ./src/api",
"start": "npm run api && ng serve --host 0.0.0.0 --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": "ng serve --host 0.0.0.0",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"release": "ng b --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "^8.1.2",
"@angular/cdk": "^8.1.1",
"@angular/common": "^8.1.2",
"@angular/compiler": "^8.1.2",
"@angular/core": "^8.1.2",
"@angular/flex-layout": "^8.0.0-beta.26",
"@angular/forms": "^8.1.2",
"@angular/material": "^8.1.1",
"@angular/platform-browser": "^8.1.2",
"@angular/platform-browser-dynamic": "^8.1.2",
"@angular/router": "^8.1.2",
"@angular/animations": "^9.0.1",
"@angular/cdk": "^9.0.0",
"@angular/common": "^9.0.1",
"@angular/compiler": "^9.0.1",
"@angular/core": "^9.0.1",
"@angular/flex-layout": "^9.0.0-beta.29",
"@angular/forms": "^9.0.1",
"@angular/material": "^9.0.0",
"@angular/platform-browser": "^9.0.1",
"@angular/platform-browser-dynamic": "^9.0.1",
"@angular/router": "^9.0.1",
"@types/jszip": "^3.1.6",
"core-js": "^2.6.9",
"hammerjs": "^2.0.8",
"jszip": "^3.2.2",
"leaflet": "^1.5.1",
"ngx-gauge": "^1.0.0-beta.10",
"ngx-gauge": "^1.0.0",
"rxjs": "^6.5.2",
"saturn-datepicker": "^8.0.1",
"tslib": "^1.10.0",
"zone.js": "^0.9.1"
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.801.2",
"@angular/cli": "^8.1.2",
"@angular/compiler-cli": "^8.1.2",
"@angular/language-service": "^8.1.2",
"@angular-devkit/build-angular": "~0.900.2",
"@angular/cli": "^9.0.2",
"@angular/compiler-cli": "^9.0.1",
"@angular/language-service": "^9.0.1",
"@types/jasmine": "^2.8.16",
"@types/jasminewd2": "^2.0.6",
"@types/leaflet": "^1.4.6",
"@types/node": "^6.14.7",
"@types/node": "^12.11.1",
"acorn": "^6.2.0",
"angular4-swagger-client-generator": "0.1.13",
"codelyzer": "^5.0.1",
"codelyzer": "^5.1.2",
"events": "^3.0.0",
"jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "^4.2.1",
@@ -58,6 +56,6 @@
"protractor": "^6.0.0",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~3.4.5"
"typescript": "~3.7.5"
}
}
+5 -2
View File
@@ -1,8 +1,11 @@
{
"/api": {
"target": "https://maptology.com",
"secure": false,
"secure": true,
"ws": true,
"logLevel": "debug"
"logLevel": "debug",
"headers" : {
"Host" : "maptology.com"
}
}
}
+3
View File
@@ -0,0 +1,3 @@
export * from '../api/api/api';
export * from '../api/model/models';
export * from '../api/configuration';
+55 -15
View File
@@ -5,16 +5,33 @@ 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, MatDialogModule,
MatListModule, MatPaginatorModule, MatTableModule,
MatPaginatorIntl, MatExpansionModule, MatSelectModule,
MatDatepickerModule, MatNativeDateModule,
MatTabsModule, MatGridListModule, MatSliderModule } from '@angular/material';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatNativeDateModule } from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatDialogModule } from '@angular/material/dialog';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatIconModule } from '@angular/material/icon';
import { MatInputModule } from '@angular/material/input';
import { MatListModule } from '@angular/material/list';
import { MatMenuModule } from '@angular/material/menu';
import { MatPaginatorModule, MatPaginatorIntl } from '@angular/material/paginator';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatSelectModule } from '@angular/material/select';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatSliderModule } from '@angular/material/slider';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { MatTableModule } from '@angular/material/table';
import { MatTabsModule } from '@angular/material/tabs';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { CdkTableModule } from '@angular/cdk/table';
import { SatDatepickerModule, SatNativeDateModule } from 'saturn-datepicker';
import { LocationStrategy, PathLocationStrategy, registerLocaleData, DatePipe } from '@angular/common';
import LocaleDE from '@angular/common/locales/de';
@@ -27,12 +44,14 @@ import { AppComponent } from './app.component';
import { InsideComponent } from './layouts/inside.component';
import { OutsideComponent } from './layouts/outside.component';
import { FooterComponent } from './layouts/footer.component';
import { ContentLayoutComponent } from './layouts/content-layout.component';
import { ContentHeaderComponent } from './layouts/content-header.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 { DefaultService, Configuration} from './api';
import { ConsoleService } from './services/console.service';
import { UserService } from './services/user.service';
import { FormsModule } from '@angular/forms';
@@ -89,6 +108,10 @@ import { ExportComponent } from './views/export.component';
import { ExportService } from './services/export.service';
import { DevicePositionService } from './services/device-position.service';
import { DevicePositionsComponent } from './views/device-positions.component';
import { ChartComponent } from './widgets/chart.component';
import { TimeSheetComponent } from './views/time-sheet.component';
import { PlacesDialogComponent } from './widgets/places-dialog.component';
/**
* Computes the api domain from the browser location.
@@ -157,6 +180,11 @@ registerLocaleData(LocaleDE);
ManageNoticesComponent,
EditNoticeComponent,
UseParentFormDirective,
ChartComponent,
TimeSheetComponent,
PlacesDialogComponent,
ContentLayoutComponent,
ContentHeaderComponent,
],
imports: [
BrowserModule,
@@ -189,11 +217,16 @@ registerLocaleData(LocaleDE);
MatNativeDateModule,
MatTabsModule,
MatGridListModule,
MatMenuModule,
CdkTableModule,
AppRoutingModule,
SatDatepickerModule,
SatNativeDateModule,
MatButtonToggleModule
],
providers: [
// injection token for http client
{ provide: 'domain', useValue: apidomain().http },
{ provide: Configuration, useValue: new Configuration({ basePath: apidomain().http }) },
{ provide: 'wsdomain', useValue: apidomain().ws },
// location stategy for passing that with the router
{ provide: LocationStrategy, useClass: PathLocationStrategy },
@@ -205,12 +238,19 @@ registerLocaleData(LocaleDE);
{ provide: MatPaginatorIntl, useClass: GermanPaginatorProvider },
DatePipe,
// add our application services (api access, logging, authentication)
ApiClientService, ConsoleService, AuthGuard,
DefaultService, ConsoleService, AuthGuard,
ResourceService, CredentialService, UserService, VersionService, ExportService,
DeviceService, PrivilegeService, PlaceService, NoticeService, PlaceVisitService, DeviceVisitService, DevicePositionService,
ManageLogService, ManageUserService, ManageNoticeService
],
entryComponents: [MessageDialogComponent, ConfirmationDialogComponent, ShareDialogComponent, NicknameDialogComponent, LogDialogComponent],
],
entryComponents: [
MessageDialogComponent,
ConfirmationDialogComponent,
ShareDialogComponent,
NicknameDialogComponent,
LogDialogComponent,
PlacesDialogComponent,
],
bootstrap: [AppComponent]
})
export class AppModule { }
+4
View File
@@ -26,6 +26,7 @@ import { ManageNoticesComponent } from './views/manage-notices.component';
import { EditNoticeComponent } from './views/edit-notice.component';
import { ExportComponent } from './views/export.component';
import { DevicePositionsComponent } from './views/device-positions.component';
import { TimeSheetComponent } from "./views/time-sheet.component";
export const routes: Routes = [
{ path: '', canActivate: [AuthGuard], canActivateChild: [AuthGuard], children: [
@@ -55,6 +56,9 @@ export const routes: Routes = [
{ path: 'export', component: InsideComponent, children: [
{ path: '', component: ExportComponent }
]},
{ path: 'timesheet', component: InsideComponent, children: [
{ path: '', component: TimeSheetComponent }
]},
/// inside (admin)
{ path: 'manage', component: InsideComponent, children: [
{ path: 'logs', component: ManageLogComponent },
+1 -1
View File
@@ -12,7 +12,7 @@ export class AuthGuard implements CanActivate, CanActivateChild {
];
private static readonly USER: string[] = [
'/devices', '/notices', '/privileges', '/profile', '/places', '/export'
'/devices', '/notices', '/privileges', '/profile', '/places', '/export', '/timesheet'
];
private static readonly ADMIN: string[] = [
@@ -0,0 +1,4 @@
<mat-toolbar id="content-toolbar" [ngClass]="headerClass" [ngStyle]="headerStyle">
<ng-content select=".header-title"></ng-content>
<ng-content select=".header-actions"></ng-content>
</mat-toolbar>
@@ -0,0 +1,22 @@
import { Component, Input } from '@angular/core';
/**
* Simple content header component which is containing the name of the page on
* the left side and the action buttons on the right side.
*
* @author Adriano
*/
@Component({
selector: 'app-content-header',
templateUrl: './content-header.component.html'
})
export class ContentHeaderComponent {
/* Attributes which are forwarding the styles and classes
* to the mat-toolbar which where specified on the app-content-header.*/
@Input() headerStyle?: { [klass: string]: any; };
@Input() headerClass?: string | string[] | Set<string> | { [klass: string]: any; };
constructor() { }
}
@@ -0,0 +1,8 @@
<div class="outer-container" [ngClass]="layoutClass" [ngStyle]="layoutStyle">
<ng-content select="app-content-header"></ng-content>
<div #mainDiv class="inner-container">
<ng-content select="aside"></ng-content>
<ng-content select="main"></ng-content>
</div>
</div>
@@ -0,0 +1,32 @@
import { Component, AfterViewInit, ViewChild, ElementRef, Input } from '@angular/core';
/**
* Content layout component which displays an <app-header>
* on the top, a <main> on the left and an <aside> on the right side
* through angular projection.
* The <main> tag is mandatory and the other two can be omitted if necessary.
*
* @author Adriano
*/
@Component({
selector: 'app-content-layout',
templateUrl: './content-layout.component.html'
})
export class ContentLayoutComponent implements AfterViewInit {
/* Attributes which are forwarding the styles and classes
* to the div.outer-container which where specified on the app-content-layout.*/
@Input() layoutStyle?: { [klass: string]: any; };
@Input() layoutClass?: string | string[] | Set<string> | { [klass: string]: any; };
@ViewChild('mainDiv') mainDiv: ElementRef;
constructor() { }
ngAfterViewInit(): void {
const div: HTMLDivElement = this.mainDiv.nativeElement;
if (div.getElementsByTagName('main').length === 0) {
throw new Error('<main> tag not specified!');
}
}
}
@@ -1,67 +1,51 @@
<mat-list class="mat-typography">
<mat-nav-list class="mat-typography" style="display: flex; flex: 1 1 auto; flex-direction: column;">
<h3 mat-subheader>{{res.strings('drawer_navigation')}}</h3>
<mat-list-item>
<button mat-button routerLink="/notices">
<mat-icon class="icon-button">message</mat-icon>
<span class="mat-button">{{ res.strings('notices_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/privileges">
<mat-icon class="icon-button">share</mat-icon>
<span class="mat-button">{{ res.strings('privileges_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/devices">
<mat-icon class="icon-button">devices</mat-icon>
<span class="mat-button">{{ res.strings('devices_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/places">
<mat-icon class="icon-button">pie_chart_outlined</mat-icon>
<span class="mat-button">{{ res.strings('places_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/export">
<mat-icon class="icon-button">cloud_download</mat-icon>
<span class="mat-button">{{ res.strings('export_title') }}</span>
</button>
</mat-list-item>
<a mat-list-item routerLink="/notices">
<mat-icon class="icon-button">message</mat-icon>
<span class="mat-button">{{ res.strings('notices_title') }}</span>
</a>
<a mat-list-item routerLink="/privileges">
<mat-icon class="icon-button">share</mat-icon>
<span class="mat-button">{{ res.strings('privileges_title') }}</span>
</a>
<a mat-list-item routerLink="/timesheet">
<mat-icon class="icon-button">access_time_icon</mat-icon>
<span class="mat-button">{{ res.strings('time_sheet_title') }}</span>
</a>
<a mat-list-item routerLink="/devices">
<mat-icon class="icon-button">devices</mat-icon>
<span class="mat-button">{{ res.strings('devices_title') }}</span>
</a>
<a mat-list-item routerLink="/places">
<mat-icon class="icon-button">pie_chart_outlined</mat-icon>
<span class="mat-button">{{ res.strings('places_title') }}</span>
</a>
<a mat-list-item routerLink="/export">
<mat-icon class="icon-button">cloud_download</mat-icon>
<span class="mat-button">{{ res.strings('export_title') }}</span>
</a>
<h3 mat-subheader>{{res.strings('drawer_settings')}}</h3>
<mat-list-item>
<button mat-button routerLink="/profile">
<mat-icon class="icon-button">perm_identity</mat-icon>
<span class="mat-button">{{ res.strings('user_title') }}</span>
</button>
</mat-list-item>
<a mat-list-item routerLink="/profile">
<mat-icon class="icon-button">perm_identity</mat-icon>
<span class="mat-button">{{ res.strings('user_title') }}</span>
</a>
<ng-container *ngIf="admin">
<h3 mat-subheader>{{res.strings('drawer_management')}}</h3>
<mat-list-item>
<button mat-button routerLink="/manage/system">
<mat-icon class="icon-button">equalizer</mat-icon>
<span class="mat-button">{{ res.strings('manage_system_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/manage/logs">
<mat-icon class="icon-button">subject</mat-icon>
<span class="mat-button">{{ res.strings('manage_logs_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/manage/users">
<mat-icon class="icon-button">people</mat-icon>
<span class="mat-button">{{ res.strings('manage_users_title') }}</span>
</button>
</mat-list-item>
<mat-list-item>
<button mat-button routerLink="/manage/notices">
<mat-icon class="icon-button">forum</mat-icon>
<span class="mat-button">{{ res.strings('manage_notices_title') }}</span>
</button>
</mat-list-item>
<a mat-list-item routerLink="/manage/system">
<mat-icon class="icon-button">equalizer</mat-icon>
<span class="mat-button">{{ res.strings('manage_system_title') }}</span>
</a>
<a mat-list-item routerLink="/manage/logs">
<mat-icon class="icon-button">subject</mat-icon>
<span class="mat-button">{{ res.strings('manage_logs_title') }}</span>
</a>
<a mat-list-item routerLink="/manage/users">
<mat-icon class="icon-button">people</mat-icon>
<span class="mat-button">{{ res.strings('manage_users_title') }}</span>
</a>
<a mat-list-item routerLink="/manage/notices">
<mat-icon class="icon-button">forum</mat-icon>
<span class="mat-button">{{ res.strings('manage_notices_title') }}</span>
</a>
</ng-container>
</mat-list>
</mat-nav-list>
@@ -2,7 +2,7 @@ import { Component, OnInit, OnDestroy, HostListener, ViewChild } from '@angular/
import { Router } from '@angular/router';
import { UserService, UserState } from '../services/user.service';
import { Subscription } from 'rxjs';
import { MatSidenavContainer, MatSidenav } from '@angular/material';
import { MatSidenavContainer, MatSidenav } from '@angular/material/sidenav';
import { ResourceService } from '../services/resource.service';
@Component({
@@ -1,7 +1,8 @@
import { MatPaginatorIntl } from '@angular/material';
import { MatPaginatorIntl } from '@angular/material/paginator';
import { ResourceService } from '../services/resource.service';
import { Inject } from '@angular/core';
import { Inject, Injectable } from '@angular/core';
@Injectable()
export class GermanPaginatorProvider extends MatPaginatorIntl {
constructor(@Inject(ResourceService) public res: ResourceService) {
@@ -1,7 +1,4 @@
import { Injectable } from '@angular/core';
import { ConsoleService } from './console.service';
import { BehaviorSubject } from 'rxjs';
import { HttpErrorResponse } from '@angular/common/http';
/**
* A service to manage the user's credentials. This service only
@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
import { Observable, BehaviorSubject } from 'rxjs';
import { DataSource } from '@angular/cdk/table';
import { Device, Position } from '../../api/models';
import { ApiClientService } from '../../api';
import { DefaultService, Device, Position } from '../api';
import { CollectionViewer } from '@angular/cdk/collections';
import { DeltaCodec } from "../utils/deltacodec";
/**
* A service that handles visits for a particular device and time.
@@ -16,12 +16,13 @@ export class DevicePositionService implements DataSource<Position> {
readonly date = new BehaviorSubject<Date>(new Date());
private elements = new BehaviorSubject<Position[]>([]);
private readonly streams = 5;
private readonly deltaCodec = new DeltaCodec(this.streams);
private id: number;
private subscriptions = 0;
constructor(private apiClientService: ApiClientService) {
}
constructor(private apiClientService: DefaultService) { }
getPositions(): Position[] {
return this.elements.getValue();
@@ -35,7 +36,7 @@ export class DevicePositionService implements DataSource<Position> {
this.id = id;
if (id != null) {
this.apiClientService.getDevice(id).subscribe((result) => {
this.device.next(result.body);
this.device.next(result);
this.loading.next(false);
this.setDate(this.date.getValue());
}, (error) => {
@@ -53,8 +54,8 @@ export class DevicePositionService implements DataSource<Position> {
const millis = d.getTime();
this.date.next(d);
this.elements.next([]);
this.apiClientService.getDevicePositionsRange(this.id, millis, 24 * 60 * 60 * 1000, false).subscribe((result) => {
this.elements.next(result.body.sort((a, b) => a.timestamp - b.timestamp));
this.apiClientService.getDevicePositionsRange(this.id, millis, 24 * 60 * 60 * 1000, true).subscribe((result) => {
this.elements.next(result.sort((a, b) => a.timestamp - b.timestamp));
this.loading.next(false);
}, (error) => {
this.elements.next([]);
@@ -71,4 +72,25 @@ export class DevicePositionService implements DataSource<Position> {
this.subscriptions -= 1;
}
/**
* Decodes the accelerator string of the given position if present.
*
* The accelerator string is decoded into an array of 5 tuples by the DeltaCodec.
* -> (timestamp, accuracy, x, y, z).
* -> timestamp is given in microseconds.
* -> x, y & z need to be shiftet 7 digits to the left (multiply with 10^-7).
*
* @param currPosition Current position object.
* @return A multidimensional array of numbers.
*/
decodeAccelData(currPosition: Position): number[][] {
if (!currPosition.metadata.accel) return null;
let data = this.deltaCodec.decode(currPosition.metadata.accel as string, null);
data.forEach((value: number[], idx: number, arr: number[][]) => {
value[2] *= 0.0000001;
value[3] *= 0.0000001;
value[4] *= 0.0000001;
})
return data;
}
}
@@ -1,12 +1,8 @@
import { Injectable } from '@angular/core';
import { Subject , Observable, BehaviorSubject } from 'rxjs';
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 { DefaultService, Device, Place, Visit } from '../api';
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.
@@ -24,7 +20,7 @@ export class DeviceVisitService implements DataSource<Visit> {
private id: number;
private subscriptions = 0;
constructor(private apiClientService: ApiClientService) {
constructor(private apiClientService: DefaultService) {
}
getVisits(): Visit[] {
@@ -39,7 +35,7 @@ export class DeviceVisitService implements DataSource<Visit> {
this.id = id;
if (id != null) {
this.apiClientService.getDevice(id).subscribe((result) => {
this.device.next(result.body);
this.device.next(result);
this.loading.next(false);
this.setDate(this.date.getValue());
}, (error) => {
@@ -58,7 +54,7 @@ export class DeviceVisitService implements DataSource<Visit> {
this.date.next(d);
this.elements.next([]);
this.apiClientService.getDeviceVisitsRange(this.id, millis, 24 * 60 * 60 * 1000).subscribe((result) => {
this.elements.next(result.body);
this.elements.next(result);
this.loadPlaces();
}, (error) => {
this.elements.next([]);
@@ -84,7 +80,7 @@ export class DeviceVisitService implements DataSource<Visit> {
this.loaders = ids.length;
for (const v of ids) {
this.apiClientService.getPlace(v).subscribe((result) => {
this.finishLoading(v, result.body);
this.finishLoading(v, result);
}, (error) => {
this.finishLoading(v, null);
});
@@ -1,12 +1,7 @@
import { Injectable } from '@angular/core';
import { Subject , 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 { Observable } from 'rxjs';
import { DefaultService, Device, DevicePage } from '../api';
import { AbstractPageService } from '../utils/pagination';
import { HttpResponse } from '@angular/common/http';
/**
* A service that handles devices.
@@ -14,11 +9,11 @@ import { HttpResponse } from '@angular/common/http';
@Injectable()
export class DeviceService extends AbstractPageService<Device, DevicePage> {
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<DevicePage>> {
protected loadPage(offset: number, size: number): Observable<DevicePage> {
return this.apiClientService.getCurrentUserDevices(offset, size);
}
@@ -1,10 +1,9 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, empty } from 'rxjs';
import { ApiClientService, Order } from '../../api';
import { PlacePage, VisitPage, DevicePage } from '../../api/models';
import { DefaultService, PlacePage, VisitPage, DevicePage } from '../api';
import { Page } from '../utils/pagination';
import * as JSZip from 'jszip';
import { UserService, UserState } from './user.service';
import { UserService } from './user.service';
/**
* A service that handles the download of
* data to create exports.
@@ -29,7 +28,7 @@ export class ExportService {
return { elements: [], offset: 0, total: -1, size: 0 };
}
constructor(private apiClientService: ApiClientService, private userService: UserService) { }
constructor(private apiClientService: DefaultService, private userService: UserService) { }
startDownload(): void {
if (this.downloading.getValue()) { return; }
@@ -44,17 +43,17 @@ export class ExportService {
this.apiClientService.getCurrentUserDevices(this.devices.getValue().offset, ExportService.BATCH_SIZE)
.subscribe(response => {
if (code === this.request) {
this.devices.next(this.mergePages(response.body, this.devices.getValue()));
this.devices.next(this.mergePages(response, this.devices.getValue()));
this.scheduleDownload(code);
}
}, this.createErrorHandler(code)
);
} else if (this.isIncomplete(this.places.getValue())) {
// download more places
this.apiClientService.getCurrentUserPlaces(Order.IDENTIFIER, this.places.getValue().offset, ExportService.BATCH_SIZE)
this.apiClientService.getCurrentUserPlaces('IDENTIFIER', this.places.getValue().offset, ExportService.BATCH_SIZE)
.subscribe(response => {
if (code === this.request) {
this.places.next(this.mergePages(response.body, this.places.getValue()));
this.places.next(this.mergePages(response, this.places.getValue()));
this.scheduleDownload(code);
}
}, this.createErrorHandler(code)
@@ -64,7 +63,7 @@ export class ExportService {
this.apiClientService.getCurrentUserVisits(this.visits.getValue().offset, ExportService.BATCH_SIZE)
.subscribe(response => {
if (code === this.request) {
this.visits.next(this.mergePages(response.body, this.visits.getValue()));
this.visits.next(this.mergePages(response, this.visits.getValue()));
this.scheduleDownload(code);
}
}, this.createErrorHandler(code)
@@ -2,7 +2,7 @@ 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 { LogMessage } from '../api';
import { CollectionViewer } from '@angular/cdk/collections';
import { CredentialService } from './credential.service';
@@ -1,9 +1,7 @@
import { Injectable } from '@angular/core';
import { AbstractPageService } from '../utils/pagination';
import { NoticePage, Notice } from '../../api/models';
import { ApiClientService } from '../../api';
import { DefaultService, NoticePage, Notice } from '../api';
import { Observable, BehaviorSubject, Subject } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
/**
* A service that handles notices for admins.
@@ -11,18 +9,18 @@ import { HttpResponse } from '@angular/common/http';
@Injectable()
export class ManageNoticeService extends AbstractPageService<Notice, NoticePage> {
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<NoticePage>> {
protected loadPage(offset: number, size: number): Observable<NoticePage> {
return this.apiClientService.getNotices(offset, size);
}
setNotice(notice: Notice): Observable<Notice> {
if (this.loading.getValue()) { return new BehaviorSubject<Notice>(null); }
this.loading.next(true);
let call: Observable<HttpResponse<Notice>>;
let call: Observable<Notice>;
if (notice.id === 0) {
call = this.apiClientService.addNotice(notice);
} else {
@@ -31,7 +29,7 @@ export class ManageNoticeService extends AbstractPageService<Notice, NoticePage>
const result = new Subject<Notice>();
call.subscribe((response) => {
this.loading.next(false);
result.next(response.body);
result.next(response);
this.reload();
}, (error) => {
this.loading.next(false);
@@ -46,7 +44,7 @@ export class ManageNoticeService extends AbstractPageService<Notice, NoticePage>
this.loading.next(true);
const result = new Subject<Notice>();
this.apiClientService.getNotice(id).subscribe((response) => {
result.next(response.body);
result.next(response);
this.loading.next(false);
}, (error) => {
result.next(null);
@@ -1,9 +1,7 @@
import { Injectable } from '@angular/core';
import { AbstractPageService } from '../utils/pagination';
import { User, UserPage } from '../../api/models';
import { ApiClientService } from '../../api';
import { DefaultService, User, UserPage } from '../api';
import { Observable, BehaviorSubject, Subject } from 'rxjs';
import { HttpResponse } from '@angular/common/http';
/**
* A service that handles users for admins.
@@ -17,13 +15,13 @@ export class ManageUserService extends AbstractPageService<User, UserPage> {
*/
private term: string = null;
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<UserPage>> {
protected loadPage(offset: number, size: number): Observable<UserPage> {
if (this.term != null) {
return this.apiClientService.searchUsers(offset, size, this.term);
return this.apiClientService.searchUsers(this.term, offset, size);
} else {
return this.apiClientService.getUsers(offset, size);
}
@@ -1,12 +1,7 @@
import { Injectable } from '@angular/core';
import { Subject , 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 { Observable } from 'rxjs';
import { DefaultService, Notice, NoticePage } from '../api';
import { AbstractPageService } from '../utils/pagination';
import { HttpResponse } from '@angular/common/http';
/**
* A service that handles notices.
@@ -14,11 +9,11 @@ import { HttpResponse } from '@angular/common/http';
@Injectable()
export class NoticeService extends AbstractPageService<Notice, NoticePage> {
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<NoticePage>> {
protected loadPage(offset: number, size: number): Observable<NoticePage> {
return this.apiClientService.getActiveNotices(offset, size);
}
@@ -1,12 +1,7 @@
import { Injectable } from '@angular/core';
import { Subject , 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, AbstractReferencePageService } from '../utils/pagination';
import { HttpResponse } from '@angular/common/http';
import { DefaultService, Device, Place, Visit, VisitPage } from '../api';
import { AbstractReferencePageService } from '../utils/pagination';
import { BehaviorSubject, Observable } from 'rxjs';
/**
* A service that handles visits for a particular place.
@@ -17,7 +12,7 @@ export class PlaceVisitService extends AbstractReferencePageService<Visit, Visit
readonly place = new BehaviorSubject<Place>(null);
private id: number;
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
@@ -30,7 +25,7 @@ export class PlaceVisitService extends AbstractReferencePageService<Visit, Visit
this.id = id;
this.loading.next(true);
this.apiClientService.getPlace(id).subscribe((result) => {
this.place.next(result.body);
this.place.next(result);
this.loading.next(false);
this.reload();
}, (error) => {
@@ -46,7 +41,7 @@ export class PlaceVisitService extends AbstractReferencePageService<Visit, Visit
if (this.id == null) { this.page.next(this.emptyPage()); } else { super.getPage(offset, size); }
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<VisitPage>> {
protected loadPage(offset: number, size: number): Observable<VisitPage> {
return this.apiClientService.getPlaceVisits(this.id, offset, size);
}
@@ -60,7 +55,7 @@ export class PlaceVisitService extends AbstractReferencePageService<Visit, Visit
return result;
}
protected loadReference(id: number): Observable<HttpResponse<Device>> {
protected loadReference(id: number): Observable<Device> {
return this.apiClientService.getDevice(id);
}
@@ -1,10 +1,7 @@
import { Injectable } from '@angular/core';
import { Subject , Observable, BehaviorSubject } from 'rxjs';
import { DataSource } from '@angular/cdk/table';
import { Device, DevicePage, Privilege, PrivilegePage, Place, PlacePage } from '../../api/models';
import { ApiClientService, Order } from '../../api';
import { UserService } from './user.service';
import { CollectionViewer } from '@angular/cdk/collections';
import { DefaultService, Place, PlacePage } from '../api';
import { AbstractPageService } from '../utils/pagination';
import { HttpResponse } from '@angular/common/http';
@@ -14,10 +11,10 @@ import { HttpResponse } from '@angular/common/http';
@Injectable()
export class PlaceService extends AbstractPageService<Place, PlacePage> {
public readonly order = new BehaviorSubject<Order>(Order.TIME);
public readonly order = new BehaviorSubject<"TIME" | "IDENTIFIER" | "IMPORTANCE" | "DURATION" | "FREQUENCY">('TIME');
private loaded = this.order.getValue();
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
this.order.subscribe(order => {
if (this.loaded !== order) {
@@ -37,7 +34,7 @@ export class PlaceService extends AbstractPageService<Place, PlacePage> {
});
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<PlacePage>> {
protected loadPage(offset: number, size: number): Observable<PlacePage> {
this.loaded = this.order.getValue();
return this.apiClientService.getCurrentUserPlaces(this.order.getValue(), offset, size);
}
@@ -1,12 +1,7 @@
import { Injectable } from '@angular/core';
import { Subject , 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 { Observable } from 'rxjs';
import { DefaultService, Privilege, PrivilegePage } from '../api';
import { AbstractPageService } from '../utils/pagination';
import { HttpResponse } from '@angular/common/http';
/**
* A service that handles privileges.
@@ -14,11 +9,11 @@ import { HttpResponse } from '@angular/common/http';
@Injectable()
export class PrivilegeService extends AbstractPageService<Privilege, PrivilegePage> {
constructor(apiClientService: ApiClientService) {
constructor(apiClientService: DefaultService) {
super(apiClientService);
}
protected loadPage(offset: number, size: number): Observable<HttpResponse<PrivilegePage>> {
protected loadPage(offset: number, size: number): Observable<PrivilegePage> {
return this.apiClientService.getCurrentUserPrivileges(offset, size);
}
@@ -404,6 +404,10 @@ export class ResourceService {
'devices_location_tooltip': 'Standort anzeigen',
'devices_history_tooltip': 'Verlauf anzeigen',
'devices_position_tooltip': 'Aktualisierungen anzeigen',
'devices_position_chart_header': 'Accelerometer',
'devices_position_chart_y_axis_label': 'Daten',
'devices_position_chart_x_axis_label': 'Sek.',
'devices_position_chart_acceleration': 'Beschleunigung',
'devices_delete_tooltip': 'Gerät löschen',
'device_location_device_error': 'Die Geräteinformationen konnten nicht geladen werden.',
'device_location_location_error': 'Der Standort konte nicht abgerufen werden.',
@@ -441,6 +445,42 @@ export class ResourceService {
'activate_error_badlink': '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.',
'activate_error_expiredlink': 'Der Aktivierungslink ist nicht mehr gültig. Entweder wurder er schon benutzt oder er ist abgelaufen.',
// TODO: Time Sheet labels DE
'time_sheet_update_btn_tooltip': 'Aktualisieren',
'time_sheet_export_btn_tooltip': 'Exportieren',
'time_sheet_export_as_csv_label': 'als CSV',
'time_sheet_export_as_json_label': 'als JSON',
'time_sheet_export_error_msg_title': 'Fehler!',
'time_sheet_export_error_msg': 'Es ist ein unerwarteter Fehler aufgetreten. Der Export ist fehlgeschlagen.',
'time_sheet_title': 'Stundenzettel',
'time_sheet_table_row_dialog_title': 'Zeitinfo',
'time_sheet_table_date': 'Datum',
'time_sheet_table_from': 'von',
'time_sheet_table_to': 'bis',
'time_sheet_table_working_time': 'Arbeitszeit',
'time_sheet_table_place': 'Arbeitsplatz',
'time_sheet_table_device': 'Gerät',
'time_sheet_config_label': 'Konfiguration',
'time_sheet_toggle_default_label': 'Arbeit',
'time_sheet_toggle_default_tooltip': 'Gedeckelte & zusammengefasste Arbeitszeit je Tag.',
'time_sheet_toggle_acc_label': 'Normal',
'time_sheet_toggle_acc_tooltip': 'Ungedeckelte & zusammengefasste Zeiteinträge je Tag.',
'time_sheet_toggle_by_days_label': 'Nach Tagen',
'time_sheet_toggle_by_days_tooltip': 'Alle Zeiteinträge je Tag.',
'time_sheet_toggle_raw_label': 'Rohdaten',
'time_sheet_toggle_raw_tooltip': 'Rohdaten',
'time_sheet_select_device_label': 'Gerät',
'time_sheet_select_device_tooltip': 'Filtert die Zeiteinträge auf das ausgewählte Gerät.',
'time_sheet_no_device_selected': 'Keins',
'time_sheet_break_time_label': 'Pausendauer',
'time_sheet_break_time_tooltip': 'Gibt an, ab welcher Dauer die Abwesenheit vom Arbeitsplatz als Pausendauer '
+ 'zu werten ist und somit nicht zum Zeiteintrag hinzugerechnet wird.',
'time_sheet_break_time_minutes': 'Minuten',
'time_sheet_no_break_time_selected': 'Keine',
'time_sheet_time_period_label': 'Zeitraum',
'time_sheet_time_period_tooltip': 'Markiert den Zeitraum für die auszuwertendend Daten.',
'time_sheet_workplace_button': 'Arbeitsplatz auswählen',
'time_sheet_workplace_clear_list': 'Liste leeren',
// layouts
'drawer_navigation': 'Navigation',
'drawer_settings': 'Einstellungen',
@@ -845,6 +885,10 @@ export class ResourceService {
'devices_location_tooltip': 'Show current location',
'devices_history_tooltip': 'Show location history',
'devices_position_tooltip': 'Show individual updates',
'devices_position_chart_header': 'Accelerometer',
'devices_position_chart_y_axis_label': 'Data',
'devices_position_chart_x_axis_label': 'Sec.',
'devices_position_chart_acceleration': 'Acceleration',
'devices_delete_tooltip': 'Delete device',
'device_location_device_error': 'Failed to load the device information.',
'device_location_location_error': 'Failed to load the device location.',
@@ -879,6 +923,42 @@ export class ResourceService {
'activate_error_badlink': 'The activation link was invalid. If you copied it from your email program into the browser, '
+ 'make sure to copy it completely.',
'activate_error_expiredlink': 'The activation link is no longer valid. Did you already use it?',
// TODO: Time Sheet labels EN
'time_sheet_update_btn_tooltip': 'Update',
'time_sheet_export_btn_tooltip': 'Export',
'time_sheet_export_as_csv_label': 'as CSV',
'time_sheet_export_as_json_label': 'as JSON',
'time_sheet_export_error_msg_title': 'Error!',
'time_sheet_export_error_msg': 'An unexpected error has occurred. The export has failed.',
'time_sheet_title': 'Time Sheet',
'time_sheet_table_row_dialog_title': 'Time Info',
'time_sheet_table_date': 'Date',
'time_sheet_table_from': 'from',
'time_sheet_table_to': 'to',
'time_sheet_table_working_time': 'Working Hours',
'time_sheet_table_place': 'Workplace',
'time_sheet_table_device': 'Device',
'time_sheet_config_label': 'Configuration',
'time_sheet_toggle_default_label': 'Work',
'time_sheet_toggle_default_tooltip': 'Capped & accumulated working time per day.',
'time_sheet_toggle_acc_label': 'Normal',
'time_sheet_toggle_acc_tooltip': 'Uncapped & accumulated time entries per day.',
'time_sheet_toggle_by_days_label': 'By Days',
'time_sheet_toggle_by_days_tooltip': 'All time entries per day.',
'time_sheet_toggle_raw_label': 'Raw',
'time_sheet_toggle_raw_tooltip': 'Raw data.',
'time_sheet_select_device_label': 'Device',
'time_sheet_select_device_tooltip': 'Filters the time entries to the selected device.',
'time_sheet_no_device_selected': 'None',
'time_sheet_break_time_label': 'Break Time',
'time_sheet_break_time_tooltip': 'Specifies the duration from which the absence from the work '
+ 'place is to be valuated as a break duration and is therefore not added to the time entry.',
'time_sheet_break_time_minutes': 'Minutes',
'time_sheet_no_break_time_selected': 'None',
'time_sheet_time_period_label': 'Time Period',
'time_sheet_time_period_tooltip': 'Marks the period for the data to be evaluated.',
'time_sheet_workplace_button': 'Select Workplace',
'time_sheet_workplace_clear_list': 'Clear List',
// layouts
'drawer_navigation': 'Navigation',
'drawer_settings': 'Settings',
@@ -0,0 +1,618 @@
import { Injectable } from '@angular/core';
import { Time, formatDate } from '@angular/common';
import { HttpResponse } from '@angular/common/http';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { BehaviorSubject } from 'rxjs';
import { SatDatepickerRangeValue } from 'saturn-datepicker';
import { Page } from '../utils/pagination';
import { DefaultService, VisitPage, Device, Place, Visit } from '../api';
import { UserService } from './user.service';
/**
* Data model for the TimeSheetService.
*/
export interface TimeSheetData {
overlappingDays: boolean; /* True if contained data is overlapping two or more days. */
beginDate: Date; /* Start date */
endDate: Date; /* End date */
duration: Time; /* Duration time */
placeId?: number; /* The id of the place. Null if placesSet is set. */
deviceId?: number; /* The id of the device. Null if devicesSet is set. */
placesSet?: Set<number>; /* A set of Places. Null if placeId is set. */
devicesSet?: Set<number>; /* A set of Devices. Null if deviceId is set. */
}
/**
* Determines how the TimeSheetData
* of the service is grouped.
*/
export enum Grouping {
DEFAULT = 1, /* Capped & accumulated working time per day. */
BY_DAY_ACC = 2, /* Uncapped & accumulated working time per day. */
BY_DAY = 3, /* All time entries per day. */
RAW = 4 /* Raw data which was extracted from the call to the '/users/current/visits' api */
}
interface DateRange {
range?: SatDatepickerRangeValue<Date>;
begin?: number;
end?: number;
}
const COLUMN_SEPARATOR = ';';
const LINE_SEPARATOR = '\r\n';
/**
* A service which is fetching data from the '/users/current/visits'
* api and transforms it to TimeSheetData.
*/
@Injectable({
providedIn: 'root'
})
export class TimeSheetService extends MatTableDataSource<TimeSheetData> {
private static readonly BATCH_SIZE = 500;
private static readonly DAY_IN_MILLI = 86_400_000;
/* Properties representing the current progress in
* fetching Visit data from the server. */
fetching$ = new BehaviorSubject<boolean>(false);
error$ = new BehaviorSubject<boolean>(false);
private _visitsAvailable = false;
private visitsPage: VisitPage = TimeSheetService.emptyPage();
private request = 0;
/* These Properties are used to filter the Visit data which then,
* in turn can be composed to the final timeSheet data shown
* to the user.
* At least the dateRange & workPlaces have to contain
* valid values to start the composition process.
* Remark: The prefixed _prev... values serve as a workaround
* for a known bug in angular, where mat-selection is fireing
* a "selectionChange" event twice when the selected value is null. */
private _grouped: Grouping = Grouping.DEFAULT;
private _device: Device = null;
private _prevDevice: Device = null;
private _breakTime: number = null;
private _prevBreakTime: number = null;
private _dateRange: DateRange = {};
private _workPlaces: Place[] = [];
/** Creates an empty page. */
private static emptyPage() {
return { elements: [], offset: 0, total: -1, size: 0 };
}
constructor(
private apiClientService: DefaultService,
private userService: UserService
) {
super([]);
}
get isTimeSheetReady(): boolean {
return this.visitsAvailable === true && this.dateRange !== null && this.workPlaces.length > 0;
}
private get visitsAvailable(): boolean {
return this._visitsAvailable;
}
private set visitsAvailable(available: boolean) {
this._visitsAvailable = available;
this.updateTimeSheet();
}
get grouped(): Grouping {
return this._grouped;
}
set grouped(grouped: Grouping) {
if (grouped != null) {
if (this._grouped !== grouped) {
if ((this._grouped === Grouping.DEFAULT || this.grouped === Grouping.BY_DAY_ACC)
&& this._breakTime) {
this._breakTime = null;
}
this._grouped = grouped;
this.updateTimeSheet();
}
}
}
get device(): Device | null {
return this._device;
}
set device(device: Device | null) {
this._prevDevice = this._device;
this._device = device;
if (this._prevDevice === null && device === null) { return; }
this.updateTimeSheet();
}
get breakTime(): number | null {
return this._breakTime;
}
set breakTime(breakTime: number | null) {
this._prevBreakTime = this._breakTime;
this._breakTime = breakTime;
if (this._prevBreakTime === null && breakTime === null) { return; }
this.updateTimeSheet();
}
get dateRange(): SatDatepickerRangeValue<Date> | null {
return this._dateRange.range;
}
set dateRange(dateRange: SatDatepickerRangeValue<Date> | null) {
if (dateRange !== null) {
const beginMillis = dateRange.begin.getTime();
const endMillis = new Date(dateRange.end.getTime() + TimeSheetService.DAY_IN_MILLI).getTime();
this._dateRange = {
range: dateRange,
begin: beginMillis,
end: endMillis
};
} else {
this._dateRange = {};
}
this.updateTimeSheet();
}
get workPlaces(): Place[] {
return this._workPlaces;
}
set workPlaces(workPlaces: Place[]) {
this._workPlaces = workPlaces;
this.updateTimeSheet();
}
setup(paginator?: MatPaginator, sort?: MatSort): void {
this.paginator = paginator;
this.sort = sort;
this.fetchData();
}
reset(): void {
this.paginator = null;
this.sort = null;
this.resetService(false);
this.resetFilters();
}
fetchData(): void {
if (this.fetching$.getValue()) { return; }
this.resetService(true);
this.fetchAllVisits(this.request);
}
private resetService(isFetch: boolean): void {
this.request += 1;
this.fetching$.next(isFetch);
this.visitsAvailable = false;
this.visitsPage = TimeSheetService.emptyPage();
}
private resetFilters(): void {
this._grouped = Grouping.RAW;
this._device = null;
this._breakTime = null;
this._dateRange = {};
this._workPlaces = [];
this.updateTimeSheet();
}
private fetchAllVisits(code: number): void {
if (this.isIncomplete(this.visitsPage)) {
this.apiClientService.getCurrentUserVisits(this.visitsPage.offset, TimeSheetService.BATCH_SIZE)
.subscribe((response) => {
if (code === this.request) {
this.visitsPage = this.mergePages(response, this.visitsPage);
this.fetchAllVisits(code);
}
},
this.createErrorHandler(code)
);
} else {
this.fetching$.next(false);
this.visitsAvailable = true;
}
}
private isIncomplete(page: Page<any>): boolean {
return page.total < 0 || page.total > page.offset;
}
private mergePages<T>(source: Page<T>, destination: Page<T>): Page<T> {
const result = TimeSheetService.emptyPage();
result.total = source.total;
result.size = destination.size + source.elements.length;
result.elements = destination.elements.concat(source.elements);
result.offset = destination.offset + TimeSheetService.BATCH_SIZE;
return result;
}
private createErrorHandler(code: number): (error: any) => void {
return (error: any) => {
if (code === this.request) {
this.error$.next(true);
this.fetching$.next(false);
}
};
}
/**
* Updates the member data of the MatTableDataSource if some of the properties change.
* The data is only updated if the property "isTimeSheetReady" is true.
*/
private updateTimeSheet(): void {
let timeSheet: TimeSheetData[] = [];
if (this.isTimeSheetReady) {
/* Filter all relevant places and dates. */
let filteredVisits = this.visitsPage.elements.filter((visit: Visit) => {
if (this._dateRange.begin <= visit.beginTime && visit.endTime < this._dateRange.end
&& this.workPlaces.some(place => place.id === visit.place)) {
return visit;
}
});
/* Filter for specified device. */
if (this.device != null) {
filteredVisits = filteredVisits.filter(visit => visit.device === this.device.id);
}
/* Map filtered visits to TimeSheetData */
if (filteredVisits.length > 0) {
switch (this.grouped) {
case Grouping.DEFAULT:
case Grouping.BY_DAY_ACC:
timeSheet = this.accumulateV2TsByDay(filteredVisits);
break;
case Grouping.BY_DAY:
const tsMap = this.mapV2TsByDay(filteredVisits);
tsMap.forEach((ts: TimeSheetData[]) => {
if (ts.length > 0) { timeSheet.push(...ts); }
});
break;
case Grouping.RAW:
timeSheet = this.mapVisitsToTimeSheet(filteredVisits);
break;
}
}
}
this.data = timeSheet;
}
/**
* Mapping the passed Visit objects to raw TimeSheetData objects.
*
* @param visits Visits to map.
* @return List of the corresponding TimeSheetData objects.
*/
private mapVisitsToTimeSheet(visits: Visit[]): TimeSheetData[] {
return visits.map(visit => {
const workingTime = this.getWorkingTime(visit.beginTime, visit.endTime);
const midnight = this.getMidnightDate(visit.beginTime);
const overlapping = (visit.endTime - midnight.getTime()) >= TimeSheetService.DAY_IN_MILLI;
return {
overlappingDays: overlapping,
beginDate: new Date(visit.beginTime),
endDate: new Date(visit.endTime),
duration: workingTime,
placeId: visit.place,
deviceId: visit.device
};
});
}
/**
* Mapping the passed Visit objects to TimeSheetData objects which are grouped by days
* represented as Unix timestamps starting at midnight.
* E.g.:
* timestamp: 1580425200000
* GMT: Thursday, 30. January 2020 23:00:00
* Germany: Freitag, 31. Januar 2020 00:00:00 GMT+01:00
*
* @param visits Visits to map.
* @return Map of TimeSheetData objects grouped by days.
*/
private mapV2TsByDay(visits: Visit[]): Map<number, TimeSheetData[]> {
const timeSheetMap = new Map<number, TimeSheetData[]>();
const rawTimeSheet: TimeSheetData[] = this.mapVisitsToTimeSheet(visits);
const putInMap = (map: Map<number, TimeSheetData[]>, key: number, value: TimeSheetData) => {
if (map.has(key)) {
map.get(key).push(value);
} else {
map.set(key, [value]);
}
};
if (rawTimeSheet.length > 0) {
return rawTimeSheet
.reduce((prevMap: Map<number, TimeSheetData[]>, currTS: TimeSheetData) => {
const beginMidnight = this.getMidnightDate(currTS.beginDate.getTime()).getTime();
const endMidnight = this.getMidnightDate(currTS.endDate.getTime()).getTime();
if (beginMidnight === endMidnight) {
putInMap(prevMap, beginMidnight, currTS);
} else {
/* If beginDate & endDate are overlapping two or more days then split
* object into multiple TimeSheetData objects till endDate is reached. */
const DAY = TimeSheetService.DAY_IN_MILLI;
for (let j = beginMidnight + DAY; j <= endMidnight; j += DAY) {
const begin = (j === beginMidnight + DAY) ? currTS.beginDate.getTime() : j - DAY;
const end = j;
const newTimeSheet = {
overlappingDays: false,
beginDate: new Date(begin),
endDate: new Date(end),
duration: this.getWorkingTime(begin, end),
placeId: currTS.placeId,
deviceId: currTS.deviceId
};
putInMap(prevMap, end - DAY, newTimeSheet);
}
const newTS = {
overlappingDays: false,
beginDate: new Date(endMidnight),
endDate: currTS.endDate,
duration: this.getWorkingTime(endMidnight, currTS.endDate.getTime()),
placeId: currTS.placeId,
deviceId: currTS.deviceId
};
putInMap(prevMap, endMidnight, newTS);
}
return prevMap;
}, timeSheetMap);
} else {
return timeSheetMap;
}
}
/**
* Maps a list of Visits to a list of TimeSheetData which in turn
* is containing only accumulated TimeSheetData object each
* representing a single day.
*
* @param visits Visits to map.
* @param workingTimeAcc Function to accumulate the working time.
* @returns List of accumulated TimeSheetData.
*/
private accumulateV2TsByDay(visits: Visit[]): TimeSheetData[] {
const timeSheet: TimeSheetData[] = [];
const tsMap = this.mapV2TsByDay(visits);
tsMap.forEach((tsList: TimeSheetData[]) => {
if (tsList.length > 0) {
const erliestBegin = tsList
.map((ts: TimeSheetData) => ts.beginDate.getTime())
.reduce((prev, curr) => prev < curr ? prev : curr, Number.MAX_SAFE_INTEGER);
const latestEnd = tsList
.map((ts: TimeSheetData) => ts.endDate.getTime())
.reduce((prev, curr) => prev > curr ? prev : curr, Number.MIN_SAFE_INTEGER);
const places = new Set<number>();
const devices = new Set<number>();
tsList.forEach((ts: TimeSheetData) => {
if (ts.placeId) { places.add(ts.placeId); }
if (ts.deviceId) { devices.add(ts.deviceId); }
});
const btThreshold = (this.breakTime) ? this.breakTime * 60_000 : 0;
const timeAccumulation = tsList
.reduce((prev: { sheet?: TimeSheetData, acc: Time, breakAcc: Time }, curr: TimeSheetData) => {
if (prev.sheet) {
let addToBreakAcc = true;
const time = this.getWorkingTime(prev.sheet.endDate.getTime(), curr.beginDate.getTime());
if (btThreshold > 0) {
if (curr.beginDate.getTime() - prev.sheet.endDate.getTime() <= btThreshold) {
prev.acc.hours += time.hours;
prev.acc.minutes += time.minutes;
addToBreakAcc = false;
}
}
if (addToBreakAcc) {
prev.breakAcc.hours += time.hours;
prev.breakAcc.minutes += time.minutes;
}
}
prev.acc.hours += curr.duration.hours;
prev.acc.minutes += curr.duration.minutes;
prev.sheet = curr;
return prev;
},
{ sheet: null, acc: { hours: 0, minutes: 0 }, breakAcc: { hours: 0, minutes: 0} }
);
const accWorkingHours = this.processWorkingHours(timeAccumulation.acc, timeAccumulation.breakAcc);
timeSheet.push({
overlappingDays: false,
beginDate: new Date(erliestBegin),
endDate: new Date(latestEnd),
duration: accWorkingHours,
placesSet: places,
devicesSet: devices
});
}
});
return timeSheet;
}
/**
* Processes the work and break time. If Grouping is DEFAULT, the break time is evaluated
* and has to fit the legal requirements of having at least a 30 or 45 minutes break when
* working more than 6 or 9 hours respectively.
*
* @param working The time that is counting as work time.
* @param breaking The time between the single work time entries
* which can be seen as break time.
* @return The normalized and processed work time.
*/
private processWorkingHours(working: Time, breaking: Time): Time {
working = this.normalizeTime(working);
if (this.grouped === Grouping.DEFAULT) {
let subtrahend = 0;
breaking = this.normalizeTime(breaking);
if (working.hours >= 6 && breaking.hours === 0 && breaking.minutes < 30) {
subtrahend = 30 - breaking.minutes;
} else if (working.hours >= 9 && breaking.hours === 0 && breaking.minutes < 45) {
subtrahend = 45 - breaking.minutes;
}
working.minutes -= subtrahend;
if (working.minutes < 0) {
--working.hours;
working.minutes = 60 - working.minutes;
}
/* Rounds up the minutes to a multiple of 15. */
if (working.minutes !== 0) {
working.minutes += Math.floor(15 - working.minutes % 15);
}
if (working.minutes === 60) {
++working.hours;
working.minutes = 0;
}
if (working.hours >= 10) { working = { hours: 10, minutes: 0 }; }
}
return working;
}
private normalizeTime(time: Time): Time {
time.hours += Math.floor(time.minutes / 60);
time.minutes = time.minutes % 60;
return time;
}
private getMidnightDate(tstp: number): Date {
const midnight = new Date(tstp);
midnight.setHours(0, 0, 0, 0);
return midnight;
}
private getWorkingTime(beginMillis: number, endMillis: number): Time {
const beginMinutes = Math.floor(beginMillis / 1000 / 60);
const endMinutes = Math.floor(endMillis / 1000 / 60);
const totalMinutes = endMinutes - beginMinutes;
const totalHours = totalMinutes / 60;
let hours = Math.floor(totalHours);
let minutes = Math.round(60 * (totalHours - hours));
if (minutes >= 60) {
const additionalHours = Math.floor(minutes / 60);
hours += additionalHours;
minutes = minutes - (60 * additionalHours);
}
return { hours, minutes };
}
getWorkplaceName(place: Place): string {
return (place.nickname != null && place.nickname.length > 0) ? place.nickname : place.address;
}
getWorkplaceString(data: TimeSheetData): string {
let res = '';
if (data.placeId) {
const place = this.workPlaces.find(p => p.id === data.placeId);
res = this.getWorkplaceName(place);
} else {
data.placesSet.forEach(id => {
const place = this.workPlaces.find(p => p.id === id);
res += this.getWorkplaceName(place) + ', ';
});
res = res.slice(0, res.length - 2);
}
return res;
}
getDate(data: TimeSheetData): string {
if (this.grouped === Grouping.RAW) {
let prefix = '';
const date = formatDate(data.endDate, 'dd.LL.yyyy', 'de');
if (data.overlappingDays) {
prefix = formatDate(data.beginDate, 'dd', 'de') + ' - ';
}
return prefix + date;
} else {
return formatDate(data.beginDate, 'dd.LL.yyyy', 'de');
}
}
exportTimeSheet(type: string): boolean {
let exportStr: string;
switch (type) {
case 'csv':
exportStr = this.createCSV();
break;
case 'json':
exportStr = this.createJSON();
break;
}
if (!exportStr) { return false; }
/* '\ufeff' -> UTF-8 Header Byte prepended. */
const blob = new Blob(['\ufeff', exportStr], { type: `text/${type};` });
const login = this.userService.getLogin();
let name = 'timesheet-export';
if (login != null) { name += '-' + login; }
name += '-' + Date.now();
this.saveAs(`${name}.${type}`, blob);
return true;
}
private saveAs(name: string, blob: Blob): void {
if (navigator.msSaveBlob) {
navigator.msSaveBlob(blob, name);
} else {
const link = document.createElement('a');
(<any>link).download = name;
link.href = URL.createObjectURL(blob);
link.click();
setTimeout(() => {
URL.revokeObjectURL(link.href);
link.remove();
}, 10);
}
}
private createCSV(): string | null {
if (this.data.length === 0) { return null; }
let result = '';
result += 'DATE' + COLUMN_SEPARATOR;
result += 'FROM' + COLUMN_SEPARATOR;
result += 'TO' + COLUMN_SEPARATOR;
result += 'WORKING_TIME' + COLUMN_SEPARATOR;
result += 'PLACES' + COLUMN_SEPARATOR;
result += LINE_SEPARATOR;
this.data.forEach((td: TimeSheetData) => {
result += this.getDate(td) + COLUMN_SEPARATOR;
result += formatDate(td.beginDate, 'H:mm', 'de') + COLUMN_SEPARATOR;
result += formatDate(td.endDate, 'H:mm', 'de') + COLUMN_SEPARATOR;
result += `${td.duration.hours} h ${td.duration.minutes} m` + COLUMN_SEPARATOR;
result += this.getWorkplaceString(td) + COLUMN_SEPARATOR;
result += LINE_SEPARATOR;
});
return result;
}
private createJSON(): string | null {
return JSON.stringify(
this.data.map((td: TimeSheetData) => {
return {
date: this.getDate(td),
from: formatDate(td.beginDate, 'H:mm', 'de'),
to: formatDate(td.endDate, 'H:mm', 'de'),
workingTime: `${td.duration.hours} h ${td.duration.minutes} m`,
workplaces: this.getWorkplaceString(td)
};
})
);
}
}
+5 -7
View File
@@ -3,9 +3,7 @@ import { ConsoleService } from './console.service';
import { BehaviorSubject , Subject, Observable } from 'rxjs';
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 { DefaultService, User, UserPassword } from '../api';
import { CredentialService } from './credential.service';
import { HttpStatusCode } from '../utils/httpcodes';
@@ -81,7 +79,7 @@ export class UserService {
* @param credentailService The credential service to manage the username and password.
*/
constructor(private consoleService: ConsoleService,
private apiClientService: ApiClientService,
private apiClientService: DefaultService,
private credentailService: CredentialService) {
if (credentailService.hasCredential()) {
this.login();
@@ -147,7 +145,7 @@ export class UserService {
this.state.next(UserState.Changing);
this.user.next(null);
this.apiClientService.getCurrentUser().subscribe(result => {
this.user.next(result.body);
this.user.next(result);
this.state.next(UserState.Available);
}, this.createErrorHandler());
return true;
@@ -177,7 +175,7 @@ export class UserService {
this.user.next(null);
this.apiClientService.setCurrentPassword({ password: newPassword }).subscribe(result => {
this.credentailService.setCredential(this.credentailService.getLogin(), newPassword);
this.user.next(result.body);
this.user.next(result);
this.state.next(UserState.Available);
}, this.createErrorHandler());
return true;
@@ -217,7 +215,7 @@ export class UserService {
this.state.next(UserState.Changing);
this.user.next(null);
this.apiClientService.setCurrentUser(user).subscribe(result => {
this.user.next(result.body);
this.user.next(result);
this.state.next(UserState.Available);
}, error => {
if (error instanceof HttpErrorResponse) {
@@ -1,7 +1,6 @@
import { Injectable } from '@angular/core';
import { Subject , BehaviorSubject, Subscription } from 'rxjs';
import { BuildVersion } from '../../api/models';
import { ApiClientService } from '../../api';
import { BehaviorSubject, Subscription } from 'rxjs';
import { DefaultService, BuildVersion } from '../api';
/**
* A service to download the current version
@@ -13,13 +12,13 @@ export class VersionService {
private version = new BehaviorSubject<BuildVersion>(null);
private loading = false;
constructor(private apiClientService: ApiClientService) { }
constructor(private apiClientService: DefaultService) { }
subscribe(handler: (version: BuildVersion) => void): Subscription {
if (!this.loading && this.version.getValue() == null) {
this.loading = true;
this.apiClientService.getBuildVersion().subscribe((v) => {
this.version.next(v.body);
this.version.next(v);
this.loading = false;
}, (e) => {
this.loading = false;
+121
View File
@@ -0,0 +1,121 @@
/**
* A delta compression codec based on Google's WGS84 encoder that
* supports multiple data streams to encode other data than latitude
* and longitude values. Callers must supply the number of streams
* encoded in the data and the streams must exhibit the same number
* of data items.
*
* Copied the DeltaCodec class from the `android-app project` and
* ported to TypeScript.
*
* @author Adriano
*/
export class DeltaCodec {
/**
* Creates a delta compressor for the specified number of streams.
*
* @param streams The number of streams to encode in the string.
*/
constructor(private streams: number) { }
/**
* Returns the number of streams expected by this codec.
*
* @return The number of streams.
*/
getStreams(): number {
return this.streams;
}
/**
* Encodes a list of values into a string.
*
* @param values The values consisting of arrays that represent
* the individual streams.
* @return The string.
*/
encode(values: number[][]): string {
let builder: string = '';
let previous: number[] = new Array(this.streams).fill(0);
for (const current of values) {
for (let i = 0; i < this.streams; i++) {
const delta: number = current[i] - previous[i];
builder += DeltaCodec.encodeSignedNumber(delta);
previous[i] = current[i];
}
}
return builder;
}
/**
* Extracts the list of data from an encoded string.
*
* @param encoded The encoded string.
* @param data An optional list of data items to be reused
* to avoid object allocations. Can be null.
* @return The list of data items representing the streams.
*/
decode(encoded: string, data: number[][]): number[][] {
let list: number[][] = [];
let index: number = 0;
let length: number = encoded.length;
let current: number[] = new Array(this.streams).fill(0);
while (index < length) {
let next: number[];
if (data !== null && data.length > 0) {
next = data.shift();
} else {
next = new Array(this.streams).fill(0);
}
let c: number;
for (let i = 0; i < this.streams; i++) {
let shift: number = 0;
let result: number = 0;
do {
c = encoded.charCodeAt(index++) - 63;
result |= (c & 0x1f) << shift;
shift += 5;
} while (c >= 0x20);
const delta: number = ((result & 1) !== 0) ? ~(result >> 1) : (result >> 1);
current[i] += delta;
next[i] = current[i];
}
list.push(next);
}
return list;
}
/**
* Encodes a signed number as string.
*
* @param num The number.
* @return The string.
*/
private static encodeSignedNumber(num: number): string {
let sgn_num: number = num << 1;
if (num < 0) {
sgn_num = ~(sgn_num);
}
return (DeltaCodec.encodeNumber(sgn_num));
}
/**
* Encodes an unsigned number as string.
*
* @param num The number.
* @return The string.
*/
private static encodeNumber(num: number): string {
let encodeString: string = '';
while (num >= 0x20) {
let nextValue: number = (0x20 | (num & 0x1f)) + 63;
encodeString += String.fromCharCode(nextValue);
num >>= 5;
}
num += 63;
encodeString += String.fromCharCode(num);
return encodeString;
}
}
+8 -9
View File
@@ -1,9 +1,8 @@
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';
import { DefaultService } from '../api';
import { MatPaginator } from '@angular/material/paginator';
export interface Page<E> {
offset: number;
@@ -45,7 +44,7 @@ export abstract class AbstractPageService<D, P extends Page<D>> extends DataSour
private subscriptions = 0;
readonly loading = new BehaviorSubject<boolean>(false);
constructor(protected apiClientService: ApiClientService) {
constructor(protected apiClientService: DefaultService) {
super();
this.page.subscribe((page) => {
this.elements.next(page.elements);
@@ -56,13 +55,13 @@ export abstract class AbstractPageService<D, P extends Page<D>> extends DataSour
if (this.loading.getValue()) { return; }
this.loading.next(true);
this.loadPage(offset, size).subscribe((result) => {
this.pageLoaded(result.body);
this.pageLoaded(result);
}, (error) => {
this.pageLoaded(null);
});
}
protected abstract loadPage(offset: number, size: number): Observable<HttpResponse<P>>;
protected abstract loadPage(offset: number, size: number): Observable<P>;
protected pageLoaded(page: P): void {
this.page.next(page);
@@ -93,13 +92,13 @@ export abstract class AbstractReferencePageService<D, P extends Page<D>, R> exte
readonly references: Map<number, R> = new Map<number, R>();
private referenceRequests = 0;
constructor(protected apiClientService: ApiClientService) {
constructor(protected apiClientService: DefaultService) {
super(apiClientService);
}
protected abstract getReferences(page: P): number[];
protected abstract loadReference(id: number): Observable<HttpResponse<R>>;
protected abstract loadReference(id: number): Observable<R>;
protected pageLoaded(page: P): void {
this.page.next(page);
@@ -108,7 +107,7 @@ export abstract class AbstractReferencePageService<D, P extends Page<D>, R> exte
if (this.getReference(id) == null) {
this.referenceRequests += 1;
this.loadReference(id).subscribe(result => {
this.referenceLoaded(id, result.body);
this.referenceLoaded(id, result);
}, error => {
this.referenceLoaded(id, null);
});
+1 -1
View File
@@ -1,4 +1,4 @@
import { MatSnackBar } from '@angular/material';
import { MatSnackBar } from '@angular/material/snack-bar';
export class Snackbars {
+1 -1
View File
@@ -1,4 +1,4 @@
import { MatTable } from '@angular/material';
import { MatTable } from '@angular/material/table';
import { ElementRef } from '@angular/core';
export interface TableColumn {
@@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { ApiClientService } from '../../api';
import { MatDialog } from '@angular/material';
import { DefaultService } from '../api';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { MessageDialogComponent } from '../widgets/message-dialog.component';
import { HttpErrorResponse } from '@angular/common/http';
@@ -17,7 +17,7 @@ import { ResourceService } from '../services/resource.service';
constructor(
public res: ResourceService,
private apiClientService: ApiClientService,
private apiClientService: DefaultService,
private dialog: MatDialog,
private router: Router,
private route: ActivatedRoute) { }
@@ -1,15 +1,12 @@
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 { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { NgForm } from '@angular/forms';
import { Snackbars } from '../utils/snackbars';
import { ApiClientService } from '../../api';
import { DefaultService } from '../api';
import { HttpErrorResponse } from '@angular/common/http';
import { MessageDialogComponent } from '../widgets/message-dialog.component';
import { ResourceService } from '../services/resource.service';
@@ -30,7 +27,7 @@ export class ChangeComponent implements OnInit, OnDestroy {
constructor(
public res: ResourceService,
private apiClientService: ApiClientService,
private apiClientService: DefaultService,
private snackbar: MatSnackBar,
private dialog: MatDialog,
private router: Router,
@@ -1,15 +1,9 @@
import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit, HostBinding } 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 { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
import { Subscription, BehaviorSubject } from 'rxjs';
import { Device, Location } from '../../api/models';
import { DefaultService, Device, Location } from '../api';
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 { ResourceService } from '../services/resource.service';
@@ -32,7 +26,7 @@ import { ResourceService } from '../services/resource.service';
constructor(
public res: ResourceService,
private snackbar: MatSnackBar,
private apiClientService: ApiClientService,
private apiClientService: DefaultService,
private route: ActivatedRoute
) { }
@@ -53,7 +47,7 @@ import { ResourceService } from '../services/resource.service';
updateDevice(): void {
if (this.deviceSubscription) { return; }
this.deviceSubscription = this.apiClientService.getDevice(parseInt(this.id, 10)).subscribe((result) => {
this.device.next(result.body);
this.device.next(result);
this.deviceSubscription = null;
}, (error) => {
Snackbars.showError(this.snackbar, this.res.strings('device_location_device_error'));
@@ -64,8 +58,8 @@ import { ResourceService } from '../services/resource.service';
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.location.next(result);
this.map.setMarkerPosition(result.coordinate);
this.locationSubscription = null;
}, (error) => {
Snackbars.showError(this.snackbar, this.res.strings('device_location_location_error'));
@@ -65,4 +65,17 @@
</button>
</mat-card-footer>
</mat-card>
<mat-card class="sidebar" [ngStyle]="getPanelWidth()" style="margin-right:10px;margin-top:10px">
<mat-card-title style="font-size: 14px;text-align: center;">
{{ res.strings('devices_position_chart_header') }}
</mat-card-title>
<mat-divider></mat-divider>
<mat-card-content style="padding-top: 10px;">
<app-chart [width]="300" [height]="300"
[xAxisConfig]="getXAxisConfig()"
[yAxisConfig]="getYAxisConfig()"
[horizontalGrid]="true"
[verticalGrid]="true"></app-chart>
</mat-card-content>
</mat-card>
</app-marker-map>
@@ -1,19 +1,18 @@
import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit, ElementRef, DoCheck } from '@angular/core';
import { ApiClientService } from '../../api';
import { MatDialog, MatSnackBar, MatDatepicker, MatDatepickerInputEvent, MatSliderChange, MatSlider } from '@angular/material';
import {
Component, OnInit, OnDestroy, ViewChild,
AfterViewInit, ElementRef, DoCheck, AfterContentInit,
} from '@angular/core';
import { MatDatepickerInputEvent } from '@angular/material/datepicker';
import { MatSliderChange } from '@angular/material/slider';
import { ActivatedRoute, Router } from '@angular/router';
import { Subscription, BehaviorSubject } from 'rxjs';
import { Device, Position } from '../../api/models';
import { Snackbars } from '../utils/snackbars';
import { Device, Position } from '../api';
import * as L from 'leaflet';
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 { TableColumn, TableHandler } from '../utils/tables';
import { ResourceService } from '../services/resource.service';
import { DevicePositionService } from '../services/device-position.service';
import { ValueConverter } from '@angular/compiler/src/render3/view/template';
import { ChartComponent, AxisConfig, Point } from '../widgets/chart.component';
@Component({
selector: 'app-device-positions',
@@ -23,6 +22,7 @@ export class DevicePositionsComponent implements OnInit, AfterViewInit, OnDestro
@ViewChild(MarkerMapComponent, { static: true }) map: MarkerMapComponent;
@ViewChild('table', { read: ElementRef, static: true }) table: ElementRef;
@ViewChild(ChartComponent, { static: true }) chart: ChartComponent;
id: string;
@@ -131,6 +131,26 @@ export class DevicePositionsComponent implements OnInit, AfterViewInit, OnDestro
}
}
getXAxisConfig(): AxisConfig {
return {
label: this.res.strings('devices_position_chart_x_axis_label'),
from: 0,
to: 60,
stride: 5,
fontSize: 28
};
}
getYAxisConfig(): AxisConfig {
return {
label: this.res.strings('devices_position_chart_y_axis_label'),
from: -20,
to: 20,
stride: 2,
fontSize: 28
};
}
ngDoCheck(): void {
this.compact = (this.map.getWidth() < 900);
}
@@ -184,6 +204,7 @@ export class DevicePositionsComponent implements OnInit, AfterViewInit, OnDestro
private updateSelectedPosition(): void {
if (this.loading.getValue() || this.devicePositionService.getPositions().length === 0) {
this.selectedPosition.remove();
this.updateChart();
} else {
const date = new Date(this.selectedDate);
date.setHours(Math.floor(this.sliderValue / 60));
@@ -218,7 +239,7 @@ export class DevicePositionsComponent implements OnInit, AfterViewInit, OnDestro
}
this.selectedPosition.addTo(this.map.map.map);
}
this.updateChart(after, before);
}
}
@@ -253,5 +274,110 @@ export class DevicePositionsComponent implements OnInit, AfterViewInit, OnDestro
}
}
/**
* Updates the acceleration data for the given position and minute.
* Depending on what parameters are passed, the method clears the chart
* and draws either the before or after position or interpolates between them
* if the date of both positions is present.
*
* This data is summarized into x, y, z and the respective timestamp
* delta which starts with the first measurement with second 0.
* Furthermore it also calculates the summerized Acceleration of the x, y
* & z values.
*
* @param after Position data of the after position.
* @param before Position data of the before position.
*/
private updateChart(after?: Position, before?: Position): void {
this.chart.clearChartLines();
if (!before && !after) return;
const beforePoints = before ? this.processChartData(this.devicePositionService.decodeAccelData(before)) : null;
const afterPoints = after ? this.processChartData(this.devicePositionService.decodeAccelData(after)) : null;
if (!beforePoints && afterPoints) {
this.drawChart(afterPoints);
} else if (beforePoints && !afterPoints) {
this.drawChart(beforePoints);
} else if (beforePoints && afterPoints) {
const interpolated = { x: [], y: [], z: [], accel: [] };
const len = Math.min(beforePoints.x.length, afterPoints.x.length);
for (let i = 0; i < len; i++) {
interpolated.x.push(
[(beforePoints.x[i][0] + afterPoints.x[i][0]) / 2,
(beforePoints.x[i][1] + afterPoints.x[i][1]) / 2]
);
interpolated.y.push(
[(beforePoints.y[i][0] + afterPoints.y[i][0]) / 2,
(beforePoints.y[i][1] + afterPoints.y[i][1]) / 2]
);
interpolated.z.push(
[(beforePoints.z[i][0] + afterPoints.z[i][0]) / 2,
(beforePoints.z[i][1] + afterPoints.z[i][1]) / 2]
);
interpolated.accel.push(
[(beforePoints.accel[i][0] + afterPoints.accel[i][0]) / 2,
(beforePoints.accel[i][1] + afterPoints.accel[i][1]) / 2]
);
}
this.drawChart(interpolated);
}
}
/**
* The acceleration sample data is processed to show the rate of change within one minute.
* Multiple samples are summarized into one second which is represented by a Point object
* containing the current second and the rate of change.
*
* @param data The acceleration data which is pre-processed and formatted.
*/
private processChartData(data: number[][])
: { x: Point[], y: Point[], z: Point[], accel: Point[] } {
if (!data || data.length === 0) return;
const THRESHOLD = 1_000_000;
const chartPoints = { x: [], y: [], z: [], accel: [] };
let startTime = data[0][0];
let lastTimestampDelta = 0;
let second = 0;
let count = 1;
let x = data[0][2], y = data[0][3], z = data[0][4];
let accel = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2));
for (const value of data) {
let timestampDelta = value[0] - startTime;
if (timestampDelta > THRESHOLD || timestampDelta < lastTimestampDelta || second === 0) {
chartPoints.x.push([second, x / count]);
chartPoints.y.push([second, y / count]);
chartPoints.z.push([second, z / count]);
chartPoints.accel.push([second, accel / count]);
startTime = value[0];
count = x = y = z = accel = 0;
++second;
}
if (second > 60) break;
lastTimestampDelta = timestampDelta;
++count;
x += value[2];
y += value[3];
z += value[4];
accel += Math.sqrt(
Math.pow(value[2], 2) + Math.pow(value[3], 2) + Math.pow(value[4], 2)
);
}
return chartPoints;
}
/**
* Draws the current Lines onto the chart.
*
* @param chartData Object containing Point arrays representing the lines to be drawn.
*/
private drawChart(chartData: { x: Point[], y: Point[], z: Point[], accel: Point[] }): void {
this.chart.addChartLine(chartData.x, 'x', 'red', 4);
this.chart.addChartLine(chartData.y, 'y', 'green', 4);
this.chart.addChartLine(chartData.z, 'z', 'blue', 4);
this.chart.addChartLine(
chartData.accel, this.res.strings('devices_position_chart_acceleration'), 'purple', 4
);
}
}
@@ -1,20 +1,16 @@
import { Component, OnInit, OnDestroy, ViewChild, AfterViewInit, ElementRef, DoCheck } 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 { MatDatepickerInputEvent } from '@angular/material/datepicker';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
import { Subscription, BehaviorSubject } from 'rxjs';
import { Device, Location, Visit } from '../../api/models';
import { Device, DefaultService, Visit } from '../api';
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';
import { TableColumn, TableHandler } from '../utils/tables';
import { ResourceService } from '../services/resource.service';
@@ -65,7 +61,7 @@ export class DeviceVisitsComponent implements OnInit, AfterViewInit, OnDestroy,
public res: ResourceService,
private snackbar: MatSnackBar,
private dialog: MatDialog,
private apiClientService: ApiClientService,
private apiClientService: DefaultService,
private deviceVisitSerivce: DeviceVisitService,
private route: ActivatedRoute
) {
@@ -1,9 +1,12 @@
<div style="margin: 20px;">
<mat-toolbar>
<mat-icon>devices</mat-icon>
<span style="margin-left: 10px">{{ res.strings('devices_title') }}</span>
</mat-toolbar>
<div class="mat-elevation-z2">
<app-content-layout [layoutClass]="'table-page'">
<app-content-header>
<div class="header-title">
<mat-icon>devices</mat-icon>
<span>{{ res.strings('devices_title') }}</span>
</div>
</app-content-header>
<main class="mat-elevation-z2">
<ng-container *ngIf="loading.getValue()">
<mat-progress-bar mode="indeterminate" color="accent"></mat-progress-bar>
</ng-container>
@@ -65,6 +68,5 @@
<mat-paginator #paginator [pageSize]="20" [pageSizeOptions]="[1, 10, 20, 50]" [showFirstLastButtons]="true">
</mat-paginator>
</div>
</div>
</main>
</app-content-layout>
@@ -1,12 +1,13 @@
import { Component, ViewChild, OnInit, OnDestroy, ElementRef, DoCheck } from '@angular/core';
import { MatPaginator, MatTableDataSource, PageEvent, MatPaginatorIntl, MatDialog, MatSnackBar } from '@angular/material';
import { MatDialog } from '@angular/material/dialog';
import { MatPaginator } from '@angular/material/paginator';
import { MatSnackBar } from '@angular/material/snack-bar';
import { DeviceService } from '../services/device.service';
import { Device, DevicePage } from '../../api/models';
import { DefaultService, Device, DevicePage } from '../api';
import { DataSource } from '@angular/cdk/table';
import { Subscription, BehaviorSubject } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
import { PaginationHandler } from '../utils/pagination';
import { ConfirmationDialogComponent, ConfirmationDialogResult } from '../widgets/confirmation-dialog.component';
import { ApiClientService } from '../../api';
import { ConfirmationDialogComponent } from '../widgets/confirmation-dialog.component';
import { Snackbars } from '../utils/snackbars';
import { TableHandler, TableColumn } from '../utils/tables';
import { ResourceService } from '../services/resource.service';
@@ -41,7 +42,7 @@ export class DevicesComponent implements OnInit, OnDestroy, DoCheck {
constructor(
public res: ResourceService,
private userService: UserService,
private apiClientService: ApiClientService,
private apiClientService: DefaultService,
private deviceSerivce: DeviceService,
private snackbar: MatSnackBar,
private dialog: MatDialog) {
@@ -1,16 +1,10 @@
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 { Component, OnInit, OnDestroy, ViewEncapsulation } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { Notice, Message } from '../api';
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 { ResourceService, Language } from '../services/resource.service';
+61 -63
View File
@@ -1,63 +1,61 @@
<ng-container>
<div style="flex: 1 1 100%;">
<mat-toolbar style="margin-top:20px;background:transparent">
<mat-icon style="margin-left:20px;">cloud_download</mat-icon>
<span style="margin-left: 10px">{{ res.strings('export_title') }}</span>
</mat-toolbar>
<mat-grid-list [cols]="columns" gutterSize="10" rowHeight="450" class="grid-layout">
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card">
<mat-card-title-group>
<mat-card-title>{{ res.strings('export_explain_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('export_explain_subtitle') }}</mat-card-subtitle>
</mat-card-title-group>
<mat-card-content style="min-height:130px">
<p class="mat-body">{{ res.strings('export_explain_content') }}</p>
<p class="mat-body">{{ res.strings('export_explain_process') }}</p>
</mat-card-content>
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center">
<ng-container *ngIf="exportService.downloading | async; else exportButton">
<button mat-raised-button color="accent" (click)="exportService.stopDownload()">
<mat-icon class="icon-button">cancel</mat-icon>
<span>{{ res.strings('button_cancel') }}</span>
</button>
</ng-container>
<ng-template #exportButton>
<button mat-raised-button color="primary" (click)="exportService.startDownload()">
<mat-icon class="icon-button">import_export</mat-icon>
<span>{{ res.strings('button_export') }}</span>
</button>
</ng-template>
</mat-card-actions>
</mat-card>
</mat-grid-tile>
<mat-grid-tile>
<mat-card class="mat-typography" class="user-card">
<mat-card-title-group>
<mat-card-title>{{ res.strings('export_download_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('export_download_subtitle') }}</mat-card-subtitle>
</mat-card-title-group>
<mat-card-content>
<mat-list>
<mat-divider></mat-divider>
<mat-list-item>
<mat-label style="font-size:85%" matLine>{{ res.strings('export_devices') }}<div style="float: right;">{{ (exportService.devices | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.devices | async)" matLine></mat-progress-bar>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item>
<mat-label style="font-size:85%" matLine>{{ res.strings('export_places') }}<div style="float: right;">{{ (exportService.places | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.places | async)" matLine></mat-progress-bar>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item>
<mat-label style="font-size:85%" matLine>{{ res.strings('export_visits') }}<div style="float: right;">{{ (exportService.visits | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.visits | async)" matLine></mat-progress-bar>
</mat-list-item>
</mat-list>
</mat-card-content>
</mat-card>
</mat-grid-tile>
</mat-grid-list>
</div>
</ng-container>
<app-content-layout>
<app-content-header [headerClass]="'header-transparent'">
<div class="header-title">
<mat-icon>cloud_download</mat-icon>
<span>{{ res.strings('export_title') }}</span>
</div>
</app-content-header>
<main class="flex-row-wrap justify-space-evenly">
<mat-card class="mat-typography user-card">
<mat-card-title-group>
<mat-card-title>{{ res.strings('export_explain_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('export_explain_subtitle') }}</mat-card-subtitle>
</mat-card-title-group>
<mat-card-content>
<p class="mat-body">{{ res.strings('export_explain_content') }}</p>
<p class="mat-body">{{ res.strings('export_explain_process') }}</p>
</mat-card-content>
<mat-card-actions fxFlexLayout="row" fxLayoutAlign="space-around center">
<ng-container *ngIf="exportService.downloading | async; else exportButton">
<button mat-raised-button color="accent" (click)="exportService.stopDownload()">
<mat-icon class="icon-button">cancel</mat-icon>
<span>{{ res.strings('button_cancel') }}</span>
</button>
</ng-container>
<ng-template #exportButton>
<button mat-raised-button color="primary" (click)="exportService.startDownload()">
<mat-icon class="icon-button">import_export</mat-icon>
<span>{{ res.strings('button_export') }}</span>
</button>
</ng-template>
</mat-card-actions>
</mat-card>
<mat-card class="mat-typography user-card">
<mat-card-title-group>
<mat-card-title>{{ res.strings('export_download_title') }}</mat-card-title>
<mat-card-subtitle>{{ res.strings('export_download_subtitle') }}</mat-card-subtitle>
</mat-card-title-group>
<mat-card-content>
<mat-list>
<mat-divider></mat-divider>
<mat-list-item>
<mat-label class="progress-label" matLine>{{ res.strings('export_devices') }}<div class="progress-float">{{ (exportService.devices | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.devices | async)" matLine></mat-progress-bar>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item>
<mat-label class="progress-label" matLine>{{ res.strings('export_places') }}<div class="progress-float">{{ (exportService.places | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.places | async)" matLine></mat-progress-bar>
</mat-list-item>
<mat-divider></mat-divider>
<mat-list-item>
<mat-label class="progress-label" matLine>{{ res.strings('export_visits') }}<div class="progress-float">{{ (exportService.visits | async)?.size }}</div></mat-label>
<mat-progress-bar mode="determinate" [value]="progressValue(exportService.visits | async)" matLine></mat-progress-bar>
</mat-list-item>
</mat-list>
</mat-card-content>
</mat-card>
</main>
</app-content-layout>

Some files were not shown because too many files have changed in this diff Show More