Compare commits

..

52 Commits

Author SHA1 Message Date
eb65b56b78 convert y axis definition to standalone component 2024-10-01 19:14:15 +02:00
b0415ed972 convert image to to standalone component 2024-10-01 19:09:59 +02:00
4b211e425d convert limit by to standalone component 2024-10-01 19:07:34 +02:00
9459eee606 lazy loading for main page 2024-10-01 18:56:58 +02:00
a81c458775 convert customizable grid to standalone component and add lazy loading 2024-10-01 18:55:24 +02:00
ee0eab22f8 convert help page into standalone component and add lazy loading 2024-10-01 18:47:34 +02:00
9ccb7a14b5 lazy loading for upload page 2024-10-01 18:42:52 +02:00
05cc0e985a convert upload page to standalone component 2024-10-01 18:38:44 +02:00
6dc5ba1a1e convert main page into standalone component 2024-09-29 13:51:06 +02:00
a6ae8e533e convert new dashboard component to standalone component 2024-09-29 13:11:15 +02:00
8e0572d35b convert date picker to standalone component 2024-09-29 10:10:00 +02:00
697d3664aa convert AddTextDialogComponent into standalone component 2024-09-29 09:34:56 +02:00
526e1d842e update Gradle to 8.10.2 2024-09-29 08:59:48 +02:00
06c9b4998f update Junit to 5.11.1 2024-09-29 08:57:48 +02:00
ac5dcdc58f Merge pull request 'dashboard' (#1) from dashboard into master
Reviewed-on: #1
2024-09-29 06:47:35 +00:00
296d42e721 update node to 20.17.0 2024-09-29 08:45:56 +02:00
9db020ceb0 update 3rd party libs 2024-09-29 08:21:46 +02:00
36da503be9 add date picker to dashboard page 2024-09-29 08:11:38 +02:00
42751f84d4 remove head-box dif, because it is unnecessary 2024-09-28 10:35:15 +02:00
39d7c029ea remove debug output for absolute date 2024-09-28 10:28:28 +02:00
f072185074 nicer placement of the date picker 2024-09-28 10:26:53 +02:00
122ba11a79 remove debugger 2024-09-28 10:26:38 +02:00
f1d7799bf1 update luxon to 3.5.0 2024-09-28 09:18:23 +02:00
680f1bff03 update Angular Material to 18.2 2024-09-28 09:16:56 +02:00
fa0315650a update Angular to 18.2 2024-09-28 09:14:31 +02:00
8f765dd478 remove date picker test component 2024-09-28 09:12:31 +02:00
1234560512 update ngx-markdown to be compatible with angular 2024-09-28 08:54:47 +02:00
2711579afb add resource handler to be able to load htm/js
With the Angular update the smart people at google moved the
location where the build output is written to. It is now in a
subfolder called 'browser'. This means the default lookup locations
of Spring don't work anymore.
2024-09-28 08:37:47 +02:00
3ac021e45f ng update @angular/material@18 2024-07-28 12:17:53 +02:00
c199eae4ff g update @angular/core@18 @angular/cli@18 2024-07-28 12:17:00 +02:00
6073dd0779 fix compile errors after angualr 17 update 2024-07-28 12:14:19 +02:00
fee5eda780 update ngx-markdown 2024-07-28 11:58:01 +02:00
cc0db6d732 update angular material to 17 2024-07-28 11:56:46 +02:00
f084396e95 update angular cor and cli to 17 2024-07-28 11:55:22 +02:00
e4b6eea4b1 angular updates are shit 2024-07-28 11:54:09 +02:00
75fa966af3 udpate Spring to 3.3.2 2024-07-28 11:47:05 +02:00
a3e4917e89 update gradle versions plugin to 0.51.0 2024-07-27 14:09:37 +02:00
05fc03e48f update to gradle 8.9 2024-07-27 14:05:36 +02:00
b00ce507ef update to jdk 21 2024-07-27 14:02:37 +02:00
a69fe09464 more updates to handle date ranges with my custom range language 2024-07-27 13:19:35 +02:00
77b99801e4 add projects directly instead of scanning for them
IntelliJ Idea cannot import projects unless they are listed in the
settings.gradle
2024-05-05 10:27:49 +02:00
da210145e6 opt out of analytics 2024-05-05 10:23:33 +02:00
21a84b5223 use date picker in visualization page 2024-05-05 10:22:45 +02:00
a99a884423 add date parser for relative time notation 2024-05-05 08:40:30 +02:00
6d6b6ba00c add date picker component 2024-04-25 09:41:10 +02:00
380bad6967 update testing properties 2024-04-03 16:46:25 +02:00
f3556b6909 custom ticks for no unit y-axis 2024-04-03 16:46:25 +02:00
452030de5e use more efficient way to determine needed bytes for variable byte
encoding

I experimented with a few branch-free variants, but they were slower
than just using ternary operators and readable code.
2024-04-01 12:44:30 +02:00
6b8e3d2089 add component for a custom date picker that also knows relative date ranges like 'last month' 2024-03-31 14:48:33 +02:00
b0467c4571 better scrolling of legend 2023-10-03 14:12:59 +02:00
a64e851c33 define max size for legend 2023-10-01 14:33:52 +02:00
fefc7411c1 add source-map-explorer 2023-10-01 10:31:51 +02:00
50 changed files with 14167 additions and 8862 deletions

View File

@@ -4,7 +4,7 @@ import org.apache.tools.ant.filters.ReplaceTokens
plugins { plugins {
id 'java' id 'java'
id 'eclipse' id 'eclipse'
id 'com.github.ben-manes.versions' version "0.48.0" // check for dependency updates run: gradlew dependenyUpdates id 'com.github.ben-manes.versions' version "0.51.0" // check for dependency updates run: gradlew dependenyUpdates
} }
@@ -13,18 +13,18 @@ ext {
javaVersion=21 javaVersion=21
version_log4j2= '2.20.0' // keep in sync with spring-boot-starter-log4j2 version_log4j2= '2.20.0' // keep in sync with spring-boot-starter-log4j2
version_spring = '3.1.4' version_spring = '3.3.4'
version_junit = '5.10.0' version_junit = '5.11.1'
version_junit_platform = '1.10.0' version_junit_platform = '1.11.1'
version_nodejs = '18.18.0' // keep in sync with npm version_nodejs = '20.17.0' // keep in sync with npm
version_npm = '9.8.1' // keep in sync with nodejs version_npm = '10.8.2' // keep in sync with nodejs
lib_antlr = "org.antlr:antlr4:4.13.1" lib_antlr = "org.antlr:antlr4:4.13.2"
lib_commons_collections4 = 'org.apache.commons:commons-collections4:4.4' lib_commons_collections4 = 'org.apache.commons:commons-collections4:4.4'
lib_commons_csv= 'org.apache.commons:commons-csv:1.10.0' lib_commons_csv= 'org.apache.commons:commons-csv:1.12.0'
lib_commons_lang3 = 'org.apache.commons:commons-lang3:3.13.0' lib_commons_lang3 = 'org.apache.commons:commons-lang3:3.17.0'
lib_jackson_databind = 'com.fasterxml.jackson.core:jackson-databind:2.15.2' lib_jackson_databind = 'com.fasterxml.jackson.core:jackson-databind:2.18.0'
lib_log4j2_core = "org.apache.logging.log4j:log4j-core:${version_log4j2}" lib_log4j2_core = "org.apache.logging.log4j:log4j-core:${version_log4j2}"
lib_log4j2_slf4j_impl = "org.apache.logging.log4j:log4j-slf4j-impl:${version_log4j2}" lib_log4j2_slf4j_impl = "org.apache.logging.log4j:log4j-slf4j-impl:${version_log4j2}"
@@ -141,5 +141,5 @@ subprojects {
} }
wrapper { wrapper {
gradleVersion = '8.3' gradleVersion = '8.10.2'
} }

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

21
gradlew vendored
View File

@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -145,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@@ -153,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045 # shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@@ -202,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command:
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# shell script including quotes and variable substitutions, so put them in # and any embedded shellness will be escaped.
# double quotes to make sure that they get re-expanded; and # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# * put everything else in single quotes, so that it's not re-expanded. # treated as '${Hostname}' itself on the command line.
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

22
gradlew.bat vendored
View File

@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View File

@@ -18,12 +18,15 @@
"prefix": "app", "prefix": "app",
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:application",
"options": { "options": {
"outputPath": "build/generated/resources", "outputPath": {
"base": "build/generated/resources"
},
"index": "src/index.html", "index": "src/index.html",
"main": "src/main.ts", "polyfills": [
"polyfills": "src/polyfills.ts", "src/polyfills.ts"
],
"tsConfig": "tsconfig.app.json", "tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss", "inlineStyleLanguage": "scss",
"assets": [ "assets": [
@@ -35,7 +38,8 @@
], ],
"scripts": [ "scripts": [
"node_modules/marked/marked.min.js" "node_modules/marked/marked.min.js"
] ],
"browser": "src/main.ts"
}, },
"configurations": { "configurations": {
"production": { "production": {
@@ -57,12 +61,11 @@
"with": "src/environments/environment.prod.ts" "with": "src/environments/environment.prod.ts"
} }
], ],
"outputHashing": "all" "outputHashing": "all",
"sourceMap": true
}, },
"development": { "development": {
"buildOptimizer": false,
"optimization": false, "optimization": false,
"vendorChunk": true,
"extractLicenses": false, "extractLicenses": false,
"sourceMap": true, "sourceMap": true,
"namedChunks": true "namedChunks": true
@@ -77,10 +80,10 @@
}, },
"configurations": { "configurations": {
"production": { "production": {
"browserTarget": "pdb-js:build:production" "buildTarget": "pdb-js:build:production"
}, },
"development": { "development": {
"browserTarget": "pdb-js:build:development" "buildTarget": "pdb-js:build:development"
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"
@@ -88,7 +91,7 @@
"extract-i18n": { "extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n", "builder": "@angular-devkit/build-angular:extract-i18n",
"options": { "options": {
"browserTarget": "pdb-js:build" "buildTarget": "pdb-js:build"
} }
}, },
"test": { "test": {
@@ -111,5 +114,8 @@
} }
} }
} }
},
"cli": {
"analytics": false
} }
} }

View File

@@ -3,6 +3,7 @@ import java.nio.file.Paths
plugins { plugins {
id("com.github.node-gradle.node") version "7.0.0" id("com.github.node-gradle.node") version "7.0.0"
id("java-library") // not sure why this is needed - is already set in /build.gradle - but without it the project sometimes (not always) is not configured as a java project
} }

20438
pdb-js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -9,32 +9,33 @@
"test": "ng test", "test": "ng test",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e",
"releasebuild": "ng build --configuration production" "releasebuild": "ng build --configuration production",
"explore": "source-map-explorer build/generated/resources/**/*.js"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@angular/animations": "^16.2.7", "@angular/animations": "^18.2.6",
"@angular/cdk": "^16.2.6", "@angular/cdk": "^18.2.6",
"@angular/common": "^16.2.7", "@angular/common": "^18.2.6",
"@angular/compiler": "^16.2.7", "@angular/compiler": "^18.2.6",
"@angular/core": "^16.2.7", "@angular/core": "^18.2.6",
"@angular/forms": "^16.2.7", "@angular/forms": "^18.2.6",
"@angular/material": "^16.2.6", "@angular/material": "^18.2.6",
"@angular/platform-browser": "^16.2.7", "@angular/platform-browser": "^18.2.6",
"@angular/platform-browser-dynamic": "^16.2.7", "@angular/platform-browser-dynamic": "^18.2.6",
"@angular/router": "^16.2.7", "@angular/router": "^18.2.6",
"luxon": "^3.4.3", "luxon": "^3.4.3",
"marked": "^4.2.12", "marked": "^12",
"ngx-markdown": "^16.0.0", "ngx-markdown": "18.0.0",
"rxjs": "~7.5.0", "rxjs": "~7.5.0",
"rxjs-compat": "^6.6.7", "rxjs-compat": "^6.6.7",
"tslib": "^2.3.0", "tslib": "^2.3.0",
"zone.js": "~0.13.3" "zone.js": "^0.14.10"
}, },
"devDependencies": { "devDependencies": {
"@angular-devkit/build-angular": "^16.2.4", "@angular-devkit/build-angular": "^18.2.6",
"@angular/cli": "^16.2.4", "@angular/cli": "^18.2.6",
"@angular/compiler-cli": "^16.2.7", "@angular/compiler-cli": "^18.2.6",
"@types/jasmine": "~4.3.0", "@types/jasmine": "~4.3.0",
"@types/luxon": "^3.3.2", "@types/luxon": "^3.3.2",
"@types/marked": "^4.0.8", "@types/marked": "^4.0.8",
@@ -45,6 +46,7 @@
"karma-coverage": "~2.2.0", "karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0", "karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0", "karma-jasmine-html-reporter": "~2.1.0",
"typescript": "5.1" "source-map-explorer": "^2.5.3",
"typescript": "^5.4.5"
} }
} }

View File

@@ -1,30 +1,25 @@
import { NgModule } from '@angular/core'; import { NgModule } from "@angular/core";
import { Routes, RouterModule } from '@angular/router'; import { RouterModule, Routes } from "@angular/router";
import { VisualizationPageComponent } from './visualization-page/visualization-page.component'; import { VisualizationPageComponent } from "./visualization-page/visualization-page.component";
import { MainPageComponent } from './main-page/main-page.component'; import { DashboardPageComponent } from "./dashboard-page/dashboard-page.component";
import { UploadPageComponent } from './upload-page/upload-page.component'; import { DashboardComponent } from "./dashboard-page/dashboard/dashboard.component";
import { HelpPageComponent } from './help-page/help-page.component';
import { DashboardPageComponent } from './dashboard-page/dashboard-page.component';
import { DashboardComponent } from './dashboard-page/dashboard/dashboard.component';
import { CustomizableGridComponent } from './customizable-grid/customizable-grid.component';
const routes: Routes = [ const routes: Routes = [
{ path: '', component: MainPageComponent}, { path: "", loadComponent: () => import("./main-page/main-page.component").then(m => m.MainPageComponent) },
{ path: 'vis', component: VisualizationPageComponent }, { path: "vis", component: VisualizationPageComponent },
{ path: 'dashboard', component: DashboardPageComponent}, { path: "dashboard", component: DashboardPageComponent },
{ path: 'dashboard/:id', component: DashboardComponent}, { path: "dashboard/:id", component: DashboardComponent },
{ path: 'upload', component: UploadPageComponent }, { path: "upload", loadComponent: () => import("./upload-page/upload-page.component").then(m => m.UploadPageComponent) },
{ path: 'grid', component: CustomizableGridComponent }, { path: "grid", loadComponent: () => import("./customizable-grid/customizable-grid.component").then(m => m.CustomizableGridComponent) },
{ path: 'help', component: HelpPageComponent }, { path: "help", loadComponent: () => import("./help-page/help-page.component").then(m => m.HelpPageComponent) },
// { path: '**', component: PageNotFoundComponent } // { path: '**', component: PageNotFoundComponent }
]; ];
@NgModule({ @NgModule({
imports: [ imports: [
RouterModule.forRoot(routes, {}) RouterModule.forRoot(routes, {}),
], ],
declarations: [], declarations: [],
exports: [RouterModule] exports: [RouterModule],
}) })
export class AppRoutingModule { } export class AppRoutingModule {}

View File

@@ -1,113 +1,115 @@
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { NgModule, enableProdMode } from '@angular/core'; import { enableProdMode, NgModule } from "@angular/core";
import { HttpClientModule } from '@angular/common/http'; import { provideHttpClient, withInterceptorsFromDi } from "@angular/common/http";
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from './app.component'; import { AppComponent } from "./app.component";
import { MainPageComponent } from './main-page/main-page.component'; import { VisualizationPageComponent } from "./visualization-page/visualization-page.component";
import { HelpPageComponent } from './help-page/help-page.component';
import { UploadPageComponent } from './upload-page/upload-page.component';
import { VisualizationPageComponent } from './visualization-page/visualization-page.component';
import {MatAutocompleteModule} from '@angular/material/autocomplete'; import { DatePickerComponent } from "./components/datepicker/date-picker.component";
import {MatButtonModule} from '@angular/material/button';
import {MatCheckboxModule} from '@angular/material/checkbox';
import {MatSelectModule} from '@angular/material/select';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import {MatProgressBarModule} from '@angular/material/progress-bar';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatRadioModule} from '@angular/material/radio';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatTooltipModule} from '@angular/material/tooltip';
import {OverlayModule} from '@angular/cdk/overlay';
import { YAxisDefinitionComponent } from './y-axis-definition/y-axis-definition.component';
import { QueryAutocompleteComponent } from './query-autocomplete/query-autocomplete.component';
import { LimitByComponent } from './limit-by/limit-by.component';
import { PlotDetailsComponent } from './plot-details/plot-details.component';
import { PlotViewComponent } from './plot-view/plot-view.component';
import { GalleryViewComponent, GalleryItemView, GalleryFilterView } from './gallery-view/gallery-view.component';
import { ImageToggleComponent } from './image-toggle/image-toggle.component';
import { DashboardPageComponent } from './dashboard-page/dashboard-page.component';
import { NewDashboardComponent } from './dashboard-page/new-dashboard/new-dashboard.component';
import { MatDialogModule, MAT_DIALOG_DEFAULT_OPTIONS } from '@angular/material/dialog';
import {MatTableModule} from '@angular/material/table';
import {MatGridListModule} from '@angular/material/grid-list';
import {MatCardModule} from '@angular/material/card';
import {MatBadgeModule} from '@angular/material/badge';
import { DashboardComponent } from './dashboard-page/dashboard/dashboard.component';
import { AddTextDialogComponent } from './dashboard-page/dashboard/add-text-dialog/add-text-dialog.component';
import { TextWidgetComponent } from './dashboard-page/dashboard/text-widget/text-widget.component';
import { AddPlotDialogComponent } from './dashboard-page/dashboard/add-plot-dialog/add-plot-dialog.component';
import { PlotWidgetComponent } from './dashboard-page/dashboard/plot-widget/plot-widget.component';
import { FullScreenPlotDialogComponent } from './dashboard-page/dashboard/full-screen-plot-dialog/full-screen-plot-dialog.component';
import { CustomizableGridComponent } from './customizable-grid/customizable-grid.component';
import {DragDropModule} from '@angular/cdk/drag-drop'; import { MatAutocompleteModule } from "@angular/material/autocomplete";
import { ConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component'; import { MatButtonModule } from "@angular/material/button";
import { FocusDirective } from './focus.directive'; import { MatCheckboxModule } from "@angular/material/checkbox";
import { MarkdownModule } from 'ngx-markdown'; import { MatSelectModule } from "@angular/material/select";
import { MatFormFieldModule } from "@angular/material/form-field";
import { MatInputModule } from "@angular/material/input";
import { MatProgressBarModule } from "@angular/material/progress-bar";
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
import { MatRadioModule } from "@angular/material/radio";
import { MatSnackBarModule } from "@angular/material/snack-bar";
import { MatTooltipModule } from "@angular/material/tooltip";
import { OverlayModule } from "@angular/cdk/overlay";
import { YAxisDefinitionComponent } from "./y-axis-definition/y-axis-definition.component";
import { QueryAutocompleteComponent } from "./query-autocomplete/query-autocomplete.component";
import { PlotDetailsComponent } from "./plot-details/plot-details.component";
import { PlotViewComponent } from "./plot-view/plot-view.component";
import {
GalleryFilterView,
GalleryItemView,
GalleryViewComponent,
} from "./gallery-view/gallery-view.component";
import { ImageToggleComponent } from "./image-toggle/image-toggle.component";
import { DashboardPageComponent } from "./dashboard-page/dashboard-page.component";
import {
MAT_DIALOG_DEFAULT_OPTIONS,
MatDialogModule,
} from "@angular/material/dialog";
import { MatTabsModule } from "@angular/material/tabs";
import { MatTableModule } from "@angular/material/table";
import { MatGridListModule } from "@angular/material/grid-list";
import { MatCardModule } from "@angular/material/card";
import { MatBadgeModule } from "@angular/material/badge";
import { DashboardComponent } from "./dashboard-page/dashboard/dashboard.component";
import { TextWidgetComponent } from "./dashboard-page/dashboard/text-widget/text-widget.component";
import { AddPlotDialogComponent } from "./dashboard-page/dashboard/add-plot-dialog/add-plot-dialog.component";
import { PlotWidgetComponent } from "./dashboard-page/dashboard/plot-widget/plot-widget.component";
import { FullScreenPlotDialogComponent } from "./dashboard-page/dashboard/full-screen-plot-dialog/full-screen-plot-dialog.component";
@NgModule({ import { DragDropModule } from "@angular/cdk/drag-drop";
declarations: [ import { ConfirmationDialogComponent } from "./confirmation-dialog/confirmation-dialog.component";
AppComponent, import { FocusDirective } from "./focus.directive";
MainPageComponent, import { MarkdownModule } from "ngx-markdown";
HelpPageComponent, import { MainPageComponent } from "./main-page/main-page.component";
UploadPageComponent, import { LimitByComponent } from "./limit-by/limit-by.component";
VisualizationPageComponent,
YAxisDefinitionComponent,
QueryAutocompleteComponent,
LimitByComponent,
PlotDetailsComponent,
PlotViewComponent,
GalleryViewComponent,
GalleryItemView,
GalleryFilterView,
ImageToggleComponent,
DashboardPageComponent,
NewDashboardComponent,
DashboardComponent,
AddTextDialogComponent,
TextWidgetComponent,
AddPlotDialogComponent,
PlotWidgetComponent,
FullScreenPlotDialogComponent,
CustomizableGridComponent,
ConfirmationDialogComponent,
FocusDirective
],
imports: [
MarkdownModule.forRoot(),
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
DragDropModule,
MatAutocompleteModule,
MatBadgeModule,
MatButtonModule,
MatCardModule,
MatCheckboxModule,
MatDialogModule,
MatFormFieldModule,
MatGridListModule,
MatInputModule,
MatRadioModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSnackBarModule,
MatTableModule,
MatTooltipModule,
BrowserAnimationsModule,
HttpClientModule,
OverlayModule
],
providers: [{provide: MAT_DIALOG_DEFAULT_OPTIONS, useValue: {hasBackdrop: true}}],
bootstrap: [AppComponent]
})
export class AppModule { }
enableProdMode() @NgModule({ declarations: [
AppComponent,
VisualizationPageComponent,
QueryAutocompleteComponent,
PlotDetailsComponent,
PlotViewComponent,
GalleryViewComponent,
GalleryItemView,
GalleryFilterView,
DashboardPageComponent,
DashboardComponent,
TextWidgetComponent,
AddPlotDialogComponent,
PlotWidgetComponent,
FullScreenPlotDialogComponent,
ConfirmationDialogComponent,
FocusDirective,
],
bootstrap: [AppComponent],
imports: [
MarkdownModule.forRoot(),
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
DatePickerComponent,
DragDropModule,
ImageToggleComponent,
LimitByComponent,
MainPageComponent,
MatAutocompleteModule,
MatBadgeModule,
MatButtonModule,
MatCardModule,
MatCheckboxModule,
MatDialogModule,
MatFormFieldModule,
MatGridListModule,
MatInputModule,
MatRadioModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatSelectModule,
MatSnackBarModule,
MatTabsModule,
MatTableModule,
MatTooltipModule,
BrowserAnimationsModule,
OverlayModule,
YAxisDefinitionComponent
],
providers: [{
provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: { hasBackdrop: true },
}, provideHttpClient(withInterceptorsFromDi())] })
export class AppModule {}
enableProdMode();

View File

@@ -0,0 +1,188 @@
<style>
.date-picker-overlay {
width: 500px;
transition: box-shadow 200ms cubic-bezier(0, 0, 0.2, 1);
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
background-color: white;
}
.tab-quick {
display: flex;
flex-direction: row;
gap: 2em;
}
.tab-quick-column {
display: flex;
flex-direction: column;
}
.date-picker-form-field {
width: 23.5em;
}
</style>
<button
mat-button
matTooltip="Date Picker"
(click)="isOpen = !isOpen"
cdkOverlayOrigin
#trigger="cdkOverlayOrigin"
[attr.disabled]="isDisabled ? 'disabled' : null"
>
{{ datePickerControl.value?.display }}
</button>
<ng-template
cdkConnectedOverlay
[cdkConnectedOverlayOrigin]="trigger"
[cdkConnectedOverlayOpen]="isOpen"
>
<div class="date-picker-overlay">
<mat-tab-group
animationDuration="0ms"
(selectedTabChange)="tabChange()"
[(selectedIndex)]="selectedTabIndex"
>
<mat-tab label="Quick">
<div class="tab-quick">
<div class="tab-quick-column">
<button mat-button (click)="applyQuick('BD/E1D', 'today')">
Today
</button>
<button mat-button (click)="applyQuick('B-1D/E-1D', 'yesterday')">
Yesterday
</button>
<button mat-button (click)="applyQuick('BW/EW', 'this week')">
This Week
</button>
<button mat-button (click)="applyQuick('BM/EM', 'this month')">
This Month
</button>
<button mat-button (click)="applyQuick('BY/EY', 'this year')">
This Year
</button>
</div>
<div class="tab-quick-column">
<button mat-button (click)="applyQuick('B-7D/ED', 'last 7 days')">
Last 7 Days
</button>
<button mat-button (click)="applyQuick('B-1W/ED', 'last week')">
Last Week
</button>
<button mat-button (click)="applyQuick('B-30D/ED', 'last 30 days')">
Last 30 Days
</button>
<button mat-button (click)="applyQuick('B-1M/E-1M', 'last month')">
Last Month
</button>
<button
mat-button
(click)="applyQuick('B-3M/E-1M', 'last 3 months')"
>
Last 3 Months
</button>
<button mat-button (click)="applyQuick('B-1Y/E-1Y', 'last year')">
Last Year
</button>
</div>
</div>
</mat-tab>
<mat-tab label="Relative">
<mat-form-field
class="pdb-form-number-small"
(wheel)="scrollRelativeTimeRange($event, 'seconds', 59)"
>
<mat-label>Seconds:</mat-label>
<input
matInput
name="relative-time-range-seconds"
[(ngModel)]="relativeTimeRange.seconds"
type="number"
min="0"
max="59"
/>
</mat-form-field>
<mat-form-field
class="pdb-form-number-small"
(wheel)="scrollRelativeTimeRange($event, 'minutes', 59)"
>
<mat-label>Minutes:</mat-label>
<input
matInput
name="relative-time-range-minutes"
[(ngModel)]="relativeTimeRange.minutes"
type="number"
min="0"
max="59"
/>
</mat-form-field>
<mat-form-field
class="pdb-form-number-small"
(wheel)="scrollRelativeTimeRange($event, 'hours', 23)"
>
<mat-label>Hours:</mat-label>
<input
matInput
name="relative-time-range-hours"
[(ngModel)]="relativeTimeRange.hours"
type="number"
min="0"
max="23"
/>
</mat-form-field>
<mat-form-field
class="pdb-form-number-small"
(wheel)="scrollRelativeTimeRange($event, 'days', 367)"
>
<mat-label>Days:</mat-label>
<input
matInput
name="relative-time-range-days"
[(ngModel)]="relativeTimeRange.days"
type="number"
min="0"
max="367"
/>
</mat-form-field>
<mat-form-field
class="pdb-form-number-small"
(wheel)="scrollRelativeTimeRange($event, 'months', 11)"
>
<mat-label>Months:</mat-label>
<input
matInput
name="relative-time-range-months"
[(ngModel)]="relativeTimeRange.months"
type="number"
min="0"
max="11"
/>
</mat-form-field>
<mat-form-field
class="pdb-form-number-small"
(wheel)="scrollRelativeTimeRange($event, 'years', 10)"
>
<mat-label>Years:</mat-label>
<input
matInput
name="relative-time-range-years"
[(ngModel)]="relativeTimeRange.years"
type="number"
min="0"
max="10"
/>
</mat-form-field>
<button mat-button (click)="applyRelativeTimeRange()">Apply</button>
</mat-tab>
<mat-tab label="Absolute">
<mat-form-field class="date-picker-form-field">
<mat-label>Date Range:</mat-label>
<input matInput [formControl]="dateRange" name="dates" />
</mat-form-field>
<button mat-button (click)="applyAbsoluteTime()">Apply</button>
</mat-tab>
</mat-tab-group>
</div>
</ng-template>

View File

@@ -0,0 +1,208 @@
import { OverlayModule } from "@angular/cdk/overlay";
import {
Component,
EventEmitter,
forwardRef,
Input,
Output,
} from "@angular/core";
import {
ControlValueAccessor,
FormControl,
FormsModule,
NG_VALUE_ACCESSOR,
ReactiveFormsModule,
Validators,
} from "@angular/forms";
import { MatButtonModule } from "@angular/material/button";
import { MAT_DIALOG_DEFAULT_OPTIONS } from "@angular/material/dialog";
import { MatFormFieldModule } from "@angular/material/form-field";
import { MatInputModule } from "@angular/material/input";
import { MatTabsModule } from "@angular/material/tabs";
import { BrowserModule } from "@angular/platform-browser";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
export type DateType = "QUICK" | "RELATIVE" | "ABSOLUTE";
export class DateValue {
constructor(
public type: DateType,
public value: string,
public display: string,
) {}
}
export class DatePickerChange {
constructor(public value: DateValue) {}
}
@Component({
selector: "app-date-picker",
templateUrl: "./date-picker.component.html",
standalone: true,
imports: [
BrowserModule,
MatButtonModule,
MatFormFieldModule,
MatInputModule,
MatTabsModule,
FormsModule,
ReactiveFormsModule,
OverlayModule
],
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => DatePickerComponent),
multi: true,
},
{
provide: MAT_DIALOG_DEFAULT_OPTIONS,
useValue: { hasBackdrop: true },
}
],
})
export class DatePickerComponent implements ControlValueAccessor {
isOpen = false;
relativeTimeRangeUnit = "relativeTimeRangeMinutes";
relativeTimeRangeAmount = 15;
relativeTimeRange = {
seconds: 0,
minutes: 15,
hours: 0,
days: 0,
months: 0,
years: 0,
};
dateRange = new FormControl<string>(
"2019-10-05 00:00:00 - 2019-10-11 23:59:59",
[
Validators.pattern(
/^\d{4}-\d{2}-\d{2} ([01][0-9]|2[0-3]):\d{2}:\d{2} - \d{4}-\d{2}-\d{2} ([01][0-9]|2[0-3]):\d{2}:\d{2}$/,
),
],
);
datePickerControl = new FormControl(
new DateValue("QUICK", "BM/EM", "this month"),
);
@Input()
isDisabled: boolean = false;
@Output()
readonly dateValueSelected: EventEmitter<DatePickerChange> = new EventEmitter<
DatePickerChange
>();
selectedTabIndex = 0;
_onChange = (_: any) => {};
_onTouched = (_: any) => {};
constructor() {}
getDateValue(): DateValue {
return this.datePickerControl.value!;
}
writeValue(obj: DateValue): void {
this.datePickerControl.setValue(obj);
switch (obj.type) {
case "QUICK":
break;
case "ABSOLUTE":
this.dateRange.setValue(obj.value);
break;
case "RELATIVE":
const x = this.relativeTimeRange;
// obj.value looks like "P1Y2M3DT4H5M6S" or "PT4H5M6S" or "P1Y2M3D" or "P1YT6S" or ...
const matches = obj.value.match(
/P(?:(\d+)Y)(?:(\d+)M)(?:(\d+)D)?(?:T(?:(\d+)H)(?:(\d+)M)(?:(\d+)S))?/,
) ?? [];
x.years = Number.parseInt(matches[1] ?? 0);
x.months = Number.parseInt(matches[2] ?? 0);
x.days = Number.parseInt(matches[3] ?? 0);
x.hours = Number.parseInt(matches[4] ?? 0);
x.minutes = Number.parseInt(matches[5] ?? 0);
x.seconds = Number.parseInt(matches[6] ?? 0);
break;
default:
}
}
registerOnChange(fn: any): void {
this._onChange = fn;
}
registerOnTouched(fn: any): void {
this._onTouched = fn;
}
setDisabledState?(isDisabled: boolean): void {
this.isDisabled = isDisabled;
}
dateDisplay(): string {
return this.datePickerControl.value?.display || "no date set";
}
tabChange() {
//(<any> window).initSimpleDatePicker(); // breaks form control
}
setDateValue(dateValue: DateValue) {
this.datePickerControl.setValue(dateValue);
this._onChange(dateValue);
this.dateValueSelected.emit(new DatePickerChange(dateValue));
//console.log("date value updated: ", dateValue);
}
applyQuick(value: string, display: string) {
const newValue = new DateValue("QUICK", value, display);
this.setDateValue(newValue);
this.isOpen = false;
}
private fixToRange(val: number, min: number, max: number) {
return val < min ? min : (val > max ? max : val);
}
applyRelativeTimeRange() {
const x = this.relativeTimeRange;
const years = x.years ? "-"+x.years + "Y" : "";
const months = x.months ? "-"+x.months + "M" : "";
const days = x.days ? "-"+x.days + "D" : "";
const hours = x.hours ? "-"+x.hours + "H" : "";
const minutes = x.minutes ? "-"+x.minutes + "m" : "";
const timeRange = `B${years}${months}${days}${hours}${minutes}/Bm`;
const newValue = new DateValue("RELATIVE", timeRange, timeRange);
this.setDateValue(newValue);
this.isOpen = false;
}
applyAbsoluteTime() {
const value = <string> this.dateRange.value;
const newValue = new DateValue("ABSOLUTE", value, value);
this.setDateValue(newValue);
this.isOpen = false;
}
scrollRelativeTimeRange(
event: WheelEvent,
unit: "seconds" | "minutes" | "hours" | "days" | "months" | "years",
max: number,
) {
this.relativeTimeRange[unit] = this.fixToRange(
this.relativeTimeRange[unit] + (event.deltaY > 0 ? -1 : 1),
0,
max,
);
}
}

View File

@@ -1,12 +1,18 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { CdkDragEnter, CdkDropList, moveItemInArray, DragRef} from '@angular/cdk/drag-drop'; import { CdkDragEnter, CdkDropList, moveItemInArray, DragRef, DragDropModule} from '@angular/cdk/drag-drop';
import { AfterViewInit } from '@angular/core'; import { AfterViewInit } from '@angular/core';
import { ViewChild } from '@angular/core'; import { ViewChild } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@Component({ @Component({
selector: 'app-customizable-grid', selector: 'app-customizable-grid',
templateUrl: './customizable-grid.component.html' templateUrl: './customizable-grid.component.html',
standalone: true,
imports: [
BrowserModule,
DragDropModule
]
}) })
export class CustomizableGridComponent implements AfterViewInit { export class CustomizableGridComponent implements AfterViewInit {
@ViewChild(CdkDropList) placeholder!: CdkDropList; @ViewChild(CdkDropList) placeholder!: CdkDropList;

View File

@@ -1,4 +1,4 @@
import { AfterViewInit, Component, ElementRef, Inject, ViewChild } from '@angular/core'; import { Component, Inject, ViewChild } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { PlotConfig } from 'src/app/plot.service'; import { PlotConfig } from 'src/app/plot.service';
import { VisualizationPageComponent } from 'src/app/visualization-page/visualization-page.component'; import { VisualizationPageComponent } from 'src/app/visualization-page/visualization-page.component';

View File

@@ -1,9 +1,28 @@
import { Component, ElementRef, Inject, ViewChild } from '@angular/core'; import { Component, ElementRef, Inject, ViewChild } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MarkdownModule } from 'ngx-markdown';
@Component({ @Component({
selector: 'app-add-text-dialog', selector: 'app-add-text-dialog',
templateUrl: './add-text-dialog.component.html' templateUrl: './add-text-dialog.component.html',
standalone: true,
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
ReactiveFormsModule,
MarkdownModule,
MatButtonModule,
MatDialogModule,
MatFormFieldModule,
MatInputModule,
]
}) })
export class AddTextDialogComponent { export class AddTextDialogComponent {
text = ""; text = "";

View File

@@ -3,6 +3,16 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.toolbar {
display: flex;
flex-direction: row;
}
.toolbar #filter-date-range{
flex-grow: 1;
display: flex;
align-items: center;
justify-content: flex-end;
}
.center { .center {
position: absolute; position: absolute;
top: 50%; top: 50%;
@@ -37,6 +47,9 @@
flex-basis: 0; flex-basis: 0;
} }
.editable {
padding: 0.5em;
}
.editable-hovered { .editable-hovered {
visibility: hidden; visibility: hidden;
@@ -73,12 +86,14 @@
<button mat-button (click)="addText()">Add Text</button> <button mat-button (click)="addText()">Add Text</button>
<button mat-button (click)="addPlot()">Add Plot</button> <button mat-button (click)="addPlot()">Add Plot</button>
<button class="save-button" mat-button (click)="save()" [disabled]="!isDirty()">Save</button> <button class="save-button" mat-button (click)="save()" [disabled]="!isDirty()">Save</button>
<div id="filter-date-range">
Date range: <app-date-picker #datePicker (dateValueSelected)="updateDateRange($event)" ></app-date-picker>
</div>
</div> </div>
<div class="editable"> <div class="editable">
<h1>{{dashboard.name}}<button mat-icon-button (click)="editNameAndDescription()" class="editable-hovered"><img src="/assets/img/edit-outline.svg"/></button></h1> <h1>{{dashboard.name}}<button mat-icon-button (click)="editNameAndDescription()" class="editable-hovered"><img src="/assets/img/edit-outline.svg"/></button></h1>
<p>{{dashboard.description}}</p> <p>{{dashboard.description}}</p>
</div> </div>
<div cdkDropListGroup class="dashboard-area"> <div cdkDropListGroup class="dashboard-area">
<div <div
cdkDropList cdkDropList

View File

@@ -1,6 +1,6 @@
import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop'; import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
import { HttpErrorResponse } from '@angular/common/http'; import { HttpErrorResponse } from '@angular/common/http';
import { Component, ElementRef, OnInit } from '@angular/core'; import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar'; import { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
@@ -9,12 +9,13 @@ import { PlotConfig, PlotResponse, PlotService } from 'src/app/plot.service';
import { NewDashboardComponent } from '../new-dashboard/new-dashboard.component'; import { NewDashboardComponent } from '../new-dashboard/new-dashboard.component';
import { AddPlotDialogComponent } from './add-plot-dialog/add-plot-dialog.component'; import { AddPlotDialogComponent } from './add-plot-dialog/add-plot-dialog.component';
import { AddTextDialogComponent } from './add-text-dialog/add-text-dialog.component'; import { AddTextDialogComponent } from './add-text-dialog/add-text-dialog.component';
import { DatePickerChange, DatePickerComponent } from 'src/app/components/datepicker/date-picker.component';
@Component({ @Component({
selector: 'app-dashboard', selector: 'app-dashboard',
templateUrl: './dashboard.component.html' templateUrl: './dashboard.component.html'
}) })
export class DashboardComponent implements OnInit { export class DashboardComponent implements OnInit{
dashboard?: Dashboard = undefined; dashboard?: Dashboard = undefined;
@@ -24,6 +25,9 @@ export class DashboardComponent implements OnInit {
plotWidgetRenderData: PlotWidgetRenderData[] = []; plotWidgetRenderData: PlotWidgetRenderData[] = [];
@ViewChild("datePicker")
datePicker!: DatePickerComponent;
constructor( constructor(
private route: ActivatedRoute, private route: ActivatedRoute,
private service: DashboardService, private service: DashboardService,
@@ -58,6 +62,13 @@ export class DashboardComponent implements OnInit {
}); });
} }
updateDateRange(e: DatePickerChange) {
this.plotWidgetRenderData.forEach(r => {
r.widget.config.dateRange = e.value;
});
this.loadImages(0, this.plotWidgetRenderData);
}
isDirty() { isDirty() {
return this.pristineDashboardJSON !== JSON.stringify(this.dashboard); return this.pristineDashboardJSON !== JSON.stringify(this.dashboard);
} }
@@ -70,10 +81,13 @@ export class DashboardComponent implements OnInit {
if (plot.isAborted) { if (plot.isAborted) {
this.loadImages(index +1 , plotWidgetQueue); this.loadImages(index +1 , plotWidgetQueue);
}else{ }else{
plot.plotResponse = undefined; // remove old image and show loading icon
const request = PlotWidget.createPlotRequest(plot.widget, plot.submitterId); const request = PlotWidget.createPlotRequest(plot.widget, plot.submitterId);
this.plotService.sendPlotRequest(request).subscribe({ this.plotService.sendPlotRequest(request).subscribe({
next: (response: PlotResponse)=> { next: (response: PlotResponse)=> {
plot.plotResponse= response; plot.plotResponse = response;
}, },
error: (error:any)=> { error: (error:any)=> {
plot.error = error; plot.error = error;

View File

@@ -1,4 +1,4 @@
import { AfterViewInit, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { Component, EventEmitter, Input, Output, ViewChild, input } from '@angular/core';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { ConfirmationDialogComponent } from 'src/app/confirmation-dialog/confirmation-dialog.component'; import { ConfirmationDialogComponent } from 'src/app/confirmation-dialog/confirmation-dialog.component';
import { PlotWidget, PlotWidgetRenderData } from 'src/app/dashboard.service'; import { PlotWidget, PlotWidgetRenderData } from 'src/app/dashboard.service';
@@ -18,14 +18,13 @@ export class PlotWidgetComponent {
public thumbnailUrl = ""; public thumbnailUrl = "";
@ViewChild("plotView") plotView!: PlotViewComponent; //@ViewChild("plotView") plotView!: PlotViewComponent;
@Output() @Output()
deleted : EventEmitter<string> = new EventEmitter<string>(); deleted : EventEmitter<string> = new EventEmitter<string>();
constructor(private dialog: MatDialog, private service: PlotService){} constructor(private dialog: MatDialog, private service: PlotService){}
hasRender(name: string): boolean{ hasRender(name: string): boolean{
return this.data !== undefined && this.data.plotResponse !== undefined && this.data.plotResponse?.rendered[name] !== undefined; return this.data !== undefined && this.data.plotResponse !== undefined && this.data.plotResponse?.rendered[name] !== undefined;
} }

View File

@@ -1,11 +1,26 @@
import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core'; import { Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; import {MAT_DIALOG_DATA, MatDialogModule, MatDialogRef} from '@angular/material/dialog';
import { DashboardCreationData } from 'src/app/dashboard.service'; import { DashboardCreationData } from 'src/app/dashboard.service';
import { AbstractControl, FormControl, FormGroup, ValidationErrors, ValidatorFn, Validators } from '@angular/forms'; import { FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { MatButtonModule } from '@angular/material/button';
import { OverlayModule } from '@angular/cdk/overlay';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
@Component({ @Component({
selector: 'app-new-dashboard', selector: 'app-new-dashboard',
templateUrl: './new-dashboard.component.html' templateUrl: './new-dashboard.component.html',
standalone: true,
imports: [
BrowserModule,
FormsModule,
MatButtonModule,
MatDialogModule,
MatFormFieldModule,
MatInputModule,
ReactiveFormsModule
]
}) })
export class NewDashboardComponent implements OnInit { export class NewDashboardComponent implements OnInit {

View File

@@ -3,7 +3,8 @@ import { Component, OnInit } from '@angular/core';
@Component({ @Component({
selector: 'pdb-help-page', selector: 'pdb-help-page',
templateUrl: './help-page.component.html', templateUrl: './help-page.component.html',
styleUrls: ['./help-page.component.scss'] styleUrls: ['./help-page.component.scss'],
standalone: true
}) })
export class HelpPageComponent implements OnInit { export class HelpPageComponent implements OnInit {

View File

@@ -1,9 +1,14 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
@Component({ @Component({
selector: 'pdb-image-toggle', selector: 'pdb-image-toggle',
templateUrl: './image-toggle.component.html', templateUrl: './image-toggle.component.html',
styleUrls: ['./image-toggle.component.scss'] styleUrls: ['./image-toggle.component.scss'],
standalone: true,
imports: [
BrowserModule
]
}) })
export class ImageToggleComponent implements OnInit { export class ImageToggleComponent implements OnInit {

View File

@@ -1,10 +1,25 @@
import { Component, Input} from '@angular/core'; import { Component } from '@angular/core';
import {FormControl} from '@angular/forms'; import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatInput } from '@angular/material/input';
import { MatOption, MatSelect } from '@angular/material/select';
import { BrowserModule } from '@angular/platform-browser';
@Component({ @Component({
selector: 'pdb-limit-by', selector: 'pdb-limit-by',
templateUrl: './limit-by.component.html', templateUrl: './limit-by.component.html',
styleUrls: ['./limit-by.component.scss'] styleUrls: ['./limit-by.component.scss'],
standalone: true,
imports: [
BrowserModule,
FormsModule,
MatFormField,
MatInput,
MatLabel,
MatSelect,
MatOption,
ReactiveFormsModule
]
}) })
export class LimitByComponent { export class LimitByComponent {

View File

@@ -1,15 +1,14 @@
import { Component, OnInit } from '@angular/core'; import { Component } from '@angular/core';
import { RouterLink } from '@angular/router';
@Component({ @Component({
selector: 'pdb-main-page', selector: 'pdb-main-page',
templateUrl: './main-page.component.html', templateUrl: './main-page.component.html',
styleUrls: ['./main-page.component.scss'] standalone: true,
imports: [
RouterLink
]
}) })
export class MainPageComponent implements OnInit { export class MainPageComponent {
constructor() { }
ngOnInit() {
}
} }

View File

@@ -1,4 +1,4 @@
import { Component, OnInit, Input, Output, ViewChild, EventEmitter, ɵpublishDefaultGlobalUtils } from '@angular/core'; import { Component, Input } from '@angular/core';
import { DashTypeAndColor, PlotResponseStats, DataSeriesStats } from '../plot.service'; import { DashTypeAndColor, PlotResponseStats, DataSeriesStats } from '../plot.service';
import { UtilService } from '../utils.service'; import { UtilService } from '../utils.service';

View File

@@ -1,13 +1,15 @@
<!----> <!---->
<div cdkDrag <div cdkDrag
[ngClass]="{'hidden': !imageUrl || showStats}" [ngClass]="{'hidden': !imageUrl || showStats || dataSeries().length == 0}"
class="plot-view--legend" class="plot-view--legend"
[cdkDragFreeDragPosition]="legendInitialPosition"> [cdkDragFreeDragPosition]="legendInitialPosition">
<div cdkDragHandle></div> <div cdkDragHandle></div>
<ol> <div class="plot-view--legend-content">
<li *ngFor="let stat of dataSeries()"><div class="{{ pointTypeClass(stat.dashTypeAndColor) }}" title="{{ stat.name }}"></div>{{ stat.name }}</li> <ol>
</ol> <li *ngFor="let stat of dataSeries()"><div class="{{ pointTypeClass(stat.dashTypeAndColor) }}" title="{{ stat.name }}"></div>{{ stat.name }}</li>
</ol>
</div>
</div> </div>
<div <div
*ngIf="imageUrl"> *ngIf="imageUrl">

View File

@@ -23,7 +23,6 @@ img {
} }
.plot-view--legend { .plot-view--legend {
padding-bottom: 0.5em;
border: solid 1px #ccc; border: solid 1px #ccc;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -46,6 +45,7 @@ img {
.plot-view--legend div[cdkDragHandle] { .plot-view--legend div[cdkDragHandle] {
visibility: hidden; visibility: hidden;
height: 1.2rem; height: 1.2rem;
flex-shrink: 0;
} }
.plot-view--legend:hover div[cdkDragHandle] { .plot-view--legend:hover div[cdkDragHandle] {
@@ -54,6 +54,15 @@ img {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAF0lEQVQI12P4//8/AwMDhGSEUFCAUwYAJl4R8Z1D4wIAAAAASUVORK5CYII=); background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAF0lEQVQI12P4//8/AwMDhGSEUFCAUwYAJl4R8Z1D4wIAAAAASUVORK5CYII=);
} }
.plot-view--legend-content {
max-height: 30em;
overflow: auto;
max-width: 60em;
overflow: auto;
resize: both;
padding-bottom: 0.5em;
}
.plot-view--legend ol { .plot-view--legend ol {
padding-inline-start: 0.7em; padding-inline-start: 0.7em;
} }
@@ -66,4 +75,6 @@ img {
} }
.plot-view--legend ol li .plot-details-plotType{ .plot-view--legend ol li .plot-details-plotType{
margin-right: 0.3em; margin-right: 0.3em;
flex-shrink: 0;
flex-grow: 0;
} }

View File

@@ -6,6 +6,8 @@ import { WidgetDimensions } from '../dashboard.service';
import { Overlay } from "@angular/cdk/overlay"; import { Overlay } from "@angular/cdk/overlay";
import { DateTime, Duration } from "luxon"; import { DateTime, Duration } from "luxon";
import { DateValue } from '../components/datepicker/date-picker.component';
import { Observable } from 'rxjs';
@Component({ @Component({
selector: 'pdb-plot-view', selector: 'pdb-plot-view',
@@ -32,7 +34,7 @@ export class PlotViewComponent {
loadingEvent : EventEmitter<LoadingEvent> = new EventEmitter<LoadingEvent>(); loadingEvent : EventEmitter<LoadingEvent> = new EventEmitter<LoadingEvent>();
@Output() @Output()
dateRangeUpdateEvent : EventEmitter<string> = new EventEmitter<string>(); dateRangeUpdateEvent : EventEmitter<DateValue> = new EventEmitter<DateValue>();
in_drag_mode = false; in_drag_mode = false;
drag_start_x = 0; drag_start_x = 0;
@@ -184,8 +186,8 @@ export class PlotViewComponent {
const formattedEndDate = endDate.toFormat(this.DATE_PATTERN); const formattedEndDate = endDate.toFormat(this.DATE_PATTERN);
const newDateRange = formattedStartDate+" - "+formattedEndDate; const newDateRange = formattedStartDate+" - "+formattedEndDate;
const newDateValue = new DateValue('ABSOLUTE', newDateRange, newDateRange);
this.dateRangeUpdateEvent.emit(newDateRange); this.dateRangeUpdateEvent.emit(newDateValue);
} }
zoomRange(range: SelectionRange) { zoomRange(range: SelectionRange) {
@@ -294,18 +296,26 @@ export class PlotViewComponent {
* shiftDateByAnchor(dateRangeAsString, 0.20, 0.5) zooms in by 50%, so that the date that was at 20% before the zoom is still at 20% after the zoom * shiftDateByAnchor(dateRangeAsString, 0.20, 0.5) zooms in by 50%, so that the date that was at 20% before the zoom is still at 20% after the zoom
* shiftDateByAnchor(dateRangeAsString, 0.33, 2) zooms out by 50%, so that the date that was at 33% before the zoom is still at 33% after the zoom * shiftDateByAnchor(dateRangeAsString, 0.33, 2) zooms out by 50%, so that the date that was at 33% before the zoom is still at 33% after the zoom
*/ */
shiftDateByAnchor(dateRange:string, anchorInPercentOfDateRange:number, zoomFactor:number) shiftDateByAnchor(dateValue:DateValue, anchorInPercentOfDateRange:number, zoomFactor:number)
{ {
const dateRangeParsed = this.parseDateRange(dateRange); const dateRangeParsed = this.parseDateRange(dateValue);
const dateRangeInSeconds = Math.floor(dateRangeParsed.duration.toMillis()/1000); dateRangeParsed.subscribe({
next: (dataRange: DateRange) => {
const dateRangeInSeconds = Math.floor(dataRange.duration.toMillis()/1000);
const anchorTimestampInSeconds = dateRangeParsed.startDate.plus(Math.floor(dateRangeInSeconds*anchorInPercentOfDateRange)*1000); const anchorTimestampInSeconds = dataRange.startDate.plus(Math.floor(dateRangeInSeconds*anchorInPercentOfDateRange)*1000);
const newDateRangeInSeconds = dateRangeInSeconds * zoomFactor; const newDateRangeInSeconds = dateRangeInSeconds * zoomFactor;
const newStartDate = anchorTimestampInSeconds.minus(newDateRangeInSeconds*anchorInPercentOfDateRange*1000); const newStartDate = anchorTimestampInSeconds.minus(newDateRangeInSeconds*anchorInPercentOfDateRange*1000);
const newEndDate = newStartDate.plus({seconds: newDateRangeInSeconds});; const newEndDate = newStartDate.plus({seconds: newDateRangeInSeconds});;
this.setDateRange(newStartDate, newEndDate);
},
error: (err: any) => {
window.console.error("failed to parse DateValue into DateRange: ", err);
}
})
this.setDateRange(newStartDate, newEndDate);
} }
/** /**
@@ -317,27 +327,35 @@ export class PlotViewComponent {
* shiftDate(dateRangeAsString, -0.5, -0.5) will move the range by half its size to older values * shiftDate(dateRangeAsString, -0.5, -0.5) will move the range by half its size to older values
* shiftDate(dateRangeAsString, 1, 1) will move the range by its size to newer values * shiftDate(dateRangeAsString, 1, 1) will move the range by its size to newer values
*/ */
shiftDate(dateRange: string, factorStartDate: number, factorEndDate: number) shiftDate(dateValue: DateValue, factorStartDate: number, factorEndDate: number)
{ {
const dateRangeParsed = this.parseDateRange(dateRange); this.parseDateRange(dateValue).subscribe(
const dateRangeInSeconds = Math.floor(dateRangeParsed.duration.toMillis()/1000); dateRangeParsed => {
const dateRangeInSeconds = Math.floor(dateRangeParsed.duration.toMillis()/1000);
const newStartDate = dateRangeParsed.startDate.plus({seconds: dateRangeInSeconds*factorStartDate}); const newStartDate = dateRangeParsed.startDate.plus({seconds: dateRangeInSeconds*factorStartDate});
const newEndDate = dateRangeParsed.endDate.plus({seconds: dateRangeInSeconds*factorEndDate}); const newEndDate = dateRangeParsed.endDate.plus({seconds: dateRangeInSeconds*factorEndDate});
this.setDateRange(newStartDate, newEndDate); this.setDateRange(newStartDate, newEndDate);
}
);
} }
parseDateRange(dateRangeAsString : string) : DateRange { parseDateRange(dateValue : DateValue) : Observable<DateRange> {
const startDate = DateTime.fromFormat(dateRangeAsString.slice(0, 19), this.DATE_PATTERN ); return this.service.toDateRange(dateValue);
const endDate = DateTime.fromFormat(dateRangeAsString.slice(22, 41), this.DATE_PATTERN ); /*
.pipe(map((dateRangeAsString:string) => {
const startDate = DateTime.fromFormat(dateRangeAsString.slice(0, 19), this.DATE_PATTERN );
const endDate = DateTime.fromFormat(dateRangeAsString.slice(22, 41), this.DATE_PATTERN );
return { return {
startDate: startDate, startDate: startDate,
endDate: endDate, endDate: endDate,
duration: endDate.diff(startDate), duration: endDate.diff(startDate),
}; };
}));
*/
} }

View File

@@ -1,72 +1,236 @@
import { Injectable, OnInit } from '@angular/core'; import { Injectable, OnInit } from "@angular/core";
import { HttpClient, HttpParams } from '@angular/common/http'; import { HttpClient, HttpParams } from "@angular/common/http";
import { Observable } from 'rxjs'; import { Observable } from "rxjs";
import { map } from 'rxjs/operators'; import { map } from "rxjs/operators";
import { DateValue } from "./components/datepicker/date-picker.component";
import { DateRange } from "./plot-view/plot-view.component";
import { DateTime } from "luxon";
@Injectable({ @Injectable({
providedIn: 'root' providedIn: "root",
}) })
export class PlotService { export class PlotService {
readonly DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss";
plotTypes: Array<PlotType>; plotTypes: Array<PlotType>;
constructor(private http: HttpClient) { constructor(private http: HttpClient) {
this.plotTypes = new Array<PlotType>(); this.plotTypes = new Array<PlotType>();
this.plotTypes.push(new PlotType("SCATTER","Scatter","scatter-chart2",true,DataType.Time,DataType.Duration)); this.plotTypes.push(
this.plotTypes.push(new PlotType("CUM_DISTRIBUTION", "Cumulative Distribution", "cumulative-distribution-chart", true, DataType.Percent, DataType.Duration)); new PlotType(
this.plotTypes.push(new PlotType("HISTOGRAM", "Histogram", "histogram", true, DataType.HistogramBin, DataType.HistogramCount)); "SCATTER",
this.plotTypes.push(new PlotType("PARALLEL", "Parallel Requests", "parallel-requests-chart", true, DataType.Time, DataType.Count)); "Scatter",
this.plotTypes.push(new PlotType("BAR", "Bar (number of requests)", "bar-chart", true, DataType.Group, DataType.Count)); "scatter-chart2",
this.plotTypes.push(new PlotType("BOX", "Box", "box-plot", true, DataType.Time, DataType.Duration)); true,
DataType.Time,
DataType.Duration,
),
);
this.plotTypes.push(
new PlotType(
"CUM_DISTRIBUTION",
"Cumulative Distribution",
"cumulative-distribution-chart",
true,
DataType.Percent,
DataType.Duration,
),
);
this.plotTypes.push(
new PlotType(
"HISTOGRAM",
"Histogram",
"histogram",
true,
DataType.HistogramBin,
DataType.HistogramCount,
),
);
this.plotTypes.push(
new PlotType(
"PARALLEL",
"Parallel Requests",
"parallel-requests-chart",
true,
DataType.Time,
DataType.Count,
),
);
this.plotTypes.push(
new PlotType(
"BAR",
"Bar (number of requests)",
"bar-chart",
true,
DataType.Group,
DataType.Count,
),
);
this.plotTypes.push(
new PlotType(
"BOX",
"Box",
"box-plot",
true,
DataType.Time,
DataType.Duration,
),
);
this.plotTypes.push(new PlotType("HEATMAP", "Heatmap", "heatmap", false, DataType.Other, DataType.Other)); this.plotTypes.push(
this.plotTypes.push(new PlotType("CONTOUR", "Contour", "contour-chart", false, DataType.Time, DataType.Duration)); new PlotType(
this.plotTypes.push(new PlotType("RIDGELINES", "Ridgelines", "ridgelines", false, DataType.Other, DataType.Other)); "HEATMAP",
this.plotTypes.push(new PlotType("QQ", "Quantile-Quantile", "quantile-quantile", false, DataType.Other, DataType.Other)); "Heatmap",
this.plotTypes.push(new PlotType("VIOLIN", "Violin", "violin-chart", false, DataType.Group, DataType.Duration)); "heatmap",
this.plotTypes.push(new PlotType("STRIP", "Strip", "strip-chart", false, DataType.Group, DataType.Duration)); false,
this.plotTypes.push(new PlotType("PIE", "Pie", "pie-chart", false, DataType.Other, DataType.Other)); DataType.Other,
this.plotTypes.push(new PlotType("STEP_FIT", "Step Fit", "step-fit", false, DataType.Other, DataType.Other)); DataType.Other,
this.plotTypes.push(new PlotType("LAG", "Lag", "lag-plot", false, DataType.Other, DataType.Other)); ),
this.plotTypes.push(new PlotType("ACF", "ACF", "acf-plot", false, DataType.Other, DataType.Other)); );
this.plotTypes.push(
new PlotType(
"CONTOUR",
"Contour",
"contour-chart",
false,
DataType.Time,
DataType.Duration,
),
);
this.plotTypes.push(
new PlotType(
"RIDGELINES",
"Ridgelines",
"ridgelines",
false,
DataType.Other,
DataType.Other,
),
);
this.plotTypes.push(
new PlotType(
"QQ",
"Quantile-Quantile",
"quantile-quantile",
false,
DataType.Other,
DataType.Other,
),
);
this.plotTypes.push(
new PlotType(
"VIOLIN",
"Violin",
"violin-chart",
false,
DataType.Group,
DataType.Duration,
),
);
this.plotTypes.push(
new PlotType(
"STRIP",
"Strip",
"strip-chart",
false,
DataType.Group,
DataType.Duration,
),
);
this.plotTypes.push(
new PlotType(
"PIE",
"Pie",
"pie-chart",
false,
DataType.Other,
DataType.Other,
),
);
this.plotTypes.push(
new PlotType(
"STEP_FIT",
"Step Fit",
"step-fit",
false,
DataType.Other,
DataType.Other,
),
);
this.plotTypes.push(
new PlotType(
"LAG",
"Lag",
"lag-plot",
false,
DataType.Other,
DataType.Other,
),
);
this.plotTypes.push(
new PlotType(
"ACF",
"ACF",
"acf-plot",
false,
DataType.Other,
DataType.Other,
),
);
} }
getPlotTypes(): Array<PlotType> { getPlotTypes(): Array<PlotType> {
return this.plotTypes.filter(plotType => plotType.active); return this.plotTypes.filter((plotType) => plotType.active);
} }
getTagFields(): Observable<Array<string>> { getTagFields(): Observable<Array<string>> {
return this.http.get<Array<string>>('//'+window.location.hostname+':'+window.location.port+'/api/fields'); return this.http.get<Array<string>>(
"//" + window.location.hostname + ":" + window.location.port +
"/api/fields",
);
} }
autocomplete(query: string, caretIndex: number, resultMode: ResultMode): Observable<AutocompleteResult> autocomplete(
{ query: string,
caretIndex: number,
resultMode: ResultMode,
): Observable<AutocompleteResult> {
const options = { const options = {
params: new HttpParams() params: new HttpParams()
.set('caretIndex', ""+caretIndex) .set("caretIndex", "" + caretIndex)
.set('query', query) .set("query", query)
.set('resultMode', resultMode) .set("resultMode", resultMode),
}; };
return this.http.get<AutocompleteResult>('//'+window.location.hostname+':'+window.location.port+'/api/autocomplete', options); return this.http.get<AutocompleteResult>(
"//" + window.location.hostname + ":" + window.location.port +
"/api/autocomplete",
options,
);
} }
abort(submitterId: string): Observable<void>{ abort(submitterId: string): Observable<void> {
return this.http.delete<void>('//'+window.location.hostname+':'+window.location.port+'/api/plots/'+submitterId) return this.http.delete<void>(
"//" + window.location.hostname + ":" + window.location.port +
"/api/plots/" + submitterId,
);
} }
sendPlotRequest(plotRequest: PlotRequest): Observable<PlotResponse>{ sendPlotRequest(plotRequest: PlotRequest): Observable<PlotResponse> {
//console.log("send plot request: "+ JSON.stringify(plotRequest)); //console.log("send plot request: "+ JSON.stringify(plotRequest));
const result = this.http.post<PlotResponse>('//'+window.location.hostname+':'+window.location.port+'/api/plots', plotRequest); const result = this.http.post<PlotResponse>(
"//" + window.location.hostname + ":" + window.location.port +
"/api/plots",
plotRequest,
);
return result.pipe(map(this.enrichStats)); return result.pipe(map(this.enrichStats));
} }
enrichStats(response: PlotResponse): PlotResponse { enrichStats(response: PlotResponse): PlotResponse {
let maxAvgRatio = 0; let maxAvgRatio = 0;
let x : DataSeriesStats[] = response.stats.dataSeriesStats; let x: DataSeriesStats[] = response.stats.dataSeriesStats;
for (const row in x){ for (const row in x) {
for (const col in x){ for (const col in x) {
maxAvgRatio = Math.max(maxAvgRatio, x[row].average / x[col].average); maxAvgRatio = Math.max(maxAvgRatio, x[row].average / x[col].average);
} }
} }
@@ -76,39 +240,56 @@ export class PlotService {
return response; return response;
} }
getFilterDefaults(): Observable<FilterDefaults>{ getFilterDefaults(): Observable<FilterDefaults> {
return this.http.get<FilterDefaults>('//'+window.location.hostname+':'+window.location.port+'/api/filters/defaults') return this.http.get<FilterDefaults>(
"//" + window.location.hostname + ":" + window.location.port +
"/api/filters/defaults",
);
} }
splitQuery(query: string, splitBy:string) : Observable<Array<string>>{ splitQuery(query: string, splitBy: string): Observable<Array<string>> {
const q = "(" + query + ") and " + splitBy + "=";
const q = "("+query+") and "+splitBy+"="; return this.autocomplete(q, q.length + 1, ResultMode.FULL_VALUES).pipe(
return this.autocomplete(q, q.length+1, ResultMode.FULL_VALUES).pipe(
map( map(
(autocompleteResult: AutocompleteResult) => autocompleteResult.proposals.map((suggestion:Suggestion) => suggestion.value) (autocompleteResult: AutocompleteResult) =>
) autocompleteResult.proposals.map((suggestion: Suggestion) =>
suggestion.value
),
),
); );
} }
toDateRange(dateValue: DateValue): Observable<DateRange> {
return this.http.post<{start: string, end:string, startEpochMilli: number, endEpochMilli: number}>("//" + window.location.hostname+":" + window.location.port +"/api/dates",dateValue)
.pipe(map((data) => {
const startDate = DateTime.fromFormat(data.start.slice(0, -1), this.DATE_PATTERN );
const endDate = DateTime.fromFormat(data.end.slice(0, -1), this.DATE_PATTERN );
return {
startDate: startDate,
endDate: endDate,
duration: endDate.diff(startDate),
};
}));
}
} }
export class PlotType { export class PlotType {
constructor( constructor(
public id: string, public id: string,
public name: string, public name: string,
public icon: string, public icon: string,
public active: boolean, public active: boolean,
public xAxis: DataType, public xAxis: DataType,
public yAxis: DataType) { public yAxis: DataType,
) {
} }
compatible(others: Array<PlotType>) : boolean { compatible(others: Array<PlotType>): boolean {
var xAxisTypes = new Set([this.xAxis]); var xAxisTypes = new Set([this.xAxis]);
var yAxisTypes = new Set([this.yAxis]); var yAxisTypes = new Set([this.yAxis]);
for(var i = 0; i < others.length; i++){ for (var i = 0; i < others.length; i++) {
var other = others[i]; var other = others[i];
xAxisTypes.add(other.xAxis); xAxisTypes.add(other.xAxis);
yAxisTypes.add(other.yAxis); yAxisTypes.add(other.yAxis);
@@ -127,40 +308,40 @@ export class TagField {
} }
export enum DataType { export enum DataType {
Time, Time,
Duration, Duration,
Percent, Percent,
Count, Count,
Group, Group,
Metric, Metric,
HistogramBin, HistogramBin,
HistogramCount, HistogramCount,
Other Other,
} }
export class AxesTypes { export class AxesTypes {
x : Array<DataType>; x: Array<DataType>;
y : Array<DataType>; y: Array<DataType>;
constructor(x: Array<DataType>, y : Array<DataType>) { constructor(x: Array<DataType>, y: Array<DataType>) {
this.x = x; this.x = x;
this.y = y; this.y = y;
} }
hasXAxis(type : DataType){ hasXAxis(type: DataType) {
return this.x.includes(type); return this.x.includes(type);
} }
hasYAxis(type : DataType){ hasYAxis(type: DataType) {
return this.y.includes(type); return this.y.includes(type);
} }
/** /**
* return the 1-indexed axis data type, e.g. getXAxisDataType(1) for the x1 axis * return the 1-indexed axis data type, e.g. getXAxisDataType(1) for the x1 axis
*/ */
getXAxisDataType(index: number){ getXAxisDataType(index: number) {
if (this.x.length+1 >= index){ if (this.x.length + 1 >= index) {
return this.x[index-1]; return this.x[index - 1];
} }
return undefined; return undefined;
} }
@@ -168,9 +349,9 @@ export class AxesTypes {
/** /**
* return the 1-indexed axis data type, e.g. getYAxisDataType(1) for the x1 axis * return the 1-indexed axis data type, e.g. getYAxisDataType(1) for the x1 axis
*/ */
getYAxisDataType(index: number){ getYAxisDataType(index: number) {
if (this.y.length+1 >= index){ if (this.y.length + 1 >= index) {
return this.y[index-1]; return this.y[index - 1];
} }
return undefined; return undefined;
} }
@@ -181,10 +362,10 @@ export class AxesTypes {
const x2 = this.getXAxisDataType(2); const x2 = this.getXAxisDataType(2);
const y2 = this.getYAxisDataType(2); const y2 = this.getYAxisDataType(2);
return (x1 ? "x1:"+DataType[x1] : "") return (x1 ? "x1:" + DataType[x1] : "") +
+ (y1 ? " y1:"+DataType[y1] : "") (y1 ? " y1:" + DataType[y1] : "") +
+ (x2 ? " x2:"+DataType[x2] : "") (x2 ? " x2:" + DataType[x2] : "") +
+ (y2 ? " y2:"+DataType[y2] : ""); (y2 ? " y2:" + DataType[y2] : "");
} }
} }
@@ -192,12 +373,12 @@ export class Suggestion {
constructor( constructor(
public value: string, public value: string,
public newQuery: string, public newQuery: string,
public newCaretPosition: number){} public newCaretPosition: number,
) {}
} }
export class AutocompleteResult {
export class AutocompleteResult{ constructor(public proposals: Array<Suggestion>) {}
constructor(public proposals: Array<Suggestion>){}
} }
export type RenderOptionsMap = { export type RenderOptionsMap = {
@@ -212,9 +393,8 @@ export class PlotRequest {
constructor( constructor(
public submitterId: string, public submitterId: string,
public config: PlotConfig, public config: PlotConfig,
public renders: RenderOptionsMap public renders: RenderOptionsMap,
){} ) {}
copy(): PlotRequest { copy(): PlotRequest {
return JSON.parse(JSON.stringify(this)); return JSON.parse(JSON.stringify(this));
@@ -222,17 +402,19 @@ export class PlotRequest {
} }
export class PlotConfig { export class PlotConfig {
constructor( public query : string, constructor(
public groupBy : Array<string>, public query: string,
public limitBy : string, public groupBy: Array<string>,
public limit : number, public limitBy: string,
public y1:YAxisDefinition, public limit: number,
public y2:YAxisDefinition|undefined, public y1: YAxisDefinition,
public dateRange : string, public y2: YAxisDefinition | undefined,
public aggregates : Array<string>, public dateRange: DateValue,
public aggregates: Array<string>,
public intervalUnit: string, public intervalUnit: string,
public intervalValue: number, public intervalValue: number,
public renderBarChartTickLabels: boolean = false,) {} public renderBarChartTickLabels: boolean = false,
) {}
} }
export class RenderOptions { export class RenderOptions {
@@ -240,58 +422,65 @@ export class RenderOptions {
public height: number, public height: number,
public width: number, public width: number,
public showKey: boolean, public showKey: boolean,
public renderLabels: boolean) {} public renderLabels: boolean,
) {}
} }
export class YAxisDefinition { export class YAxisDefinition {
constructor( constructor(
public axisScale : string, public axisScale: string,
public rangeMin : number, public rangeMin: number,
public rangeMax : number, public rangeMax: number,
public rangeUnit : string){} public rangeUnit: string,
) {}
} }
export class PlotResponse { export class PlotResponse {
constructor( constructor(
public stats : PlotResponseStats, public stats: PlotResponseStats,
public rendered: RenderedImages){} public rendered: RenderedImages,
) {}
} }
export class PlotResponseStats { export class PlotResponseStats {
constructor( constructor(
public maxValue : number, public maxValue: number,
public values : number, public values: number,
public average : number, public average: number,
public plottedValues : number, public plottedValues: number,
public maxAvgRatio: number, public maxAvgRatio: number,
public dataSeriesStats : Array<DataSeriesStats>){} public dataSeriesStats: Array<DataSeriesStats>,
) {}
} }
export class DataSeriesStats { export class DataSeriesStats {
constructor( constructor(
public name: string, public name: string,
public values : number, public values: number,
public maxValue : number, public maxValue: number,
public average : number , public average: number,
public plottedValues : number, public plottedValues: number,
public dashTypeAndColor: DashTypeAndColor, public dashTypeAndColor: DashTypeAndColor,
public percentiles: Map<string, number>){} public percentiles: Map<string, number>,
) {}
} }
export class DashTypeAndColor { export class DashTypeAndColor {
constructor( constructor(
public color: string, public color: string,
public pointType: number) {} public pointType: number,
) {}
} }
export class FilterDefaults { export class FilterDefaults {
constructor( constructor(
public groupBy: Array<string>, public groupBy: Array<string>,
public fields: Array<string>, public fields: Array<string>,
public splitBy: string){} public splitBy: string,
) {}
} }
export enum ResultMode { export enum ResultMode {
CUT_AT_DOT = "CUT_AT_DOT", CUT_AT_DOT = "CUT_AT_DOT",
FULL_VALUES = "FULL_VALUES" FULL_VALUES = "FULL_VALUES",
} }

View File

@@ -3,7 +3,8 @@ import { Component, OnInit } from '@angular/core';
@Component({ @Component({
selector: 'pdb-upload-page', selector: 'pdb-upload-page',
templateUrl: './upload-page.component.html', templateUrl: './upload-page.component.html',
styleUrls: ['./upload-page.component.scss'] styleUrls: ['./upload-page.component.scss'],
standalone: true
}) })
export class UploadPageComponent implements OnInit { export class UploadPageComponent implements OnInit {

View File

@@ -1,22 +1,34 @@
<div id="visualization"> <div id="visualization">
<div id="query-box"> <div id="query-box">
<pdb-query-autocomplete #query></pdb-query-autocomplete> <pdb-query-autocomplete #query></pdb-query-autocomplete>
</div> </div>
<div id="date-box"> <div id="date-box">
<app-date-picker #datePicker></app-date-picker>
<!--
<mat-form-field class="pdb-form-full-width"> <mat-form-field class="pdb-form-full-width">
<mat-label>Date Range:</mat-label> <mat-label>Date Range:</mat-label>
<input matInput id="search-date-range" value="dateRange" name="dates" /> <input matInput id="search-date-range" value="dateRange" name="dates" />
</mat-form-field> </mat-form-field>
-->
</div> </div>
<div id="filters"> <div id="filters">
<div id="filterpanel"> <div id="filterpanel">
<mat-form-field class="pdb-form-full-width"> <mat-form-field class="pdb-form-full-width">
<mat-label>Type:</mat-label> <mat-label>Type:</mat-label>
<mat-select multiple [(ngModel)]="selectedPlotType" (ngModelChange)="changePlotType($event)"> <mat-select
<mat-option *ngFor="let plotType of plotTypes" [value]="plotType" [disabled]="!plotType.active"> multiple
<img src="assets/img/{{plotType.icon}}.svg" class="icon-select" /> {{plotType.name}} [(ngModel)]="selectedPlotType"
(ngModelChange)="changePlotType($event)"
>
<mat-option
*ngFor="let plotType of plotTypes"
[value]="plotType"
[disabled]="!plotType.active"
>
<img src="assets/img/{{ plotType.icon }}.svg" class="icon-select" />
{{ plotType.name }}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@@ -24,60 +36,85 @@
<mat-form-field class="pdb-form-full-width"> <mat-form-field class="pdb-form-full-width">
<mat-label>Group By:</mat-label> <mat-label>Group By:</mat-label>
<mat-select multiple [(value)]="groupBy"> <mat-select multiple [(value)]="groupBy">
<mat-option *ngFor="let tagField of tagFields" [value]="tagField">{{tagField.name}}</mat-option> <mat-option *ngFor="let tagField of tagFields" [value]="tagField">{{
tagField.name
}}</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<pdb-limit-by #limitbycomponent></pdb-limit-by> <pdb-limit-by #limitbycomponent></pdb-limit-by>
<div [hidden]="!selectedPlotTypesContains(['BAR', 'BOX'])"> <div [hidden]="!selectedPlotTypesContains(['BAR', 'BOX'])">
<mat-form-field > <mat-form-field>
<mat-label>Intervals (only bar chart):</mat-label> <mat-label>Intervals (only bar chart):</mat-label>
<mat-select [(value)]="intervalUnit"> <mat-select [(value)]="intervalUnit">
<mat-option value="NO_INTERVAL">-</mat-option> <mat-option value="NO_INTERVAL">-</mat-option>
<mat-option value="SECOND">second</mat-option> <mat-option value="SECOND">second</mat-option>
<mat-option value="MINUTE">minute</mat-option> <mat-option value="MINUTE">minute</mat-option>
<mat-option value="HOUR">hour</mat-option> <mat-option value="HOUR">hour</mat-option>
<mat-option value="DAY">day</mat-option> <mat-option value="DAY">day</mat-option>
<mat-option value="WEEK">week</mat-option> <mat-option value="WEEK">week</mat-option>
<mat-option value="MONTH">month</mat-option> <mat-option value="MONTH">month</mat-option>
<mat-option value="YEAR">year</mat-option> <mat-option value="YEAR">year</mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</div> </div>
<div [hidden]="!selectedPlotTypesContains(['BAR', 'BOX'])"> <div [hidden]="!selectedPlotTypesContains(['BAR', 'BOX'])">
<mat-checkbox [(ngModel)]="renderBarChartTickLabels">Show Tic Labels (bar chart)</mat-checkbox> <mat-checkbox [(ngModel)]="renderBarChartTickLabels"
>Show Tic Labels (bar chart)</mat-checkbox
>
</div> </div>
<pdb-y-axis-definition #y1AxisDefinitionComponent yIndex="1"></pdb-y-axis-definition> <pdb-y-axis-definition
<pdb-y-axis-definition #y2AxisDefinitionComponent yIndex="2" [hidden]="!y2AxisAvailable"></pdb-y-axis-definition> #y1AxisDefinitionComponent
yIndex="1"
></pdb-y-axis-definition>
<pdb-y-axis-definition
#y2AxisDefinitionComponent
yIndex="2"
[hidden]="!y2AxisAvailable"
></pdb-y-axis-definition>
<mat-checkbox *ngIf="galleryEnabled" [(ngModel)]="enableGallery" (click)="toggleGallery($event)">Gallery</mat-checkbox> <mat-checkbox
*ngIf="galleryEnabled"
[(ngModel)]="enableGallery"
(click)="toggleGallery($event)"
>Gallery</mat-checkbox
>
<mat-form-field *ngIf="enableGallery" class="pdb-form-full-width"> <mat-form-field *ngIf="enableGallery" class="pdb-form-full-width">
<mat-label>Split By:</mat-label> <mat-label>Split By:</mat-label>
<mat-select [(value)]="splitBy"> <mat-select [(value)]="splitBy">
<mat-option *ngFor="let tagField of tagFields" [value]="tagField">{{tagField.name}}</mat-option> <mat-option *ngFor="let tagField of tagFields" [value]="tagField">{{
tagField.name
}}</mat-option>
</mat-select> </mat-select>
<mat-error *ngIf="splitBy == null || true"> <mat-error *ngIf="splitBy == null || true">
Please select a value! Please select a value!
</mat-error> </mat-error>
</mat-form-field> </mat-form-field>
<div id="plot-button-bar"> <div id="plot-button-bar">
<a <a
mat-icon-button mat-icon-button
[routerLink]="['/vis']" [routerLink]="['/vis']"
[queryParams]="{config: serializedConfig()}" [queryParams]="{ config: serializedConfig() }"
target="_blank" target="_blank"
aria-label="open new window with the same search" aria-label="open new window with the same search"
title="open new window with the same search"><img src="assets/img/link.svg" aria-hidden="true"/></a> title="open new window with the same search"
><img src="assets/img/link.svg" aria-hidden="true"
/></a>
<button <button
*ngIf="!enableGallery && !plotJobActive" *ngIf="!enableGallery && !plotJobActive"
[disabled]="plotJobActive" [disabled]="plotJobActive"
mat-button mat-button
matTooltip="Create Plot" matTooltip="Create Plot"
(click)="plot()"> (click)="plot()"
<img src="assets/img/scatter-chart2.svg" class="icon-inline" aria-hidden="true" title="create plot" /> >
<img
src="assets/img/scatter-chart2.svg"
class="icon-inline"
aria-hidden="true"
title="create plot"
/>
Plot Plot
</button> </button>
<button <button
@@ -85,15 +122,24 @@
mat-button mat-button
matTooltip="Create Gallery" matTooltip="Create Gallery"
(click)="gallery()" (click)="gallery()"
[disabled]="this.splitBy == null"> [disabled]="this.splitBy == null"
<img src="assets/img/four-squares-line.svg" class="icon-inline" aria-hidden="true" title="Create Gallery (only active if 'Split' is set)" /> >
<img
src="assets/img/four-squares-line.svg"
class="icon-inline"
aria-hidden="true"
title="Create Gallery (only active if 'Split' is set)"
/>
Gallery Gallery
</button> </button>
<button <button
*ngIf="plotJobActive" *ngIf="plotJobActive"
mat-button mat-button
(click)="abort()" (click)="abort()"
matTooltip="abort"><img src="assets/img/close.svg" class="icon-inline" /> Abort</button> matTooltip="abort"
>
<img src="assets/img/close.svg" class="icon-inline" /> Abort
</button>
</div> </div>
</div> </div>
</div> </div>
@@ -102,12 +148,8 @@
<pdb-plot-view <pdb-plot-view
#plotView #plotView
(loadingEvent)="loading($event)" (loadingEvent)="loading($event)"
(dateRangeUpdateEvent)="updateDateRange($event)"></pdb-plot-view> (dateRangeUpdateEvent)="updateDateRange($event)"
<pdb-gallery-view ></pdb-plot-view>
#galleryView> <pdb-gallery-view #galleryView> </pdb-gallery-view>
</pdb-gallery-view>
</div> </div>
</div> </div>

View File

@@ -15,7 +15,7 @@
grid: grid:
"query-box query-box date-box" auto "query-box query-box date-box" auto
"filters results results" 1fr "filters results results" 1fr
/ 25.5em 3fr 23.5em; / 25.5em 3fr auto;
} }
} }
@@ -43,6 +43,8 @@
#date-box{ #date-box{
grid-area: date-box; grid-area: date-box;
display: flex;
align-items: center;
} }

View File

@@ -1,21 +1,46 @@
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core'; import {
import { PlotService, PlotType, PlotRequest, TagField, FilterDefaults, DataType, AxesTypes, PlotConfig, RenderOptions, RenderOptionsMap, Suggestion } from '../plot.service'; AfterViewInit,
import { UntypedFormControl, } from '@angular/forms'; Component,
import { MatSnackBar } from '@angular/material/snack-bar'; Input,
import { LimitByComponent } from '../limit-by/limit-by.component'; OnInit,
import { YAxisDefinitionComponent } from '../y-axis-definition/y-axis-definition.component'; ViewChild,
import { QueryAutocompleteComponent } from '../query-autocomplete/query-autocomplete.component'; } from "@angular/core";
import { PlotViewComponent, LoadingEvent } from '../plot-view/plot-view.component'; import {
import { GalleryViewComponent } from '../gallery-view/gallery-view.component'; AxesTypes,
import { WidgetDimensions } from '../dashboard.service'; DataType,
FilterDefaults,
PlotConfig,
PlotRequest,
PlotService,
PlotType,
RenderOptions,
RenderOptionsMap,
Suggestion,
TagField,
} from "../plot.service";
import { UntypedFormControl } from "@angular/forms";
import { MatSnackBar } from "@angular/material/snack-bar";
import { LimitByComponent } from "../limit-by/limit-by.component";
import { YAxisDefinitionComponent } from "../y-axis-definition/y-axis-definition.component";
import { QueryAutocompleteComponent } from "../query-autocomplete/query-autocomplete.component";
import {
DateRange,
LoadingEvent,
PlotViewComponent,
} from "../plot-view/plot-view.component";
import { GalleryViewComponent } from "../gallery-view/gallery-view.component";
import { WidgetDimensions } from "../dashboard.service";
import {
DatePickerComponent,
DateValue,
} from "../components/datepicker/date-picker.component";
@Component({ @Component({
selector: 'pdb-visualization-page', selector: "pdb-visualization-page",
templateUrl: './visualization-page.component.html', templateUrl: "./visualization-page.component.html",
styleUrls: ['./visualization-page.component.scss'] styleUrls: ["./visualization-page.component.scss"],
}) })
export class VisualizationPageComponent implements OnInit, AfterViewInit { export class VisualizationPageComponent implements OnInit, AfterViewInit {
readonly DATE_PATTERN = "YYYY-MM-DD HH:mm:ss"; // for moment-JS readonly DATE_PATTERN = "YYYY-MM-DD HH:mm:ss"; // for moment-JS
@Input() @Input()
@@ -24,7 +49,9 @@ export class VisualizationPageComponent implements OnInit, AfterViewInit {
@Input() @Input()
galleryEnabled = true; galleryEnabled = true;
dateRange = new UntypedFormControl('2019-10-05 00:00:00 - 2019-10-11 23:59:59'); dateRange = new UntypedFormControl(
"2019-10-05 00:00:00 - 2019-10-11 23:59:59",
);
selectedPlotType = new Array<PlotType>(); selectedPlotType = new Array<PlotType>();
plotTypes: PlotType[] = []; plotTypes: PlotType[] = [];
@@ -33,37 +60,38 @@ export class VisualizationPageComponent implements OnInit, AfterViewInit {
groupBy = new Array<TagField>(); groupBy = new Array<TagField>();
@ViewChild('limitbycomponent') @ViewChild("limitbycomponent")
private limitbycomponent! : LimitByComponent; private limitbycomponent!: LimitByComponent;
@ViewChild("y1AxisDefinitionComponent", { read: YAxisDefinitionComponent })
private y1AxisDefinitionComponent!: YAxisDefinitionComponent;
@ViewChild('y1AxisDefinitionComponent', { read: YAxisDefinitionComponent }) @ViewChild("y2AxisDefinitionComponent", { read: YAxisDefinitionComponent })
private y1AxisDefinitionComponent! : YAxisDefinitionComponent; private y2AxisDefinitionComponent!: YAxisDefinitionComponent;
@ViewChild('y2AxisDefinitionComponent', { read: YAxisDefinitionComponent }) @ViewChild("query")
private y2AxisDefinitionComponent! : YAxisDefinitionComponent;
@ViewChild('query')
query!: QueryAutocompleteComponent; query!: QueryAutocompleteComponent;
@ViewChild('plotView') @ViewChild("plotView")
plotView!: PlotViewComponent; plotView!: PlotViewComponent;
@ViewChild('galleryView') @ViewChild("galleryView")
galleryView!: GalleryViewComponent; galleryView!: GalleryViewComponent;
@ViewChild("datePicker")
datePicker!: DatePickerComponent;
enableGallery = false; enableGallery = false;
splitBy : TagField | undefined = undefined; splitBy: TagField | undefined = undefined;
y2AxisAvailable = false; y2AxisAvailable = false;
intervalUnit = 'NO_INTERVAL'; intervalUnit = "NO_INTERVAL";
intervalValue = 1; intervalValue = 1;
renderBarChartTickLabels = false; renderBarChartTickLabels = false;
plotJobActive = false; plotJobActive = false;
constructor(private plotService: PlotService, private snackBar: MatSnackBar) { constructor(private plotService: PlotService, private snackBar: MatSnackBar) {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
if (!this.defaultConfig && params.get("config")) { if (!this.defaultConfig && params.get("config")) {
const config = JSON.parse(params.get("config")!); const config = JSON.parse(params.get("config")!);
@@ -71,105 +99,116 @@ export class VisualizationPageComponent implements OnInit, AfterViewInit {
} }
} }
showError(message:string) { showError(message: string) {
this.snackBar.open(message, "", { this.snackBar.open(message, "", {
duration: 5000, duration: 5000,
verticalPosition: 'top' verticalPosition: "top",
}); });
} }
ngOnInit() { ngOnInit() {
(<any> window).initDatePicker();
(<any>window).initDatePicker();
this.plotTypes = this.plotService.getPlotTypes(); this.plotTypes = this.plotService.getPlotTypes();
this.selectedPlotType.push(this.plotTypes[0]); this.selectedPlotType.push(this.plotTypes[0]);
this.plotService.getFilterDefaults().subscribe((filterDefaults: FilterDefaults) => { this.plotService.getFilterDefaults().subscribe(
(filterDefaults: FilterDefaults) => {
filterDefaults.fields.forEach((name: string) => {
this.tagFields.push(new TagField(name));
}, (error: any) => {
this.showError(error.error.message);
});
filterDefaults.fields.forEach((name:string) => { const groupByDefaults = this.defaultConfig
this.tagFields.push(new TagField(name)); ? this.defaultConfig.groupBy
: filterDefaults.groupBy;
this.groupBy = this.tagFields.filter((val) =>
groupByDefaults.includes(val.name)
);
this.splitBy = this.tagFields.find((val) =>
filterDefaults.splitBy == val.name
);
if (this.defaultConfig) {
this.plot();
}
}, },
(error: any) => { );
this.showError(error.error.message);
});
const groupByDefaults = this.defaultConfig ? this.defaultConfig.groupBy : filterDefaults.groupBy;
this.groupBy = this.tagFields.filter(val => groupByDefaults.includes(val.name));
this.splitBy = this.tagFields.find(val => filterDefaults.splitBy == val.name);
if (this.defaultConfig) {
this.plot();
}
});
} }
ngAfterViewInit(): void { ngAfterViewInit(): void {
if (this.defaultConfig) { if (this.defaultConfig) {
const c = this.defaultConfig; const c = this.defaultConfig;
this.query.suggestionFetcherEnabled = false; this.query.suggestionFetcherEnabled = false;
this.query.queryField.setValue(new Suggestion(c.query, c.query, c.query.length)); this.query.queryField.setValue(
this.query.suggestionFetcherEnabled = true; new Suggestion(c.query, c.query, c.query.length),
);
this.query.suggestionFetcherEnabled = true;
this.selectedPlotType = this.plotTypes.filter(pt => c.aggregates.includes(pt.id)); this.selectedPlotType = this.plotTypes.filter((pt) =>
this.changePlotType(this.selectedPlotType); c.aggregates.includes(pt.id)
this.updateDateRange(c.dateRange, false); );
this.limitbycomponent.limitBy = c.limitBy; this.changePlotType(this.selectedPlotType);
this.limitbycomponent.limit = c.limit; this.updateDateRange(c.dateRange, false);
this.intervalUnit = c.intervalUnit; this.limitbycomponent.limitBy = c.limitBy;
this.intervalValue = c.intervalValue; this.limitbycomponent.limit = c.limit;
this.y1AxisDefinitionComponent.yAxisScale = c.y1.axisScale; this.intervalUnit = c.intervalUnit;
this.y1AxisDefinitionComponent.minYValue = c.y1.rangeMin; this.intervalValue = c.intervalValue;
this.y1AxisDefinitionComponent.maxYValue = c.y1.rangeMax; this.y1AxisDefinitionComponent.yAxisScale = c.y1.axisScale;
this.y1AxisDefinitionComponent.yAxisUnit = c.y1.rangeUnit; this.y1AxisDefinitionComponent.minYValue = c.y1.rangeMin;
this.y1AxisDefinitionComponent.maxYValue = c.y1.rangeMax;
this.y1AxisDefinitionComponent.yAxisUnit = c.y1.rangeUnit;
if (c.y2) { if (c.y2) {
this.y2AxisDefinitionComponent.yAxisScale = c.y2.axisScale; this.y2AxisDefinitionComponent.yAxisScale = c.y2.axisScale;
this.y2AxisDefinitionComponent.minYValue = c.y2.rangeMin; this.y2AxisDefinitionComponent.minYValue = c.y2.rangeMin;
this.y2AxisDefinitionComponent.maxYValue = c.y2.rangeMax; this.y2AxisDefinitionComponent.maxYValue = c.y2.rangeMax;
this.y2AxisDefinitionComponent.yAxisUnit = c.y2.rangeUnit; this.y2AxisDefinitionComponent.yAxisUnit = c.y2.rangeUnit;
}
} }
} }
}
toggleGallery(event: Event){ toggleGallery(event: Event) {
this.galleryView.show = this.enableGallery; this.galleryView.show = this.enableGallery;
} }
loading(event: LoadingEvent) { loading(event: LoadingEvent) {
this.plotJobActive = event.loading; this.plotJobActive = event.loading;
} }
updateDateRange(newDateRange: string, updatePlot=true) { updateDateRange(newDateRange: DateValue, updatePlot = true) {
(<HTMLInputElement>document.getElementById("search-date-range")).value = newDateRange; this.datePicker.setDateValue(newDateRange);
if (updatePlot){ if (updatePlot) {
this.plot(); this.plot();
} }
} }
changePlotType(selectedPlotTypes: Array<PlotType>) { changePlotType(selectedPlotTypes: Array<PlotType>) {
const compatiblePlotTypes = this.plotTypes.filter(pt => pt.compatible(selectedPlotTypes)); const compatiblePlotTypes = this.plotTypes.filter((pt) =>
this.plotTypes.forEach(pt => pt.active=false); pt.compatible(selectedPlotTypes)
compatiblePlotTypes.forEach(pt => pt.active=true); );
this.plotTypes.forEach((pt) => pt.active = false);
compatiblePlotTypes.forEach((pt) => pt.active = true);
const axesTypes = this.getAxes(); const axesTypes = this.getAxes();
this.y2AxisAvailable = axesTypes.y.length == 2; this.y2AxisAvailable = axesTypes.y.length == 2;
} }
selectedPlotTypesContains(plotTypeIds: Array<string>){ selectedPlotTypesContains(plotTypeIds: Array<string>) {
return this.selectedPlotType.filter(pt => plotTypeIds.includes(pt.id)).length > 0; return this.selectedPlotType.filter((pt) => plotTypeIds.includes(pt.id))
.length > 0;
} }
dateRangeAsString(): DateValue {
dateRangeAsString() : string { return this.datePicker.getDateValue();
return (<HTMLInputElement>document.getElementById("search-date-range")).value;
} }
gallery(){ gallery() {
if (this.splitBy != null){ if (this.splitBy != null) {
this.plotView.imageUrl = ''; this.plotView.imageUrl = "";
this.plotView.stats = null; this.plotView.stats = null;
this.galleryView.show=true; this.galleryView.show = true;
const request = this.createPlotRequest(); const request = this.createPlotRequest();
this.galleryView.renderGallery(request, this.splitBy.name); this.galleryView.renderGallery(request, this.splitBy.name);
} else { } else {
@@ -177,12 +216,11 @@ toggleGallery(event: Event){
} }
} }
getAxes() : AxesTypes { getAxes(): AxesTypes {
const x = new Array<DataType>(); const x = new Array<DataType>();
const y = new Array<DataType>(); const y = new Array<DataType>();
for(var i = 0; i < this.selectedPlotType.length; i++){ for (var i = 0; i < this.selectedPlotType.length; i++) {
var plotType = this.selectedPlotType[i]; var plotType = this.selectedPlotType[i];
if (!x.includes(plotType.xAxis)) { if (!x.includes(plotType.xAxis)) {
x.push(plotType.xAxis); x.push(plotType.xAxis);
@@ -192,43 +230,46 @@ toggleGallery(event: Event){
} }
} }
return new AxesTypes(x,y); return new AxesTypes(x, y);
} }
abort() { abort() {
this.plotService.abort((<any>window).submitterId).subscribe({ this.plotService.abort((<any> window).submitterId).subscribe({
complete: () => { complete: () => {
} },
}); });
} }
plot(){ plot() {
const config = this.createPlotConfig(); const config = this.createPlotConfig();
this.plotView.plot(config, this.plotDimensionSupplier); this.plotView.plot(config, this.plotDimensionSupplier);
} }
plotDimensionSupplier(): WidgetDimensions{ plotDimensionSupplier(): WidgetDimensions {
const results = document.getElementById("results"); const results = document.getElementById("results");
return new WidgetDimensions( return new WidgetDimensions(
results != null ? results.offsetWidth-1 : 1024, results != null ? results.offsetWidth - 1 : 1024,
results != null ? results.offsetHeight-1: 1024); results != null ? results.offsetHeight - 1 : 1024,
);
} }
createPlotConfig(): PlotConfig { createPlotConfig(): PlotConfig {
const aggregates = new Array<string>(); const aggregates = new Array<string>();
this.selectedPlotType.forEach(a => aggregates.push(a.id)); this.selectedPlotType.forEach((a) => aggregates.push(a.id));
const y1 = this.y1AxisDefinitionComponent.getAxisDefinition(); const y1 = this.y1AxisDefinitionComponent.getAxisDefinition();
const y2 = this.y2AxisDefinitionComponent ? this.y2AxisDefinitionComponent.getAxisDefinition() : undefined; const y2 = this.y2AxisDefinitionComponent
? this.y2AxisDefinitionComponent.getAxisDefinition()
: undefined;
const config = new PlotConfig( const config = new PlotConfig(
this.query.query, this.query.query,
this.groupBy.map(o => o.name), this.groupBy.map((o) => o.name),
this.limitbycomponent.limitBy, this.limitbycomponent.limitBy,
this.limitbycomponent.limit, this.limitbycomponent.limit,
y1, y1,
y2, y2,
this.dateRangeAsString(), // dateRange this.datePicker.getDateValue(), // dateRange
aggregates, // aggregates aggregates, // aggregates
this.intervalUnit, this.intervalUnit,
this.intervalValue, this.intervalValue,
@@ -242,24 +283,29 @@ toggleGallery(event: Event){
const config = this.createPlotConfig(); const config = this.createPlotConfig();
const renderOptions : RenderOptionsMap = { const renderOptions: RenderOptionsMap = {
'main': new RenderOptions(results!.offsetHeight-1, results!.offsetWidth-1, true, true), "main": new RenderOptions(
'thumbnail': new RenderOptions(200, 300, false, false), results!.offsetHeight - 1,
results!.offsetWidth - 1,
true,
true,
),
"thumbnail": new RenderOptions(200, 300, false, false),
}; };
const request = new PlotRequest( const request = new PlotRequest(
(<any>window).submitterId, (<any> window).submitterId,
config, config,
renderOptions renderOptions,
); );
return request; return request;
} }
serializedConfig(): string { serializedConfig(): string {
try{ try {
const config = this.createPlotConfig(); const config = this.createPlotConfig();
return JSON.stringify(config); return JSON.stringify(config);
}catch (e) { } catch (e) {
return ""; return "";
} }
} }

View File

@@ -1,10 +1,27 @@
import { Component, Input } from '@angular/core'; import { Component, Input } from '@angular/core';
import { YAxisDefinition } from '../plot.service'; import { YAxisDefinition } from '../plot.service';
import { BrowserModule } from '@angular/platform-browser';
import { MatFormField, MatLabel } from '@angular/material/form-field';
import { MatOptgroup, MatOption, MatSelect } from '@angular/material/select';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatInput } from '@angular/material/input';
@Component({ @Component({
selector: 'pdb-y-axis-definition', selector: 'pdb-y-axis-definition',
templateUrl: './y-axis-definition.component.html', templateUrl: './y-axis-definition.component.html',
styleUrls: ['./y-axis-definition.component.scss'] styleUrls: ['./y-axis-definition.component.scss'],
standalone: true,
imports: [
BrowserModule,
FormsModule,
MatFormField,
MatInput,
MatLabel,
MatSelect,
MatOption,
MatOptgroup,
ReactiveFormsModule
]
}) })
export class YAxisDefinitionComponent { export class YAxisDefinitionComponent {

View File

@@ -47,6 +47,22 @@
}); });
} }
function initSimpleDatePicker() {
$('input[name="dates"]').daterangepicker({
timePicker: true,
minDate: "2017-01-01",
maxDate: "2029-12-31",
maxYear: parseInt(moment().format('YYYY'),10),
timePicker24Hour: true,
timePickerSeconds: true,
showDropdowns: true, // drop downs for selecting year and month
locale: {
format: 'YYYY-MM-DD HH:mm:ss',
"firstDay": 1 // monday is the first day of the week
},
});
}
$( document ).ready(function() { $( document ).ready(function() {
initInvaders('results'); initInvaders('results');
document.addEventListener("invadersPause", function(event) { document.addEventListener("invadersPause", function(event) {

View File

@@ -14,25 +14,21 @@
// If you don't need the default component typographies but still want the hierarchy styles, // If you don't need the default component typographies but still want the hierarchy styles,
// you can delete this line and instead use: // you can delete this line and instead use:
// `@include mat.legacy-typography-hierarchy(mat.define-typography-config());` // `@include mat.legacy-typography-hierarchy(mat.define-typography-config());`
/* TODO(mdc-migration): Remove all-legacy-component-typographies once all legacy components are migrated*/
@include mat.all-legacy-component-typographies();
@include mat.all-component-typographies(); @include mat.all-component-typographies();
/* TODO(mdc-migration): Remove legacy-core once all legacy components are migrated*/
@include mat.legacy-core();
@include mat.core(); @include mat.core();
// Define the palettes for your theme using the Material Design palettes available in palette.scss // Define the palettes for your theme using the Material Design palettes available in palette.scss
// (imported above). For each palette, you can optionally specify a default, lighter, and darker // (imported above). For each palette, you can optionally specify a default, lighter, and darker
// hue. Available color palettes: https://material.io/design/color/ // hue. Available color palettes: https://material.io/design/color/
$candy-app-primary: mat.define-palette(mat.$blue-palette); $candy-app-primary: mat.m2-define-palette(mat.$m2-blue-palette);
$candy-app-accent: mat.define-palette(mat.$blue-palette, A200, A100, A400); $candy-app-accent: mat.m2-define-palette(mat.$m2-blue-palette, A200, A100, A400);
// The warn palette is optional (defaults to red). // The warn palette is optional (defaults to red).
$candy-app-warn: mat.define-palette(mat.$red-palette); $candy-app-warn: mat.m2-define-palette(mat.$m2-red-palette);
// Create the theme object. A theme consists of configurations for individual // Create the theme object. A theme consists of configurations for individual
// theming systems such as "color" or "typography". // theming systems such as "color" or "typography".
$candy-app-theme: mat.define-light-theme(( $candy-app-theme: mat.m2-define-light-theme((
color: ( color: (
primary: $candy-app-primary, primary: $candy-app-primary,
accent: $candy-app-accent, accent: $candy-app-accent,
@@ -45,8 +41,6 @@ $candy-app-theme: mat.define-light-theme((
// Include theme styles for core and each component used in your app. // Include theme styles for core and each component used in your app.
// Alternatively, you can import and @include the theme mixins for each component // Alternatively, you can import and @include the theme mixins for each component
// that you are using. // that you are using.
/* TODO(mdc-migration): Remove all-legacy-component-themes once all legacy components are migrated*/
@include mat.all-legacy-component-themes($candy-app-theme);
@include mat.all-component-themes($candy-app-theme); @include mat.all-component-themes($candy-app-theme);
@@ -182,6 +176,9 @@ a.external-link:after {
mat-form-field.pdb-form-full-width { mat-form-field.pdb-form-full-width {
width: 100%; width: 100%;
} }
mat-form-field.pdb-form-number-small {
width: 4.5em;
}
mat-form-field.pdb-form-number { mat-form-field.pdb-form-number {
width: 5.5em; width: 5.5em;
} }
@@ -201,7 +198,7 @@ app-add-text-dialog .mat-mdc-form-field-subscript-wrapper {
.errorPanel { .errorPanel {
padding: 1ex; padding: 1ex;
background-color: map-get(mat.$red-palette, 100); background-color: map-get(mat.$m2-red-palette, 100);
border-radius: 5px; border-radius: 5px;
} }

View File

@@ -5,6 +5,7 @@
"baseUrl": "./", "baseUrl": "./",
"outDir": "./dist/out-tsc", "outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"strict": true, "strict": true,
"noImplicitOverride": true, "noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true, "noPropertyAccessFromIndexSignature": true,
@@ -12,7 +13,6 @@
"noFallthroughCasesInSwitch": true, "noFallthroughCasesInSwitch": true,
"sourceMap": true, "sourceMap": true,
"declaration": false, "declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"moduleResolution": "node", "moduleResolution": "node",
"importHelpers": true, "importHelpers": true,

View File

@@ -0,0 +1,143 @@
package org.lucares.pdb.plot.api;
import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.lucares.pdb.api.DateTimeRange;
import org.lucares.utils.Preconditions;
public class DateTimeRangeParser {
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
public static DateTimeRange parse(final OffsetDateTime offsetTime, final String datePeriod) {
final String[] startEnd = datePeriod.split(Pattern.quote("/"));
final String start = startEnd[0];
final String end = startEnd[1];
final OffsetDateTime startTime = parseInternal(offsetTime, start);
final OffsetDateTime endTime = parseInternal(offsetTime, end);
return new DateTimeRange(startTime, endTime);
}
private static OffsetDateTime parseInternal(final OffsetDateTime offsetTime, final String timeDefinition) {
final Pattern regex = Pattern.compile("(?<beginEnd>[BE])(?<amountUnit>(\\-?[0-9]*[mHDWMY])+)",
Pattern.MULTILINE);
final Matcher matcher = regex.matcher(timeDefinition);
if (matcher.matches()) {
final String beginEnd = matcher.group("beginEnd");
final boolean begin = "B".equals(beginEnd);
OffsetDateTime result = offsetTime;
final String amountUnitString = matcher.group("amountUnit");
final Pattern regexAmountUnit = Pattern.compile("(?<amount>\\-?[0-9]*)(?<unit>[mHDWMY])");
final Matcher m = regexAmountUnit.matcher(amountUnitString);
while (m.find()) {
final String amountString = m.group("amount");
final String unitString = m.group("unit");
final int amount = amountString.equals("") ? 0 : Integer.parseInt(amountString);
switch (unitString) {
case "m": {
final ChronoUnit unit = ChronoUnit.MINUTES;
if (begin) {
result = result.plus(amount, unit).truncatedTo(unit);
} else {
result = result.plus(amount + 1, unit).truncatedTo(unit).minusSeconds(1);
}
break;
}
case "H": {
final ChronoUnit unit = ChronoUnit.HOURS;
if (begin) {
result = result.plus(amount, unit).truncatedTo(unit);
} else {
result = result.plus(amount + 1, unit).truncatedTo(unit).minusSeconds(1);
}
break;
}
case "D": {
final ChronoUnit unit = ChronoUnit.DAYS;
if (begin) {
result = result.plus(amount, unit).truncatedTo(unit);
} else {
result = result.plus(amount + 1, unit).truncatedTo(unit).minusSeconds(1);
}
break;
}
case "W": {
final DayOfWeek firstDayOfWeek = DayOfWeek.MONDAY;
final DayOfWeek lastDayOfWeek = DayOfWeek
.of(((firstDayOfWeek.getValue() - 1 + 6) % DayOfWeek.values().length) + 1); // weird
// computation,
// because
// DayOfWeek
// goes from 1
// to 7
final ChronoUnit unit = ChronoUnit.WEEKS;
if (begin) {
result = result.plus(amount, unit).with(TemporalAdjusters.previousOrSame(firstDayOfWeek))
.truncatedTo(ChronoUnit.DAYS);
} else {
result = result.plus(amount, unit).with(TemporalAdjusters.nextOrSame(lastDayOfWeek))
.plus(1, ChronoUnit.DAYS).truncatedTo(ChronoUnit.DAYS).minusSeconds(1);
}
break;
}
case "M": {
final ChronoUnit unit = ChronoUnit.MONTHS;
if (begin) {
result = result.plus(amount, unit).truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1);
} else {
result = result.plus(amount, unit).truncatedTo(ChronoUnit.DAYS).withDayOfMonth(1)
.plus(1, ChronoUnit.MONTHS).minusSeconds(1);
}
break;
}
case "Y": {
final ChronoUnit unit = ChronoUnit.YEARS;
if (begin) {
result = result.plus(amount, unit).truncatedTo(ChronoUnit.DAYS).withDayOfYear(1);
} else {
result = result.plus(amount, unit).truncatedTo(ChronoUnit.DAYS).withDayOfYear(1)
.plus(1, ChronoUnit.YEARS).minusSeconds(1);
}
break;
}
default:
throw new IllegalArgumentException("Unexpected value: " + unitString);
}
}
return result;
}
throw new IllegalArgumentException("invalid input: " + timeDefinition);
}
public static DateTimeRange parseAbsolute(final String dateRangeAsString) {
final String[] startEnd = dateRangeAsString.split(Pattern.quote(" - "));
Preconditions.checkEqual(startEnd.length, 2, "invalid date range: ''{0}''", dateRangeAsString);
final String startString = startEnd[0];
final String endString = startEnd[1];
final OffsetDateTime start = LocalDateTime.parse(startString, DATE_FORMAT).atOffset(ZoneOffset.UTC);
final OffsetDateTime end = LocalDateTime.parse(endString, DATE_FORMAT).atOffset(ZoneOffset.UTC);
return new DateTimeRange(start, end);
}
}

View File

@@ -0,0 +1,38 @@
package org.lucares.pdb.plot.api;
public class DateValue {
public enum DateType {
QUICK, RELATIVE, ABSOLUTE
}
private DateType type;
private String display;
private String value;
public DateType getType() {
return type;
}
public void setType(final DateType type) {
this.type = type;
}
public String getDisplay() {
return display;
}
public void setDisplay(final String display) {
this.display = display;
}
public String getValue() {
return value;
}
public void setValue(final String value) {
this.value = value;
}
}

View File

@@ -1,23 +1,19 @@
package org.lucares.pdb.plot.api; package org.lucares.pdb.plot.api;
import java.time.LocalDateTime;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.regex.Pattern;
import org.lucares.pdb.api.DateTimeRange; import org.lucares.pdb.api.DateTimeRange;
import org.lucares.recommind.logs.GnuplotAxis; import org.lucares.recommind.logs.GnuplotAxis;
import org.lucares.recommind.logs.GnuplotSettings; import org.lucares.recommind.logs.GnuplotSettings;
import org.lucares.utils.Preconditions;
public class PlotSettings { public class PlotSettings {
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); public static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
private String query; private String query;
@@ -27,7 +23,7 @@ public class PlotSettings {
private int limit; private int limit;
private String dateRangeAsString; private DateValue dateValue;
private YAxisDefinition y1; private YAxisDefinition y1;
private YAxisDefinition y2; private YAxisDefinition y2;
@@ -80,30 +76,32 @@ public class PlotSettings {
this.limit = limit; this.limit = limit;
} }
public String getDateRange() { public DateValue getDateRange() {
return dateRangeAsString; return dateValue;
} }
public void setDateRange(final String dateRangeAsString) { public void setDateRange(final DateValue dateValue) {
this.dateRangeAsString = dateRangeAsString; this.dateValue = dateValue;
} }
public DateTimeRange dateRange() { public DateTimeRange dateRange() {
final String[] startEnd = dateRangeAsString.split(Pattern.quote(" - ")); switch (this.dateValue.getType()) {
Preconditions.checkEqual(startEnd.length, 2, "invalid date range: ''{0}''", dateRangeAsString); case RELATIVE:
case QUICK:
final OffsetDateTime startDate = LocalDateTime.parse(startEnd[0], DATE_FORMAT).atOffset(ZoneOffset.UTC); final DateTimeRange dateTimeRange = DateTimeRangeParser.parse(OffsetDateTime.now(), dateValue.getValue());
final OffsetDateTime endDate = LocalDateTime.parse(startEnd[1], DATE_FORMAT).atOffset(ZoneOffset.UTC); return dateTimeRange;
case ABSOLUTE:
return new DateTimeRange(startDate, endDate); return DateTimeRangeParser.parseAbsolute(dateValue.getValue());
}
throw new UnsupportedOperationException();
} }
@Override @Override
public String toString() { public String toString() {
return "PlotSettings [query=" + query + ", groupBy=" + groupBy + ", limitBy=" + limitBy + ", limit=" + limit return "PlotSettings [query=" + query + ", groupBy=" + groupBy + ", limitBy=" + limitBy + ", limit=" + limit
+ ", dateRangeAsString=" + dateRangeAsString + ", y1=" + y1 + " y2=" + y2 + ", aggregates=" + aggregates + ", dateRangeAsString=" + dateValue + ", y1=" + y1 + " y2=" + y2 + ", aggregates=" + aggregates
+ ", renders=" + renders + "]"; + ", renders=" + renders + "]";
} }

View File

@@ -60,6 +60,7 @@ class YAxisTicks {
} else { } else {
switch (yAxisDefinition.getAxisScale()) { switch (yAxisDefinition.getAxisScale()) {
case LINEAR: case LINEAR:
result = computeLinearYTicksNoUnit(height, yRangeMin, yRangeMax);
break; break;
case LOG10: case LOG10:
result = computeLog10YTicksNoUnit(height, yRangeMin, yRangeMax); result = computeLog10YTicksNoUnit(height, yRangeMin, yRangeMax);
@@ -206,25 +207,103 @@ class YAxisTicks {
final List<String> ticsLabels = Arrays.asList(// final List<String> ticsLabels = Arrays.asList(//
"\"1\" 1", // "\"1\" 1", //
"\"2\" 2", //
"\"5\" 5", //
"\"10\" 10", // "\"10\" 10", //
"\"20\" 20", //
"\"50\" 50", //
"\"100\" 100", // "\"100\" 100", //
"\"200\" 200", //
"\"500\" 500", //
"\"1000\" 1000", // "\"1000\" 1000", //
"\"2000\" 2000", //
"\"5000\" 5000", //
"\"10k\" 10000", // "\"10k\" 10000", //
"\"20k\" 20000", //
"\"50k\" 50000", //
"\"100k\" 100000", // "\"100k\" 100000", //
"\"200k\" 200000", //
"\"500k\" 500000", //
"\"1m\" 1000000", // "\"1m\" 1000000", //
"\"2m\" 2000000", //
"\"5m\" 5000000", //
"\"10m\" 10000000", // "\"10m\" 10000000", //
"\"20m\" 20000000", //
"\"50m\" 50000000", //
"\"100m\" 100000000", // "\"100m\" 100000000", //
"\"200m\" 200000000", //
"\"500m\" 500000000", //
"\"1b\" 1000000000.0", // "\"1b\" 1000000000.0", //
"\"2b\" 2000000000.0", //
"\"5b\" 5000000000.0", //
"\"10b\" 10000000000.0", // "\"10b\" 10000000000.0", //
"\"20b\" 20000000000.0", //
"\"50b\" 50000000000.0", //
"\"100b\" 100000000000.0", // "\"100b\" 100000000000.0", //
"\"200b\" 200000000000.0", //
"\"500b\" 500000000000.0", //
"\"1t\" 1000000000000.0", // "\"1t\" 1000000000000.0", //
"\"2t\" 2000000000000.0", //
"\"5t\" 5000000000000.0", //
"\"10t\" 10000000000000.0", // "\"10t\" 10000000000000.0", //
"\"100t\" 100000000000000.0" // "\"20t\" 20000000000000.0", //
"\"50t\" 50000000000000.0", //
"\"100t\" 100000000000000.0", //
"\"200t\" 2000000000000000.0", //
"\"500t\" 5000000000000000.0", //
"\"1q\" 10000000000000000.0", //
"\"2q\" 20000000000000000.0", //
"\"5q\" 50000000000000000.0" //
); );
return ticsLabels; return ticsLabels;
} }
private static List<String> computeLinearYTicksNoUnit(final long height, final long yRangeMinInMs,
final long yRangeMaxInMs) {
final long plotHeight = height - GnuplotSettings.GNUPLOT_TOP_BOTTOM_MARGIN;
final long maxLabels = plotHeight / (GnuplotSettings.TICKS_FONT_SIZE * 2);
final long range = yRangeMaxInMs - yRangeMinInMs;
final long rangePerLabel = roundToNextLinearNoUnitStep(range / maxLabels);
final List<String> ticsLabels = new ArrayList<>();
for (long i = yRangeMinInMs; i <= yRangeMaxInMs; i += rangePerLabel) {
ticsLabels.add("\"" + valueToTic(i, rangePerLabel) + "\" " + i);
}
return ticsLabels;
}
private static String valueToTic(final long val, final double rangePerLabel) {
final List<String> powers = List.of("", "k", "m", "b", "t", "q");
int power = 1;
String result = String.format("%d", val);
while (val >= Math.pow(1000, power) && power < powers.size()) {
result = String.format("%.3f", val / Math.pow(1000, power));
result = result.replaceAll("\\.?0*$", "");
result = result + powers.get(power);
power = power + 1;
}
return result;
}
private static long roundToNextLinearNoUnitStep(final long stepSize) {
final List<Long> steps = Arrays.asList(1L, 5L, 10L, 20L, 25L, 50L, 100L, 200L, 250L, 500L, 1000L, 2000L, 2500L,
5000L, 10_000L, 20_000L, 25_000L, 50_000L, 100_000L, 200_000L, 250_000L, 500_000L, 1_000_000L,
2_000_000L, 2_500_000L, 5_000_000L, 10_000_000L, 20_000_000L, 25_000_000L, 100_000_000L, 200_000_000L,
250_000_000L, 500_000_000L, 1_000_000_000L, 2_000_000_000L, 2_500_000_000L, 5_000_000_000L);
for (final Long step : steps) {
if (stepSize < step) {
return step;
}
}
return stepSize;
}
private static long roundToLinearLabelSteps(final long msPerLabel) { private static long roundToLinearLabelSteps(final long msPerLabel) {
final List<Long> steps = Arrays.asList(2L, 5L, 10L, 20L, 50L, 100L, 200L, 500L, 1000L, 2000L, 5000L, 10_000L, final List<Long> steps = Arrays.asList(2L, 5L, 10L, 20L, 50L, 100L, 200L, 500L, 1000L, 2000L, 5000L, 10_000L,
20_000L, MINUTES.toMillis(1), MINUTES.toMillis(2), MINUTES.toMillis(5), MINUTES.toMillis(10), 20_000L, MINUTES.toMillis(1), MINUTES.toMillis(2), MINUTES.toMillis(5), MINUTES.toMillis(10),

View File

@@ -0,0 +1,133 @@
package org.lucares.pdb.plot.api;
import java.time.LocalDateTime;
import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.util.stream.Stream;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import org.lucares.pdb.api.DateTimeRange;
public class DateTimeRangeParserTest {
@Test
public void test() {
}
public static Stream<Arguments> providerDatePeriods() {
return Stream.of(//
// last 15 minutes
Arguments.of("2000-01-02 12:59:59", "B-14m/Em", "2000-01-02 12:45:00", "2000-01-02 12:59:59"),
// this hour
Arguments.of("2000-01-02 12:00:00", "BH/EH", "2000-01-02 12:00:00", "2000-01-02 12:59:59"),
Arguments.of("2000-01-02 12:59:59", "BH/EH", "2000-01-02 12:00:00", "2000-01-02 12:59:59"),
// previous hour
Arguments.of("2000-01-02 12:00:00", "B-1H/E-1H", "2000-01-02 11:00:00", "2000-01-02 11:59:59"),
Arguments.of("2000-01-02 12:59:58", "B-1H/E-1H", "2000-01-02 11:00:00", "2000-01-02 11:59:59"),
Arguments.of("2000-01-02 12:59:59", "B-1H/E-1H", "2000-01-02 11:00:00", "2000-01-02 11:59:59"),
// today
Arguments.of("2000-01-02 12:00:00", "BD/ED", "2000-01-02 00:00:00", "2000-01-02 23:59:59"),
Arguments.of("2000-01-02 00:00:00", "BD/ED", "2000-01-02 00:00:00", "2000-01-02 23:59:59"),
Arguments.of("2000-01-02 23:59:59", "BD/ED", "2000-01-02 00:00:00", "2000-01-02 23:59:59"),
Arguments.of("2000-01-02 12:00:00", "B0D/E0D", "2000-01-02 00:00:00", "2000-01-02 23:59:59"),
// tomorrow
Arguments.of("2000-01-02 12:00:00", "B1D/E1D", "2000-01-03 00:00:00", "2000-01-03 23:59:59"),
// yesterday
Arguments.of("2000-01-02 12:00:00", "B-1D/E-1D", "2000-01-01 00:00:00", "2000-01-01 23:59:59"),
// this week
Arguments.of("2024-04-22 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
Arguments.of("2024-04-23 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
Arguments.of("2024-04-24 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
Arguments.of("2024-04-25 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
Arguments.of("2024-04-26 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
Arguments.of("2024-04-27 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
Arguments.of("2024-04-28 12:00:00", "BW/EW", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
// previous week
Arguments.of("2024-04-29 12:00:00", "B-1W/E-1W", "2024-04-22 00:00:00", "2024-04-28 23:59:59"),
// last 4 week (including this one
Arguments.of("2024-04-28 12:00:00", "B-3W/EW", "2024-04-01 00:00:00", "2024-04-28 23:59:59"),
// this month
Arguments.of("2024-04-29 12:00:00", "BM/EM", "2024-04-01 00:00:00", "2024-04-30 23:59:59"),
// previous month (in a leap year)
Arguments.of("2023-03-29 12:00:00", "B-1M/E-1M", "2023-02-01 00:00:00", "2023-02-28 23:59:59"),
// previous month (in a leap year)
Arguments.of("2024-03-29 12:00:00", "B-1M/E-1M", "2024-02-01 00:00:00", "2024-02-29 23:59:59"),
// last 3 months
Arguments.of("2024-03-29 12:00:00", "B-2M/EM", "2024-01-01 00:00:00", "2024-03-31 23:59:59"),
// previous 3 months (in a leap year)
Arguments.of("2024-03-29 12:00:00", "B-3M/E-1M", "2023-12-01 00:00:00", "2024-02-29 23:59:59"),
// this year
Arguments.of("2024-03-29 12:00:00", "BY/EY", "2024-01-01 00:00:00", "2024-12-31 23:59:59"),
// previous year
Arguments.of("2024-03-29 12:00:00", "B-1Y/E-1Y", "2023-01-01 00:00:00", "2023-12-31 23:59:59"),
//
Arguments.of("2024-03-29 12:00:00", "B-1H-15m/Bm", "2024-03-29 10:45:00", "2024-03-29 12:00:00")
);
}
@ParameterizedTest
@MethodSource("providerDatePeriods")
public void testDatePeriods(final String now, final String datePeriod, final String expectedStart,
final String expectedEnd) throws Exception {
final OffsetDateTime offsetTime = LocalDateTime.parse(now, PlotSettings.DATE_FORMAT).atOffset(ZoneOffset.UTC);
final DateTimeRange actual = DateTimeRangeParser.parse(offsetTime, datePeriod);
final String actualStart = PlotSettings.DATE_FORMAT.format(actual.getStart());
final String actualEnd = PlotSettings.DATE_FORMAT.format(actual.getEnd());
System.out.println("at " + now + " " + datePeriod + " -> " + actualStart + " - " + actualEnd);
Assertions.assertEquals(expectedStart, actualStart, "start");
Assertions.assertEquals(expectedEnd, actualEnd, "end");
}
public static Stream<Arguments> providerDatePeriods_multiple() {
return Stream.of(//
//
Arguments.of("2024-03-29 12:00:00", "B-1H-15m/Bm", "2024-03-29 10:45:00", "2024-03-29 12:00:00"),
Arguments.of("2024-03-29 12:00:00", "B-1H-15m/EH15m", "2024-03-29 10:45:00", "2024-03-29 13:14:59")
);
}
@ParameterizedTest
@MethodSource("providerDatePeriods_multiple")
public void testDatePeriods_multiple(final String now, final String datePeriod, final String expectedStart,
final String expectedEnd) throws Exception {
final OffsetDateTime offsetTime = LocalDateTime.parse(now, PlotSettings.DATE_FORMAT).atOffset(ZoneOffset.UTC);
final DateTimeRange actual = DateTimeRangeParser.parse(offsetTime, datePeriod);
final String actualStart = PlotSettings.DATE_FORMAT.format(actual.getStart());
final String actualEnd = PlotSettings.DATE_FORMAT.format(actual.getEnd());
System.out.println("at " + now + " " + datePeriod + " -> " + actualStart + " - " + actualEnd);
Assertions.assertEquals(expectedStart, actualStart, "start");
Assertions.assertEquals(expectedEnd, actualEnd, "end");
}
}

View File

@@ -3,6 +3,8 @@ package org.lucares.pdbui;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.Collator; import java.text.Collator;
import java.time.OffsetDateTime;
import java.time.ZoneId;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
@@ -26,6 +28,9 @@ import org.lucares.pdb.api.DateTimeRange;
import org.lucares.pdb.api.QueryWithCaretMarker; import org.lucares.pdb.api.QueryWithCaretMarker;
import org.lucares.pdb.api.QueryWithCaretMarker.ResultMode; import org.lucares.pdb.api.QueryWithCaretMarker.ResultMode;
import org.lucares.pdb.datastore.Proposal; import org.lucares.pdb.datastore.Proposal;
import org.lucares.pdb.plot.api.DateTimeRangeParser;
import org.lucares.pdb.plot.api.DateValue;
import org.lucares.pdb.plot.api.DateValue.DateType;
import org.lucares.pdb.plot.api.PlotSettings; import org.lucares.pdb.plot.api.PlotSettings;
import org.lucares.pdbui.domain.AutocompleteProposal; import org.lucares.pdbui.domain.AutocompleteProposal;
import org.lucares.pdbui.domain.AutocompleteProposalByValue; import org.lucares.pdbui.domain.AutocompleteProposalByValue;
@@ -345,6 +350,22 @@ public class PdbController implements HardcodedValues, PropertyKeys {
return result; return result;
} }
@RequestMapping(path = "/dates", //
method = RequestMethod.POST, //
consumes = MediaType.APPLICATION_JSON_VALUE, //
produces = MediaType.APPLICATION_JSON_VALUE //
)
@ResponseBody
public DateTimeRange dates(@RequestBody final DateValue dateValue) {
final DateType type = dateValue.getType();
final DateTimeRange result = switch (type) {
case RELATIVE -> DateTimeRangeParser.parse(OffsetDateTime.now(ZoneId.of("UTC")), dateValue.getValue());
case QUICK -> DateTimeRangeParser.parse(OffsetDateTime.now(ZoneId.of("UTC")), dateValue.getValue());
case ABSOLUTE -> DateTimeRangeParser.parseAbsolute(dateValue.getValue());
};
return result;
}
@PostMapping(path = "/data", consumes = MediaType.MULTIPART_MIXED_VALUE) @PostMapping(path = "/data", consumes = MediaType.MULTIPART_MIXED_VALUE)
@ResponseBody @ResponseBody
@ResponseStatus(code = HttpStatus.CREATED) @ResponseStatus(code = HttpStatus.CREATED)

View File

@@ -26,7 +26,7 @@ public class WebConfiguration implements WebMvcConfigurer, HardcodedValues, Prop
addResourceHandlerForPlottedImages(registry); addResourceHandlerForPlottedImages(registry);
// addResourceHandlerForAngular(registry); addResourceHandlerForAngular(registry);
} }
private void addResourceHandlerForPlottedImages(final ResourceHandlerRegistry registry) { private void addResourceHandlerForPlottedImages(final ResourceHandlerRegistry registry) {
@@ -57,7 +57,7 @@ public class WebConfiguration implements WebMvcConfigurer, HardcodedValues, Prop
// to determine which sub-page to show. // to determine which sub-page to show.
// //
// This makes Angular also responsible for all 404 pages. // This makes Angular also responsible for all 404 pages.
registry.addResourceHandler("/**").addResourceLocations("classpath:/resources/").resourceChain(true) registry.addResourceHandler("/**").addResourceLocations("classpath:/resources/browser/").resourceChain(true)
.addResolver(new PathResourceResolver() { .addResolver(new PathResourceResolver() {
@Override @Override
protected Resource getResource(final String resourcePath, final Resource location) protected Resource getResource(final String resourcePath, final Resource location)
@@ -65,7 +65,7 @@ public class WebConfiguration implements WebMvcConfigurer, HardcodedValues, Prop
final Resource requestedResource = location.createRelative(resourcePath); final Resource requestedResource = location.createRelative(resourcePath);
return requestedResource.exists() && requestedResource.isReadable() ? requestedResource return requestedResource.exists() && requestedResource.isReadable() ? requestedResource
: new ClassPathResource("/resources/index.html"); : new ClassPathResource("/resources/browser/index.html");
} }
}); });
} }

View File

@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.lucares.pdb.plot.api.Aggregate; import org.lucares.pdb.plot.api.Aggregate;
import org.lucares.pdb.plot.api.DateValue;
import org.lucares.pdb.plot.api.Limit; import org.lucares.pdb.plot.api.Limit;
import org.lucares.pdb.plot.api.YAxisDefinition; import org.lucares.pdb.plot.api.YAxisDefinition;
@@ -25,7 +26,7 @@ public class PlotConfig {
private YAxisDefinition y1 = new YAxisDefinition(); private YAxisDefinition y1 = new YAxisDefinition();
private YAxisDefinition y2 = new YAxisDefinition(); private YAxisDefinition y2 = new YAxisDefinition();
private String dateRange; private DateValue dateRange;
private List<Aggregate> aggregates = new ArrayList<>(); private List<Aggregate> aggregates = new ArrayList<>();
@@ -66,11 +67,11 @@ public class PlotConfig {
this.limit = limit; this.limit = limit;
} }
public String getDateRange() { public DateValue getDateRange() {
return dateRange; return dateRange;
} }
public void setDateRange(final String dateRange) { public void setDateRange(final DateValue dateRange) {
this.dateRange = dateRange; this.dateRange = dateRange;
} }

View File

@@ -1,7 +1,7 @@
db.base=D:/ws/pdb/databases/test db.base=c:/ws/pdb/databases/test
server.port=17333 server.port=17333
gnuplot.home=D:/ws/pdb/gnuplot-5.2 gnuplot.home=D:/ws/pdb/gnuplot-5.2
cache.images.duration.seconds=86400 cache.images.duration.seconds=86400
defaults.groupBy=pod,method,metric defaults.groupBy=pod,method,metric
defaults.splitBy=method defaults.splitBy=method
defaults.query.examples=pod=vapfinra01 and method=ViewService.findFieldView,ViewService.findFieldViewGroup;pod=vappilby01 and method=ReviewInContextController.index;pod=vapnyse001 and method=ReviewInContextController.index,ReviewController.index defaults.query.examples=pod=vadperfo01 and method=ViewService.findFieldView,ViewService.findFieldViewGroup;pod=vadperfo01 and method=ReviewInContextController.index;pod=vadperfo01 and method=ReviewInContextController.index,ReviewController.index

View File

@@ -28,15 +28,10 @@ public class VariableByteEncoder {
public static final long MIN_VALUE = Long.MIN_VALUE / 2 + 1; public static final long MIN_VALUE = Long.MIN_VALUE / 2 + 1;
public static final long MAX_VALUE = Long.MAX_VALUE / 2; public static final long MAX_VALUE = Long.MAX_VALUE / 2;
private static final int MAX_BYTES_PER_VALUE = 10;
private static final int CONTINUATION_BYTE_FLAG = 1 << 7; // 10000000 private static final int CONTINUATION_BYTE_FLAG = 1 << 7; // 10000000
private static final long DATA_BITS = (1 << 7) - 1; // 01111111 private static final long DATA_BITS = (1 << 7) - 1; // 01111111
private static final ThreadLocal<byte[]> SINGLE_VALUE_BUFFER = ThreadLocal
.withInitial(() -> new byte[MAX_BYTES_PER_VALUE]);
/** /**
* Encodes time and value into the given buffer. * Encodes time and value into the given buffer.
* <p> * <p>
@@ -137,8 +132,18 @@ public class VariableByteEncoder {
* input: 0 1 -1 2 -2 3 -3 * input: 0 1 -1 2 -2 3 -3
* encoded: 1 2 3 4 5 6 7 * encoded: 1 2 3 4 5 6 7
* </pre> * </pre>
*
* Note: 1. I tried to replace this ternary operator with a branchfree
* alternative, but it was slower:
*
* <pre>
* final long sign = (x - 1) >> 63; // will be 111...1 if first bit was 1 (x was negative) and 000..0
* // otherwise
* final long signBit = sign & 0x1; // will be 1 for negative x and 0 otherwise
* return (((x * 2) ^ (sign))) + (signBit * 2); // same as above, but branchless
* </pre>
*/ */
private static long encodeIntoPositiveValue(final long value) { static long encodeIntoPositiveValue(final long value) {
return value > 0 ? value * 2 : (value * -2) + 1; return value > 0 ? value * 2 : (value * -2) + 1;
} }
@@ -234,9 +239,9 @@ public class VariableByteEncoder {
} }
public static int neededBytes(final long value) { public static int neededBytes(final long value) {
final byte[] buffer = SINGLE_VALUE_BUFFER.get(); final long val = encodeIntoPositiveValue(value);
final int usedBytes = encodeInto(value, buffer, 0); final int numberOfOnes = 64 - Long.numberOfLeadingZeros(val);
return usedBytes; return numberOfOnes / 7 + (numberOfOnes % 7 == 0 ? 0 : 1);
} }
} }

View File

@@ -81,7 +81,7 @@ public class VariableByteEncoderTest {
Assertions.assertEquals(originalValues, decodedValues); Assertions.assertEquals(originalValues, decodedValues);
} }
public static Stream<Arguments> providerNededBytes() { public static Stream<Arguments> providerNeededBytes() {
return Stream.of( // return Stream.of( //
Arguments.of(0, 1), // Arguments.of(0, 1), //
Arguments.of(-10, 1), // Arguments.of(-10, 1), //
@@ -98,7 +98,7 @@ public class VariableByteEncoderTest {
} }
@ParameterizedTest @ParameterizedTest
@MethodSource("providerNededBytes") @MethodSource("providerNeededBytes")
public void testNeededBytes(final long value, final int expectedNeededBytes) { public void testNeededBytes(final long value, final int expectedNeededBytes) {
final int neededBytes = VariableByteEncoder.neededBytes(value); final int neededBytes = VariableByteEncoder.neededBytes(value);

View File

@@ -1,7 +1,8 @@
// include all projects with a build.gradle include("block-storage")
// (this does not support nested projects) include("data-store")
File srcDir = new File(".") include("pdb-api")
FileCollection collection = files { srcDir.listFiles() } include("pdb-js")
collection.filter{ new File(it, "build.gradle").isFile() }.each{ include it.getName() } include("pdb-plotting")
include("pdb-ui")
include("pdb-utils")
include("performanceDb")